当前位置: 首页>>代码示例>>C#>>正文


C# DJsIO.ReadStream方法代码示例

本文整理汇总了C#中X360.IO.DJsIO.ReadStream方法的典型用法代码示例。如果您正苦于以下问题:C# DJsIO.ReadStream方法的具体用法?C# DJsIO.ReadStream怎么用?C# DJsIO.ReadStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在X360.IO.DJsIO的用法示例。


在下文中一共展示了DJsIO.ReadStream方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addImageToolStripMenuItem_Click

 private void addImageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DJsIO xIO = new DJsIO(DJFileMode.Open, "Open a PNG", "PNG File|*.png", true);
     if (!xIO.Accessed)
         return;
     if (xIO.Length > 0x4000)
     {
         MessageBox.Show("Error: Image is too big");
         return;
     }
     byte[] x = xIO.ReadStream();
     try { Image y = x.BytesToImage(); pictureBox1.Image = y; }
     catch (Exception z) { MessageBox.Show(z.Message); return; }
     HeaderInfo.ContentImageBinary = x;
 }
开发者ID:VictorOverX,项目名称:X360,代码行数:15,代码来源:PackageCreatez.cs

示例2: 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;
 }
开发者ID:DarrenRainey,项目名称:snes360savegameconverter,代码行数:75,代码来源:STFSPackage.cs

示例3: xUpdate

 internal bool xUpdate()
 {
     try
     {
         int xsize = xpairs.Count * 0x10;
         if (Size > xsize)
         {
             new FreeSpaceEntry(xRef, xOffset + xsize, Size - xsize);
             xRef.PatchFree();
         }
         else if (Size < xsize)
         {
             int off = xRef.AllocateData(xsize);
             if (off == -1)
                 return false;
             new FreeSpaceEntry(xRef, xOffset, Size);
             xRef.PatchFree();
             xOffset = off;
         }
         DJsIO xbuff = new DJsIO(new byte[xsize], true);
         xbuff.Position = 0;
         foreach (SyncPair x in xpairs)
         {
             xbuff.Write(x.ID);
             xbuff.Write(x.Sync);
         }
         xbuff.Flush();
         xRef.xIO.Position = Offset;
         xRef.xIO.Write(xbuff.ReadStream());
         xRef.xIO.Flush();
         if (xsize > xSize)
             xRef.UpdateHeader();
         xSize = xsize;
         return true;
     }
     catch { return false; }
 }
开发者ID:BGCX261,项目名称:ziggy-pro-editor-svn-to-git,代码行数:37,代码来源:GPD.cs

示例4: 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; }
 }
开发者ID:VictorOverX,项目名称:X360,代码行数:48,代码来源:SVODPackage.cs

示例5: xEncrypt

 bool xEncrypt(ref DJsIO xNewPayload)
 {
     try
     {
         if (!xSuccess)
             return false;
         if (xIsLive)
         {
             byte[] xService = (ThisType == AccountType.Stock ?
                 new byte[] { 0x50, 0x52, 0x4F, 0x44 } : // PROD
                 new byte[] { 0x50, 0x41, 0x53, 0x54 }); // PART
             xNewPayload.Position = 0x34;
             xNewPayload.Write(xService);
             xNewPayload.Flush();
         }
         List<byte> xReturn = new List<byte>();
         byte[] xConfounder = xRC4.NewConfounder(8);
         byte[] NewPay = xNewPayload.ReadStream();
         xNewPayload.Dispose();
         byte[] xHeaderKey = xComputeHeaderKey(xConfounder, NewPay);
         xRC4.KeyBinary = xComputeRC4Key(xHeaderKey);
         xReturn.AddRange(xHeaderKey);
         xReturn.AddRange(xRC4.KerberosEncrypt(ref xConfounder, ref NewPay));
         IO.Position = 0;
         IO.Write(xReturn.ToArray());
         IO.Flush();
         return true;
     }
     catch { return false; }
 }
开发者ID:BGCX261,项目名称:ziggy-pro-editor-svn-to-git,代码行数:30,代码来源:ProfileTools.cs

示例6: UserAccount

 /// <summary>
 /// Initializes an instance
 /// </summary>
 /// <param name="xAcc"></param>
 /// <param name="xType"></param>
 /// <param name="CreateBackup"></param>
 public UserAccount(DJsIO xAcc, AccountType xType, bool CreateBackup)
 {
     if (xAcc.Length != 404 || !Enum.IsDefined(typeof(AccountType), xType))
         return;
     IO = xAcc;
     xHS = new HMACSHA1();
     ThisType = xType;
     DJsIO xfill;
     if (xDecrypt(out xfill))
     {
         if (CreateBackup)
         {
             xBackup = new DJsIO(true);
             xBackup.Position = 0;
             xBackup.Write(IO.ReadStream());
         }
         xfill.Position = 0;
         if (((xfill.ReadByte() >> 5) & 1) == 1)
         {
             xIsLive = true;
             xfill.Position = 0x28;
             xXUID = xfill.ReadUInt64();
         }
         xSuccess = true;
     }
 }
开发者ID:BGCX261,项目名称:ziggy-pro-editor-svn-to-git,代码行数:32,代码来源:ProfileTools.cs


注:本文中的X360.IO.DJsIO.ReadStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。