diff --git a/ColorzCore/App.config b/ColorzCore/App.config
deleted file mode 100644
index d740e88..0000000
--- a/ColorzCore/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ColorzCore/ColorzCore.csproj b/ColorzCore/ColorzCore.csproj
index 842e13f..b9de063 100644
--- a/ColorzCore/ColorzCore.csproj
+++ b/ColorzCore/ColorzCore.csproj
@@ -1,124 +1,10 @@
-
-
-
-
- Debug
- AnyCPU
- {B98F7CCF-9CAA-406E-88D7-2040FA99F631}
- Exe
- ColorzCore
- ColorzCore
- v4.5.2
- 512
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
- bin\32bit\
- x86
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+ Exe
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/ColorzCore/ColorzCore.sln b/ColorzCore/ColorzCore.sln
index f0a2e0f..65861dc 100644
--- a/ColorzCore/ColorzCore.sln
+++ b/ColorzCore/ColorzCore.sln
@@ -1,28 +1,16 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26430.6
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorzCore", "ColorzCore.csproj", "{B98F7CCF-9CAA-406E-88D7-2040FA99F631}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- 32bit|Any CPU = 32bit|Any CPU
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {B98F7CCF-9CAA-406E-88D7-2040FA99F631}.32bit|Any CPU.ActiveCfg = 32bit|Any CPU
- {B98F7CCF-9CAA-406E-88D7-2040FA99F631}.32bit|Any CPU.Build.0 = 32bit|Any CPU
- {B98F7CCF-9CAA-406E-88D7-2040FA99F631}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B98F7CCF-9CAA-406E-88D7-2040FA99F631}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B98F7CCF-9CAA-406E-88D7-2040FA99F631}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B98F7CCF-9CAA-406E-88D7-2040FA99F631}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {21D63160-BE4B-46B7-995A-04D8AC7B4472}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorzCore", "ColorzCore.csproj", "{CFFB1609-2FCD-42E9-B335-C9C86F7DD5EC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CFFB1609-2FCD-42E9-B335-C9C86F7DD5EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CFFB1609-2FCD-42E9-B335-C9C86F7DD5EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CFFB1609-2FCD-42E9-B335-C9C86F7DD5EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CFFB1609-2FCD-42E9-B335-C9C86F7DD5EC}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/ColorzCore/IO/IOUtility.cs b/ColorzCore/IO/IOUtility.cs
index 73c7c78..1c72d32 100644
--- a/ColorzCore/IO/IOUtility.cs
+++ b/ColorzCore/IO/IOUtility.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@@ -22,17 +23,13 @@ public static string UnescapePath(string param)
return sb.Replace("\\ ", " ").Replace("\\\\", "\\").ToString();
}
- public static string GetToolFileName(string name)
- {
- switch (Environment.OSVersion.Platform)
- {
- case PlatformID.Win32Windows: // Who knows, maybe someone runs EA on win 95
- case PlatformID.Win32NT:
- return name + ".exe";
-
- default:
- return name;
- }
+ public static string GetToolFileName(string name)
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
+ return name + ".exe";
+ } else {
+ return name;
+ }
}
}
}
diff --git a/ColorzCore/Parser/EAParser.cs b/ColorzCore/Parser/EAParser.cs
index 3ff8431..8e620b7 100644
--- a/ColorzCore/Parser/EAParser.cs
+++ b/ColorzCore/Parser/EAParser.cs
@@ -20,7 +20,7 @@ class EAParser
public MacroCollection Macros { get; }
public Dictionary Definitions { get; }
public Dictionary> Raws { get; }
- public static readonly HashSet SpecialCodes = new HashSet { "ORG", "PUSH", "POP", "MESSAGE", "WARNING", "ERROR", "ASSERT", "PROTECT", "ALIGN", "FILL" };
+ public static readonly HashSet SpecialCodes = new HashSet { "ORG", "PUSH", "POP", "MESSAGE", "WARNING", "ERROR", "ASSERT", "PROTECT", "ALIGN", "FILL", "BASE64" };
//public static readonly HashSet BuiltInMacros = new HashSet { "String", "AddToPool" };
//TODO: Built in macros.
//public static readonly Dictionary BuiltInMacros;
@@ -278,49 +278,69 @@ private Maybe ParseStatement(MergeableGenerator tokens, Immuta
}),
() => { Error(parameters[0].MyLocation, "Expected atomic param to ALIGN"); }
);
- break;
+ break;
case "FILL":
- if (parameters.Count > 2 || parameters.Count == 0)
- {
- Error(head.Location, "Incorrect number of parameters in FILL: " + parameters.Count);
+ if (parameters.Count > 2 || parameters.Count == 0)
+ {
+ Error(head.Location, "Incorrect number of parameters in FILL: " + parameters.Count);
}
- else
+ else
{
// FILL [value]
int amount = 0;
- int value = 0;
-
+ int value = 0;
+
if (parameters.Count == 2)
{
// param 2 (if given) is fill value
-
+
parameters[1].AsAtom().IfJust(
- (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
+ (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
(int val) => { value = val; }),
() => { Error(parameters[0].MyLocation, "Expected atomic param to FILL"); });
- }
+ }
- // param 1 is amount of bytes to fill
+ // param 1 is amount of bytes to fill
parameters[0].AsAtom().IfJust(
- (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
- (int val) => { amount = val; }),
- () => { Error(parameters[0].MyLocation, "Expected atomic param to FILL"); });
+ (IAtomNode atom) => atom.TryEvaluate((Exception e) => { Error(parameters[0].MyLocation, e.Message); }).IfJust(
+ (int val) => { amount = val; }),
+ () => { Error(parameters[0].MyLocation, "Expected atomic param to FILL"); });
var data = new byte[amount];
for (int i = 0; i < amount; ++i)
- data[i] = (byte) value;
+ data[i] = (byte) value;
+
+ var node = new DataNode(CurrentOffset, data);
- var node = new DataNode(CurrentOffset, data);
-
CheckDataWrite(amount);
CurrentOffset += amount;
-
- return new Just(node);
+
+ return new Just(node);
}
break;
+ case "BASE64": {
+ if (parameters.Count != 1)
+ {
+ Error(head.Location, "Incorrect number of parameters in BASE64: " + parameters.Count);
+ }
+ var paramStr = parameters[0].ToString();
+ try {
+ if (string.IsNullOrWhiteSpace(paramStr)) {
+ throw new FormatException();
+ }
+ var data = Convert.FromBase64String(paramStr);
+ var node = new DataNode(CurrentOffset, data);
+ CheckDataWrite(data.Length);
+ CurrentOffset += data.Length;
+ return new Just(node);
+ } catch (FormatException e) {
+ Error(head.Location, "Invalid base64 string: " + parameters[0].ToString());
+ }
+ break;
+ }
}
return new Nothing();
}
diff --git a/ColorzCore/Preprocessor/Directives/IncludeDirective.cs b/ColorzCore/Preprocessor/Directives/IncludeDirective.cs
index e70f6c3..b14f419 100644
--- a/ColorzCore/Preprocessor/Directives/IncludeDirective.cs
+++ b/ColorzCore/Preprocessor/Directives/IncludeDirective.cs
@@ -8,8 +8,8 @@
using ColorzCore.Parser.AST;
using System.IO;
using ColorzCore.Parser;
-using ColorzCore.IO;
-
+using ColorzCore.IO;
+
namespace ColorzCore.Preprocessor.Directives
{
class IncludeDirective : IDirective
@@ -18,13 +18,13 @@ class IncludeDirective : IDirective
public int? MaxParams { get { return 1; } }
- public bool RequireInclusion { get { return true; } }
-
+ public bool RequireInclusion { get { return true; } }
+
public IncludeFileSearcher FileSearcher { get; set; }
- public Maybe Execute(EAParser p, Token self, IList parameters, MergeableGenerator tokens)
- {
- Maybe existantFile = FileSearcher.FindFile(Path.GetDirectoryName(self.FileName), parameters[0].ToString());
+ public Maybe Execute(EAParser p, Token self, IList parameters, MergeableGenerator tokens) {
+ var file = parameters[0].ToString().Replace("\\", "/");
+ Maybe existantFile = FileSearcher.FindFile(Path.GetDirectoryName(self.FileName), file);
if (!existantFile.IsNothing)
{
@@ -38,12 +38,12 @@ public Maybe Execute(EAParser p, Token self, IList parame
}
catch(Exception)
{
- p.Error(self.Location, "Error reading file \"" + parameters[0].ToString() + "\".");
+ p.Error(self.Location, "Error reading file \"" + file + "\".");
}
}
else
{
- p.Error(parameters[0].MyLocation, "Could not find file \"" + parameters[0].ToString() + "\".");
+ p.Error(parameters[0].MyLocation, "Could not find file \"" + file + "\".");
}
return new Nothing();
}
diff --git a/ColorzCore/Properties/AssemblyInfo.cs b/ColorzCore/Properties/AssemblyInfo.cs
deleted file mode 100644
index 4694981..0000000
--- a/ColorzCore/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("ColorzCore")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ColorzCore")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("b98f7ccf-9caa-406e-88d7-2040fa99f631")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.0.2.*")]
-[assembly: AssemblyFileVersion("0.0.1.0")]
diff --git a/ColorzCore/bin/Debug/ColorzCore.exe.config b/ColorzCore/bin/Debug/ColorzCore.exe.config
deleted file mode 100644
index d740e88..0000000
--- a/ColorzCore/bin/Debug/ColorzCore.exe.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ColorzCore/bin/Release/ColorzCore.exe b/ColorzCore/bin/Release/ColorzCore.exe
deleted file mode 100644
index 3f317c3..0000000
Binary files a/ColorzCore/bin/Release/ColorzCore.exe and /dev/null differ