Compare commits

..

No commits in common. "146aefeb39755ef4e4b8492aaf9db3c26b6ae4b3" and "e9c0a7018ab4cc9b716d2b0b66c07d1e8fd933e4" have entirely different histories.

8 changed files with 36 additions and 78 deletions

28
MainForm.Designer.cs generated
View File

@ -80,9 +80,9 @@ namespace RokettoLaunch
panel1 = new System.Windows.Forms.Panel(); panel1 = new System.Windows.Forms.Panel();
tileMenu1 = new System.Windows.Forms.ContextMenuStrip(components); tileMenu1 = new System.Windows.Forms.ContextMenuStrip(components);
editToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); editToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
removeToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem6 = new System.Windows.Forms.ToolStripMenuItem(); toolStripMenuItem6 = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
removeToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
contextMenuStrip2.SuspendLayout(); contextMenuStrip2.SuspendLayout();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
tileContainerMenu1.SuspendLayout(); tileContainerMenu1.SuspendLayout();
@ -92,12 +92,12 @@ namespace RokettoLaunch
// //
// saveFileDialog1 // saveFileDialog1
// //
saveFileDialog1.Filter = "Session files (compressed)|*.jsnx|Session files|*.json;*.jsonfig"; saveFileDialog1.Filter = "Session files|*.jsonfig";
saveFileDialog1.Title = "Choose file to save the session"; saveFileDialog1.Title = "Choose file to save the session";
// //
// openFileDialog1 // openFileDialog1
// //
openFileDialog1.Filter = "All supported files|*.json;*.jsonfig;*.jsnx|Session files (compressed)|*.jsnx|Session files|*.json;*.jsonfig"; openFileDialog1.Filter = "Session files|*.jsonfig";
openFileDialog1.Title = "Choose session file"; openFileDialog1.Title = "Choose session file";
// //
// notifyIcon1 // notifyIcon1
@ -420,33 +420,33 @@ namespace RokettoLaunch
// //
tileMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { editToolStripMenuItem1, toolStripMenuItem6, toolStripSeparator4, removeToolStripMenuItem1 }); tileMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { editToolStripMenuItem1, toolStripMenuItem6, toolStripSeparator4, removeToolStripMenuItem1 });
tileMenu1.Name = "tileMenu1"; tileMenu1.Name = "tileMenu1";
tileMenu1.Size = new System.Drawing.Size(125, 76); tileMenu1.Size = new System.Drawing.Size(181, 98);
// //
// editToolStripMenuItem1 // editToolStripMenuItem1
// //
editToolStripMenuItem1.Name = "editToolStripMenuItem1"; editToolStripMenuItem1.Name = "editToolStripMenuItem1";
editToolStripMenuItem1.Size = new System.Drawing.Size(124, 22); editToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
editToolStripMenuItem1.Text = "&Edit"; editToolStripMenuItem1.Text = "&Edit";
editToolStripMenuItem1.Click += editToolStripMenuItem1_Click; editToolStripMenuItem1.Click += editToolStripMenuItem1_Click;
// //
// removeToolStripMenuItem1
//
removeToolStripMenuItem1.Name = "removeToolStripMenuItem1";
removeToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
removeToolStripMenuItem1.Text = "&Remove";
removeToolStripMenuItem1.Click += removeToolStripMenuItem1_Click;
//
// toolStripMenuItem6 // toolStripMenuItem6
// //
toolStripMenuItem6.Name = "toolStripMenuItem6"; toolStripMenuItem6.Name = "toolStripMenuItem6";
toolStripMenuItem6.Size = new System.Drawing.Size(124, 22); toolStripMenuItem6.Size = new System.Drawing.Size(180, 22);
toolStripMenuItem6.Text = "&Duplicate"; toolStripMenuItem6.Text = "&Duplicate";
toolStripMenuItem6.Click += toolStripMenuItem6_Click; toolStripMenuItem6.Click += toolStripMenuItem6_Click;
// //
// toolStripSeparator4 // toolStripSeparator4
// //
toolStripSeparator4.Name = "toolStripSeparator4"; toolStripSeparator4.Name = "toolStripSeparator4";
toolStripSeparator4.Size = new System.Drawing.Size(121, 6); toolStripSeparator4.Size = new System.Drawing.Size(177, 6);
//
// removeToolStripMenuItem1
//
removeToolStripMenuItem1.Name = "removeToolStripMenuItem1";
removeToolStripMenuItem1.Size = new System.Drawing.Size(124, 22);
removeToolStripMenuItem1.Text = "&Remove";
removeToolStripMenuItem1.Click += removeToolStripMenuItem1_Click;
// //
// MainForm // MainForm
// //

View File

@ -5,11 +5,12 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq;
using RokettoLaunch.Models; using RokettoLaunch.Models;
using RyzStudio;
using RyzStudio.Windows.Forms; using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox; using RyzStudio.Windows.ThemedForms.ButtonTextBox;
using RyzStudio.Windows.TileForms; using RyzStudio.Windows.TileForms;
using static RyzStudio.Windows.ThemedForms.ButtonTextBox.ThKeyCodeTextBox;
namespace RokettoLaunch namespace RokettoLaunch
{ {
@ -25,7 +26,6 @@ namespace RokettoLaunch
{ {
InitializeComponent(); InitializeComponent();
this.AutoScaleMode = AutoScaleMode.None;
this.Text = Application.ProductName; this.Text = Application.ProductName;
_fileSessionManager = new FileSessionManager(); _fileSessionManager = new FileSessionManager();
@ -37,7 +37,10 @@ namespace RokettoLaunch
_fileSessionManager.OnClearing += fileSessionManager_OnClearSession; _fileSessionManager.OnClearing += fileSessionManager_OnClearSession;
_fileSessionManager.OnFilenameChanged += fileSessionManager_OnFilenameChanged; _fileSessionManager.OnFilenameChanged += fileSessionManager_OnFilenameChanged;
//tileContainer1.OnColumnSizeChanged += tileContainer1_OnSizeChanged;
notifyIcon1.Text = Application.ProductName; notifyIcon1.Text = Application.ProductName;
this.AutoScaleMode = AutoScaleMode.None;
} }
protected async override void OnShown(EventArgs e) protected async override void OnShown(EventArgs e)
@ -427,22 +430,7 @@ namespace RokettoLaunch
{ {
return await Task.Run(async () => return await Task.Run(async () =>
{ {
var result = GenericResult.Create(); this.CurrentSession = RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile<AppOptions>(filename);
switch (Path.GetExtension(filename?.ToLower()?.Trim() ?? string.Empty))
{
case ".json":
case ".jsonfig":
this.CurrentSession = RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile<AppOptions>(filename);
break;
case ".jsnx":
this.CurrentSession = await RyzStudio.IO.Compression.ZFile.ReadFile<AppOptions>(filename, "Document.json");
break;
default:
this.CurrentSession = null;
break;
}
if (this.CurrentSession == null) if (this.CurrentSession == null)
{ {
MessageBox.Show("Unable to read session", "Load session"); MessageBox.Show("Unable to read session", "Load session");
@ -491,7 +479,7 @@ namespace RokettoLaunch
return true; return true;
} }
return await Task.Run(async () => return await Task.Run(() =>
{ {
if (_isBusy) if (_isBusy)
{ {
@ -515,31 +503,7 @@ namespace RokettoLaunch
this.CurrentSession.Groups.Add((TileGroupModel)container.Tag); this.CurrentSession.Groups.Add((TileGroupModel)container.Tag);
} }
var result = GenericResult.Create(); var result = RyzStudio.Text.Json.JsonSerialiser.SerialiseFile(filename, this.CurrentSession);
switch (Path.GetExtension(filename?.ToLower()?.Trim() ?? string.Empty))
{
case ".json":
case ".jsonfig":
result = RyzStudio.Text.Json.JsonSerialiser.SerialiseFile(filename, this.CurrentSession);
break;
case ".jsnx":
try
{
System.IO.File.Delete(filename);
}
catch(Exception)
{
// do nothing
}
result = await RyzStudio.IO.Compression.ZFile.WriteFile(filename, "Document.json", this.CurrentSession);
break;
default:
result = GenericResult.Fault("Format not supported");
break;
}
if (result.IsSuccess) if (result.IsSuccess)
{ {
if (showNotices) if (showNotices)
@ -549,15 +513,16 @@ namespace RokettoLaunch
} }
else else
{ {
if (showNotices) MessageBox.Show(result.Message, "Save session");
{
MessageBox.Show(result.Message, "Save session"); _isBusy = false;
}
return false;
} }
_isBusy = false; _isBusy = false;
return result.IsSuccess; return true;
}); });
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,7 +14,7 @@
<Copyright>Ray Lam</Copyright> <Copyright>Ray Lam</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion> <AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion> <FileVersion>1.0.0.0</FileVersion>
<Version>0.3.3.038</Version> <Version>0.3.2.017</Version>
<EnableNETAnalyzers>False</EnableNETAnalyzers> <EnableNETAnalyzers>False</EnableNETAnalyzers>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<PackageIcon>icon-128.png</PackageIcon> <PackageIcon>icon-128.png</PackageIcon>
@ -78,8 +78,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="RyzStudio" Version="8.1.2.249" /> <PackageReference Include="RyzStudio" Version="8.1.2.244" />
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.87" /> <PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.36" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -66,7 +66,11 @@ namespace RokettoLaunch.Windows.Forms
{ {
if ((fileList?.Length ?? 0) > 0) if ((fileList?.Length ?? 0) > 0)
{ {
LoadInfo(fileList[0]); var model = GetTileModel(fileList[0]);
if (model != null)
{
LoadInfo(model);
}
} }
} }
} }
@ -133,17 +137,6 @@ namespace RokettoLaunch.Windows.Forms
toolTip1.SetToolTip(this, this.Title); toolTip1.SetToolTip(this, this.Title);
} }
public void LoadInfo(string filename)
{
var model = GetTileModel(filename);
if (model == null)
{
return;
}
LoadInfo(model);
}
private void Execute(TileModel model) private void Execute(TileModel model)
{ {
if (model == null) if (model == null)