Added CDRWin image plugin skeleton.

git-svn-id: svn://claunia.com/FileSystemIDandChk@25 17725271-3d32-4980-a8cb-9ff532f270ba
This commit is contained in:
2013-12-14 23:02:04 +00:00
parent 18ade83e2c
commit 9f91ae340c
4 changed files with 293 additions and 9 deletions

View File

@@ -68,6 +68,7 @@
<Compile Include="Plugins\UNIXBFS.cs" /> <Compile Include="Plugins\UNIXBFS.cs" />
<Compile Include="Plugins\SysV.cs" /> <Compile Include="Plugins\SysV.cs" />
<Compile Include="ImagePlugins\ImagePlugin.cs" /> <Compile Include="ImagePlugins\ImagePlugin.cs" />
<Compile Include="ImagePlugins\CDRWin.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>

View File

@@ -0,0 +1,279 @@
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using FileSystemIDandChk;
namespace FileSystemIDandChk.ImagePlugins
{
class CDRWin : ImagePlugin
{
#region Internal structures
private struct TrackFile
{
public UInt32 sequence; // Track #
public string datafile; // Path of file containing track
public UInt64 offset; // Offset of track start in file
}
#endregion
#region Internal variables
private string imagePath;
private FileStream imageStream;
private List<Session> sessions;
private List<Track> tracks;
private Dictionary<UInt32, TrackFile> trackFiles; // Dictionary, index is track #, value is TrackFile
#region
#region Parsing regexs
private const string SessionRegEx = "REM\\s+SESSION\\s+(?<number>\\d+)$";
private const string CommentRegEx = "REM\\s+(?<comment>.+)$";
private const string CDTextRegEx = "CDTEXMAIN\\s+(?<filename>.+)$";
private const string MCNRegEx = "CATALOG\\s+(?<catalog>\\d{13})$";
private const string TitleRegEx = "TITLE\\s+(?<title>.+)$";
private const string PerformerRegEx = "PERFORMER\\s+(?<performer>.+)$";
private const string SongWriterRegEx = "SONGWRITER\\s+(?<songwriter>.+)$";
private const string FileRegEx = "FILE\\s+(?<filename>.+)\\s+(?<type>\\S+)$";
private const string TrackRegEx = "TRACK\\s+(?<number>\\d+)\\s+(?<type>\\S+)$";
private const string ISRCRegEx = "ISRC\\s+(?<isrc>\\w{12})$";
private const string IndexRegEx = "INDEX\\s+(?<index>\\d+)\\s+(?<msf>[\\d]+:[\\d]+:[\\d]+)$";
private const string PregapRegEx = "PREGAP\\s+(?<msf>[\\d]+:[\\d]+:[\\d]+)$";
private const string PostgapRegex = "POSTGAP\\s+(?<msf>[\\d]+:[\\d]+:[\\d]+)$";
private const string FlagsRegEx = "FLAGS\\+(((?<dcp>DCP)|(?<4ch>4CH)|(?<pre>PRE)|(?<scms>SCMS))\\s*)+$";
#endregion
#region Methods
public CDRWin (PluginBase Core)
{
base.Name = "CDRWin cuesheet handler";
base.PluginUUID = new Guid("664568B2-15D4-4E64-8A7A-20BDA8B8386F");
this.imagePath = "";
}
public CDRWin (PluginBase Core, string imagePath)
{
this.imagePath = imagePath;
}
// Due to .cue format, this method must parse whole file, ignoring errors (those will be thrown by OpenImage()).
public override bool IdentifyImage()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override bool OpenImage()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override bool ImageHasPartitions()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override UInt64 GetImageSize()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override UInt64 GetSectors()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override UInt32 GetSectorSize()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadDiskTag(DiskTagType tag)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSector(UInt64 SectorAddress)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectorTag(UInt64 SectorAddress, SectorTagType tag)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSector(UInt64 SectorAddress, UInt32 track)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectorTag(UInt64 SectorAddress, UInt32 track, SectorTagType tag)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectors(UInt64 SectorAddress, UInt32 length)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectorsTag(UInt64 SectorAddress, UInt32 length, SectorTagType tag)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectors(UInt64 SectorAddress, UInt32 length, UInt32 track)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectorsTag(UInt64 SectorAddress, UInt32 length, UInt32 track, SectorTagType tag)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectorLong(UInt64 SectorAddress)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectorLong(UInt64 SectorAddress, UInt32 track)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectorsLong(UInt64 SectorAddress, UInt32 length)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override byte[] ReadSectorsLong(UInt64 SectorAddress, UInt32 length, UInt32 track)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override string GetImageFormat()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override string GetImageVersion()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override string GetImageApplication()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override string GetImageApplicationVersion()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override DateTime GetImageCreationTime()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override DateTime GetImageLastModificationTime()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override string GetImageComments()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override string GetDiskSerialNumber()
{
return this.GetDiskBarcode();
}
public override string GetDiskBarcode()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override DiskType GetDiskType()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override List<PartPlugins.Partition> GetPartitions()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override List<Track> GetTracks()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override List<Track> GetSessionTracks(Session Session)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override List<Track> GetSessionTracks(UInt16 Session)
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
public override List<Session> GetSessions()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
}
#endregion
#region Unsupported features
public override int GetDiskSequence()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
public override int GetLastDiskSequence()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
public override string GetDriveManufacturer()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
public override string GetDriveModel()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
public override string GetDriveSerialNumber()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
public override string GetDiskPartNumber()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
public override string GetDiskManufacturer()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
public override string GetDiskModel()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
public override string GetImageName()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
public override string GetImageCreator()
{
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
#endregion
}
}

View File

@@ -9,6 +9,10 @@ namespace FileSystemIDandChk.ImagePlugins
public string Name; public string Name;
public Guid PluginUUID; public Guid PluginUUID;
protected ImagePlugin ()
{
}
protected ImagePlugin (string ImagePath) protected ImagePlugin (string ImagePath)
{ {
} }
@@ -50,14 +54,14 @@ namespace FileSystemIDandChk.ImagePlugins
public abstract string GetImageComments(); // Gets image comments public abstract string GetImageComments(); // Gets image comments
// Functions to get information from disk represented by image // Functions to get information from disk represented by image
public abstract string GetDiskManufacturer(); // Gets disk manufacturer public abstract string GetDiskManufacturer(); // Gets disk manufacturer
public abstract string GetDiskModel(); // Gets disk model public abstract string GetDiskModel(); // Gets disk model
public abstract string GetDiskSerialNumber(); // Gets disk serial number public abstract string GetDiskSerialNumber(); // Gets disk serial number
public abstract string GetDiskBarcode(); // Gets disk (or product) public abstract string GetDiskBarcode(); // Gets disk (or product)
public abstract string GetDiskPartNumber(); // Gets disk part no. as manufacturer set public abstract string GetDiskPartNumber(); // Gets disk part no. as manufacturer set
public abstract string GetDiskType(); // Gets disk type public abstract DiskType GetDiskType(); // Gets disk type
public abstract int GetDiskSequence(); // Gets disk sequence number, 1-starting public abstract int GetDiskSequence(); // Gets disk sequence number, 1-starting
public abstract int GetLastDiskSequence(); // Gets last disk sequence number public abstract int GetLastDiskSequence(); // Gets last disk sequence number
// Functions to get information from drive used to create image // Functions to get information from drive used to create image
public abstract string GetDriveManufacturer(); // Gets drive manufacturer public abstract string GetDriveManufacturer(); // Gets drive manufacturer

View File

@@ -199,7 +199,7 @@ namespace FileSystemIDandChk
} }
finally finally
{ {
stream.Close(); stream = null;
} }
} }