Skip to content

Commit

Permalink
JPD Version 2.5.1 [BETA]
Browse files Browse the repository at this point in the history
👉 GUI v1.5.6 [BETA]
- The project was transferred from the VitNX version 1.1.3-PreFinalBeta (2021) to the not yet released version 2.7 (2022)
- Fixed bug when after canceling the installation (download) of a modification the checkbox for its installation remained
- Simplified code reading

👉 Downgrader v1.16.2 [BETA]
- A little easier to read code
  • Loading branch information
Zalexanninev15 committed Feb 26, 2022
1 parent 9df275e commit 45a7210
Show file tree
Hide file tree
Showing 17 changed files with 278 additions and 276 deletions.
1 change: 0 additions & 1 deletion data/languages/EN.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<Warning>Warning</Warning>
<Error>Error</Error>
<Question>Question</Question>
<FolderSelectDialog>Select the game folder</FolderSelectDialog>
<!-- Information messages -->
<ModSucces>modification has been successfully installed!</ModSucces>
<BindingOK>The binding of the game is completed!</BindingOK>
Expand Down
1 change: 0 additions & 1 deletion data/languages/RU.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<Warning>Предупреждение</Warning>
<Error>Ошибка</Error>
<Question>Вопрос</Question>
<FolderSelectDialog>Укажите папку с игрой</FolderSelectDialog>
<!-- Сообщения с ифнормацией -->
<ModSucces>была успешно установлена!</ModSucces>
<BindingOK>Добавление игры в реестр успешно завершено!</BindingOK>
Expand Down
43 changes: 22 additions & 21 deletions sources/Downgrader/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;
using System.Reflection;

using VitNX.Functions.Common;
using VitNX.Functions.Common.Information;
Expand Down Expand Up @@ -67,10 +68,10 @@ public static void Main(string[] args)
//
// todo Localization
//string lgcode = "EN";
//if (File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\gui.xml"))
//if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\gui.xml"))
//{
// XmlSerializer serializer = new XmlSerializer(typeof(SettingsEditor));
// using (StringReader reader = new StringReader(File.ReadAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\gui.xml")))
// using (StringReader reader = new StringReader(File.ReadAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\gui.xml")))
// {
// var string_gui = (GUI_Settings)serializer.Deserialize(reader);
// lgcode = string_gui.LnguageCode;
Expand All @@ -79,7 +80,7 @@ public static void Main(string[] args)
Console.Title = "Jetpack Downgrader";
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("[JPD] App: Jetpack Downgrader\n[JPD] Version: " +
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "\n[JPD] License: MIT" +
Assembly.GetExecutingAssembly().GetName().Version.ToString() + "\n[JPD] License: MIT" +
"\n[JPD] Authors: Zalexanninev15 (programmer and creator) & Vadim M. (consultant)" +
"\n[JPD] GitHub: https://github.com/Zalexanninev15/Jetpack-Downgrader\n\n[App] Start of log output...");
Console.ResetColor();
Expand All @@ -95,10 +96,10 @@ public static void Main(string[] args)
settings[7] = false;
settings[8] = false;
settings[9] = true;
if (File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\downgrader.xml"))
if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\downgrader.xml"))
{
XmlSerializer serializer = new XmlSerializer(typeof(SettingsEditor));
using (StringReader reader = new StringReader(File.ReadAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\downgrader.xml")))
using (StringReader reader = new StringReader(File.ReadAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\downgrader.xml")))
{
var bool_settings = (SettingsEditor)serializer.Deserialize(reader);
settings[0] = bool_settings.CreateBackups;
Expand All @@ -117,7 +118,7 @@ public static void Main(string[] args)
else { Logger("App", "downgrader.xml", "false"); }
}
catch { Logger("App", "downgrader.xml", "false"); }
if (File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patcher.exe"))
if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patcher.exe"))
{
try { path = args[0]; } catch { }
if (Directory.Exists(path) == false)
Expand Down Expand Up @@ -306,13 +307,13 @@ public static void Main(string[] args)
Logger("DirectPlay", "Enabled", "In process...");
try
{
if (settings[9] == true) { Processes.Execute("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart"); }
if (settings[9] == true) { Processes.RunAW("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart", false); }
else { Process.Start("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart").WaitForExit(); }
}
catch { Logger("DirectPlay", "Enabled", "Error"); }
try
{
if (settings[9] == true) { Processes.Execute("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart /all"); }
if (settings[9] == true) { Processes.RunAW("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart /all", false); }
else { Process.Start("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart /all").WaitForExit(); }
}
catch { Logger("DirectPlay", "Enabled", "Error"); }
Expand All @@ -321,13 +322,13 @@ public static void Main(string[] args)
}
if ((settings[7] == true) && (gv != 5))
{
if (Directory.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\DirectX"))
if (Directory.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\DirectX"))
{
try
{
Logger("DirectX", "Process", "Installing...");
Logger("DirectX", "Process", "App is not frozen, just busy right now...");
Process.Start(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\DirectX\DXSETUP.exe", "/silent").WaitForExit();
Process.Start(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\DirectX\DXSETUP.exe", "/silent").WaitForExit();
Logger("DirectX", "Process", "Installation completed successfully");
}
catch { Logger("DirectX", "Process", "Installation error"); }
Expand Down Expand Up @@ -823,15 +824,15 @@ public static void Main(string[] args)
}
if (er == 0)
{
if (Directory.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches"))
if (Directory.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches"))
{
bool all_patches = true;
for (int i = 2; i < fl.Length; i++)
{
if (!File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp"))
if (!File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp"))
all_patches = false;
}
if (!File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches\game.jpp"))
if (!File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches\game.jpp"))
all_patches = false;
if (all_patches == true)
{
Expand All @@ -841,8 +842,8 @@ public static void Main(string[] args)
// For All Versions | EXE
var restoreRGLfiles = new ProcessStartInfo
{
FileName = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\7z.exe",
Arguments = "x \"" + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\patches\\game.jpp\" -o\"" + path + "\" -y",
FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\7z.exe",
Arguments = "x \"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\patches\\game.jpp\" -o\"" + path + "\" -y",
UseShellExecute = false,
CreateNoWindow = true,
};
Expand Down Expand Up @@ -871,10 +872,10 @@ public static void Main(string[] args)
for (int i = 2; i < fl.Length; i++)
{
progress.SetColor(ConsoleColor.Blue);
string par = '"' + path + fl[i] + '"' + " " + '"' + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"';
string par = '"' + path + fl[i] + '"' + " " + '"' + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"';
if (settings[0] == true)
par = '"' + path + fl[i] + ".jpb" + '"' + " " + '"' + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"';
Processes.Execute(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patcher.exe", @par);
par = '"' + path + fl[i] + ".jpb" + '"' + " " + '"' + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"';
Processes.RunAW(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patcher.exe", @par, false);
if (settings[0] == false)
File.Delete(path + fl[i]);
File.Move(path + fl[i] + ".temp", path + fl[i]);
Expand All @@ -900,10 +901,10 @@ public static void Main(string[] args)
progress.SetColor(ConsoleColor.Blue);
if ((i >= 2) && (i > 11))
{
string par = '"' + path + fl[i] + '"' + " " + '"' + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"';
string par = '"' + path + fl[i] + '"' + " " + '"' + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"';
if (settings[0] == true)
par = '"' + path + fl[i] + ".jpb" + '"' + " " + '"' + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"';
Processes.Execute(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patcher.exe", @par);
par = '"' + path + fl[i] + ".jpb" + '"' + " " + '"' + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"';
Processes.RunAW(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patcher.exe", @par, false);
if (settings[0] == false)
File.Delete(path + fl[i]);
File.Move(path + fl[i] + ".temp", path + fl[i]);
Expand Down
4 changes: 2 additions & 2 deletions sources/Downgrader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
[assembly: AssemblyTrademark("Jetpack Downgrader (2020-2022)")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.16.1.0")]
[assembly: AssemblyFileVersion("1.16.1.0")]
[assembly: AssemblyVersion("1.16.2.0")]
[assembly: AssemblyFileVersion("1.16.2.0")]
2 changes: 2 additions & 0 deletions sources/GUI/Classes/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public static class Data
public static bool DebugMode { get; set; }
public static string NewVersionDetector { get; } = "https://raw.githubusercontent.com/Zalexanninev15/Jetpack-Downgrader/unstable/Version.txt";
public static string GitHubPing { get; } = "github.com";
public static string Mods { get; } = "https://raw.githubusercontent.com/Zalexanninev15/Jetpack-Downgrader/unstable/data/mods/info/v2.json";
}

public class ModsData
Expand All @@ -29,6 +30,7 @@ public static class Urls
public static string GTAForums { get; } = "https://gtaforums.com/topic/969056-jetpack-downgrader";
public static string GitHubAppUsage { get; } = "https://github.com/Zalexanninev15/Jetpack-Downgrader/blob/main/README.md#usage";
public static string GitHubAppAuthors { get; } = "https://github.com/Zalexanninev15/Jetpack-Downgrader/blob/main/README.md#authors";
public static string GitHubAppAddMods { get; } = "https://github.com/Zalexanninev15/Jetpack-Downgrader/blob/unstable/data/docs/AddNewData.md#add-new-modifications";
public static string GitHubAppIssues { get; } = "https://github.com/Zalexanninev15/Jetpack-Downgrader/issues";
}
}
6 changes: 3 additions & 3 deletions sources/GUI/Classes/GUI_Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ public GUI()
public void WriteXml()
{
XmlSerializer ser = new XmlSerializer(typeof(GUI_Settings));
using (TextWriter writer = new StreamWriter(Application.StartupPath + @"\files\gui.xml"))
using (TextWriter writer = new StreamWriter($@"{Application.StartupPath}\files\gui.xml"))
ser.Serialize(writer, Fields);
}

public void ReadXml()
{
if (File.Exists(Application.StartupPath + @"\files\gui.xml"))
if (File.Exists($@"{Application.StartupPath}\files\gui.xml"))
{
XmlSerializer ser = new XmlSerializer(typeof(GUI_Settings));
using (TextReader reader = new StreamReader(Application.StartupPath + @"\files\gui.xml"))
using (TextReader reader = new StreamReader($@"{Application.StartupPath}\files\gui.xml"))
Fields = ser.Deserialize(reader) as GUI_Settings;
}
}
Expand Down
3 changes: 0 additions & 3 deletions sources/GUI/Classes/LanguagesString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ public class LanguagesString
[XmlElement(ElementName = "Done")]
public string Done { get; set; }

[XmlElement(ElementName = "FolderSelectDialog")]
public string FolderSelectDialog { get; set; }

[XmlElement(ElementName = "WishDownloadPatches")]
public string WishDownloadPatches { get; set; }

Expand Down
6 changes: 3 additions & 3 deletions sources/GUI/Classes/SettingsEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ public Props()
public void WriteXml()
{
XmlSerializer ser = new XmlSerializer(typeof(SettingsEditor));
using (TextWriter writer = new StreamWriter(Application.StartupPath + @"\files\downgrader.xml"))
using (TextWriter writer = new StreamWriter($@"{Application.StartupPath}\files\downgrader.xml"))
ser.Serialize(writer, Fields);
}

public void ReadXml()
{
if (File.Exists(Application.StartupPath + @"\files\downgrader.xml"))
if (File.Exists($@"{Application.StartupPath}\files\downgrader.xml"))
{
XmlSerializer ser = new XmlSerializer(typeof(SettingsEditor));
using (TextReader reader = new StreamReader(Application.StartupPath + @"\files\downgrader.xml"))
using (TextReader reader = new StreamReader($@"{Application.StartupPath}\files\downgrader.xml"))
Fields = ser.Deserialize(reader) as SettingsEditor;
}
}
Expand Down
Loading

0 comments on commit 45a7210

Please sign in to comment.