Skip to content

Commit

Permalink
* Added the rest of the files needed for the initial revision of the …
Browse files Browse the repository at this point in the history
…solution.
  • Loading branch information
jaerith authored and Aaron Kendall committed Jul 27, 2016
1 parent dfc7a52 commit 5cb67c1
Show file tree
Hide file tree
Showing 8 changed files with 332 additions and 0 deletions.
28 changes: 28 additions & 0 deletions OnixData.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25029.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnixData", "OnixData\OnixData.csproj", "{001B5989-7440-44BB-BEED-FE4422E2634E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnixTestHarness", "OnixTestHarness\OnixTestHarness.csproj", "{4B03D0C9-7AC3-4775-8A91-AF9A6408BEBA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{001B5989-7440-44BB-BEED-FE4422E2634E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{001B5989-7440-44BB-BEED-FE4422E2634E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{001B5989-7440-44BB-BEED-FE4422E2634E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{001B5989-7440-44BB-BEED-FE4422E2634E}.Release|Any CPU.Build.0 = Release|Any CPU
{4B03D0C9-7AC3-4775-8A91-AF9A6408BEBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B03D0C9-7AC3-4775-8A91-AF9A6408BEBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B03D0C9-7AC3-4775-8A91-AF9A6408BEBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B03D0C9-7AC3-4775-8A91-AF9A6408BEBA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
75 changes: 75 additions & 0 deletions OnixData/OnixData.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{001B5989-7440-44BB-BEED-FE4422E2634E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnixData</RootNamespace>
<AssemblyName>OnixData</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<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="Legacy\OnixLegacyDiscountCoded.cs" />
<Compile Include="Legacy\OnixLegacyHeader.cs" />
<Compile Include="Legacy\OnixLegacyIllustrations.cs" />
<Compile Include="Legacy\OnixLegacyImprint.cs" />
<Compile Include="Legacy\OnixLegacyLanguage.cs" />
<Compile Include="Legacy\OnixLegacyMeasure.cs" />
<Compile Include="Legacy\OnixLegacyMediaFile.cs" />
<Compile Include="Legacy\OnixLegacyMessage.cs" />
<Compile Include="Legacy\OnixLegacyOtherText.cs" />
<Compile Include="Legacy\OnixLegacyProduct.cs" />
<Compile Include="Legacy\OnixLegacyContributor.cs" />
<Compile Include="Legacy\OnixLegacyProductFormFeature.cs" />
<Compile Include="Legacy\OnixLegacyProductId.cs" />
<Compile Include="Legacy\OnixLegacyPublisher.cs" />
<Compile Include="Legacy\OnixLegacyRelatedProduct.cs" />
<Compile Include="Legacy\OnixLegacySubject.cs" />
<Compile Include="Legacy\OnixLegacySupplyDetail.cs" />
<Compile Include="Legacy\OnixLegacyPrice.cs" />
<Compile Include="Legacy\OnixLegacyTitle.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Version3\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
36 changes: 36 additions & 0 deletions OnixData/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("OnixData")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OnixData")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("001b5989-7440-44bb-beed-fe4422e2634e")]

// 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")]
6 changes: 6 additions & 0 deletions OnixTestHarness/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.5.2" />
</startup>
</configuration>
68 changes: 68 additions & 0 deletions OnixTestHarness/OnixTestHarness.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{4B03D0C9-7AC3-4775-8A91-AF9A6408BEBA}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnixTestHarness</RootNamespace>
<AssemblyName>OnixTestHarness</AssemblyName>
<TargetFrameworkVersion>v4.5.2</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.Web.Extensions" />
<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="ParseHelpers.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OnixData\OnixData.csproj">
<Project>{001b5989-7440-44bb-beed-fe4422e2634e}</Project>
<Name>OnixData</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
49 changes: 49 additions & 0 deletions OnixTestHarness/ParseHelpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;

namespace OnixTestHarness
{
internal static class ParseHelpers
{
private static JavaScriptSerializer json;
private static JavaScriptSerializer JSON { get { return json ?? (json = new JavaScriptSerializer()); } }

public static Stream ToStream(this string @this)
{
var stream = new MemoryStream();
var writer = new StreamWriter(stream);
writer.Write(@this);
writer.Flush();
stream.Position = 0;
return stream;
}

public static T ParseXML<T>(this string @this) where T : class
{
XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Document;
settings.ValidationType = ValidationType.Schema;
settings.DtdProcessing = DtdProcessing.Parse;
settings.ValidationFlags |= XmlSchemaValidationFlags.ProcessInlineSchema;
settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
// settings.ValidationFlags &= ~(XmlSchemaValidationFlags.ProcessInlineSchema);
// settings.ValidationFlags &= ~(XmlSchemaValidationFlags.ReportValidationWarnings);

var reader = XmlReader.Create(@this.Trim().ToStream(), settings);
return new XmlSerializer(typeof(T), new XmlRootAttribute("ONIXMessage")).Deserialize(reader) as T;
}

public static T ParseJSON<T>(this string @this) where T : class
{
return JSON.Deserialize<T>(@this.Trim());
}
}
}
34 changes: 34 additions & 0 deletions OnixTestHarness/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using OnixData.Legacy;

namespace OnixTestHarness
{
class Program
{
static void Main(string[] args)
{
try
{
int nPrdIdx = 0;
string xml = File.ReadAllText(@"C:\tmp\tmp2\onix.legacy.xml");

OnixLegacyMessage onixLegacyMessage = xml.ParseXML<OnixLegacyMessage>();

foreach (OnixLegacyProduct TmpProduct in onixLegacyMessage.Product)
{
System.Console.WriteLine("Product [" + (nPrdIdx++) + "] has EAN(" + TmpProduct.EAN + ").");
}
}
catch (Exception ex)
{
System.Console.WriteLine(ex);
}
}
}
}
36 changes: 36 additions & 0 deletions OnixTestHarness/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("OnixTestHarness")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OnixTestHarness")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("4b03d0c9-7ac3-4775-8a91-af9a6408beba")]

// 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 5cb67c1

Please sign in to comment.