本文整理汇总了C#中X360.IO.DJsIO.WriteUInt24方法的典型用法代码示例。如果您正苦于以下问题:C# DJsIO.WriteUInt24方法的具体用法?C# DJsIO.WriteUInt24怎么用?C# DJsIO.WriteUInt24使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X360.IO.DJsIO
的用法示例。
在下文中一共展示了DJsIO.WriteUInt24方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
//.........这里部分代码省略.........
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);
h.Position = 0x340;
h.Write((uint)0xAD0E);
h.Position = 0x379;
h.Write(new byte[] { 0x24, 5, 5, 0x11 });
h.Write(Hash);
h.Write((byte)((Deviation == 0) ? 0 : 0x40));
h.WriteUInt24(xBlockCount);
h.Write(Deviation, false);
h.Position = 0x344;
byte[] xHash = SHA1Quick.ComputeHash(h.ReadBytes((int)(h.Length - 0x344)));
h.Position = 0x32C;
h.Write(xHash);
h.Flush();
h.Position = 0x22C;
xHash = SHA1Quick.ComputeHash(h.ReadBytes(0x118));
h.Position = 4;
if (xParams.Type == PackageMagic.CON)
{
h.Write(xParams.Certificate);
h.Write(ScrambleMethods.StockScramble(RSAQuick.SignatureGenerate(xParams.RSAKeys, xHash), true));
}
else
{
h.Write(ScrambleMethods.DevScramble(RSAQuick.SignatureGenerate(xParams.RSAKeys, xHash)));
h.Write(new byte[0x128]);
}
h.IsBigEndian = true;
h.Position = 0;
h.Write(((uint)xParams.Type));
xHeader.xMagic = xParams.Type;
h.Flush();
h.Close();
return !(xActive = false);
}
catch
{
if (x != null)
x.Close();
if (h != null)
h.Close();
return (xActive = false);
}
}
示例2: xWriteHeader
bool xWriteHeader(RSAParams xParams)
{
try
{
DJsIO xio = new DJsIO(true);
xHeaderData.Write(ref xio);
xio.SetLength(0xB000);
xio.Position = 0x340;
xio.Write((uint)0xAD0E);
xio.Position = 0x379;
xio.Write(new byte[] { 0x24, 5, 5, 0x11 });
IO.Position = 0x37D;
xio.Write(IO.ReadBytes(20));
xio.Write((byte)((xIsShifted ? 1 : 0) << 6));
xio.WriteUInt24(xBlockCount);
xio.Write(xDeviation);
xio.Flush();
xio.Position = 0x344;
byte[] xHash = SHA1Quick.ComputeHash(xio.ReadBytes((int)(xio.Length - 0x344)));
xio.Position = 0x32C;
xio.Write(xHash);
xio.Flush();
xio.Position = 0x22C;
xHash = SHA1Quick.ComputeHash(xio.ReadBytes(0x118));
xio.Position = 4;
if (xParams.Type == PackageMagic.CON)
{
xio.Write(xParams.Certificate);
xio.Write(ScrambleMethods.StockScramble(RSAQuick.SignatureGenerate(xParams.RSAKeys, xHash), true));
}
else
{
xio.Write(ScrambleMethods.DevScramble(RSAQuick.SignatureGenerate(xParams.RSAKeys, xHash)));
xio.Write(new byte[0x128]);
}
xio.IsBigEndian = true;
xio.Position = 0;
xio.Write(((uint)xParams.Type));
xio.Flush();
xHeaderData.xMagic = xParams.Type;
IO.Position = 0;
IO.Write(xio.ReadStream());
IO.Flush();
xio.Dispose();
return true;
}
catch { return false; }
}