Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit adfac040 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

adding declaration data, refactoring serialization

parent de836677
No related branches found
No related tags found
No related merge requests found
using System.IO;
using System.Security.AccessControl;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.Models.DeclarationData
{
public class Wheels
{
private static Wheels _instance;
private const string ResourceId = "DeclarationWheels";
protected Wheels()
{
System.Reflection.Assembly myAssembly;
//myAssembly = this.GetType().Assembly;
myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
//string[] resources = myAssembly.GetManifestResourceNames();
//string list = "";
//foreach (string resource in resources)
// {
// list += resource + "\r\n";
// }
//System.Resources.ResourceManager myManager = new System.Resources.ResourceManager("Resources.Wheels", myAssembly);
System.IO.Stream file =
myAssembly.GetManifestResourceStream("TUGraz.VectoCore.Properties.Resources.resources");
//var csvFile = VectoCSVFile.ReadStream(file);
var reader = new StreamReader(file);
while (!reader.EndOfStream) {
var line = reader.ReadLine();
}
//var test = myManager.GetObject(ResourceId);
}
public static Wheels Instance()
{
if (_instance == null) {
_instance = new Wheels();
}
return _instance;
}
}
}
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TUGraz.VectoCore.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TUGraz.VectoCore.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to rims,F(a),F(b)
///5° DC Rims,3.03,3.03
///15° DC Rims,3.03,3.05
///Multipurpose – Radial,3,3
///Multipurpose – Diagonal,2.94,2.94
///.
/// </summary>
internal static string DeclarationRims {
get {
return ResourceManager.GetString("DeclarationRims", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Wheel,Inertia,d,Size-Class(0/1)
///9 R 22.5,8.9,970,0
///9.00 R 20,10.5,1018,0
///9.5 R 17.5,4.9,842,0
///10 R 17.5,5,858,0
///10 R 22.5,11,1020,0
///10.00 R 20,13.1,1025,0
///11 R 22.5,14.4,1050,0
///11.00 R 20,14.6,1082,0
///12 R 22.5,16.8,1084,0
///12.00 R 20,19.5,1122,0
///12.00 R 24,27.7,1226,0
///12.5 R 20,12.7,1120,0
///13 R 22.5,20,1124,0
///14.00 R 20,30.8,1238,0
///14.5 R 20,14.8,1092,0
///16.00 R 20,47.5,1343,0
///215/75 R 17.5,3.9,767,0
///225/70 R 17.5,4,759.5,0
///225/75 R 17.5,4,782,0
///235/75 R 17.5,4.5,797,0
///245/70 R 17.5,5.2,7 [rest of string was truncated]&quot;;.
/// </summary>
internal static string DeclarationWheels {
get {
return ResourceManager.GetString("DeclarationWheels", resourceCulture);
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="DeclarationRims" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Rims.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="DeclarationWheels" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Wheels.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>
\ No newline at end of file
rims,F(a),F(b)
5° DC Rims,3.03,3.03
15° DC Rims,3.03,3.05
Multipurpose – Radial,3,3
Multipurpose – Diagonal,2.94,2.94
Wheel,Inertia,d,Size-Class(0/1)
9 R 22.5,8.9,970,0
9.00 R 20,10.5,1018,0
9.5 R 17.5,4.9,842,0
10 R 17.5,5,858,0
10 R 22.5,11,1020,0
10.00 R 20,13.1,1025,0
11 R 22.5,14.4,1050,0
11.00 R 20,14.6,1082,0
12 R 22.5,16.8,1084,0
12.00 R 20,19.5,1122,0
12.00 R 24,27.7,1226,0
12.5 R 20,12.7,1120,0
13 R 22.5,20,1124,0
14.00 R 20,30.8,1238,0
14.5 R 20,14.8,1092,0
16.00 R 20,47.5,1343,0
215/75 R 17.5,3.9,767,0
225/70 R 17.5,4,759.5,0
225/75 R 17.5,4,782,0
235/75 R 17.5,4.5,797,0
245/70 R 17.5,5.2,787.5,0
245/70 R 19.5,6,838.3,0
255/70 R 22.5,9.5,928.5,0
265/70 R 19.5,6.5,866.3,0
275/70 R 22.5,11.9,956.5,0
275/80 R 22.5,12.8,1011.5,0
285/70 R 19.5,7.9,894.3,0
295/55 R 22.5,10.2,896,1
295/60 R 22.5,10.8,925.5,1
295/80 R 22.5,15.5,1043.5,0
305/70 R 19.5,9.2,922.3,0
305/70 R 22.5,13.9,998.5,0
315/45 R22.5,9.9,347,1
315/60 R 22.5,12.8,949.5,1
315/70 R 22.5,14.9,1012.5,0
315/80 R 22.5,17.6,1075.5,0
365/80 R 20,17.2,1092,0
365/85 R 20,22.5,1128.5,0
385/55 R 22.5,15.9,995,1
385/65 R 22.5,19.2,1072,1
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TUGraz.VectoCore.Models.DeclarationData;
namespace TUGraz.VectoCore.Tests.Models.DeclarationData
{
[TestClass]
public class DeclarationDataTest
{
[TestMethod]
public void WheelDataTest()
{
var wheels = Wheels.Instance();
}
}
}
......@@ -70,6 +70,7 @@
<ItemGroup>
<Compile Include="Exceptions\ExceptionTests.cs" />
<Compile Include="Integration\EngineOnlyCycle\EngineOnlyCycleTest.cs" />
<Compile Include="Models\DeclarationData\DeclarationDataTest.cs" />
<Compile Include="Models\SimulationComponentData\FuelConsumptionMapTest.cs" />
<Compile Include="Models\SimulationComponentData\FullLoadCurveTest.cs" />
<Compile Include="Models\SimulationComponentData\GearboxDataTest.cs" />
......@@ -78,6 +79,7 @@
<Compile Include="Models\SimulationComponent\CombustionEngineTest.cs" />
<Compile Include="Models\SimulationComponent\GearboxTest.cs" />
<Compile Include="Models\SimulationComponent\RetarderTest.cs" />
<Compile Include="Models\SimulationComponent\VehicleTest.cs" />
<Compile Include="Models\Simulation\DrivingCycleTests.cs" />
<Compile Include="Models\SimulationComponent\MockPorts.cs" />
<Compile Include="Models\Simulation\SimulationTests.cs" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment