Skip to content

Commit

Permalink
Add command line wrapper project
Browse files Browse the repository at this point in the history
  • Loading branch information
robincornelius committed Oct 23, 2019
1 parent ae1bbb6 commit b60f4eb
Show file tree
Hide file tree
Showing 7 changed files with 260 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ Tests/bin/*
/.vs/VSWorkspaceState.json
/.vs/slnx.sqlite
/.vs/ProjectSettings.json
/EDSSharp/bin/Debug
/EDSSharp/obj/Debug
13 changes: 11 additions & 2 deletions EDSEditor.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.28307.329
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EDSEditorGUI", "EDSTest\EDSEditorGUI.csproj", "{13D2D8ED-242B-4283-BF14-AA79FE875F7C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libEDSsharp", "libEDSsharp\libEDSsharp.csproj", "{CC0FA4B1-2BFC-43B3-8C56-B428DF2D24E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{2A479BF3-7628-409B-8A29-9314C308445E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EDSSharp", "EDSSharp\EDSSharp.csproj", "{8B7A7545-6257-44BF-8868-F429E1B72C77}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -27,8 +29,15 @@ Global
{2A479BF3-7628-409B-8A29-9314C308445E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A479BF3-7628-409B-8A29-9314C308445E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A479BF3-7628-409B-8A29-9314C308445E}.Release|Any CPU.Build.0 = Release|Any CPU
{8B7A7545-6257-44BF-8868-F429E1B72C77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B7A7545-6257-44BF-8868-F429E1B72C77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B7A7545-6257-44BF-8868-F429E1B72C77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B7A7545-6257-44BF-8868-F429E1B72C77}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E8D4F345-888A-449F-A933-E6B3B4743FE5}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions EDSSharp/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
58 changes: 58 additions & 0 deletions EDSSharp/EDSSharp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8B7A7545-6257-44BF-8868-F429E1B72C77}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>EDSSharp</RootNamespace>
<AssemblyName>EDSSharp</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\libEDSsharp\libEDSsharp.csproj">
<Project>{cc0fa4b1-2bfc-43b3-8c56-b428df2d24e7}</Project>
<Name>libEDSsharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
7 changes: 7 additions & 0 deletions EDSSharp/EDSSharp.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>
</StartArguments>
</PropertyGroup>
</Project>
140 changes: 140 additions & 0 deletions EDSSharp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using libEDSsharp;

namespace EDSSharp
{
class Program
{

static libEDSsharp.EDSsharp eds = new EDSsharp();
static string gitversion = "";

static void Main(string[] args)
{
try
{

Dictionary<string, string> argskvp = new Dictionary<string, string>();

int argv = 0;

for (argv = 0; argv < (args.Length - 1); argv++)
{
if (args[argv] == "--infile")
{
argskvp.Add("--infile", args[argv + 1]);
}

if (args[argv] == "--outfile")
{
argskvp.Add("--outfile", args[argv + 1]);
}

if (args[argv] == "--type")
{
argskvp.Add("--type", args[argv + 1]);
}

argv++;
}


if (argskvp.ContainsKey("--type") && argskvp.ContainsKey("--infile") && argskvp.ContainsKey("--outfile"))
{
string infile = argskvp["--infile"];
string outfile = argskvp["--outfile"];

switch (Path.GetExtension(infile).ToLower())
{
case ".xdd":
openXDDfile(infile, outfile);
break;

case ".xml":
openXMLfile(infile,outfile);
break;

case ".eds":
openEDSfile(infile, outfile,InfoSection.Filetype.File_EDS);
break;


default:
return;

}
}
else
{
Console.WriteLine("Usage EDSEditor --type CanOpenNode --infile file.[xdd|eds|xml] --outfile CO_OD.c");
}
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}

private static void openEDSfile(string infile, string outfile, InfoSection.Filetype ft)
{

eds.Loadfile(infile);

exportCOOD(outfile);

}

private static void exportCOOD(string outpath)
{

outpath = Path.GetFullPath(outpath);

string savePath = Path.GetDirectoryName(outpath);

eds.fi.exportFolder = savePath;

Warnings.warning_list.Clear();

CanOpenNodeExporter cone = new CanOpenNodeExporter();
cone.export(savePath, Path.GetFileNameWithoutExtension(outpath), gitversion, eds);

foreach(string warning in Warnings.warning_list)
{
Console.WriteLine("WARNING :" + warning);
}

}

private static void openXMLfile(string path,string outpath)
{

CanOpenXML coxml = new CanOpenXML();
coxml.readXML(path);

Bridge b = new Bridge();

eds = b.convert(coxml.dev);
eds.xmlfilename = path;

exportCOOD(outpath);

}

private static void openXDDfile(string path, string outpath)
{
CanOpenXDD coxml = new CanOpenXDD();
eds = coxml.readXML(path);

if (eds == null)
return;

eds.xddfilename = path;
exportCOOD(outpath);
}
}
}
36 changes: 36 additions & 0 deletions EDSSharp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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("EDSSharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EDSSharp")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("8b7a7545-6257-44bf-8868-f429e1b72c77")]

// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

0 comments on commit b60f4eb

Please sign in to comment.