From df57e96033a25699a96924f1b2dad46fc76404d7 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 17 Aug 2017 17:27:15 -0400 Subject: [PATCH] Initial commit --- .gitattributes | 2 + parseManager.sln | 18 ++++ parseManager/.gitattributes | 2 + parseManager/Program.cs | 36 +++++++ parseManager/Properties/AssemblyInfo.cs | 31 ++++++ parseManager/app.config | 6 ++ .../bin/Debug/parseManagerTester.exe.config | 6 ++ ...eManagerTester.csproj.FileListAbsolute.txt | 6 ++ parseManager/parseManager.cs | 102 ++++++++++++++++++ parseManager/parseManagerTester.csproj | 59 ++++++++++ 10 files changed, 268 insertions(+) create mode 100644 .gitattributes create mode 100644 parseManager.sln create mode 100644 parseManager/.gitattributes create mode 100644 parseManager/Program.cs create mode 100644 parseManager/Properties/AssemblyInfo.cs create mode 100644 parseManager/app.config create mode 100644 parseManager/bin/Debug/parseManagerTester.exe.config create mode 100644 parseManager/obj/Debug/parseManagerTester.csproj.FileListAbsolute.txt create mode 100644 parseManager/parseManager.cs create mode 100644 parseManager/parseManagerTester.csproj diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..eba1110 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto \ No newline at end of file diff --git a/parseManager.sln b/parseManager.sln new file mode 100644 index 0000000..b46b2f8 --- /dev/null +++ b/parseManager.sln @@ -0,0 +1,18 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +# SharpDevelop 5.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "parseManagerTester", "parseManager\parseManagerTester.csproj", "{E095732F-BCDC-4794-B013-A849C4146DA3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E095732F-BCDC-4794-B013-A849C4146DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E095732F-BCDC-4794-B013-A849C4146DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E095732F-BCDC-4794-B013-A849C4146DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E095732F-BCDC-4794-B013-A849C4146DA3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/parseManager/.gitattributes b/parseManager/.gitattributes new file mode 100644 index 0000000..eba1110 --- /dev/null +++ b/parseManager/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto \ No newline at end of file diff --git a/parseManager/Program.cs b/parseManager/Program.cs new file mode 100644 index 0000000..3d2fba2 --- /dev/null +++ b/parseManager/Program.cs @@ -0,0 +1,36 @@ +/* + * Created by SharpDevelop. + * User: Ryan + * Date: 8/17/2017 + * Time: 11:53 AM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; + + +public class define +{ + public void testM(string arg1) + { + Console.WriteLine(arg1 + " it works!"); + } + public void testM2(string arg1) + { + Console.WriteLine(arg1 + " it works!!!"); + } +} +namespace parseManager +{ + class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + parseManager test = new parseManager("path","define"); + test.invokeA("testM",new object[]{""}); + Console.Write("Press any key to continue . . . "); + Console.ReadKey(true); + } + } +} \ No newline at end of file diff --git a/parseManager/Properties/AssemblyInfo.cs b/parseManager/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8d90550 --- /dev/null +++ b/parseManager/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +#region Using directives + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +#endregion + +// 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("parseManager")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("parseManager")] +[assembly: AssemblyCopyright("Copyright 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all the values or you can use the default the Revision and +// Build Numbers by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/parseManager/app.config b/parseManager/app.config new file mode 100644 index 0000000..970c80b --- /dev/null +++ b/parseManager/app.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/parseManager/bin/Debug/parseManagerTester.exe.config b/parseManager/bin/Debug/parseManagerTester.exe.config new file mode 100644 index 0000000..970c80b --- /dev/null +++ b/parseManager/bin/Debug/parseManagerTester.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/parseManager/obj/Debug/parseManagerTester.csproj.FileListAbsolute.txt b/parseManager/obj/Debug/parseManagerTester.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..e88155f --- /dev/null +++ b/parseManager/obj/Debug/parseManagerTester.csproj.FileListAbsolute.txt @@ -0,0 +1,6 @@ +C:\Users\Ryan\Documents\SharpDevelop Projects\parseManager\parseManager\obj\Debug\parseManagerTester.csprojResolveAssemblyReference.cache +C:\Users\Ryan\Documents\SharpDevelop Projects\parseManager\parseManager\bin\Debug\parseManagerTester.exe.config +C:\Users\Ryan\Documents\SharpDevelop Projects\parseManager\parseManager\bin\Debug\parseManagerTester.exe +C:\Users\Ryan\Documents\SharpDevelop Projects\parseManager\parseManager\bin\Debug\parseManagerTester.pdb +C:\Users\Ryan\Documents\SharpDevelop Projects\parseManager\parseManager\obj\Debug\parseManagerTester.exe +C:\Users\Ryan\Documents\SharpDevelop Projects\parseManager\parseManager\obj\Debug\parseManagerTester.pdb diff --git a/parseManager/parseManager.cs b/parseManager/parseManager.cs new file mode 100644 index 0000000..c19a77b --- /dev/null +++ b/parseManager/parseManager.cs @@ -0,0 +1,102 @@ +/* + * Created by SharpDevelop. + * User: Ryan + * Date: 8/17/2017 + * Time: 11:54 AM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.IO; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using System.Reflection; +namespace parseManager +{ + /// + /// Description of parseManager. + /// + public class parseManager + { + string filepath; + bool hasDefine; + string define; + string entry="START"; + Type defineType; + MethodInfo defineMethod; + object defineClassObject; + Dictionary chunks = new Dictionary(); + private void parse(){ + try + { + StreamReader sr = File.OpenText (filepath); + string CDFDATA = sr.ReadToEnd (); + string pattern = @"\[(.+)\][\r\n]*?\{([^\0]+?)\}"; + var match = Regex.Matches( CDFDATA, pattern ); + foreach (Match m in match) + chunks.Add (m.Groups [1].ToString (), m.Groups [2].ToString ()); + } + catch (FileNotFoundException ex) + { + Console.WriteLine("File '"+filepath+"' does not exist!\n"+ex); + } + + } + public parseManager(string filepath) + { + this.filepath=filepath; + hasDefine=false; + parse(); + } + public parseManager(string filepath,string define){ + this.define=define; + hasDefine=true; + this.filepath=filepath; + defineType = Type.GetType(define); + ConstructorInfo defineConstructor = defineType.GetConstructor(Type.EmptyTypes); + defineClassObject = defineConstructor.Invoke(new object[]{}); + parse(); + } + public int invokeA(string method, object[] args){ // TODO collect the returned arguments if any + if (!hasDefine) + return -1; + defineMethod = defineType.GetMethod(method); + defineMethod.Invoke(defineClassObject, args); + return 0; + } + public int invokeNA(string method, object[] args){ // Simple Invoking! + if (!hasDefine) + return -1; + defineMethod = defineType.GetMethod(method); + defineMethod.Invoke(defineClassObject, args); + return 0; + } + public nextType next(){ + return new nextType("method"); + } + } + public class nextType + { + string type; + string text; + Dictionary other = new Dictionary(); + public nextType(string type){ + this.type=type; + } + public string getType(){ + return type; + } + public void setText(string text){ + this.text=text; + } + public string getText(){ + return text; + } + public object getData(string name){ + return other[name]; + } + public void addData(string varname,object data){ + other.Add(varname,data); + } + } +} \ No newline at end of file diff --git a/parseManager/parseManagerTester.csproj b/parseManager/parseManagerTester.csproj new file mode 100644 index 0000000..63fdf93 --- /dev/null +++ b/parseManager/parseManagerTester.csproj @@ -0,0 +1,59 @@ + + + + {E095732F-BCDC-4794-B013-A849C4146DA3} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + AnyCPU + Exe + parseManager + parseManagerTester + v4.0 + Properties + + + x86 + + + bin\Debug\ + True + Full + False + True + DEBUG;TRACE + + + bin\Release\ + False + None + True + False + TRACE + + + + 4.0 + + + + 3.5 + + + + 3.5 + + + + 3.5 + + + + + + + + + + + + \ No newline at end of file