本文整理汇总了C#中X360.IO.DJsIO.Close方法的典型用法代码示例。如果您正苦于以下问题:C# DJsIO.Close方法的具体用法?C# DJsIO.Close怎么用?C# DJsIO.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X360.IO.DJsIO
的用法示例。
在下文中一共展示了DJsIO.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddFile
public bool AddFile(string FileName, byte[] fileData, AddType xType)
{
if (!VariousFunctions.IsValidXboxName(FileName))
return false;
if (xDrive.ActiveCheck())
return false;
DJsIO xIOIn = null;
byte[] b = fileData;
xIOIn = new DJsIO(b, true);
try
{
FATXReadContents xconts = xRead();
foreach (FATXFileEntry x in xconts.xfiles)
{
if (string.Compare(x.Name, FileName, true) == 0)
{
bool xreturn = false;
if (xType == AddType.NoOverWrite)
{
xIOIn.Close();
return (xDrive.xActive = false);
}
else if (xType == AddType.Inject)
{
xreturn = x.xInject(xIOIn);
}
else
{
xreturn = x.xReplace(xIOIn);
}
xIOIn.Close();
return (xreturn & !(xDrive.xActive = false));
}
}
uint xnew = 0;
long xpos = GetNewEntryPos(out xnew);
if (xpos == -1)
return (xDrive.xActive = false);
var count = xIOIn.BlockCountFATX(Partition);
uint[] blocks = Partition.xTable.GetNewBlockChain(count, xnew + 1);
if (blocks.Length == 0)
return (xDrive.xActive = false);
if (!Partition.WriteFile(blocks, ref xIOIn))
return (xDrive.xActive = false);
FATXEntry y = new FATXEntry(this,
FileName,
blocks[0], (int)xIOIn.Length,
xpos, false, ref xDrive);
if (!y.xWriteEntry())
return (xDrive.xActive = false);
if (xnew > 0)
{
var filebx = Partition.xTable.GetBlocks(xStartBlock);
List<uint> fileblocks = new List<uint>(filebx);
fileblocks.Add(xnew);
uint[] xtemp = fileblocks.ToArray();
if (!Partition.xTable.WriteChain(ref xtemp))
return (xDrive.xActive = false);
}
if (!Partition.xTable.WriteChain(ref blocks))
return (xDrive.xActive = false);
if (Partition.WriteAllocTable())
return !(xDrive.xActive = false);
return (xDrive.xActive = false);
}
catch { xIOIn.Close(); return (xDrive.xActive = false); }
}
示例2: xExtractBytes
public byte[] xExtractBytes()
{
byte[] ret = null;
var xIO = new DJsIO(true);
try
{
if (xExtract(ref xIO))
{
xIO.Position = 0;
ret = xIO.GetBytes();
}
}
catch
{
ret = null;
}
xIO.Close();
return ret;
}
示例3: IncreaseXDBFCount
internal bool IncreaseXDBFCount()
{
DJsIO xtemp = new DJsIO(true);
try
{
xtemp.Position = (HeaderSize + (0xFF * 0x12));
xIO.Position = HeaderSize;
int len = (int)(xIO.Length - xIO.Position);
for (int i = 0; i < len; i++)
xtemp.Write(xIO.ReadByte());
xtemp.Position = 0;
xtemp.Write((uint)AllMagic.XDBF);
xtemp.Write((int)0x10000);
xEntryMax += 0xFF;
xtemp.Write((int)xEntryMax);
xtemp.Write((int)xEntryCurrent);
xtemp.Write((int)xFreeCurrent);
xtemp.Write((int)xFreeMax);
List<XDBFEntry> xEntries = GetEntries();
foreach (XDBFEntry x in xEntries)
{
xtemp.Write((ushort)x.NS);
xtemp.Write(x.ID);
xtemp.Write(x.xOffset);
xtemp.Write(x.Size);
}
xtemp.Write(new byte[0x12 * (xEntryMax - xEntries.Count)]);
foreach (FreeSpaceEntry x in xFreeEnts)
{
if (x.Size != 0)
{
xtemp.Write(x.offset);
xtemp.Write(x.Size);
}
}
int xdatasize = (int)(xtemp.Length - HeaderSize);
xtemp.Write(xdatasize);
xtemp.Write((int)(((-1) - xdatasize)));
xtemp.Write(new byte[0x8 * (xFreeMax - (xFreeEnts.Count + 1))]);
xtemp.Flush();
xtemp.Close();
xIO.Close();
VariousFunctions.MoveFile(xtemp.FileNameLong, xIO.FileNameLong);
xIO = new DJsIO(xIO.FileNameLong, DJFileMode.Open, true);
return true;
}
catch { xtemp.Dispose(true); return false; }
}
示例4: Create
/// <summary>
/// Builds the package
/// </summary>
/// <param name="xParams"></param>
/// <param name="ContentType"></param>
/// <returns></returns>
public bool Create(RSAParams xParams, PackageType ContentType)
{
if (BaseImage == null)
throw new Exception("No image");
if (!xParams.Valid)
throw CryptoExcepts.ParamError;
if (ContentType != PackageType.HDDInstalledGame &&
ContentType != PackageType.OriginalXboxGame &&
ContentType != PackageType.GamesOnDemand &&
ContentType != PackageType.SocialTitle)
return false;
if (xActive)
return false;
xActive = true;
DJsIO x = null;
DJsIO h = null;
try
{
string outlocale = OutLocation.Replace('\\', '/');
if (outlocale[outlocale.Length - 1] == '/')
outlocale = outlocale.Substring(0, outlocale.Length - 1);
outlocale += '/' + ((uint)ContentType).ToString("X8");
string DataFolder = outlocale + "/" + xHeader.TitleID.ToString("X8") + ".data";
if (!VariousFunctions.xCheckDirectory(OutLocation))
throw IOExcepts.CreateError;
if (!VariousFunctions.xCheckDirectory(DataFolder))
throw IOExcepts.CreateError;
uint xBlockCount = 0;
uint xDataFileCount = 0;
long xDataLength = 0;
BaseImage.xIO.Position = BaseImage.baseoffset;
while (BaseImage.xIO.Position < BaseImage.xIO.Length)
{
if ((xBlockCount % Constants.SVODBL[1]) == 0)
{
if (x != null)
{
for (int i = 0; i < 0xCB; i++)
{
x.Position = SVODFuncs.GenerateHashOffset((uint)(i * Constants.SVODBL[0]), 0);
byte[] Data1 = SHA1Quick.ComputeHash(x.ReadBytes(0x1000));
x.Position = SVODFuncs.GenerateHashOffset((uint)(i * Constants.SVODBL[0]), 1);
x.Write(Data1);
}
x.Flush();
xDataLength += x.Length;
x.Close();
}
x = new DJsIO(DataFolder + SVODFuncs.formatstring(xDataFileCount), DJFileMode.Create, true);
xDataFileCount++;
}
x.Position = SVODFuncs.GenerateDataOffset(xBlockCount);
byte[] Data = BaseImage.xIO.ReadBytes(0x1000);
x.Write(Data);
x.Position = SVODFuncs.GenerateHashOffset(xBlockCount, 0);
x.Write(SHA1Quick.ComputeHash(Data));
xBlockCount++;
}
if (xBlockCount == 0)
{
x.Close();
return (xActive = false);
}
x.Flush();
xDataLength += x.Length;
int lvlct = (int)((((xBlockCount % Constants.SVODBL[1]) - 1) / Constants.SVODBL[0]) + 1);
for (int i = 0; i < lvlct; i++)
{
x.Position = SVODFuncs.GenerateHashOffset((uint)(i * Constants.SVODBL[0]), 0);
byte[] Data1 = SHA1Quick.ComputeHash(x.ReadBytes(0x1000));
x.Position = SVODFuncs.GenerateHashOffset((uint)(i * Constants.SVODBL[0]), 1);
x.Write(Data1);
}
x.Flush();
x.Close();
byte[] Hash = null;
for (int i = (int)(xDataFileCount - 1); i >= 0; i--)
{
x = new DJsIO(DataFolder + SVODFuncs.formatstring((uint)i), DJFileMode.Open, true);
if (Hash != null)
{
x.Position = 0xFF0;
x.Write(Hash);
x.Flush();
}
x.Position = 0;
Hash = SHA1Quick.ComputeHash(x.ReadBytes(0x1000));
}
xHeader.DataFileSize = xDataLength;
xHeader.DataFileCount = xDataFileCount;
xHeader.xThisType = ContentType;
h = new DJsIO(outlocale + "/" + xHeader.TitleID.ToString("X8"), DJFileMode.Create, true);
xHeader.Write(ref h);
h.SetLength(0xB000);
//.........这里部分代码省略.........
示例5: AddFile
/// <summary>
/// Adds a file
/// </summary>
/// <param name="FileName"></param>
/// <param name="FileLocation"></param>
/// <param name="xType"></param>
/// <returns></returns>
public bool AddFile(string FileName, string FileLocation, AddType xType)
{
FileName.IsValidXboxName();
if (xDrive.ActiveCheck())
return false;
DJsIO xIOIn = null;
try { xIOIn = new DJsIO(FileLocation, DJFileMode.Open, true); }
catch { return (xDrive.xActive = false); }
try
{
FATXReadContents xconts = xRead();
foreach (FATXFileEntry x in xconts.xfiles)
{
if (x.Name == FileName)
{
bool xreturn = false;
if (xType == AddType.NoOverWrite)
return (xDrive.xActive = false);
else if (xType == AddType.Inject)
xreturn = x.xInject(xIOIn);
else xreturn = x.xReplace(xIOIn);
return (xreturn & !(xDrive.xActive = false));
}
}
uint xnew = 0;
long xpos = GetNewEntryPos(out xnew);
if (xpos == -1)
return (xDrive.xActive = false);
uint[] blocks = Partition.xTable.GetNewBlockChain(xIOIn.BlockCountFATX(Partition), xnew + 1);
if (blocks.Length == 0)
return (xDrive.xActive = false);
if (!Partition.WriteFile(blocks, ref xIOIn))
return (xDrive.xActive = false);
FATXEntry y = new FATXEntry(FileName, blocks[0], (int)xIOIn.Length, xpos, false, ref xDrive);
if (!y.xWriteEntry())
return (xDrive.xActive = false);
if (xnew > 0)
{
List<uint> fileblocks = new List<uint>(Partition.xTable.GetBlocks(xStartBlock));
fileblocks.Add(xnew);
uint[] xtemp = fileblocks.ToArray();
if (!Partition.xTable.WriteChain(ref xtemp))
return (xDrive.xActive = false);
}
if (!Partition.xTable.WriteChain(ref blocks))
return (xDrive.xActive = false);
if (Partition.WriteAllocTable())
return !(xDrive.xActive = false);
return (xDrive.xActive = false);
}
catch { xIOIn.Close(); return (xDrive.xActive = false); }
}
示例6: addFileToolStripMenuItem_Click
private void addFileToolStripMenuItem_Click(object sender, EventArgs e)
{
DJsIO x = new DJsIO(DJFileMode.Open, "Open", "", true);
if (!x.Accessed)
return;
Renamer rename = new Renamer(x.FileNameShort, true);
if (rename.ShowDialog() != DialogResult.OK)
{
x.Close();
return;
}
xPackage.MakeFile(rename.FileName, x, ((FolderEntry)advTree1.SelectedNode.DataKey).EntryID, AddType.NoOverWrite);
Log("Done adding");
}
示例7: Extract
/// <summary>
/// Extracts entry to a location
/// </summary>
/// <param name="FileOut"></param>
/// <returns></returns>
public bool Extract(string FileOut)
{
if (!xPackage.ActiveCheck())
return false;
bool xReturn = false;
DJsIO xIO = new DJsIO(true);
try
{
xReturn = xExtract(xIO);
xIO.Close();
if (xReturn)
{
if (!VariousFunctions.MoveFile(xIO.FileNameLong, FileOut))
throw new Exception();
}
}
catch
{
xReturn = false;
xIO.Close();
}
VariousFunctions.DeleteFile(xIO.FileNameLong);
xPackage.xActive = false;
return xReturn;
}
示例8: xInject
internal bool xInject(DJsIO xIOIn)
{
List<uint> blocks = new List<uint>(Partition.xTable.GetBlocks(xStartBlock));
if (blocks.Count == 0)
throw new Exception();
uint xct = xIOIn.BlockCountFATX(Partition);
if (blocks.Count < xct)
{
uint[] blocks2 = Partition.xTable.GetNewBlockChain((uint)(xct - blocks.Count), 1);
if (blocks2.Length == 0)
throw new Exception();
blocks.AddRange(blocks2);
uint[] x = blocks.ToArray();
if (!Partition.xTable.WriteChain(ref x))
throw new Exception();
}
else if (blocks.Count > xct)
{
uint[] xUnneeded = new uint[blocks.Count - xct];
for (uint i = xct; i < blocks.Count; i++)
{
xUnneeded[(int)i] = i;
blocks.RemoveAt((int)i--);
}
if (!Partition.xTable.DC(ref xUnneeded))
throw new Exception();
}
xIOIn.Position = 0;
xDrive.GetIO();
foreach (uint i in blocks)
{
xDrive.xIO.Position = Partition.BlockToOffset(i);
xDrive.xIO.Write(xIOIn.ReadBytes(Partition.xBlockSize));
}
if ((xSize == 0 || (uint)(((xSize - 1) / Partition.xBlockSize) + 1) != xct) &&
!Partition.WriteAllocTable())
throw new Exception();
xSize = (int)xIOIn.Length;
xIOIn.Close();
return xWriteEntry();
}
示例9: VerifySignature
/// <summary>
/// Verifies the Header signature
/// </summary>
/// <param name="xDev"></param>
/// <returns></returns>
Verified VerifySignature(bool xDev)
{
try
{
AddToLog("Verifying Signature");
RSAParameters xRSAKeyz = new RSAParameters();
short xSigSpot = 0;
switch (xHeader.Magic)
{
case PackageMagic.CON: // signature is the same way for both Dev and Stock
{
xSigSpot = 0x1AC;
xIO.Position = 0x28;
xRSAKeyz.Exponent = xIO.ReadBytes(4);
xRSAKeyz.Modulus = ScrambleMethods.StockScramble(xIO.ReadBytes(0x80), false);
}
break;
case PackageMagic.LIVE:
{
xSigSpot = 4;
if (!xDev)
{
xRSAKeyz.Exponent = new byte[] { 0, 1, 0, 1 };
xRSAKeyz.Modulus = global::X360.Properties.Resources.XK1;
}
else
{
xRSAKeyz.Exponent = new byte[] { 0, 0, 0, 3 };
DJsIO xLK = new DJsIO(global::X360.Properties.Resources.XK4, true);
xRSAKeyz.Modulus = xLK.ReadBytes(0x100);
xLK.Close();
}
}
break;
case PackageMagic.PIRS:
{
xSigSpot = 4;
if (!xDev)
{
xRSAKeyz.Exponent = new byte[] { 0, 0, 0, 3 };
xRSAKeyz.Modulus = global::X360.Properties.Resources.XK2;
}
else
{
xRSAKeyz.Exponent = new byte[] { 0, 0, 0, 3 };
DJsIO xPK = new DJsIO(global::X360.Properties.Resources.XK5, true);
xRSAKeyz.Modulus = xPK.ReadBytes(0x100);
xPK.Close();
}
}
break;
}
xIO.Position = xSigSpot;
byte[] xSiggy = ScrambleMethods.StockScramble(xIO.ReadBytes(xRSAKeyz.Modulus.Length), true);
xIO.Position = 0x22C;
byte[] xHeadr = xIO.ReadBytes(0x118);
return new Verified(ItemType.Signature, RSAQuick.SignatureVerify(xRSAKeyz, SHA1Quick.ComputeHash(xHeadr), xSiggy), 0x22C, xSigSpot);
}
catch { throw CryptoExcepts.CryptoVeri; }
}
示例10: xGetTempIO
internal DJsIO xGetTempIO(bool BigEndian)
{
if (!Opened && !ReadBlocks())
return null;
DJsIO xIO = new DJsIO(BigEndian);
if (!xExtract(xIO))
{
xIO.Close();
VariousFunctions.DeleteFile(xIO.FileNameLong);
xIO = null;
}
ClearBlocks();
return xIO;
}
示例11: xWriteHeader
/// <summary>
/// Writes header to the file
/// </summary>
/// <param name="xParams"></param>
/// <returns></returns>
internal bool xWriteHeader(RSAParams xParams)
{
if (!xParams.Valid)
throw CryptoExcepts.ParamError;
// Writes, hashes, and signs data to a temp file
AddToLog("Writing Header values");
DJsIO x = new DJsIO(true);
if (!x.Accessed)
return false;
if (!xHeader.Write(ref x))
{
x.Close();
return false;
}
xHeader.SetSize(xIO.Length - xSTFSStruct.BaseBlock);
x.Position = 0x340;
if (xSTFSStruct.ThisType == STFSType.Type0)
x.Write((int)0xAD0E);
else x.Write((int)0x971A);
// Fills to bottom of header
x.Position = x.Length;
x.Write(new byte[(0x8E6 + (xSTFSStruct.BaseBlock - 0xA000))]);
x.Position = 0x379;
xWriteDescriptor(ref x);
AddToLog("Writing Master hash");
long xLocale = 0;
if (xSTFSStruct.xBlockCount <= Constants.BlockLevel[0])
xLocale = GenerateBaseOffset(0, TreeLevel.L0);
else if (xSTFSStruct.xBlockCount <= Constants.BlockLevel[1])
xLocale = GenerateBaseOffset(0, TreeLevel.L1);
else xLocale = GenerateBaseOffset(0, TreeLevel.L2);
XTakeHash(ref xIO, xLocale, 0x381, 0x1000, ref x);
AddToLog("Writing Header hash");
int xSize = 0;
if (xSTFSStruct.BaseBlock == 0xA000)
xSize = 0x9CBC;
else xSize = 0xACBC; // b000
XTakeHash(0x344, 0x32C, xSize, ref x);
AddToLog("Signing Header");
x.Position = 0x22C;
byte[] xHash = SHA1Quick.ComputeHash(x.ReadBytes(0x118));
x.Position = 4;
if (xParams.Type == PackageMagic.CON)
{
x.Write(xParams.Certificate);
x.Write(ScrambleMethods.StockScramble(RSAQuick.SignatureGenerate(xParams.RSAKeys, xHash), true));
}
else
{
x.Write(ScrambleMethods.DevScramble(RSAQuick.SignatureGenerate(xParams.RSAKeys, xHash)));
x.Write(new byte[0x128]);
}
x.IsBigEndian = true;
x.Position = 0;
x.Write(((uint)xParams.Type));
x.Flush();
xHeader.xMagic = xParams.Type;
// Writes header to Package just incase of a emergency close, the Package still attains original strucure
AddToLog("Writing Header to Package");
xIO.Position = 0;
xIO.Write(x.ReadStream());
xIO.Flush();
// Flush all the unused blocks to say they are written and now perm wif the new STFS Descriptor
/*switched0.Clear();
switched1.Clear();
switched2 = false;*/
x.Close();
VariousFunctions.DeleteFile(x.FileNameLong);
return true;
}
示例12: GrabSTFSStream
/// <summary>
/// Returns a real time STFS file stream
/// </summary>
/// <param name="MakeCopy"></param>
/// <param name="BigEndian"></param>
/// <returns></returns>
public DJsIO GrabSTFSStream(bool MakeCopy, bool BigEndian)
{
try
{
if (RealStream != null)
return RealStream;
if (!xPackage.ActiveCheck())
return null;
if (MakeCopy)
{
DJsIO xtemp = new DJsIO(true);
if (!xExtract(xtemp))
{
xtemp.Close();
VariousFunctions.DeleteFile(xtemp.FileNameLong);
return null;
}
bool success = xReplace(xtemp);
xtemp.Close();
VariousFunctions.DeleteFile(xtemp.FileNameLong);
if (!success)
return null;
}
if (!Opened && !ReadBlocks())
return null;
return (RealStream = new STFSStreamIO(this, BigEndian));
}
catch { RealStream = null; xPackage.xActive = false; return null; }
}
示例13: STFSPackage
/// <summary>
/// Create an STFS Package
/// </summary>
/// <param name="xSession"></param>
/// <param name="xSigning"></param>
/// <param name="xOutPath"></param>
/// <param name="LogIn"></param>
public STFSPackage(CreateSTFS xSession, RSAParams xSigning, string xOutPath, LogRecord LogIn)
{
xActive = true;
if (!xSigning.Valid)
throw CryptoExcepts.ParamError;
if (xSession.xFileDirectory.Count == 0)
throw new Exception();
try
{
AddToLog("Setting Package variables");
new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(System.DLLIdentify.PrivilegeCheck)).Start(System.Threading.Thread.CurrentThread);
xroot = new FolderEntry("", 0, 0xFFFF, 0xFFFF, this);
if (xSession.HeaderData.ThisType == PackageType.ThematicSkin)
{
DJsIO x1 = new DJsIO(true);
DJsIO x2 = new DJsIO(true);
x1.Write((int)xSession.ThemeSettings.StyleType);
x1.Flush();
x1.Close();
if (!xSession.AddFile(x1.FileNameLong, "DashStyle"))
throw STFSExcepts.ThemeError;
x2.Write("SphereColor=" + ((byte)xSession.ThemeSettings.Sphere).ToString().PadRight(2, '\0'));
x2.Write(new byte[] { 0xD, 0xA });
x2.Write("AvatarLightingDirectional=" +
xSession.ThemeSettings.AvatarLightingDirectional0.ToString("#0.0") + "," +
xSession.ThemeSettings.AvatarLightingDirectional1.ToString("#0.0000") + "," +
xSession.ThemeSettings.AvatarLightingDirectional2.ToString("#0.0") + ",0x" +
xSession.ThemeSettings.AvatarLightingDirectional3.ToString("X"));
x2.Write(new byte[] { 0xD, 0xA });
x2.Write("AvatarLightingAmbient=0x" + xSession.ThemeSettings.AvatarLightingAmbient.ToString("X"));
x2.Write(new byte[] { 0xD, 0xA });
x2.Flush();
x2.Close();
if (!xSession.AddFile(x2.FileNameLong, "parameters.ini"))
throw STFSExcepts.ThemeError;
}
else if (xSession.HeaderData.ThisType == PackageType.GamesOnDemand ||
xSession.HeaderData.ThisType == PackageType.HDDInstalledGame ||
xSession.HeaderData.ThisType == PackageType.OriginalXboxGame ||
xSession.HeaderData.ThisType == PackageType.SocialTitle)
throw STFSExcepts.Game;
xLog = LogIn;
xHeader = xSession.HeaderData;
xSTFSStruct = new STFSDescriptor(xSession.STFSType, 0);
xIO = new DJsIO(true);
List<BlockRecord> DirectoryBlockz = new List<BlockRecord>();
// switched2 = true;
uint xcurblock = 0;
for (ushort i = 0; i < xSession.GetDirectoryCount; i++)
{
DirectoryBlockz.Add(new BlockRecord());
DirectoryBlockz[DirectoryBlockz.Count - 1].ThisBlock = xcurblock++;
/*if (!switched0.Contains((int)(xcurblock / Constants.BlockLevel[0])))
switched0.Add((int)(xcurblock / Constants.BlockLevel[0]));
if (!switched1.Contains((int)(xcurblock / Constants.BlockLevel[1])))
switched1.Add((int)(xcurblock / Constants.BlockLevel[1]));*/
}
xFileBlocks = DirectoryBlockz.ToArray();
xWriteChain(xFileBlocks);
xSTFSStruct.xDirectoryBlockCount = (ushort)xFileBlocks.Length;
ushort xCurID = 0;
xSession.xFolderDirectory.Sort(new Comparison<CFolderEntry>(sortpathct));
foreach (CFolderEntry x in xSession.xFolderDirectory)
{
ushort pointer = 0xFFFF;
if (x.xthispath.xPathCount() > 1)
pointer = xGetParentFolder(x.Path).EntryID;
xFolderDirectory.Add(new FolderEntry(x.Name, 0, xCurID++, pointer, this));
xFolderDirectory[xFolderDirectory.Count - 1].xFixOffset();
}
foreach (CFileEntry x in xSession.xFileDirectory)
{
ushort pointer = 0xFFFF;
if (x.xthispath.xPathCount() > 1)
pointer = xGetParentFolder(x.Path).EntryID;
xFileDirectory.Add(new FileEntry(x.Name, (int)x.GetLength(), false,xCurID++, pointer, this));
List<BlockRecord> xAlloc = new List<BlockRecord>();
for (uint i = 0; i < x.BlockCount(); i++)
{
xAlloc.Add(new BlockRecord());
xAlloc[xAlloc.Count - 1].ThisBlock = xcurblock++;
/*if (!switched0.Contains((int)(xcurblock / Constants.BlockLevel[0])))
switched0.Add((int)(xcurblock / Constants.BlockLevel[0]));
if (!switched1.Contains((int)(xcurblock / Constants.BlockLevel[1])))
switched1.Add((int)(xcurblock / Constants.BlockLevel[1]));*/
}
xFileDirectory[xFileDirectory.Count - 1].xBlockCount = (uint)xAlloc.Count;
xFileDirectory[xFileDirectory.Count - 1].xStartBlock = xAlloc[0].ThisBlock;
xFileDirectory[xFileDirectory.Count - 1].xPackage = this;
xFileDirectory[xFileDirectory.Count - 1].xFixOffset();
xWriteChain(xAlloc.ToArray());
}
AddToLog("Writing Entry Table");
//.........这里部分代码省略.........
示例14: Extract
/// <summary>
/// Extract the file
/// </summary>
/// <param name="OutLocation"></param>
/// <returns></returns>
public bool Extract(string OutLocation)
{
if (xDrive.ActiveCheck())
return false;
bool xReturn = false;
DJsIO xIO = new DJsIO(true);
try
{
xReturn = xExtract(ref xIO);
xIO.Close();
if (xReturn)
xReturn = VariousFunctions.MoveFile(xIO.FileNameLong, OutLocation);
}
catch
{
xIO.Close();
xReturn = false;
}
VariousFunctions.DeleteFile(xIO.FileNameLong);
xDrive.xActive = false;
return xReturn;
}
示例15: Extract
/// <summary>
/// Extract a file
/// </summary>
/// <param name="OutLocale"></param>
/// <returns></returns>
public bool Extract(string OutLocale)
{
if (!xref.ActiveCheck())
return false;
DJsIO xIO = new DJsIO(true);
if (!xExtract(xIO))
{
xIO.Close();
VariousFunctions.DeleteFile(xIO.FileNameLong);
return (xref.xActive = false);
}
xIO.Close();
bool xSuccess = VariousFunctions.MoveFile(xIO.FileNameLong, OutLocale);
VariousFunctions.DeleteFile(xIO.FileNameLong);
return (xSuccess & !(xref.xActive = false));
}