update structure (not compiling yet)

This commit is contained in:
2024-09-01 09:06:35 +02:00
parent 530bae8d57
commit 1c6a2f748c
18 changed files with 151 additions and 300 deletions

View File

@@ -0,0 +1,71 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Pilz.Cryptography;
using Pilz.IO;
using Pilz.Json.Converters;
namespace SM64Lib.Patching;
public class PatchProfile
{
/// <summary>
/// The Name of the Profile.
/// </summary>
/// <returns></returns>
public string Name { get; set; } = "";
/// <summary>
/// A list with scripts.
/// </summary>
/// <returns></returns>
public List<PatchScript> Scripts { get; set; } = [];
/// <summary>
/// The version of this profile.
/// </summary>
/// <returns></returns>
[JsonConverter(typeof(VersionConverter))]
public Version Version { get; set; } = new Version("1.0.0.0");
/// <summary>
/// The minimum ROM Manager version requied for this tweak.
/// </summary>
[JsonConverter(typeof(VersionConverter))]
public Version MinVersion { get; set; } = new Version("1.0.0.0");
/// <summary>
/// The maximum ROM Manager version allowed for this tweak.
/// </summary>
[JsonConverter(typeof(VersionConverter))]
public Version MaxVersion { get; set; } = new Version("0.0.0.0");
/// <summary>
/// The description of this profile
/// </summary>
/// <returns></returns>
public string Description { get; set; } = "";
/// <summary>
/// The Xml file for this profile.
/// </summary>
/// <returns></returns>
[JsonIgnore]
public string FileName { get; set; } = "";
/// <summary>
/// Indicates if this patch use the old XML format.
/// </summary>
[JsonIgnore]
public bool IsLegacy => Path.GetExtension(FileName).Equals(".xml", StringComparison.CurrentCultureIgnoreCase);
/// <summary>
/// Contains files embedded into this profile.
/// </summary>
public EmbeddedFilesContainer EmbeddedFiles { get; } = new EmbeddedFilesContainer();
/// <summary>
/// Defines an uniquie ID to identify this tweak (e.g. for undo patch).
/// </summary>
[JsonConverter(typeof(UniquieIDStringJsonConverter))]
public UniquieID ID { get; set; } = new();
/// <summary>
/// Defines if the tweak is official and secure.
/// </summary>
public bool Official { get; set; } = false;
/// <summary>
/// Defines if the tweak is recommended for every common SM64 ROM Hack.
/// </summary>
public bool Recommended { get; set; } = false;
}

View File

@@ -9,69 +9,6 @@ using VersionConverter = Newtonsoft.Json.Converters.VersionConverter;
namespace SM64Lib.Patching;
public class PatchProfile
{
/// <summary>
/// The Name of the Profile.
/// </summary>
/// <returns></returns>
public string Name { get; set; } = "";
/// <summary>
/// A list with scripts.
/// </summary>
/// <returns></returns>
public List<PatchScript> Scripts { get; set; } = [];
/// <summary>
/// The version of this profile.
/// </summary>
/// <returns></returns>
[JsonConverter(typeof(VersionConverter))]
public Version Version { get; set; } = new Version("1.0.0.0");
/// <summary>
/// The minimum ROM Manager version requied for this tweak.
/// </summary>
[JsonConverter(typeof(VersionConverter))]
public Version MinVersion { get; set; } = new Version("1.0.0.0");
/// <summary>
/// The maximum ROM Manager version allowed for this tweak.
/// </summary>
[JsonConverter(typeof(VersionConverter))]
public Version MaxVersion { get; set; } = new Version("0.0.0.0");
/// <summary>
/// The description of this profile
/// </summary>
/// <returns></returns>
public string Description { get; set; } = "";
/// <summary>
/// The Xml file for this profile.
/// </summary>
/// <returns></returns>
[JsonIgnore]
public string FileName { get; set; } = "";
/// <summary>
/// Indicates if this patch use the old XML format.
/// </summary>
[JsonIgnore]
public bool IsLegacy => Path.GetExtension(FileName).Equals(".xml", StringComparison.CurrentCultureIgnoreCase);
/// <summary>
/// Contains files embedded into this profile.
/// </summary>
public EmbeddedFilesContainer EmbeddedFiles { get; } = new EmbeddedFilesContainer();
/// <summary>
/// Defines an uniquie ID to identify this tweak (e.g. for undo patch).
/// </summary>
[JsonConverter(typeof(UniquieIDStringJsonConverter))]
public UniquieID ID { get; set; } = new();
/// <summary>
/// Defines if the tweak is official and secure.
/// </summary>
public bool Official { get; set; } = false;
/// <summary>
/// Defines if the tweak is recommended for every common SM64 ROM Hack.
/// </summary>
public bool Recommended { get; set; } = false;
}
/// <summary>
/// A Profile containing a script and some descriptions.
/// </summary>
@@ -134,42 +71,3 @@ public class PatchScript
}
}
}
/// <summary>
/// Defines the script type, so the behavior on write it.
/// </summary>
public enum ScriptType
{
/// <summary>
/// A tweak syntax known from the SM64 Editor.
/// </summary>
TweakScript,
/// <summary>
/// A Visual Basic code.
/// </summary>
VisualBasic,
/// <summary>
/// A C# Code.
/// </summary>
CSharp,
/// <summary>
/// A DLL file containing the Code.
/// </summary>
DynamicLinkLibrary,
/// <summary>
/// Code that can be applied using Armips.
/// </summary>
Armips,
/// <summary>
/// Patch a BSP patch using Flips.
/// </summary>
BPS,
/// <summary>
/// Patch an IPS patch using Flips.
/// </summary>
IPS,
/// <summary>
/// Patch a PPF patch using ApplyPPF3.
/// </summary>
PPF
}

View File

@@ -0,0 +1,40 @@
namespace SM64Lib.Patching;
/// <summary>
/// Defines the script type, so the behavior on write it.
/// </summary>
public enum ScriptType
{
/// <summary>
/// A tweak syntax known from the SM64 Editor.
/// </summary>
TweakScript,
/// <summary>
/// A Visual Basic code.
/// </summary>
VisualBasic,
/// <summary>
/// A C# Code.
/// </summary>
CSharp,
/// <summary>
/// A DLL file containing the Code.
/// </summary>
DynamicLinkLibrary,
/// <summary>
/// Code that can be applied using Armips.
/// </summary>
Armips,
/// <summary>
/// Patch a BSP patch using Flips.
/// </summary>
BPS,
/// <summary>
/// Patch an IPS patch using Flips.
/// </summary>
IPS,
/// <summary>
/// Patch a PPF patch using ApplyPPF3.
/// </summary>
PPF
}

View File

@@ -1,70 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<DefineTrace>true</DefineTrace>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661,CA1009</NoWarn>
<Platforms>AnyCPU</Platforms>
<Configurations>Debug;Release;ReleaseBundle;ReleaseStandalone</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineDebug>true</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStandalone|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseBundle|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RelMono|AnyCPU'">
<Optimize>true</Optimize>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DefineConstants>TRACE;RelMono</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.11.0" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="Pilz.Cryptography" Version="2.1.1" />
<PackageReference Include="Pilz.IO" Version="2.0.0" />
<PackageReference Include="Pilz.IO" Version="2.1.0" />
<PackageReference Include="Pilz.Simple3DFileParser" Version="2.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="SM64Lib.Data.System" />
<Import Include="SM64Lib.TextValueConverter" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
<Import Include="Z.Collections.Extensions" />
<Import Include="Z.IO.Extensions" />
<Import Include="Z.Xml.Linq.Extensions" />
</ItemGroup>
<ItemGroup>
<Compile Update="My Project\Application.Designer.cs">