Skip to content

Commit

Permalink
updated examples and added a large-file example
Browse files Browse the repository at this point in the history
  • Loading branch information
iigorr committed Jul 28, 2015
1 parent 675f9ee commit 311a511
Show file tree
Hide file tree
Showing 14 changed files with 439 additions and 329 deletions.
79 changes: 40 additions & 39 deletions examples/Examples.sln
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{A262EF53-A7B2-4E83-A238-4DD60993F39E}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadPgnFile", "ReadPgnFile\ReadPgnFile.csproj", "{63D1ACE0-B12B-425B-92C3-458F1A72F603}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET_4_0", "NET_4_0\NET_4_0.csproj", "{EB3FD875-927A-451F-91AB-E929CE08A2D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET_4_5", "NET_4_5\NET_4_5.csproj", "{12C49C77-2C52-48EB-8C50-2784EF1E3307}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{63D1ACE0-B12B-425B-92C3-458F1A72F603}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63D1ACE0-B12B-425B-92C3-458F1A72F603}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63D1ACE0-B12B-425B-92C3-458F1A72F603}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63D1ACE0-B12B-425B-92C3-458F1A72F603}.Release|Any CPU.Build.0 = Release|Any CPU
{EB3FD875-927A-451F-91AB-E929CE08A2D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB3FD875-927A-451F-91AB-E929CE08A2D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB3FD875-927A-451F-91AB-E929CE08A2D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB3FD875-927A-451F-91AB-E929CE08A2D8}.Release|Any CPU.Build.0 = Release|Any CPU
{12C49C77-2C52-48EB-8C50-2784EF1E3307}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12C49C77-2C52-48EB-8C50-2784EF1E3307}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12C49C77-2C52-48EB-8C50-2784EF1E3307}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12C49C77-2C52-48EB-8C50-2784EF1E3307}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadPgnFile", "ReadPgnFile\ReadPgnFile.csproj", "{63D1ACE0-B12B-425B-92C3-458F1A72F603}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET_4_0", "NET_4_0\NET_4_0.csproj", "{EB3FD875-927A-451F-91AB-E929CE08A2D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NET_4_5", "NET_4_5\NET_4_5.csproj", "{12C49C77-2C52-48EB-8C50-2784EF1E3307}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LargeFile", "LargeFile\LargeFile.csproj", "{3C1FB6DA-7C50-4EF1-ACB9-25004BCA0DDF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{63D1ACE0-B12B-425B-92C3-458F1A72F603}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63D1ACE0-B12B-425B-92C3-458F1A72F603}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63D1ACE0-B12B-425B-92C3-458F1A72F603}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63D1ACE0-B12B-425B-92C3-458F1A72F603}.Release|Any CPU.Build.0 = Release|Any CPU
{EB3FD875-927A-451F-91AB-E929CE08A2D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB3FD875-927A-451F-91AB-E929CE08A2D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB3FD875-927A-451F-91AB-E929CE08A2D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB3FD875-927A-451F-91AB-E929CE08A2D8}.Release|Any CPU.Build.0 = Release|Any CPU
{12C49C77-2C52-48EB-8C50-2784EF1E3307}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12C49C77-2C52-48EB-8C50-2784EF1E3307}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12C49C77-2C52-48EB-8C50-2784EF1E3307}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12C49C77-2C52-48EB-8C50-2784EF1E3307}.Release|Any CPU.Build.0 = Release|Any CPU
{3C1FB6DA-7C50-4EF1-ACB9-25004BCA0DDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C1FB6DA-7C50-4EF1-ACB9-25004BCA0DDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C1FB6DA-7C50-4EF1-ACB9-25004BCA0DDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C1FB6DA-7C50-4EF1-ACB9-25004BCA0DDF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
11 changes: 11 additions & 0 deletions examples/LargeFile/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
57 changes: 57 additions & 0 deletions examples/LargeFile/LargeFile.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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>{3C1FB6DA-7C50-4EF1-ACB9-25004BCA0DDF}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LargeFile</RootNamespace>
<AssemblyName>LargeFile</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="pgn.net, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\pgn.net.1.2.1\lib\net45\pgn.net.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</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>
34 changes: 34 additions & 0 deletions examples/LargeFile/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using ilf.pgn;

namespace ReadPgnFile
{
class Program
{
static void Main(string[] args)
{
var reader = new PgnReader();

var gamesCollection = reader.ReadGamesFromFile(@"c:\tmp\millionbase-2.22.pgn");

int count = 0;
var start = DateTime.Now;
foreach (var item in gamesCollection)
{
if (++count % 100 == 0)
{
Console.WriteLine();
var now = DateTime.Now;
var timespan = now - start;
var gamesPerSecond = ((double)count) / timespan.TotalSeconds;
Console.SetCursorPosition(1, 0);
Console.WriteLine("Time passed: {0}. Games: {1}, Games per Second: {2}", timespan, count, gamesPerSecond);
if (count > 10000)
break;
}
}

Console.ReadKey();
}
}
}
36 changes: 36 additions & 0 deletions examples/LargeFile/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("LargeFile")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LargeFile")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[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("3c1fb6da-7c50-4ef1-acb9-25004bca0ddf")]

// 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")]
4 changes: 4 additions & 0 deletions examples/LargeFile/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="pgn.net" version="1.2.1" targetFramework="net452" />
</packages>
132 changes: 59 additions & 73 deletions examples/NET_4_0/NET_4_0.csproj
Original file line number Diff line number Diff line change
@@ -1,74 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.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>{EB3FD875-927A-451F-91AB-E929CE08A2D8}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NET_4_0</RootNamespace>
<AssemblyName>NET_4_0</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</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="pgn.net, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\pgn.net.1.1.1.1\lib\net40\pgn.net.dll</HintPath>
</Reference>
<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.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Tarrasch.pgn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.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>{EB3FD875-927A-451F-91AB-E929CE08A2D8}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NET_4_0</RootNamespace>
<AssemblyName>NET_4_0</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</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>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Tarrasch.pgn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Reference Include="pgn.net">
<HintPath>..\packages\pgn.net.1.2.1\lib\net40\pgn.net.dll</HintPath>
<Private>True</Private>
</Reference>
</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>
6 changes: 3 additions & 3 deletions examples/NET_4_0/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="pgn.net" version="1.1.1.1" targetFramework="net40" />
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="pgn.net" version="1.2.1" targetFramework="net4" />
</packages>
Loading

0 comments on commit 311a511

Please sign in to comment.