Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 6d8fd78

Browse files
authored
Revert "Code cleanup"
1 parent 0dadee5 commit 6d8fd78

File tree

65 files changed

+7097
-7748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+7097
-7748
lines changed

Deploy/SpeditUpdater/Program.cs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
26
using System.Threading;
37
using System.Diagnostics;
8+
using System.Windows;
49
using System.Windows.Forms;
510
using System.IO;
611
using System.IO.Compression;
@@ -12,66 +17,61 @@ public static class Program
1217
[STAThread]
1318
public static void Main()
1419
{
15-
var process = Process.GetProcessesByName("Spedit.exe");
16-
17-
if (process.Length > 0)
20+
Process[] p = Process.GetProcessesByName("Spedit.exe");
21+
if (p.Length > 0)
1822
{
19-
foreach (var p in process)
23+
for (int i = 0; i < p.Length; ++i)
24+
{
2025
try
2126
{
22-
p.WaitForExit();
23-
}
24-
catch (Exception)
25-
{
26-
// ignored
27+
p[i].WaitForExit();
2728
}
29+
catch (Exception) { }
30+
}
2831
}
29-
3032
Application.EnableVisualStyles();
3133
Application.SetCompatibleTextRenderingDefault(true);
32-
33-
var um = new UpdateMarquee();
34+
UpdateMarquee um = new UpdateMarquee();
3435
um.Show();
35-
36-
Application.DoEvents();
37-
38-
var t = new Thread(Worker);
36+
Application.DoEvents(); //execute Visual
37+
Thread t = new Thread(new ParameterizedThreadStart(Worker));
3938
t.Start(um);
40-
4139
Application.Run(um);
4240
}
4341

4442
private static void Worker(object arg)
4543
{
46-
var um = (UpdateMarquee) arg;
47-
var zipFile = Path.Combine(Environment.CurrentDirectory, "updateZipFile.zip");
48-
var zipFileContent = Properties.Resources.spedit1_2_0_1Update;
44+
UpdateMarquee um = (UpdateMarquee)arg;
45+
string zipFile = Path.Combine(Environment.CurrentDirectory, "updateZipFile.zip");
46+
47+
byte[] zipFileContent = SpeditUpdater.Properties.Resources.spedit1_2_0_1Update;
4948

5049
File.WriteAllBytes(zipFile, zipFileContent);
5150

52-
var zipInfo = new FileInfo(zipFile);
53-
var extractPath = Environment.CurrentDirectory;
51+
FileInfo zipInfo = new FileInfo(zipFile);
5452

55-
using (var archieve = ZipFile.OpenRead(zipInfo.FullName))
53+
string extractPath = Environment.CurrentDirectory;
54+
using (ZipArchive archieve = ZipFile.OpenRead(zipInfo.FullName))
5655
{
5756
var entries = archieve.Entries;
58-
5957
foreach (var entry in entries)
6058
{
61-
var full = Path.Combine(extractPath, entry.FullName);
62-
var fInfo = new FileInfo(full);
63-
59+
string full = Path.Combine(extractPath, entry.FullName);
60+
FileInfo fInfo = new FileInfo(full);
6461
if (!Directory.Exists(fInfo.DirectoryName))
65-
if (fInfo.DirectoryName != null)
66-
Directory.CreateDirectory(fInfo.DirectoryName);
67-
62+
{
63+
Directory.CreateDirectory(fInfo.DirectoryName);
64+
}
6865
entry.ExtractToFile(fInfo.FullName, true);
6966
}
7067
}
7168

7269
zipInfo.Delete();
7370

74-
um.Invoke((InvokeDel) (() => { um.SetToReadyState(); }));
71+
um.Invoke((InvokeDel)(() =>
72+
{
73+
um.SetToReadyState();
74+
}));
7575
}
7676

7777
public delegate void InvokeDel();
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
29
using System.Windows.Forms;
310

411
namespace SpeditUpdater
@@ -8,21 +15,21 @@ public partial class UpdateMarquee : Form
815
public UpdateMarquee()
916
{
1017
InitializeComponent();
11-
12-
pictureBox1.Image = Properties.Resources.IconPng;
18+
Bitmap bmp = SpeditUpdater.Properties.Resources.IconPng;
19+
pictureBox1.Image = (Image)bmp;
1320
}
1421

1522
public void SetToReadyState()
1623
{
17-
label1.Text = @"SPEdit got updated!";
24+
label1.Text = "SPEdit got updated!";
1825
progressBar1.Visible = false;
1926
button1.Visible = true;
20-
UseWaitCursor = false;
27+
this.UseWaitCursor = false;
2128
}
2229

2330
private void button1_Click(object sender, EventArgs e)
2431
{
25-
Close();
32+
this.Close();
2633
}
2734
}
2835
}

0 commit comments

Comments
 (0)