Skip to content

Commit 17f93f7

Browse files
committed
Релиз
1 parent d4b20b2 commit 17f93f7

7 files changed

Lines changed: 104 additions & 71 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<configSections>
44
</configSections>
55
<startup>
6-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
6+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
77
</startup>
8-
</configuration>
8+
</configuration>

OneScriptNoConsole/OneScriptNoConsole/OneScriptNoConsole.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1414
<Deterministic>true</Deterministic>
15+
<TargetFrameworkProfile />
1516
</PropertyGroup>
1617
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1718
<PlatformTarget>AnyCPU</PlatformTarget>

OneScriptNoConsole/OneScriptNoConsole/Program.cs

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static void Main(string[] args)
131131
}
132132
string set = File.ReadAllText(pathSet);
133133
string aLine;
134-
string[] result1 = set.Split(new string[] { "\u000a", "\u000d"}, StringSplitOptions.RemoveEmptyEntries);
134+
string[] result1 = set.Split(new string[] { "\u000a", "\u000d" }, StringSplitOptions.RemoveEmptyEntries);
135135

136136
for (int i = 0; i < result1.Length; i++)
137137
{
@@ -253,58 +253,58 @@ public static void MakeAssembly()
253253
@"";
254254
string typeProgram = @"" + Environment.NewLine +
255255
@"using System; using System.Text; using System.IO; using System.Reflection; using ScriptEngine.HostedScript.Library; namespace osexe" + Environment.NewLine +
256-
@"{{" + Environment.NewLine +
257-
@" public class Program" + Environment.NewLine +
258-
@" {{" + Environment.NewLine +
259-
@" private static string separator = Path.DirectorySeparatorChar.ToString();" + Environment.NewLine +
260-
@" private static string currentDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;" + Environment.NewLine +
261-
@" private static string pathEr = currentDirectory + separator + ""error.log"";" + Environment.NewLine +
262-
@" public static int Main(string[] args)" + Environment.NewLine +
263-
@" {{" + Environment.NewLine +
264-
@" // Если стартовый сценарий уже внедрен в exe файл, его можно извлечь." + Environment.NewLine +
256+
@"{{" + Environment.NewLine +
257+
@" public class Program" + Environment.NewLine +
258+
@" {{" + Environment.NewLine +
259+
@" private static string separator = Path.DirectorySeparatorChar.ToString();" + Environment.NewLine +
260+
@" private static string currentDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;" + Environment.NewLine +
261+
@" private static string pathEr = currentDirectory + separator + ""error.log"";" + Environment.NewLine +
262+
@" public static int Main(string[] args)" + Environment.NewLine +
263+
@" {{" + Environment.NewLine +
264+
@" // Если стартовый сценарий уже внедрен в exe файл, его можно извлечь." + Environment.NewLine +
265265
@" // Код стартового сценария будет записан в "".os"" файл в той же директории." + Environment.NewLine +
266-
@" // Ключ /pullout" + Environment.NewLine +
267-
@" if (args.Length > 0)" + Environment.NewLine +
268-
@" {{" + Environment.NewLine +
269-
@" if (args.Length == 1)" + Environment.NewLine +
270-
@" {{" + Environment.NewLine +
266+
@" // Ключ /pullout" + Environment.NewLine +
267+
@" if (args.Length > 0)" + Environment.NewLine +
268+
@" {{" + Environment.NewLine +
269+
@" if (args.Length == 1)" + Environment.NewLine +
270+
@" {{" + Environment.NewLine +
271271
@" string aLine = args[0].Trim();" + Environment.NewLine +
272-
@" if (aLine.Substring(0, 8) == ""/pullout"")" + Environment.NewLine +
273-
@" {{" + Environment.NewLine +
274-
@" // Извлекаем стартовый сценарий." + Environment.NewLine +
275-
@" string fileName1 = Assembly.GetExecutingAssembly().Location.Replace(@"".exe"", @"".os"");" + Environment.NewLine +
276-
@" string fileName2;" + Environment.NewLine +
277-
@" if (File.Exists(fileName1))" + Environment.NewLine +
278-
@" {{" + Environment.NewLine +
279-
@" int index = 1;" + Environment.NewLine +
280-
@" while (index < 4)" + Environment.NewLine +
281-
@" {{" + Environment.NewLine +
282-
@" fileName2 = Assembly.GetExecutingAssembly().Location.Replace(@"".exe"", ""("" + index + "").os"");" + Environment.NewLine +
283-
@" if (!File.Exists(fileName2))" + Environment.NewLine +
284-
@" {{" + Environment.NewLine +
285-
@" File.WriteAllText(fileName2, MyEntryScript.strMyEntryScript, Encoding.UTF8);" + Environment.NewLine +
286-
@" Environment.Exit(0);" + Environment.NewLine +
287-
@" }}" + Environment.NewLine +
288-
@" else" + Environment.NewLine +
289-
@" {{" + Environment.NewLine +
290-
@" index++;" + Environment.NewLine +
291-
@" }}" + Environment.NewLine +
292-
@" }}" + Environment.NewLine +
293-
@" }}" + Environment.NewLine +
294-
@" else" + Environment.NewLine +
295-
@" {{" + Environment.NewLine +
296-
@" File.WriteAllText(fileName1, MyEntryScript.strMyEntryScript, Encoding.UTF8);" + Environment.NewLine +
297-
@" }}" + Environment.NewLine +
298-
@" Environment.Exit(0);" + Environment.NewLine +
299-
@" }}" + Environment.NewLine +
300-
@" }}" + Environment.NewLine +
301-
@" }}" + Environment.NewLine +
302-
@"" + Environment.NewLine +
303-
@" string path;" + Environment.NewLine +
304-
@" path = currentDirectory + separator + ""ScriptEngine.dll""; if (!File.Exists(path)) {{ try {{ FileStream fs = new FileStream(path, FileMode.Create); BinaryWriter br = new BinaryWriter(fs); byte[] bin = Convert.FromBase64String(ScriptEnginedll.strScriptEnginedll); br.Write(bin, 0, bin.Length); fs.Close(); br.Close(); }} catch {{ WriteError(""Не удалось записать файл "" + path); }} }}" + Environment.NewLine +
305-
@" path = currentDirectory + separator + ""ScriptEngine.HostedScript.dll""; if (!File.Exists(path)) {{ try {{ FileStream fs = new FileStream(path, FileMode.Create); BinaryWriter br = new BinaryWriter(fs); byte[] bin = Convert.FromBase64String(ScriptEngineHostedScriptdll.strScriptEngineHostedScriptdll); br.Write(bin, 0, bin.Length); fs.Close(); br.Close(); }} catch {{ WriteError(""Не удалось записать файл "" + path); }} }}" + Environment.NewLine +
306-
@" path = currentDirectory + separator + ""OneScript.Language.dll""; if (!File.Exists(path)) {{ try {{ FileStream fs = new FileStream(path, FileMode.Create); BinaryWriter br = new BinaryWriter(fs); byte[] bin = Convert.FromBase64String(OneScriptLanguagedll.strOneScriptLanguagedll); br.Write(bin, 0, bin.Length); fs.Close(); br.Close(); }} catch {{ WriteError(""Не удалось записать файл "" + path); }} }}" + Environment.NewLine +
307-
@" path = currentDirectory + separator + ""Newtonsoft.Json.dll""; if (!File.Exists(path)) {{ try {{ FileStream fs = new FileStream(path, FileMode.Create); BinaryWriter br = new BinaryWriter(fs); byte[] bin = Convert.FromBase64String(NewtonsoftJsondll.strNewtonsoftJsondll); br.Write(bin, 0, bin.Length); fs.Close(); br.Close(); }} catch {{ WriteError(""Не удалось записать файл "" + path); }} }}" + Environment.NewLine +
272+
@" if (aLine.Substring(0, 8) == ""/pullout"")" + Environment.NewLine +
273+
@" {{" + Environment.NewLine +
274+
@" // Извлекаем стартовый сценарий." + Environment.NewLine +
275+
@" string fileName1 = Assembly.GetExecutingAssembly().Location.Replace(@"".exe"", @"".os"");" + Environment.NewLine +
276+
@" string fileName2;" + Environment.NewLine +
277+
@" if (File.Exists(fileName1))" + Environment.NewLine +
278+
@" {{" + Environment.NewLine +
279+
@" int index = 1;" + Environment.NewLine +
280+
@" while (index < 4)" + Environment.NewLine +
281+
@" {{" + Environment.NewLine +
282+
@" fileName2 = Assembly.GetExecutingAssembly().Location.Replace(@"".exe"", ""("" + index + "").os"");" + Environment.NewLine +
283+
@" if (!File.Exists(fileName2))" + Environment.NewLine +
284+
@" {{" + Environment.NewLine +
285+
@" File.WriteAllText(fileName2, MyEntryScript.strMyEntryScript, Encoding.UTF8);" + Environment.NewLine +
286+
@" Environment.Exit(0);" + Environment.NewLine +
287+
@" }}" + Environment.NewLine +
288+
@" else" + Environment.NewLine +
289+
@" {{" + Environment.NewLine +
290+
@" index++;" + Environment.NewLine +
291+
@" }}" + Environment.NewLine +
292+
@" }}" + Environment.NewLine +
293+
@" }}" + Environment.NewLine +
294+
@" else" + Environment.NewLine +
295+
@" {{" + Environment.NewLine +
296+
@" File.WriteAllText(fileName1, MyEntryScript.strMyEntryScript, Encoding.UTF8);" + Environment.NewLine +
297+
@" }}" + Environment.NewLine +
298+
@" Environment.Exit(0);" + Environment.NewLine +
299+
@" }}" + Environment.NewLine +
300+
@" }}" + Environment.NewLine +
301+
@" }}" + Environment.NewLine +
302+
@" string path;" + Environment.NewLine +
303+
@" FileStream fs; BinaryWriter br;" + Environment.NewLine +
304+
@" path = currentDirectory + separator + ""ScriptEngine.dll""; if (!File.Exists(path)) {{ try {{ fs = new FileStream(path, FileMode.Create); br = new BinaryWriter(fs); byte[] bin = ScriptEnginedll.Get(); br.Write(bin, 0, bin.Length); fs.Close(); br.Close(); }} catch {{ WriteError(""Не удалось записать файл "" + path); }} }}" + Environment.NewLine +
305+
@" path = currentDirectory + separator + ""ScriptEngine.HostedScript.dll""; if (!File.Exists(path)) {{ try {{ fs = new FileStream(path, FileMode.Create); br = new BinaryWriter(fs); byte[] bin = ScriptEngineHostedScriptdll.Get(); br.Write(bin, 0, bin.Length); fs.Close(); br.Close(); }} catch {{ WriteError(""Не удалось записать файл "" + path); }} }}" + Environment.NewLine +
306+
@" path = currentDirectory + separator + ""OneScript.Language.dll""; if (!File.Exists(path)) {{ try {{ fs = new FileStream(path, FileMode.Create); br = new BinaryWriter(fs); byte[] bin = OneScriptLanguagedll.Get(); br.Write(bin, 0, bin.Length); fs.Close(); br.Close(); }} catch {{ WriteError(""Не удалось записать файл "" + path); }} }}" + Environment.NewLine +
307+
@" path = currentDirectory + separator + ""Newtonsoft.Json.dll""; if (!File.Exists(path)) {{ try {{ fs = new FileStream(path, FileMode.Create); br = new BinaryWriter(fs); byte[] bin = NewtonsoftJsondll.Get(); br.Write(bin, 0, bin.Length); fs.Close(); br.Close(); }} catch {{ WriteError(""Не удалось записать файл "" + path); }} }}" + Environment.NewLine +
308308
@" try {{ Starter starter = new Starter(); return starter.Start(); }} " + Environment.NewLine +
309309
@" catch (Exception ex) {{ WriteError("""" + ex.Message); }} return 1;" + Environment.NewLine +
310310
@" }}" + Environment.NewLine +
@@ -423,21 +423,20 @@ public static void MakeAssembly()
423423
@"using System; using System.Text; namespace osexe {{ internal static class Output {{ private static Encoding _encoding; static Output() {{ Init(); }} public static Action<string> Write {{ get; private set; }} public static ConsoleColor TextColor {{ get {{ return Console.ForegroundColor; }} set {{ Console.ForegroundColor = value; }} }} public static Encoding ConsoleOutputEncoding {{ get {{ return _encoding; }} set {{ _encoding = value; Init(); }} }} private static void Init() {{ if (ConsoleOutputEncoding == null) {{ Write = WriteStandardConsole; }} else {{ Write = WriteEncodedStream; }} }} public static void WriteLine(string text) {{ Write(text); WriteLine(); }} public static void WriteLine() {{ Write(Environment.NewLine); }} private static void WriteStandardConsole(string text) {{ Console.Write(text); }} private static void WriteEncodedStream(string text) {{ using (var stdout = Console.OpenStandardOutput()) {{ var enc = ConsoleOutputEncoding; var bytes = enc.GetBytes(text); stdout.Write(bytes, 0, bytes.Length); }} }} }} }}" + Environment.NewLine +
424424
@"";
425425
string typeScriptEnginedll = @"" + Environment.NewLine +
426-
@"namespace osexe {{ public static class ScriptEnginedll {{ public static string strScriptEnginedll = @""" + scriptEngine + @"""; }} }}" + Environment.NewLine +
426+
@"using System; namespace osexe {{ public static class ScriptEnginedll {{ public static string str = @""" + scriptEngine + @"""; public static byte[] Get() {{ return Convert.FromBase64String(ScriptEnginedll.str); }} }} }}" + Environment.NewLine +
427427
@"";
428428
string typeScriptEngineHostedScriptdll = @"" + Environment.NewLine +
429-
@"namespace osexe {{ public static class ScriptEngineHostedScriptdll {{ public static string strScriptEngineHostedScriptdll = @""" + scriptEngineHostedScript + @"""; }} }}" + Environment.NewLine +
429+
@"using System; namespace osexe {{ public static class ScriptEngineHostedScriptdll {{ public static string str = @""" + scriptEngineHostedScript + @"""; public static byte[] Get() {{ return Convert.FromBase64String(ScriptEngineHostedScriptdll.str); }} }} }}" + Environment.NewLine +
430430
@"";
431431
string typeOneScriptLanguagedll = @"" + Environment.NewLine +
432-
@"namespace osexe {{ public static class OneScriptLanguagedll {{ public static string strOneScriptLanguagedll = @""" + oneScriptLanguage + @"""; }} }}" + Environment.NewLine +
432+
@"using System; namespace osexe {{ public static class OneScriptLanguagedll {{ public static string str = @""" + oneScriptLanguage + @"""; public static byte[] Get() {{ return Convert.FromBase64String(OneScriptLanguagedll.str ); }} }} }}" + Environment.NewLine +
433433
@"";
434434
string typeNewtonsoftJsondll = @"" + Environment.NewLine +
435-
@"namespace osexe {{ public static class NewtonsoftJsondll {{ public static string strNewtonsoftJsondll = @""" + newtonsoftJson + @"""; }} }}" + Environment.NewLine +
435+
@"using System; namespace osexe {{ public static class NewtonsoftJsondll {{ public static string str = @""" + newtonsoftJson + @"""; public static byte[] Get() {{ return Convert.FromBase64String(NewtonsoftJsondll.str); }} }} }}" + Environment.NewLine +
436436
@"";
437437
string typeMyEntryScript = @"" + Environment.NewLine +
438438
@"namespace osexe {{ public static class MyEntryScript {{ public static string strMyEntryScript = @""" + myEntryScript.Replace("\u0022", "\u0022\u0022") + @"""; }} }}" + Environment.NewLine +
439439
@"";
440-
441440
var assemCode = String.Format(assem, "");
442441
var ProgramCode = String.Format(typeProgram, "Program");
443442
var StarterCode = String.Format(typeStarter, "Starter");
@@ -494,7 +493,7 @@ public static void MakeAssembly()
494493
CompilerOptions = "/optimize /target:winexe"
495494
};
496495

497-
string[] references = {
496+
string[] references = {
498497
"System.dll",
499498
"System.Core.dll",
500499
"System.Net.Http.dll",
@@ -507,7 +506,7 @@ public static void MakeAssembly()
507506
CompilerParams.ReferencedAssemblies.AddRange(references);
508507
var provider = new Microsoft.CSharp.CSharpCodeProvider();
509508
System.CodeDom.Compiler.CompilerResults compile = provider.CompileAssemblyFromSource(
510-
CompilerParams,
509+
CompilerParams,
511510
new string[] {
512511
assemCode,
513512
ProgramCode,

OneScriptNoConsole/OneScriptNoConsole/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// Можно задать все значения или принять номера сборки и редакции по умолчанию
3232
// используя "*", как показано ниже:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.0.1.0")]
35-
[assembly: AssemblyFileVersion("1.0.1.0")]
34+
[assembly: AssemblyVersion("1.0.2.0")]
35+
[assembly: AssemblyFileVersion("1.0.2.0")]

0 commit comments

Comments
 (0)