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


C# DJsIO.BlockCountSTFS方法代码示例

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


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

示例1: xReplace

 internal bool xReplace(DJsIO xIOin)
 {
     if (!Opened)
         ReadBlocks();
     if (!xIOin.Accessed || xIOin.Length > 0xFFFFFFFF)
         return false;
     try
     {
         // Allocates new blocks for new data
         xPackage.AddToLog("Allocating blocks");
         BlockRecord[] xEntAlloc = xPackage.xAllocateBlocks(xPackage.xCurEntBlckCnt, 0);
         BlockRecord[] xFileAlloc = xPackage.xAllocateBlocks(xIOin.BlockCountSTFS(), xEntAlloc[xEntAlloc.Length - 1].ThisBlock + 1);
         // Updates entry
         xPackage.AddToLog("Updating entry");
         xStartBlock = xFileAlloc[0].ThisBlock;
         xSize = (int)xIOin.Length;
         xBlockCount = xIOin.BlockCountSTFS();
         if (xPackage.xDoAdd(ref xIOin, ref xEntAlloc, ref xFileAlloc))
         {
             xPackage.xDeleteChain(xBlocks);
             ClearBlocks();
             return true;
         }
         return false;
     }
     catch { ClearBlocks(); return false; }
 }
开发者ID:DarrenRainey,项目名称:snes360savegameconverter,代码行数:27,代码来源:STFSPackage.cs

示例2: xAddFile

 /// <summary>
 /// Adds a file to the package
 /// </summary>
 /// <param name="xIOIn"></param>
 /// <param name="xFileName"></param>
 /// <param name="Folder"></param>
 /// <returns></returns>
 bool xAddFile(DJsIO xIOIn, string xFileName, ushort Folder)
 {
     try
     {
         if (xIOIn == null || !xIOIn.Accessed || xIOIn.Length > ((xSTFSStruct.SpaceBetween[2] - 1) << 0xC))
             return (xActive = false);
         foreach (FileEntry m in xFileDirectory)
         {
             if (m.FolderPointer == Folder && m.Name == xFileName)
                 return (xActive = false);
         }
         // Allocates blocks
         AddToLog("Allocating blocks");
         BlockRecord[] xEntAlloc = xAllocateBlocks(xNewEntBlckCnt(1), 0);
         BlockRecord[] xFileAlloc = xAllocateBlocks(xIOIn.BlockCountSTFS(), xEntAlloc[xEntAlloc.Length - 1].ThisBlock + 1);
         // Adds new file info
         AddToLog("Adding file information");
         ItemEntry x = new ItemEntry(xFileName, (int)xIOIn.Length, false, (ushort)(xFileDirectory.Count + xFolderDirectory.Count), Folder, this);
         FileEntry y = new FileEntry(x);
         y.xStartBlock = xFileAlloc[0].ThisBlock;
         xFileDirectory.Add(y);
         return xDoAdd(ref xIOIn, ref xEntAlloc, ref xFileAlloc);
     }
     catch (Exception x) { return (xActive = false); throw x; }
 }
开发者ID:DarrenRainey,项目名称:snes360savegameconverter,代码行数:32,代码来源:STFSPackage.cs

示例3: xInject

 internal bool xInject(DJsIO xIOin)
 {
     if (!Opened && !ReadBlocks())
         return false;
     try
     {
         if (xIOin.Length > 0xFFFFFFFF)
             return false;
         uint y = xIOin.BlockCountSTFS();
         List<BlockRecord> x = xBlocks.ToList();
         List<BlockRecord> xdel = null;
         if (y > xBlocks.Length)// Allocates data for blocks needed
             x.AddRange(xPackage.xAllocateBlocks((uint)(y - xBlocks.Length), 0));
         else
         {
             xdel = new List<BlockRecord>();
             for (int i = (int)y; i < x.Count; i++)
             {
                 xdel.Add(x[i]);
                 x.RemoveAt(i--);
             }
         }
         bool success = xPackage.xWriteTo(ref xIOin, x.ToArray());
         if (success)
         {
             xBlocks = x.ToArray();
             if (xdel != null && xdel.Count != 0)
                 xPackage.xDeleteChain(xdel.ToArray());
         }
         return (success & ClearBlocks());
     }
     catch { ClearBlocks(); return false; }
 }
开发者ID:DarrenRainey,项目名称:snes360savegameconverter,代码行数:33,代码来源:STFSPackage.cs

示例4: xWriteTo

 /// <summary>
 /// Writes a file via blocks
 /// </summary>
 /// <param name="xIOIn"></param>
 /// <param name="xBlocks"></param>
 /// <returns></returns>
 internal bool xWriteTo(ref DJsIO xIOIn, BlockRecord[] xBlocks)
 {
     if (!xIOIn.Accessed || (xIOIn.BlockCountSTFS() != xBlocks.Length))
         return false;
     try
     {
         xIOIn.Position = 0;
         for (int i = 0; i < xBlocks.Length - 1; i++)
         {
             // Finds spot and writes block of data
             xIO.Position = GenerateDataOffset(xBlocks[i].ThisBlock);
             xIO.Write(xIOIn.ReadBytes(0x1000));
         }
         xIO.Position = GenerateDataOffset(xBlocks[xBlocks.Length - 1].ThisBlock);
         xIO.Write(xIOIn.ReadBytes(xIOIn.BlockRemainderSTFS()));
         xIO.Flush();
         return true;
     }
     catch { return false; }
 }
开发者ID:DarrenRainey,项目名称:snes360savegameconverter,代码行数:26,代码来源:STFSPackage.cs


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