Skip to content
This repository was archived by the owner on Oct 5, 2019. It is now read-only.

Commit 63b8b2d

Browse files
author
Zaczero
committed
Added support for preprocessor directives #5
1 parent c97751f commit 63b8b2d

File tree

6 files changed

+37
-31
lines changed

6 files changed

+37
-31
lines changed

SharpLoader/Core/RuntimeCompiler.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using System.CodeDom.Compiler;
3-
using System.Collections.Generic;
4-
using System.Diagnostics;
53
using Microsoft.CodeDom.Providers.DotNetCompilerPlatform;
64

75
namespace SharpLoader.Core

SharpLoader/Core/SourceRandomizer.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ private void Encode(ref string str)
193193
if (insideString == 0)
194194
{
195195
// Encode
196-
if (str[i] == '\r' ||
197-
str[i] == '\n' ||
196+
if (//str[i] == '\r' ||
197+
//str[i] == '\n' ||
198198
str[i] == '\t')
199199
{
200200
continue;
@@ -234,7 +234,7 @@ private void Encode(ref string str)
234234

235235
str = resultSb.ToString();
236236
}
237-
237+
238238
private void Replace(ref string str)
239239
{
240240
str = str.Replace("<seed>", _seed.ToString());
@@ -1396,7 +1396,8 @@ private string[] GetCodeBlocks(string str)
13961396
else
13971397
{
13981398
// Split
1399-
var lines = str.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries);
1399+
var lines = str.Split(';').Where(rawLine => !string.IsNullOrWhiteSpace(rawLine)).ToArray();
1400+
14001401
for (var i = 0; i < lines.Length; i++)
14011402
{
14021403
lines[i] += ';';

SharpLoader/Program.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static class Program
3535
private const int SW_SHOW = 5;
3636

3737
public const string Author = "Zaczero";
38-
public const string Version = "2.1";
38+
public const string Version = "2.2";
3939

4040
private const int ReadBufferSize = ushort.MaxValue;
4141

@@ -189,7 +189,21 @@ public static void DumpToAppData()
189189
}
190190

191191
// Run the newest file
192-
File.Copy(thisPath, exePath, true);
192+
retry:
193+
try
194+
{
195+
File.Copy(thisPath, exePath, true);
196+
}
197+
catch (Exception)
198+
{
199+
if (MessageBox.Show("SharpLoader is already running.", "SharpLoader", MessageBoxButtons.RetryCancel,
200+
MessageBoxIcon.Information) == DialogResult.Retry)
201+
{
202+
goto retry;
203+
}
204+
205+
Environment.Exit(0);
206+
}
193207

194208
var argsString = string.Empty;
195209
foreach (var arg in Environment.GetCommandLineArgs())

SharpLoader/Properties/AssemblyInfo.cs

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

SharpLoader/SelectForm.Designer.cs

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

SharpLoader/SelectForm.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
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;
82
using System.Threading;
9-
using System.Threading.Tasks;
103
using System.Windows.Forms;
114

125
namespace SharpLoader

0 commit comments

Comments
 (0)