Skip to content

Commit 2ebd463

Browse files
committed
dfg
1 parent 446662e commit 2ebd463

9 files changed

Lines changed: 96 additions & 51 deletions

File tree

CompileForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private void DoTheDeed(string tempdir)
7272
{
7373
Process p = new Process();
7474
var slp = CLISplit.SplitCommandLine(ToBuild).ToList();
75-
p.StartInfo.FileName = "pyinstaller";
75+
p.StartInfo.FileName = RuntimeConfiguration.c.PyinstallerPath;
7676
p.StartInfo.Arguments = String.Join(" ",slp.GetRange(1,slp.Count-1));
7777

7878
p.StartInfo.UseShellExecute = false;

Form1.Designer.cs

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Form1.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@ private void quitToolStripMenuItem_Click(object sender, EventArgs e)
7474
return;
7575
}
7676
}
77-
Environment.Exit(0);
77+
try
78+
{
79+
this.Close();
80+
Environment.Exit(0);
81+
}
82+
catch { }
83+
7884
}
7985

8086
private void compileToolStripMenuItem_Click(object sender, EventArgs e)
@@ -115,7 +121,7 @@ private void button2_Click(object sender, EventArgs e)
115121
}
116122
public string BuildCompileCommand(string tempdir)
117123
{
118-
string command = $"pyinstaller --log-level=INFO --noconfirm --workpath={tempdir} --distpath=\"{textBox3.Text}\" --specpath={tempdir}";
124+
string command = $"{RuntimeConfiguration.c.PyinstallerPath} --log-level=INFO --noconfirm --workpath={tempdir} --distpath=\"{textBox3.Text}\" --specpath={tempdir}";
119125
if (!File.Exists(textBox1.Text))
120126
{
121127
MessageBox.Show("You must specify a Python file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

Program.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static void Main(string[] args)
3939
{
4040
RuntimeConfiguration.AutomatedBuild = true;
4141
}
42+
RuntimeConfiguration.c = ApplicationConfiguration.FromFile(Constants.SettingsPath);
4243
Application.Run(Routines.main);
4344
}
4445
}
@@ -47,6 +48,39 @@ public static class RuntimeConfiguration
4748
{
4849
public static bool AutomatedBuild = false;
4950
public static string InFile;
51+
public static ApplicationConfiguration c;
52+
}
53+
public class ApplicationConfiguration
54+
{
55+
public string PyinstallerPath = "pyinstaller";
56+
public ApplicationConfiguration() { }
57+
public string OutToXML()
58+
{
59+
XmlSerializer xml = new XmlSerializer(typeof(ApplicationConfiguration));
60+
Utf8StringWriter sw = new Utf8StringWriter();
61+
xml.Serialize(sw, this);
62+
return sw.ToString();
63+
}
64+
public static ApplicationConfiguration FromFile(string path)
65+
{
66+
XmlSerializer serializer = new XmlSerializer(typeof(ApplicationConfiguration));
67+
68+
ApplicationConfiguration a = new ApplicationConfiguration();
69+
try
70+
{
71+
var fs = new FileStream(path, FileMode.Open);
72+
a = (ApplicationConfiguration)serializer.Deserialize(fs);
73+
fs.Close();
74+
} catch {
75+
a.WriteTo(path);//Write default values
76+
}
77+
return a;
78+
}
79+
public void WriteTo(string path)
80+
{
81+
File.WriteAllText(path,OutToXML());
82+
}
83+
5084
}
5185
public static class Routines
5286
{
@@ -253,6 +287,7 @@ public class Utf8StringWriter : StringWriter
253287
public static class Constants
254288
{
255289
public static string AppDataPath = Environment.ExpandEnvironmentVariables("%APPDATA%\\PyinstallerHelper");
290+
public static string SettingsPath = AppDataPath + "\\config.xml";
256291
public static string DistPath = Environment.ExpandEnvironmentVariables(AppDataPath+"\\dist");
257292
public static string VersionFileTemplate = @"# UTF-8
258293
#

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.6.0.0")]
36-
[assembly: AssemblyFileVersion("1.6.0.0")]
35+
[assembly: AssemblyVersion("1.7.0.0")]
36+
[assembly: AssemblyFileVersion("1.7.0.0")]

PyinstallerSetting.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public PyinstallerSetting()
2121

2222
private void button1_Click(object sender, EventArgs e)
2323
{
24+
RuntimeConfiguration.c.PyinstallerPath = textBox1.Text;
25+
RuntimeConfiguration.c.WriteTo(Constants.SettingsPath);
2426
this.Close();
2527
}
2628

@@ -37,37 +39,39 @@ private void button3_Click(object sender, EventArgs e)
3739
}
3840
else
3941
{
40-
textBox1.Text += ofd.FileName;
42+
textBox1.Text = ofd.FileName;
4143
}
4244
}
4345

4446
private void PyinstallerSetting_Load(object sender, EventArgs e)
4547
{
46-
textBox1.Text = Routines.GetFullPath("pyinstaller.exe");
47-
if (!Routines.ExistsOnPath("pyinstaller.exe"))
48+
textBox1.Text = RuntimeConfiguration.c.PyinstallerPath;
49+
if (textBox1.Text == "pyinstaller")
4850
{
49-
label3.Text = "Pyinstaller not found";
50-
label3.ForeColor = Color.Red;
51+
textBox1.Text = Routines.GetFullPath("pyinstaller.exe");
52+
if (!Routines.ExistsOnPath("pyinstaller.exe"))
53+
{
54+
label3.Text = "Pyinstaller not found";
55+
label3.ForeColor = Color.Red;
56+
}
5157
}
52-
else
53-
{
5458
Process p = new Process()
5559
{
5660
StartInfo =
5761
{
58-
FileName = "pyinstaller.exe",
62+
FileName = RuntimeConfiguration.c.PyinstallerPath,
5963
Arguments = "--version",
6064
CreateNoWindow = true,
6165
UseShellExecute = false,
6266
RedirectStandardError = true,
6367
RedirectStandardOutput = true,
6468
},
65-
69+
6670
};
6771
p.Start();
6872
p.WaitForExit();
6973
label3.Text = $"Pyinstaller Version: {p.StandardOutput.ReadToEnd()}{p.StandardError.ReadToEnd()}";
70-
}
74+
7175
}
7276

7377
private void button2_Click(object sender, EventArgs e)

manifests/e/EnderbytePrograms/PyinstallerHelper/1.5.1/EnderbytePrograms.PyinstallerHelper.installer.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PackageVersion: 1.5.1
66
InstallerType: inno
77
Installers:
88
- Architecture: x86
9-
InstallerUrl: https://github.com/Enderbyte-Programs/PyinstallerHelper/releases/download/v1.5.1/pyinstallerhelper-1.5.1-setup.exe
10-
InstallerSha256: EBE26A5B95DFF886C2A8210D75A18ABA6226DBA1B80FC8F2E8EA97B0A778A66D
9+
InstallerUrl: https://github.com/Enderbyte-Programs/PyinstallerHelper/releases/download/v1.6/pyinstallerhelper-1.6-setup.exe
10+
InstallerSha256: BC4A107F4165FD578102E060F13DB855C590D74CFED2FC3F1AF45F3945134325
1111
ManifestType: installer
1212
ManifestVersion: 1.6.0

manifests/e/EnderbytePrograms/PyinstallerHelper/1.6/EnderbytePrograms.PyinstallerHelper.installer.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PackageVersion: "1.6"
66
InstallerType: inno
77
Installers:
88
- Architecture: x86
9-
InstallerUrl: https://github.com/Enderbyte-Programs/PyinstallerHelper/releases/download/v1.5.1/pyinstallerhelper-1.5.1-setup.exe
10-
InstallerSha256: EBE26A5B95DFF886C2A8210D75A18ABA6226DBA1B80FC8F2E8EA97B0A778A66D
9+
InstallerUrl: https://github.com/Enderbyte-Programs/PyinstallerHelper/releases/download/v1.6/pyinstallerhelper-1.6-setup.exe
10+
InstallerSha256: BC4A107F4165FD578102E060F13DB855C590D74CFED2FC3F1AF45F3945134325
1111
ManifestType: installer
1212
ManifestVersion: 1.6.0

setup.iss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "Pyinstaller Helper"
5-
#define MyAppVersion "1.5.1"
5+
#define MyAppVersion "1.7"
66
#define MyAppPublisher "Enderbyte Programs"
77
#define MyAppURL "https://github.com/Enderbyte-Programs/Pyinstallerhelper"
88
#define MyAppExeName "PyinstallerHelper.exe"
@@ -28,7 +28,7 @@ DisableProgramGroupPage=yes
2828
PrivilegesRequired=lowest
2929
PrivilegesRequiredOverridesAllowed=commandline
3030
OutputDir=C:\Users\jorda\source\repos\PyinstallerHelper
31-
OutputBaseFilename=pyinstallerhelper-1.5.1-setup
31+
OutputBaseFilename=pyinstallerhelper-1.7-setup
3232
SetupIconFile=C:\Users\jorda\source\repos\PyinstallerHelper\1215332-removebg-preview.ico
3333
Compression=zip
3434
;SolidCompression=yes

0 commit comments

Comments
 (0)