Initial commit
This commit is contained in:
commit
df57e96033
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
18
parseManager.sln
Normal file
18
parseManager.sln
Normal file
@ -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
|
||||
2
parseManager/.gitattributes
vendored
Normal file
2
parseManager/.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
36
parseManager/Program.cs
Normal file
36
parseManager/Program.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
31
parseManager/Properties/AssemblyInfo.cs
Normal file
31
parseManager/Properties/AssemblyInfo.cs
Normal file
@ -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.*")]
|
||||
6
parseManager/app.config
Normal file
6
parseManager/app.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
|
||||
</startup>
|
||||
</configuration>
|
||||
6
parseManager/bin/Debug/parseManagerTester.exe.config
Normal file
6
parseManager/bin/Debug/parseManagerTester.exe.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@ -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
|
||||
102
parseManager/parseManager.cs
Normal file
102
parseManager/parseManager.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of parseManager.
|
||||
/// </summary>
|
||||
public class parseManager
|
||||
{
|
||||
string filepath;
|
||||
bool hasDefine;
|
||||
string define;
|
||||
string entry="START";
|
||||
Type defineType;
|
||||
MethodInfo defineMethod;
|
||||
object defineClassObject;
|
||||
Dictionary<string, string> chunks = new Dictionary<string, string>();
|
||||
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<string, object> other = new Dictionary<string, object>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
59
parseManager/parseManagerTester.csproj
Normal file
59
parseManager/parseManagerTester.csproj
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{E095732F-BCDC-4794-B013-A849C4146DA3}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>parseManager</RootNamespace>
|
||||
<AssemblyName>parseManagerTester</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>Full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<DebugType>None</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="parseManager.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Loading…
x
Reference in New Issue
Block a user