Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BundleManager/BundleManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DebugHelper" Version="1.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="ScottPlot.WinForms" Version="5.0.54" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.10" />
</ItemGroup>
Expand Down
161 changes: 82 additions & 79 deletions VaultFormat/AttribSysVaultForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions VaultFormat/AttribSysVaultForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Collections;
using System.Globalization;
using System.Windows.Forms;
using System.IO;
using Newtonsoft.Json;
using PluginAPI;
using BundleUtilities;
using LangEditor;
Expand Down Expand Up @@ -129,5 +131,32 @@ private void AttribSysVaultForm_FormClosed(object s, FormClosedEventArgs e)
EditEvent?.Invoke();
UpdateDisplay();
}

private void exportVaultToolStripMenuItem_Click(object sender, EventArgs e)
{
// Dialog Creation
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.Filter = "JSON File (*.json)|*.json";
saveDialog.Title = "Save AttribSys as JSON";
saveDialog.FileName = "AttribSys.json";

// Dialog Logic
if (saveDialog.ShowDialog() == DialogResult.OK)
{
try
{
// Convertion of the AttribSys. Might need smarter structure to only keep the essential data concerning the configuration of the vehicle
string jsonContent = JsonConvert.SerializeObject(AttribSys, Formatting.Indented);

File.WriteAllText(saveDialog.FileName, jsonContent);

MessageBox.Show("Successfully exported to " + saveDialog.FileName, "Export Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show("Failed to export file. Error: " + ex.Message, "Export Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}
54 changes: 27 additions & 27 deletions VaultFormat/AttribSysVaultForm.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema

Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple

There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down
3 changes: 3 additions & 0 deletions VaultFormat/VaultFormat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<Compile Remove="Properties\Resources.Designer.cs" />
<EmbeddedResource Remove="Properties\Resources.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BundleManager\bin\$(ConfigurationName)\$(TargetFramework)\plugins\&quot; /s /e /y" />
</Target>
Expand Down