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

Commit 6fb44df

Browse files
committed
more improvements
1 parent aec5813 commit 6fb44df

17 files changed

+570
-141
lines changed

Deploy/Compress_Beta.ps1

-17
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,6 @@ LiteralPath=
55
"sourcepawn/",
66
"lysis/",
77
"SPCode.exe",
8-
"MdXaml.dll",
9-
"MahApps.Metro.dll",
10-
"ICSharpCode.AvalonEdit.dll",
11-
"ByteSize.dll",
12-
"System.Windows.Interactivity.dll",
13-
"Xceed.Wpf.AvalonDock.dll",
14-
"Xceed.Wpf.AvalonDock.Themes.Metro.dll",
15-
"smxdasm.dll",
16-
"ValveQuery.dll",
17-
"SourcepawnCondenser.dll",
18-
"Renci.SshNet.dll",
19-
"Newtonsoft.Json.dll",
20-
"DiscordRPC.dll",
21-
"ControlzEx.dll",
22-
"Octokit.dll",
23-
"Microsoft.WindowsAPICodePack.dll",
24-
"Microsoft.WindowsAPICodePack.Shell.dll",
258
"lang_0_spcode.xml",
269
"GPLv3.txt",
2710
"License.txt"

Deploy/SPCode_Beta.nsi

-33
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,6 @@ SetOutPath $INSTDIR
3535
!insertmacro CheckNetFramework 48
3636

3737
File SPCode.exe
38-
File MahApps.Metro.dll
39-
File ICSharpCode.AvalonEdit.dll
40-
File System.Windows.Interactivity.dll
41-
File Xceed.Wpf.AvalonDock.dll
42-
File Xceed.Wpf.AvalonDock.Themes.Metro.dll
43-
File smxdasm.dll
44-
File ValveQuery.dll
45-
File MdXaml.dll
46-
File SourcepawnCondenser.dll
47-
File ByteSize.dll
48-
File Renci.SshNet.dll
49-
File Newtonsoft.Json.dll
50-
File DiscordRPC.dll
51-
File ControlzEx.dll
52-
File Octokit.dll
53-
File Microsoft.WindowsAPICodePack.dll
54-
File Microsoft.WindowsAPICodePack.Shell.dll
5538

5639
File lang_0_spcode.xml
5740
File License.txt
@@ -120,23 +103,7 @@ SectionEnd
120103

121104
Section "Uninstall"
122105

123-
Delete $INSTDIR\uninstall.exe
124106
Delete $INSTDIR\SPCode.exe
125-
Delete $INSTDIR\MahApps.Metro.dll
126-
Delete $INSTDIR\ICSharpCode.AvalonEdit.dll
127-
Delete $INSTDIR\System.Windows.Interactivity.dll
128-
Delete $INSTDIR\Xceed.Wpf.AvalonDock.dll
129-
Delete $INSTDIR\Xceed.Wpf.AvalonDock.Themes.Metro.dll
130-
Delete $INSTDIR\smxdasm.dll
131-
Delete $INSTDIR\LysisForSpedit.dll
132-
Delete $INSTDIR\ValveQuery.dll
133-
Delete $INSTDIR\SourcepawnCondenser.dll
134-
Delete $INSTDIR\Renci.SshNet.dll
135-
Delete $INSTDIR\Newtonsoft.Json.dll
136-
Delete $INSTDIR\MdXaml.dll
137-
Delete $INSTDIR\DiscordRPC.dll
138-
Delete $INSTDIR\Microsoft.WindowsAPICodePack.dll
139-
Delete $INSTDIR\Microsoft.WindowsAPICodePack.Shell.dll
140107

141108
Delete $INSTDIR\lang_0_spcode.xml
142109
Delete $INSTDIR\License.txt

Deploy/SPCode_Stable.nsi

-17
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,6 @@ SetOutPath $INSTDIR
3535
!insertmacro CheckNetFramework 48
3636

3737
File SPCode.exe
38-
File MahApps.Metro.dll
39-
File ICSharpCode.AvalonEdit.dll
40-
File System.Windows.Interactivity.dll
41-
File Xceed.Wpf.AvalonDock.dll
42-
File Xceed.Wpf.AvalonDock.Themes.Metro.dll
43-
File smxdasm.dll
44-
File ValveQuery.dll
45-
File MdXaml.dll
46-
File SourcepawnCondenser.dll
47-
File ByteSize.dll
48-
File Renci.SshNet.dll
49-
File Newtonsoft.Json.dll
50-
File DiscordRPC.dll
51-
File ControlzEx.dll
52-
File Octokit.dll
53-
File Microsoft.WindowsAPICodePack.dll
54-
File Microsoft.WindowsAPICodePack.Shell.dll
5538

5639
File lang_0_spcode.xml
5740
File License.txt

Deploy/SpcodeUpdater/FodyWeavers.xml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
2+
<Costura />
3+
</Weavers>

Deploy/SpcodeUpdater/FodyWeavers.xsd

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
3+
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
4+
<xs:element name="Weavers">
5+
<xs:complexType>
6+
<xs:all>
7+
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
8+
<xs:complexType>
9+
<xs:all>
10+
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
11+
<xs:annotation>
12+
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
13+
</xs:annotation>
14+
</xs:element>
15+
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
16+
<xs:annotation>
17+
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
18+
</xs:annotation>
19+
</xs:element>
20+
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
21+
<xs:annotation>
22+
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
23+
</xs:annotation>
24+
</xs:element>
25+
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
26+
<xs:annotation>
27+
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
28+
</xs:annotation>
29+
</xs:element>
30+
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
31+
<xs:annotation>
32+
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
33+
</xs:annotation>
34+
</xs:element>
35+
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
36+
<xs:annotation>
37+
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
38+
</xs:annotation>
39+
</xs:element>
40+
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
41+
<xs:annotation>
42+
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
43+
</xs:annotation>
44+
</xs:element>
45+
</xs:all>
46+
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
47+
<xs:annotation>
48+
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
49+
</xs:annotation>
50+
</xs:attribute>
51+
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
52+
<xs:annotation>
53+
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
54+
</xs:annotation>
55+
</xs:attribute>
56+
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
57+
<xs:annotation>
58+
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
59+
</xs:annotation>
60+
</xs:attribute>
61+
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
62+
<xs:annotation>
63+
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
64+
</xs:annotation>
65+
</xs:attribute>
66+
<xs:attribute name="DisableCompression" type="xs:boolean">
67+
<xs:annotation>
68+
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
69+
</xs:annotation>
70+
</xs:attribute>
71+
<xs:attribute name="DisableCleanup" type="xs:boolean">
72+
<xs:annotation>
73+
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
74+
</xs:annotation>
75+
</xs:attribute>
76+
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
77+
<xs:annotation>
78+
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
79+
</xs:annotation>
80+
</xs:attribute>
81+
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
82+
<xs:annotation>
83+
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
84+
</xs:annotation>
85+
</xs:attribute>
86+
<xs:attribute name="ExcludeAssemblies" type="xs:string">
87+
<xs:annotation>
88+
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
89+
</xs:annotation>
90+
</xs:attribute>
91+
<xs:attribute name="IncludeAssemblies" type="xs:string">
92+
<xs:annotation>
93+
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
94+
</xs:annotation>
95+
</xs:attribute>
96+
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
97+
<xs:annotation>
98+
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
99+
</xs:annotation>
100+
</xs:attribute>
101+
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
102+
<xs:annotation>
103+
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
104+
</xs:annotation>
105+
</xs:attribute>
106+
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
107+
<xs:annotation>
108+
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
109+
</xs:annotation>
110+
</xs:attribute>
111+
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
112+
<xs:annotation>
113+
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
114+
</xs:annotation>
115+
</xs:attribute>
116+
<xs:attribute name="PreloadOrder" type="xs:string">
117+
<xs:annotation>
118+
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
119+
</xs:annotation>
120+
</xs:attribute>
121+
</xs:complexType>
122+
</xs:element>
123+
</xs:all>
124+
<xs:attribute name="VerifyAssembly" type="xs:boolean">
125+
<xs:annotation>
126+
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
127+
</xs:annotation>
128+
</xs:attribute>
129+
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
130+
<xs:annotation>
131+
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
132+
</xs:annotation>
133+
</xs:attribute>
134+
<xs:attribute name="GenerateXsd" type="xs:boolean">
135+
<xs:annotation>
136+
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
137+
</xs:annotation>
138+
</xs:attribute>
139+
</xs:complexType>
140+
</xs:element>
141+
</xs:schema>

Deploy/SpcodeUpdater/Program.cs

+40-32
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System;
22
using System.Diagnostics;
33
using System.IO;
4-
using System.IO.Compression;
4+
using System.Linq;
55
using System.Threading;
66
using System.Windows.Forms;
7+
using ICSharpCode.SharpZipLib.Core;
8+
using ICSharpCode.SharpZipLib.Zip;
79

810
namespace SPCodeUpdater
911
{
@@ -14,12 +16,7 @@ public static class Program
1416
[STAThread]
1517
public static void Main()
1618
{
17-
#if BETA
18-
var processName = "SPCode Beta";
19-
#else
20-
var processName = "SPCode";
21-
#endif
22-
var processes = Process.GetProcessesByName(processName);
19+
var processes = Process.GetProcesses().Where(x => x.ProcessName.Contains("SPCode"));
2320
foreach (var process in processes)
2421
{
2522
try
@@ -28,7 +25,7 @@ public static void Main()
2825
}
2926
catch (Exception)
3027
{
31-
// ignored
28+
3229
}
3330
}
3431

@@ -45,43 +42,54 @@ public static void Main()
4542

4643
private static void Worker(object arg)
4744
{
48-
var um = (UpdateMarquee)arg;
49-
var zipFile = Path.Combine(Environment.CurrentDirectory, "updateZipFile.zip");
45+
try
46+
{
47+
var um = (UpdateMarquee)arg;
48+
5049
#if BETA
51-
var zipFileContent = File.ReadAllBytes(@"..\..\..\bin\Release-Beta\SPCode.Beta.Portable.zip");
50+
var zipFile = ".\\SPCode.Beta.Portable.zip";
5251
#else
53-
var zipFileContent = File.ReadAllBytes(@"..\..\..\bin\Release\SPCode.Portable.zip");
52+
var zipFile = ".\\SPCode.Portable.zip";
5453
#endif
5554

56-
File.WriteAllBytes(zipFile, zipFileContent);
57-
58-
var zipInfo = new FileInfo(zipFile);
59-
60-
using (var archive = ZipFile.OpenRead(zipInfo.FullName))
61-
{
62-
foreach (var entry in archive.Entries)
55+
using (var fsInput = File.OpenRead(zipFile))
56+
using (var zf = new ZipFile(fsInput))
6357
{
64-
// Dont override the sourcemod files
65-
if (!entry.FullName.StartsWith(@"sourcepawn\"))
58+
59+
foreach (ZipEntry zipEntry in zf)
6660
{
67-
// Get File directory
68-
var dirBuffer = Path.GetDirectoryName(entry.FullName);
61+
if (zipEntry.IsDirectory || zipEntry.Name.Contains("sourcepawn"))
62+
{
63+
continue;
64+
}
65+
66+
var entryFileName = zipEntry.Name;
67+
68+
var fullZipToPath = Path.Combine(@".\", entryFileName);
69+
var directoryName = Path.GetDirectoryName(fullZipToPath);
6970

70-
// Create directory if not empty
71-
if (!string.IsNullOrEmpty(dirBuffer))
71+
if (directoryName.Length > 0)
7272
{
73-
Directory.CreateDirectory(dirBuffer);
73+
Directory.CreateDirectory(directoryName);
7474
}
7575

76-
// Now we can safely extact the file.
77-
entry.ExtractToFile(entry.FullName, true);
76+
var buffer = new byte[4096];
77+
78+
using (var zipStream = zf.GetInputStream(zipEntry))
79+
using (Stream fsOutput = File.Create(fullZipToPath))
80+
{
81+
StreamUtils.Copy(zipStream, fsOutput, buffer);
82+
}
7883
}
7984
}
80-
}
81-
82-
zipInfo.Delete();
8385

84-
um.Invoke((InvokeDel)(() => { um.SetToReadyState(); }));
86+
um.Invoke((InvokeDel)(() => { um.SetToReadyState(); }));
87+
}
88+
catch (Exception ex)
89+
{
90+
MessageBox.Show($"The updater failed to update SPCode properly: {ex.Message}");
91+
Application.Exit();
92+
}
8593
}
8694
}
8795
}

0 commit comments

Comments
 (0)