Skip to content

Commit b60f4eb

Browse files
Add command line wrapper project
1 parent ae1bbb6 commit b60f4eb

File tree

7 files changed

+260
-2
lines changed

7 files changed

+260
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ Tests/bin/*
2727
/.vs/VSWorkspaceState.json
2828
/.vs/slnx.sqlite
2929
/.vs/ProjectSettings.json
30+
/EDSSharp/bin/Debug
31+
/EDSSharp/obj/Debug

EDSEditor.sln

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28307.329
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EDSEditorGUI", "EDSTest\EDSEditorGUI.csproj", "{13D2D8ED-242B-4283-BF14-AA79FE875F7C}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libEDSsharp", "libEDSsharp\libEDSsharp.csproj", "{CC0FA4B1-2BFC-43B3-8C56-B428DF2D24E7}"
99
EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{2A479BF3-7628-409B-8A29-9314C308445E}"
1111
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EDSSharp", "EDSSharp\EDSSharp.csproj", "{8B7A7545-6257-44BF-8868-F429E1B72C77}"
13+
EndProject
1214
Global
1315
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1416
Debug|Any CPU = Debug|Any CPU
@@ -27,8 +29,15 @@ Global
2729
{2A479BF3-7628-409B-8A29-9314C308445E}.Debug|Any CPU.Build.0 = Debug|Any CPU
2830
{2A479BF3-7628-409B-8A29-9314C308445E}.Release|Any CPU.ActiveCfg = Release|Any CPU
2931
{2A479BF3-7628-409B-8A29-9314C308445E}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{8B7A7545-6257-44BF-8868-F429E1B72C77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{8B7A7545-6257-44BF-8868-F429E1B72C77}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{8B7A7545-6257-44BF-8868-F429E1B72C77}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{8B7A7545-6257-44BF-8868-F429E1B72C77}.Release|Any CPU.Build.0 = Release|Any CPU
3036
EndGlobalSection
3137
GlobalSection(SolutionProperties) = preSolution
3238
HideSolutionNode = FALSE
3339
EndGlobalSection
40+
GlobalSection(ExtensibilityGlobals) = postSolution
41+
SolutionGuid = {E8D4F345-888A-449F-A933-E6B3B4743FE5}
42+
EndGlobalSection
3443
EndGlobal

EDSSharp/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
</configuration>

EDSSharp/EDSSharp.csproj

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{8B7A7545-6257-44BF-8868-F429E1B72C77}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>EDSSharp</RootNamespace>
10+
<AssemblyName>EDSSharp</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="System" />
36+
<Reference Include="System.Core" />
37+
<Reference Include="System.Xml.Linq" />
38+
<Reference Include="System.Data.DataSetExtensions" />
39+
<Reference Include="Microsoft.CSharp" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Net.Http" />
42+
<Reference Include="System.Xml" />
43+
</ItemGroup>
44+
<ItemGroup>
45+
<Compile Include="Program.cs" />
46+
<Compile Include="Properties\AssemblyInfo.cs" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<None Include="App.config" />
50+
</ItemGroup>
51+
<ItemGroup>
52+
<ProjectReference Include="..\libEDSsharp\libEDSsharp.csproj">
53+
<Project>{cc0fa4b1-2bfc-43b3-8c56-b428df2d24e7}</Project>
54+
<Name>libEDSsharp</Name>
55+
</ProjectReference>
56+
</ItemGroup>
57+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
58+
</Project>

EDSSharp/EDSSharp.csproj.user

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
4+
<StartArguments>
5+
</StartArguments>
6+
</PropertyGroup>
7+
</Project>

EDSSharp/Program.cs

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using libEDSsharp;
8+
9+
namespace EDSSharp
10+
{
11+
class Program
12+
{
13+
14+
static libEDSsharp.EDSsharp eds = new EDSsharp();
15+
static string gitversion = "";
16+
17+
static void Main(string[] args)
18+
{
19+
try
20+
{
21+
22+
Dictionary<string, string> argskvp = new Dictionary<string, string>();
23+
24+
int argv = 0;
25+
26+
for (argv = 0; argv < (args.Length - 1); argv++)
27+
{
28+
if (args[argv] == "--infile")
29+
{
30+
argskvp.Add("--infile", args[argv + 1]);
31+
}
32+
33+
if (args[argv] == "--outfile")
34+
{
35+
argskvp.Add("--outfile", args[argv + 1]);
36+
}
37+
38+
if (args[argv] == "--type")
39+
{
40+
argskvp.Add("--type", args[argv + 1]);
41+
}
42+
43+
argv++;
44+
}
45+
46+
47+
if (argskvp.ContainsKey("--type") && argskvp.ContainsKey("--infile") && argskvp.ContainsKey("--outfile"))
48+
{
49+
string infile = argskvp["--infile"];
50+
string outfile = argskvp["--outfile"];
51+
52+
switch (Path.GetExtension(infile).ToLower())
53+
{
54+
case ".xdd":
55+
openXDDfile(infile, outfile);
56+
break;
57+
58+
case ".xml":
59+
openXMLfile(infile,outfile);
60+
break;
61+
62+
case ".eds":
63+
openEDSfile(infile, outfile,InfoSection.Filetype.File_EDS);
64+
break;
65+
66+
67+
default:
68+
return;
69+
70+
}
71+
}
72+
else
73+
{
74+
Console.WriteLine("Usage EDSEditor --type CanOpenNode --infile file.[xdd|eds|xml] --outfile CO_OD.c");
75+
}
76+
}
77+
catch(Exception e)
78+
{
79+
Console.WriteLine(e.ToString());
80+
}
81+
}
82+
83+
private static void openEDSfile(string infile, string outfile, InfoSection.Filetype ft)
84+
{
85+
86+
eds.Loadfile(infile);
87+
88+
exportCOOD(outfile);
89+
90+
}
91+
92+
private static void exportCOOD(string outpath)
93+
{
94+
95+
outpath = Path.GetFullPath(outpath);
96+
97+
string savePath = Path.GetDirectoryName(outpath);
98+
99+
eds.fi.exportFolder = savePath;
100+
101+
Warnings.warning_list.Clear();
102+
103+
CanOpenNodeExporter cone = new CanOpenNodeExporter();
104+
cone.export(savePath, Path.GetFileNameWithoutExtension(outpath), gitversion, eds);
105+
106+
foreach(string warning in Warnings.warning_list)
107+
{
108+
Console.WriteLine("WARNING :" + warning);
109+
}
110+
111+
}
112+
113+
private static void openXMLfile(string path,string outpath)
114+
{
115+
116+
CanOpenXML coxml = new CanOpenXML();
117+
coxml.readXML(path);
118+
119+
Bridge b = new Bridge();
120+
121+
eds = b.convert(coxml.dev);
122+
eds.xmlfilename = path;
123+
124+
exportCOOD(outpath);
125+
126+
}
127+
128+
private static void openXDDfile(string path, string outpath)
129+
{
130+
CanOpenXDD coxml = new CanOpenXDD();
131+
eds = coxml.readXML(path);
132+
133+
if (eds == null)
134+
return;
135+
136+
eds.xddfilename = path;
137+
exportCOOD(outpath);
138+
}
139+
}
140+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("EDSSharp")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("EDSSharp")]
13+
[assembly: AssemblyCopyright("Copyright © 2019")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("8b7a7545-6257-44bf-8868-f429e1b72c77")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)