Skip to content

Commit

Permalink
Merge pull request #3 from TomasMahdal/SCS-Archive-Packer
Browse files Browse the repository at this point in the history
Replaced 7-Zip with SCS Archive Packer
  • Loading branch information
TomasMahdal authored Sep 27, 2024
2 parents dc43ad6 + d805af6 commit 76bf7ae
Show file tree
Hide file tree
Showing 20 changed files with 347 additions and 214 deletions.
11 changes: 2 additions & 9 deletions AMP4SCS/AMP4SCS.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyName>AdvancedModPackerforSCSGames</AssemblyName>
<RootNamespace>AdvancedETS2Packer</RootNamespace>
<Version>1.0.2</Version>
<Version>2.0.0</Version>
</PropertyGroup>

<ItemGroup>
<None Remove="about.txt" />
<None Remove="templateExportBat.txt" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="about.txt" />
<EmbeddedResource Include="templateExportBat.txt" />
</ItemGroup>

<ItemGroup>
<Compile Update="Languages\Export.Designer.cs">
<DesignTime>True</DesignTime>
Expand All @@ -41,7 +37,6 @@
<DependentUpon>Form1.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Languages\Export.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand All @@ -56,12 +51,10 @@
<LastGenOutput>Form1.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions AMP4SCS/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AdvancedETS2Packer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<AdvancedETS2Packer.Properties.Settings>
<setting name="SCSArchiverPath" serializeAs="String">
<value />
</setting>
<setting name="Language" serializeAs="String">
<value>-1</value>
</setting>
</AdvancedETS2Packer.Properties.Settings>
</userSettings>
</configuration>
16 changes: 8 additions & 8 deletions AMP4SCS/Exporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ public void ExportMod(string templateName, bool silentPackaging = false)
// export of Steam version
if (Directory.Exists(template.SteamPath))
{
// vygeneruje bat soubor s příkazy pro export
// generate bat
pd.UpdateStatus("dialog_PackagingSteam");
Assembly assembly = Assembly.GetExecutingAssembly();
StreamReader reader = new StreamReader(assembly.GetManifestResourceStream("AdvancedETS2Packer.templateExportBat.txt"));
string bat = reader.ReadToEnd();
bat = bat.Replace("%cache%", Environment.CurrentDirectory + "\\_cache\\data\\");
bat = bat.Replace("%7z%", Properties.Settings.Default.SevenZip_path);
bat = bat.Replace("%export%", template.SteamPath + "\\" + template.ZipName + "_s.zip");
bat = bat.Replace("%cache%", Environment.CurrentDirectory + "\\_cache\\");
bat = bat.Replace("%packer%", Properties.Settings.Default.SCSArchiverPath);
bat = bat.Replace("%export%", template.SteamPath + "\\" + template.ZipName + "_s.scs");
bat = bat.Replace("%modname%", template.Name);
bat = bat.Replace("%steam%", "");
bat = bat.Replace("%logpath%", Environment.CurrentDirectory + "\\log_Steam.txt");
Expand Down Expand Up @@ -187,9 +187,9 @@ public void ExportMod(string templateName, bool silentPackaging = false)
Assembly assembly = Assembly.GetExecutingAssembly();
StreamReader reader = new StreamReader(assembly.GetManifestResourceStream("AdvancedETS2Packer.templateExportBat.txt"));
string bat = reader.ReadToEnd();
bat = bat.Replace("%cache%", Environment.CurrentDirectory + "\\_cache\\data\\");
bat = bat.Replace("%7z%", Properties.Settings.Default.SevenZip_path);
bat = bat.Replace("%export%", template.NonSteamPath + "\\" + template.ZipName + ".zip");
bat = bat.Replace("%cache%", Environment.CurrentDirectory + "\\_cache\\");
bat = bat.Replace("%packer%", Properties.Settings.Default.SCSArchiverPath);
bat = bat.Replace("%export%", template.NonSteamPath + "\\" + template.ZipName + ".scs");
bat = bat.Replace("%modname%", template.Name);
bat = bat.Replace("%steam%", "non ");
bat = bat.Replace("%logpath%", Environment.CurrentDirectory + "\\log_nonSteam.txt");
Expand All @@ -210,7 +210,7 @@ public void ExportMod(string templateName, bool silentPackaging = false)
// close "Packing..." dialog
if (pd.Visible) {
pd.Invoke((MethodInvoker)delegate
pd.Invoke((System.Windows.Forms.MethodInvoker)delegate
{
pd.Close();
});
Expand Down
6 changes: 3 additions & 3 deletions AMP4SCS/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public Form1()
Languages.CultureGenerator.SetCultureFromProperties();

// verify, if exists settings
if (Properties.Settings.Default.SevenZip_path == "" || File.Exists(Properties.Settings.Default.SevenZip_path) == false)
if (Properties.Settings.Default.SCSArchiverPath == "" || File.Exists(Properties.Settings.Default.SCSArchiverPath) == false)
{
Options options = new Options();
options.ShowDialog();

// Was set? No? Then exit application!
if (Properties.Settings.Default.SevenZip_path == "")
if (Properties.Settings.Default.SCSArchiverPath == "")
{
MessageBox.Show("7z not selected, app will close.", "7z not selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("SCS Archiver not selected, app will close.", "SCS Archiver not selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(0);
}
}
Expand Down
11 changes: 10 additions & 1 deletion AMP4SCS/Languages/Export.Designer.cs

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

13 changes: 8 additions & 5 deletions AMP4SCS/Languages/Export.cs-CZ.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="dialog_Cleanup" xml:space="preserve">
<value>Čistění cache...</value>
Expand Down Expand Up @@ -150,19 +150,22 @@
<data name="Packaging..." xml:space="preserve">
<value>Balení...</value>
</data>
<data name="PackagingGroupCompleted" xml:space="preserve">
<value>Zabalení skupiny modů proběhlo úspěšně!</value>
</data>
<data name="PackingCompleted" xml:space="preserve">
<value>Zabalení modu proběhlo úspěšně!</value>
</data>
<data name="PackingCompleted2" xml:space="preserve">
<value>Zabalení módu {0} proběhlo úspěšně! Podrobnosti najdeš v logu, který je ve složce s programem.</value>
</data>
<data name="PackingGroupCompleted" xml:space="preserve">
<value>Zabalení skupiny módů proběhlo úspěšně!</value>
</data>
<data name="PackingGroupCompleted2" xml:space="preserve">
<value>Zabalení skupiny módů {0} proběhlo úspěšně! Podrobnosti najdeš v logu, který je ve složce s programem.</value>
</data>
<data name="ProblemWithPackaging" xml:space="preserve">
<value>Problém při balení módu</value>
</data>
<data name="PackagingGroupCompleted" xml:space="preserve">
<value>Zabalení skupiny modů proběhlo úspěšně!</value>
</data>
</root>
7 changes: 5 additions & 2 deletions AMP4SCS/Languages/Export.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="dialog_Cleanup" xml:space="preserve">
<value>Cleaning cache...</value>
Expand Down Expand Up @@ -165,4 +165,7 @@
<data name="ProblemWithPackaging" xml:space="preserve">
<value>Problem with packing of mod</value>
</data>
<data name="PackagingGroupCompleted" xml:space="preserve">
<value>Packing completed successfully!</value>
</data>
</root>
10 changes: 5 additions & 5 deletions AMP4SCS/Languages/Options.Designer.cs

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

8 changes: 4 additions & 4 deletions AMP4SCS/Languages/Options.cs-CZ.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Close" xml:space="preserve">
<value>Zavřít</value>
Expand All @@ -126,8 +126,8 @@
<data name="languageOfApp" xml:space="preserve">
<value>Jazyk aplikace:</value>
</data>
<data name="PathToConsole7zip" xml:space="preserve">
<value>Cesta ke konzolové verzi 7zipu:</value>
<data name="PathToArchiver" xml:space="preserve">
<value>Cesta k SCS Packeru:</value>
</data>
<data name="Save" xml:space="preserve">
<value>Uložit</value>
Expand Down
8 changes: 4 additions & 4 deletions AMP4SCS/Languages/Options.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Close" xml:space="preserve">
<value>Close</value>
Expand All @@ -126,8 +126,8 @@
<data name="languageOfApp" xml:space="preserve">
<value>Application language:</value>
</data>
<data name="PathToConsole7zip" xml:space="preserve">
<value>Path to the console version of 7zip:</value>
<data name="PathToArchiver" xml:space="preserve">
<value>Path to the SCS Packer:</value>
</data>
<data name="Save" xml:space="preserve">
<value>Save</value>
Expand Down
Loading

0 comments on commit 76bf7ae

Please sign in to comment.