First version.
This commit is contained in:
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
#Autosave files
|
||||
*~
|
||||
|
||||
#build
|
||||
[Oo]bj/
|
||||
[Bb]in/
|
||||
packages/
|
||||
TestResults/
|
||||
|
||||
# globs
|
||||
Makefile.in
|
||||
*.DS_Store
|
||||
*.sln.cache
|
||||
*.suo
|
||||
*.cache
|
||||
*.pidb
|
||||
*.userprefs
|
||||
*.usertasks
|
||||
config.log
|
||||
config.make
|
||||
config.status
|
||||
aclocal.m4
|
||||
install-sh
|
||||
autom4te.cache/
|
||||
*.user
|
||||
*.tar.gz
|
||||
tarballs/
|
||||
test-results/
|
||||
Thumbs.db
|
||||
|
||||
#Mac bundle stuff
|
||||
*.dmg
|
||||
*.app
|
||||
|
||||
#resharper
|
||||
*_Resharper.*
|
||||
*.Resharper
|
||||
|
||||
#dotCover
|
||||
*.dotCover
|
||||
24
CpmDefs.sln
Normal file
24
CpmDefs.sln
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CpmDefs", "CpmDefs\CpmDefs.csproj", "{283ACA95-8CC5-41C9-A0E4-27DA48B28E79}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{283ACA95-8CC5-41C9-A0E4-27DA48B28E79}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{283ACA95-8CC5-41C9-A0E4-27DA48B28E79}.Debug|x86.Build.0 = Debug|x86
|
||||
{283ACA95-8CC5-41C9-A0E4-27DA48B28E79}.Release|x86.ActiveCfg = Release|x86
|
||||
{283ACA95-8CC5-41C9-A0E4-27DA48B28E79}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
$0.StandardHeader = $1
|
||||
$1.Text = @\n${FileName}\n \nAuthor:\n ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) ${Year} ${CopyrightHolder}\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.
|
||||
$1.IncludeInNewFiles = True
|
||||
version = 1.0
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
6
CpmDefs/ChangeLog
Normal file
6
CpmDefs/ChangeLog
Normal file
@@ -0,0 +1,6 @@
|
||||
2016-08-24 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Program.cs:
|
||||
* CpmDefs.csproj:
|
||||
* AssemblyInfo.cs: First version.
|
||||
|
||||
59
CpmDefs/CpmDefs.csproj
Normal file
59
CpmDefs/CpmDefs.csproj
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{283ACA95-8CC5-41C9-A0E4-27DA48B28E79}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>CpmDefs</RootNamespace>
|
||||
<AssemblyName>CpmDefs</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<ReleaseVersion>1.0</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ExternalConsole>true</ExternalConsole>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ExternalConsole>true</ExternalConsole>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\LICENSE.MIT">
|
||||
<Link>LICENSE.MIT</Link>
|
||||
</None>
|
||||
<None Include="..\README.md">
|
||||
<Link>README.md</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<TextStylePolicy FileWidth="120" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
|
||||
<CSharpFormattingPolicy IndentSwitchSection="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" SpacingAfterMethodDeclarationName="False" SpaceAfterMethodCallName="False" SpaceAfterControlFlowStatementKeyword="False" SpaceBeforeOpenSquareBracket="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
357
CpmDefs/Program.cs
Normal file
357
CpmDefs/Program.cs
Normal file
@@ -0,0 +1,357 @@
|
||||
//
|
||||
// Program.cs
|
||||
//
|
||||
// Author:
|
||||
// Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Copyright (c) 2016 © Claunia.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Serialization;
|
||||
using System.Linq;
|
||||
|
||||
namespace CpmDefs
|
||||
{
|
||||
public struct CpmDefinitions
|
||||
{
|
||||
public List<CpmDefinition> definitions;
|
||||
public DateTime creation;
|
||||
}
|
||||
|
||||
public struct CpmDefinition
|
||||
{
|
||||
public string comment;
|
||||
public string encoding;
|
||||
public string bitrate;
|
||||
public int cylinders;
|
||||
public int sides;
|
||||
public int sectorsPerTrack;
|
||||
public int bytesPerSector;
|
||||
public int skew;
|
||||
public Side side1;
|
||||
public Side side2;
|
||||
public string order;
|
||||
public string label;
|
||||
public int bsh;
|
||||
public int blm;
|
||||
public int exm;
|
||||
public int dsm;
|
||||
public int drm;
|
||||
public int al0;
|
||||
public int al1;
|
||||
public int ofs;
|
||||
public int sofs;
|
||||
public bool complement;
|
||||
public bool evenOdd;
|
||||
}
|
||||
|
||||
public class Side
|
||||
{
|
||||
public int sideId;
|
||||
public int[] sectorIds;
|
||||
}
|
||||
|
||||
class MainClass
|
||||
{
|
||||
const string beginRegEx = "\\bBEGIN\\s*(?<label>\\w*)(\\s*(?<comment>.+))?$";
|
||||
const string informationRegEx = "^((\\s*DENSITY\\s+(?<encoding>\\w+)\\s*[,]\\s*(?<bitrate>\\w+)\\s*)?(\\s*CYLINDERS\\s(?<cylinders>\\d+)\\s*)?(\\s*SIDES\\s(?<sides>\\d+)\\s*)?(\\s*SECTORS\\s+(?<sectors>\\d+)\\s*[,]\\s*(?<bps>\\d+)\\s*)?(\\s*SKEW\\s+(?<skew>\\d+)\\s*)?(\\s*ORDER\\s+(?<order>\\w+)\\s*)?(\\s*(?<even>EVEN-ODD)\\s*)?(\\s*(?<complement>COMPLEMENT)\\s*)?(\\s*LABEL\\s+(?<label>\\w+)\\s*)?)$";
|
||||
const string sideRegEx = "\\bSIDE(?<side>[12])\\s+(?<sideid>\\d)\\s+(?<sectors>[0-9,]+)";
|
||||
const string dpbRegEx = "\\bBSH\\s+(?<bsh>\\d+)\\s*BLM\\s+(?<blm>\\d+)\\s*EXM\\s+(?<exm>\\d+)\\s*DSM\\s+(?<dsm>\\d+)\\s*DRM\\s+(?<drm>\\d+)\\s*AL0\\s+((?<al0>[0123456789ABCDEF]+)(?<hex0>H)?)\\s*AL1\\s+((?<al1>[0123456789ABCDEF]+)(?<hex1>H)?)\\s*((OFS\\s+(?<ofs>\\d+))|(SOFS\\s+(?<sofs>\\d+)))";
|
||||
const string endRegEx = "\\bEND";
|
||||
const string seeRegEx = "\\bSEE\\s*(?<label>\\w*)\\s*$";
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
if(args.Length != 2)
|
||||
{
|
||||
Console.WriteLine("Usage: CpmDefs.exe <cpmdisks.noi> <cpmdisks.xml>");
|
||||
return;
|
||||
}
|
||||
|
||||
StreamReader defsReader = new StreamReader(args[0]);
|
||||
bool inDefinition = false;
|
||||
|
||||
CpmDefinitions defs = new CpmDefinitions();
|
||||
defs.definitions = new List<CpmDefinition>();
|
||||
int maxSectors = 0;
|
||||
int maxSize = 0;
|
||||
|
||||
CpmDefinition def = new CpmDefinition();
|
||||
while(defsReader.Peek() >= 0)
|
||||
{
|
||||
string _line = defsReader.ReadLine();
|
||||
|
||||
if(inDefinition)
|
||||
{
|
||||
Regex Ir = new Regex(informationRegEx);
|
||||
Regex Sr = new Regex(sideRegEx);
|
||||
Regex Dr = new Regex(dpbRegEx);
|
||||
Regex Er = new Regex(endRegEx);
|
||||
Regex Wr = new Regex(seeRegEx);
|
||||
|
||||
Match Im;
|
||||
Match Sm;
|
||||
Match Dm;
|
||||
Match Em;
|
||||
Match Wm;
|
||||
|
||||
Im = Ir.Match(_line);
|
||||
Sm = Sr.Match(_line);
|
||||
Dm = Dr.Match(_line);
|
||||
Em = Er.Match(_line);
|
||||
Wm = Wr.Match(_line);
|
||||
|
||||
int temp;
|
||||
|
||||
if(Im.Success)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(Im.Result("${encoding}")) && !string.IsNullOrEmpty(Im.Result("${bitrate}")))
|
||||
{
|
||||
def.encoding = Im.Result("${encoding}");
|
||||
def.bitrate = Im.Result("${bitrate}");
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(Im.Result("${cylinders}")) && int.TryParse(Im.Result("${cylinders}"), out temp))
|
||||
def.cylinders = temp;
|
||||
|
||||
if(!string.IsNullOrEmpty(Im.Result("${sides}")) && int.TryParse(Im.Result("${sides}"), out temp))
|
||||
def.sides = temp;
|
||||
|
||||
if(!string.IsNullOrEmpty(Im.Result("${skew}")) && int.TryParse(Im.Result("${skew}"), out temp))
|
||||
def.skew = temp;
|
||||
|
||||
if(!string.IsNullOrEmpty(Im.Result("${sectors}")) && !string.IsNullOrEmpty(Im.Result("${bps}")))
|
||||
{
|
||||
if(int.TryParse(Im.Result("${sectors}"), out temp))
|
||||
def.sectorsPerTrack = temp;
|
||||
if(int.TryParse(Im.Result("${bps}"), out temp))
|
||||
def.bytesPerSector = temp;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(Im.Result("${order}")))
|
||||
def.order = Im.Result("${order}");
|
||||
|
||||
def.evenOdd |= (!string.IsNullOrEmpty(Im.Result("${even}")) && Im.Result("${even}") == "EVEN-ODD");
|
||||
def.complement |= (!string.IsNullOrEmpty(Im.Result("${complement}")) && Im.Result("${complement}") == "COMPLEMENT");
|
||||
|
||||
if(!string.IsNullOrEmpty(Im.Result("${label}")))
|
||||
def.label = Im.Result("${label}");
|
||||
}
|
||||
else if(Sm.Success)
|
||||
{
|
||||
if(Sm.Result("${side}") == "1" && int.TryParse(Sm.Result("${sideid}"), out temp))
|
||||
{
|
||||
def.side1 = new Side();
|
||||
def.side1.sideId = temp;
|
||||
string[] sectorIds = Sm.Result("${sectors}").Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
def.side1.sectorIds = new int[sectorIds.Length];
|
||||
for(int i = 0; i < sectorIds.Length; i++)
|
||||
{
|
||||
string toConvert;
|
||||
int fromBase;
|
||||
|
||||
if(sectorIds[i].ToLowerInvariant().Last() == 'h')
|
||||
{
|
||||
toConvert = sectorIds[i].Substring(0, sectorIds[i].Length - 1);
|
||||
fromBase = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
toConvert = sectorIds[i];
|
||||
fromBase = 10;
|
||||
}
|
||||
|
||||
def.side1.sectorIds[i] = Convert.ToInt32(toConvert, fromBase);
|
||||
}
|
||||
}
|
||||
else if(Sm.Result("${side}") == "2" && int.TryParse(Sm.Result("${sideid}"), out temp))
|
||||
{
|
||||
def.side2 = new Side();
|
||||
def.side2.sideId = temp;
|
||||
string[] sectorIds = Sm.Result("${sectors}").Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
def.side2.sectorIds = new int[sectorIds.Length];
|
||||
for(int i = 0; i < sectorIds.Length; i++)
|
||||
{
|
||||
string toConvert;
|
||||
int fromBase;
|
||||
|
||||
if(sectorIds[i].ToLowerInvariant().Last() == 'h')
|
||||
{
|
||||
toConvert = sectorIds[i].Substring(0, sectorIds[i].Length - 1);
|
||||
fromBase = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
toConvert = sectorIds[i];
|
||||
fromBase = 10;
|
||||
}
|
||||
|
||||
def.side2.sectorIds[i] = Convert.ToInt32(toConvert, fromBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(Dm.Success)
|
||||
{
|
||||
if(int.TryParse(Dm.Result("${bsh}"), out temp))
|
||||
def.bsh = temp;
|
||||
if(int.TryParse(Dm.Result("${blm}"), out temp))
|
||||
def.blm = temp;
|
||||
if(int.TryParse(Dm.Result("${exm}"), out temp))
|
||||
def.exm = temp;
|
||||
if(int.TryParse(Dm.Result("${dsm}"), out temp))
|
||||
def.dsm = temp;
|
||||
if(int.TryParse(Dm.Result("${drm}"), out temp))
|
||||
def.drm = temp;
|
||||
if(Dm.Result("${hex0}") == "H")
|
||||
def.al0 = Convert.ToInt32(Dm.Result("${al0}"), 16);
|
||||
else
|
||||
def.al0 = Convert.ToInt32(Dm.Result("${al0}"), 10);
|
||||
if(Dm.Result("${hex1}") == "H")
|
||||
def.al1 = Convert.ToInt32(Dm.Result("${al1}"), 16);
|
||||
else
|
||||
def.al1 = Convert.ToInt32(Dm.Result("${al1}"), 10);
|
||||
if(int.TryParse(Dm.Result("${ofs}"), out temp))
|
||||
def.ofs = temp;
|
||||
if(int.TryParse(Dm.Result("${sofs}"), out temp))
|
||||
def.sofs = temp;
|
||||
}
|
||||
else if(Em.Success)
|
||||
{
|
||||
defs.definitions.Add(def);
|
||||
inDefinition = false;
|
||||
|
||||
int sectors = def.cylinders * def.sides * def.sectorsPerTrack;
|
||||
int size = sectors * def.bytesPerSector;
|
||||
|
||||
if(sectors > maxSectors)
|
||||
maxSectors = sectors;
|
||||
if(size > maxSize)
|
||||
maxSize = size;
|
||||
}
|
||||
else inDefinition &= !Wm.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
Regex Br = new Regex(beginRegEx);
|
||||
Match Bm;
|
||||
Bm = Br.Match(_line);
|
||||
|
||||
if(Bm.Success == true)
|
||||
{
|
||||
inDefinition = true;
|
||||
def = new CpmDefinition();
|
||||
if(!string.IsNullOrEmpty(Bm.Result("${label}")))
|
||||
def.label = Bm.Result("${label}");
|
||||
if(!string.IsNullOrEmpty(Bm.Result("${comment}")))
|
||||
def.comment = Bm.Result("${comment}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defsReader.Close();
|
||||
|
||||
Console.WriteLine("Converted {0} definitions", defs.definitions.Count);
|
||||
Console.WriteLine("Disk with most sectors had {0} sectors", maxSectors);
|
||||
Console.WriteLine("Biggest disk had {0} bytes", maxSize);
|
||||
|
||||
Console.WriteLine("Removing duplicate definitions");
|
||||
CpmDefinitions noDups = new CpmDefinitions();
|
||||
noDups.definitions = new List<CpmDefinition>();
|
||||
|
||||
foreach(CpmDefinition oldDef in defs.definitions)
|
||||
{
|
||||
bool unique = true;
|
||||
|
||||
foreach(CpmDefinition newDef in noDups.definitions)
|
||||
{
|
||||
bool sameEncoding = oldDef.encoding == newDef.encoding;
|
||||
bool sameBitrate = oldDef.bitrate == newDef.bitrate;
|
||||
bool sameCylinders = oldDef.cylinders == newDef.cylinders;
|
||||
bool sameSides = oldDef.sides == newDef.sides;
|
||||
bool sameSectorsPerTrack = oldDef.sectorsPerTrack == newDef.sectorsPerTrack;
|
||||
bool sameBytesPerSector = oldDef.bytesPerSector == newDef.bytesPerSector;
|
||||
bool sameSkew = oldDef.skew == newDef.skew;
|
||||
bool sameOrder = oldDef.order == newDef.order;
|
||||
bool sameBsh = oldDef.bsh == newDef.bsh;
|
||||
bool sameBlm = oldDef.blm == newDef.blm;
|
||||
bool sameExm = oldDef.exm == newDef.exm;
|
||||
bool sameDsm = oldDef.dsm == newDef.dsm;
|
||||
bool sameDrm = oldDef.drm == newDef.drm;
|
||||
bool sameAl0 = oldDef.al0 == newDef.al0;
|
||||
bool sameAl1 = oldDef.al1 == newDef.al1;
|
||||
bool sameOfs = oldDef.ofs == newDef.ofs;
|
||||
bool sameSofs = oldDef.sofs == newDef.sofs;
|
||||
bool sameComplement = oldDef.complement == newDef.complement;
|
||||
bool sameEvenOdd = oldDef.evenOdd == newDef.evenOdd;
|
||||
|
||||
bool sameSide1;
|
||||
if(oldDef.side1 == null && newDef.side1 == null)
|
||||
sameSide1 = true;
|
||||
else if(oldDef.side1 != null && newDef.side1 != null)
|
||||
{
|
||||
if(oldDef.side1.sideId != newDef.side1.sideId)
|
||||
sameSide1 = false;
|
||||
else
|
||||
sameSide1 = oldDef.side1.sectorIds.SequenceEqual(newDef.side1.sectorIds);
|
||||
}
|
||||
else
|
||||
sameSide1 = false;
|
||||
|
||||
bool sameSide2;
|
||||
if(oldDef.side2 == null && newDef.side2 == null)
|
||||
sameSide2 = true;
|
||||
else if(oldDef.side2 != null && newDef.side2 != null)
|
||||
{
|
||||
if(oldDef.side2.sideId != newDef.side2.sideId)
|
||||
sameSide2 = false;
|
||||
else
|
||||
sameSide2 = oldDef.side2.sectorIds.SequenceEqual(newDef.side2.sectorIds);
|
||||
}
|
||||
else
|
||||
sameSide2 = false;
|
||||
|
||||
if(sameEncoding && sameBitrate && sameCylinders && sameSides && sameSectorsPerTrack && sameBytesPerSector && sameSkew && sameOrder &&
|
||||
sameBsh && sameBlm && sameExm && sameDsm && sameDrm && sameAl0 && sameAl1 && sameOfs && sameSofs && sameComplement && sameEvenOdd &&
|
||||
sameSide1 && sameSide2)
|
||||
{
|
||||
unique = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(unique)
|
||||
noDups.definitions.Add(oldDef);
|
||||
}
|
||||
|
||||
defs = noDups;
|
||||
Console.WriteLine("Writing {0} definitions", defs.definitions.Count);
|
||||
defs.creation = DateTime.UtcNow;
|
||||
TextWriter defsWriter = new StreamWriter(args[1]);
|
||||
XmlSerializer ser = new XmlSerializer(typeof(CpmDefinitions));
|
||||
ser.Serialize(defsWriter, defs);
|
||||
defsWriter.Close();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
54
CpmDefs/Properties/AssemblyInfo.cs
Normal file
54
CpmDefs/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Author:
|
||||
// Natalia Portillo claunia@claunia.com
|
||||
//
|
||||
// Copyright (c) 2016, © Claunia.com
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("CpmDefs")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("Claunia.com")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("© Claunia.com")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
||||
19
LICENSE.MIT
Normal file
19
LICENSE.MIT
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015-2016 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
Reference in New Issue
Block a user