2017-05-19 20:28:49 +01:00
|
|
|
// /***************************************************************************
|
2016-10-07 00:41:59 +01:00
|
|
|
// The Disc Image Chef
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : AppleDOS.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// Component : Apple DOS filesystem plugin.
|
|
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Constructors and common variables for the Apple DOS filesystem plugin.
|
|
|
|
|
//
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2016-10-07 00:41:59 +01:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2017-06-06 21:23:20 +01:00
|
|
|
using System.Text;
|
2017-07-19 16:31:08 +01:00
|
|
|
using DiscImageChef.CommonTypes;
|
2016-10-07 00:41:59 +01:00
|
|
|
using DiscImageChef.ImagePlugins;
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Filesystems.AppleDOS
|
|
|
|
|
{
|
2017-07-01 03:26:08 +01:00
|
|
|
public partial class AppleDOS : Filesystem
|
2016-10-07 00:41:59 +01:00
|
|
|
{
|
|
|
|
|
bool mounted;
|
|
|
|
|
bool debug;
|
|
|
|
|
readonly ImagePlugin device;
|
|
|
|
|
|
|
|
|
|
#region Caches
|
|
|
|
|
/// <summary>Caches track/sector lists</summary>
|
|
|
|
|
Dictionary<string, byte[]> extentCache;
|
|
|
|
|
/// <summary>Caches files</summary>
|
|
|
|
|
Dictionary<string, byte[]> fileCache;
|
|
|
|
|
/// <summary>Caches catalog</summary>
|
|
|
|
|
Dictionary<string, ushort> catalogCache;
|
|
|
|
|
/// <summary>Caches file size</summary>
|
|
|
|
|
Dictionary<string, int> fileSizeCache;
|
|
|
|
|
/// <summary>Caches VTOC</summary>
|
|
|
|
|
byte[] vtocBlocks;
|
|
|
|
|
/// <summary>Caches catalog</summary>
|
|
|
|
|
byte[] catalogBlocks;
|
|
|
|
|
/// <summary>Caches boot code</summary>
|
|
|
|
|
byte[] bootBlocks;
|
|
|
|
|
/// <summary>Caches file type</summary>
|
|
|
|
|
Dictionary<string, byte> fileTypeCache;
|
|
|
|
|
/// <summary>Caches locked files</summary>
|
|
|
|
|
List<string> lockedFiles;
|
|
|
|
|
#endregion Caches
|
|
|
|
|
|
|
|
|
|
VTOC vtoc;
|
|
|
|
|
ulong start;
|
|
|
|
|
int sectorsPerTrack;
|
|
|
|
|
ulong totalFileEntries;
|
|
|
|
|
bool track1UsedByFiles;
|
|
|
|
|
bool track2UsedByFiles;
|
|
|
|
|
int usedSectors;
|
|
|
|
|
|
|
|
|
|
public AppleDOS()
|
|
|
|
|
{
|
|
|
|
|
Name = "Apple DOS File System";
|
|
|
|
|
PluginUUID = new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n");
|
2017-06-06 21:23:20 +01:00
|
|
|
CurrentEncoding = new Claunia.Encoding.LisaRoman();
|
2016-10-07 00:41:59 +01:00
|
|
|
}
|
|
|
|
|
|
2017-10-12 23:54:02 +01:00
|
|
|
public AppleDOS(Encoding encoding)
|
|
|
|
|
{
|
|
|
|
|
Name = "Apple DOS File System";
|
|
|
|
|
PluginUUID = new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n");
|
|
|
|
|
// TODO: Until Apple ][ encoding is implemented
|
|
|
|
|
CurrentEncoding = new Claunia.Encoding.LisaRoman();
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-19 16:31:08 +01:00
|
|
|
public AppleDOS(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
|
2016-10-07 00:41:59 +01:00
|
|
|
{
|
|
|
|
|
device = imagePlugin;
|
2017-07-19 16:37:11 +01:00
|
|
|
start = partition.Start;
|
2016-10-07 00:41:59 +01:00
|
|
|
Name = "Apple DOS File System";
|
|
|
|
|
PluginUUID = new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n");
|
2017-07-26 12:25:18 +01:00
|
|
|
// TODO: Until Apple ][ encoding is implemented
|
|
|
|
|
CurrentEncoding = new Claunia.Encoding.LisaRoman();
|
2016-10-07 00:41:59 +01:00
|
|
|
}
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
}
|