Added support for compressed session file
This commit is contained in:
parent
e9c0a7018a
commit
0a5d05a0bb
28
MainForm.Designer.cs
generated
28
MainForm.Designer.cs
generated
@ -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|*.jsonfig";
|
saveFileDialog1.Filter = "Session files (compressed)|*.jsnx|Session files|*.json;*.jsonfig";
|
||||||
saveFileDialog1.Title = "Choose file to save the session";
|
saveFileDialog1.Title = "Choose file to save the session";
|
||||||
//
|
//
|
||||||
// openFileDialog1
|
// openFileDialog1
|
||||||
//
|
//
|
||||||
openFileDialog1.Filter = "Session files|*.jsonfig";
|
openFileDialog1.Filter = "All supported files|*.json;*.jsonfig;*.jsnx|Session files (compressed)|*.jsnx|Session files|*.json;*.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(181, 98);
|
tileMenu1.Size = new System.Drawing.Size(125, 76);
|
||||||
//
|
//
|
||||||
// editToolStripMenuItem1
|
// editToolStripMenuItem1
|
||||||
//
|
//
|
||||||
editToolStripMenuItem1.Name = "editToolStripMenuItem1";
|
editToolStripMenuItem1.Name = "editToolStripMenuItem1";
|
||||||
editToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
editToolStripMenuItem1.Size = new System.Drawing.Size(124, 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(180, 22);
|
toolStripMenuItem6.Size = new System.Drawing.Size(124, 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(177, 6);
|
toolStripSeparator4.Size = new System.Drawing.Size(121, 6);
|
||||||
|
//
|
||||||
|
// removeToolStripMenuItem1
|
||||||
|
//
|
||||||
|
removeToolStripMenuItem1.Name = "removeToolStripMenuItem1";
|
||||||
|
removeToolStripMenuItem1.Size = new System.Drawing.Size(124, 22);
|
||||||
|
removeToolStripMenuItem1.Text = "&Remove";
|
||||||
|
removeToolStripMenuItem1.Click += removeToolStripMenuItem1_Click;
|
||||||
//
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
|
59
MainForm.cs
59
MainForm.cs
@ -5,12 +5,11 @@ 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
|
||||||
{
|
{
|
||||||
@ -26,6 +25,7 @@ namespace RokettoLaunch
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.AutoScaleMode = AutoScaleMode.None;
|
||||||
this.Text = Application.ProductName;
|
this.Text = Application.ProductName;
|
||||||
|
|
||||||
_fileSessionManager = new FileSessionManager();
|
_fileSessionManager = new FileSessionManager();
|
||||||
@ -37,10 +37,7 @@ 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)
|
||||||
@ -430,7 +427,22 @@ namespace RokettoLaunch
|
|||||||
{
|
{
|
||||||
return await Task.Run(async () =>
|
return await Task.Run(async () =>
|
||||||
{
|
{
|
||||||
|
var result = GenericResult.Create();
|
||||||
|
|
||||||
|
switch (Path.GetExtension(filename?.ToLower()?.Trim() ?? string.Empty))
|
||||||
|
{
|
||||||
|
case ".json":
|
||||||
|
case ".jsonfig":
|
||||||
this.CurrentSession = RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile<AppOptions>(filename);
|
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");
|
||||||
@ -479,7 +491,7 @@ namespace RokettoLaunch
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await Task.Run(() =>
|
return await Task.Run(async () =>
|
||||||
{
|
{
|
||||||
if (_isBusy)
|
if (_isBusy)
|
||||||
{
|
{
|
||||||
@ -503,7 +515,31 @@ namespace RokettoLaunch
|
|||||||
this.CurrentSession.Groups.Add((TileGroupModel)container.Tag);
|
this.CurrentSession.Groups.Add((TileGroupModel)container.Tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = RyzStudio.Text.Json.JsonSerialiser.SerialiseFile(filename, this.CurrentSession);
|
var result = GenericResult.Create();
|
||||||
|
|
||||||
|
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)
|
||||||
@ -512,17 +548,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 true;
|
return result.IsSuccess;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
BIN
References/RyzStudio.8.1.2.249.nupkg
Normal file
BIN
References/RyzStudio.8.1.2.249.nupkg
Normal file
Binary file not shown.
Binary file not shown.
BIN
References/RyzStudio.Windows.Forms.8.1.3.87.nupkg
Normal file
BIN
References/RyzStudio.Windows.Forms.8.1.3.87.nupkg
Normal file
Binary file not shown.
@ -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.2.017</Version>
|
<Version>0.3.3.038</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.244" />
|
<PackageReference Include="RyzStudio" Version="8.1.2.249" />
|
||||||
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.36" />
|
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.87" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -66,11 +66,7 @@ namespace RokettoLaunch.Windows.Forms
|
|||||||
{
|
{
|
||||||
if ((fileList?.Length ?? 0) > 0)
|
if ((fileList?.Length ?? 0) > 0)
|
||||||
{
|
{
|
||||||
var model = GetTileModel(fileList[0]);
|
LoadInfo(fileList[0]);
|
||||||
if (model != null)
|
|
||||||
{
|
|
||||||
LoadInfo(model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,6 +133,17 @@ 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)
|
||||||
|
Reference in New Issue
Block a user