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


C# ArcView类代码示例

本文整理汇总了C#中ArcView的典型用法代码示例。如果您正苦于以下问题:C# ArcView类的具体用法?C# ArcView怎么用?C# ArcView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TryOpen

 public override ArcFile TryOpen(ArcView file)
 {
     int count = file.View.ReadInt32 (4);
     if (!IsSaneCount (count))
         return null;
     uint index_offset = 8;
     var base_name = Path.GetFileNameWithoutExtension (file.Name);
     var dir = new List<Entry> (count);
     for (int i = 0; i < count; ++i)
     {
         var offset = file.View.ReadUInt32 (index_offset);
         var size   = file.View.ReadUInt32 (index_offset+4);
         if (0 != size)
         {
             var name = string.Format ("{0}#{1:D4}", base_name, i);
             var entry = AutoEntry.Create (file, offset, name);
             entry.Size = size;
             if (!entry.CheckPlacement (file.MaxOffset))
                 return null;
             dir.Add (entry);
         }
         index_offset += 8;
     }
     return new ArcFile (file, this, dir);
 }
开发者ID:Casidi,项目名称:GARbro,代码行数:25,代码来源:ArcALK.cs

示例2: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            uint index_offset = file.View.ReadUInt32 (0);
            int count = file.View.ReadInt32 (4);
            if (index_offset < 8 || index_offset >= file.MaxOffset || !IsSaneCount (count))
                return null;
            uint index_size = (uint)count * 0x28u;
            if (index_size > file.MaxOffset - index_offset)
                return null;
            var index = file.View.ReadBytes (index_offset, index_size);
            // last byte of the first filename presumably is zero
            byte key = index[0x1F];
            for (int i = 0; i < index.Length; ++i)
                index[i] ^= key;

            int current = 0;
            var dir = new List<Entry> (count);
            for (int i = 0; i < count; ++i)
            {
                int name_offset = '\\' == index[current] ? 1 : 0;
                var name = Binary.GetCString (index, current+name_offset, 0x20-name_offset);
                if (0 == name.Length)
                    return null;
                var entry = FormatCatalog.Instance.Create<Entry> (name);
                entry.Offset = LittleEndian.ToUInt32 (index, current+0x20);
                entry.Size   = LittleEndian.ToUInt32 (index, current+0x24);
                if (!entry.CheckPlacement (file.MaxOffset))
                    return null;
                dir.Add (entry);
                current += 0x28;
            }
            return new ArcFile (file, this, dir);
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:33,代码来源:ArcMPK.cs

示例3: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            uint height = file.View.ReadUInt32 (4);
            uint width  = file.View.ReadUInt32 (8);
            int count   = file.View.ReadInt32 (12);
            if (!IsSaneCount (count))
                return null;
            uint dir_size = file.View.ReadUInt32 (20);
            uint cur_offset = 24;
            uint data_offset = cur_offset + dir_size;
            uint data_size = file.View.ReadUInt32 (data_offset);
            data_offset += 4;

            var dir = new List<Entry> (count);
            for (int i = 0; i < count; ++i)
            {
                var entry = new LwgImageEntry();
                entry.PosX = file.View.ReadInt32 (cur_offset);
                entry.PosY = file.View.ReadInt32 (cur_offset+4);
                entry.BPP = file.View.ReadByte (cur_offset+8);
                entry.Offset = data_offset + file.View.ReadUInt32 (cur_offset+9);
                entry.Size = file.View.ReadUInt32 (cur_offset+13);

                uint name_length = file.View.ReadByte (cur_offset+17);
                string name = file.View.ReadString (cur_offset+18, name_length);
                entry.Name = name + ".wcg";
                cur_offset += 18+name_length;
                if (cur_offset > dir_size+24)
                    return null;
                if (entry.CheckPlacement (data_offset + data_size))
                    dir.Add (entry);
            }
            return new ArcFile (file, this, dir);
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:34,代码来源:ArcLWG.cs

示例4: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            int version = file.View.ReadByte (4) - '0';
            if (version < 0 || !file.View.AsciiEqual (5, "0__"))
                return null;
            int count = file.View.ReadInt32 (0xC);
            if (!IsSaneCount (count))
                return null;

            uint index_offset = 0x10;
            var dir = new List<Entry> (count);
            for (int i = 0; i < count; ++i)
            {
                var name = file.View.ReadString (index_offset, 0x100);
                if (string.IsNullOrWhiteSpace (name))
                    return null;
                index_offset += 0x100;
                var entry = FormatCatalog.Instance.Create<Entry> (name);
                entry.Offset = file.View.ReadInt64 (index_offset);
                entry.Size   = file.View.ReadUInt32 (index_offset+8);
                if (!entry.CheckPlacement (file.MaxOffset))
                    return null;
                dir.Add (entry);
                index_offset += 0x10;
            }
            return new ArcFile (file, this, dir);
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:27,代码来源:ArcSZS.cs

示例5: TryOpen

 public override ArcFile TryOpen(ArcView file)
 {
     int count = file.View.ReadInt32 (0);
     if (!IsSaneCount (count))
         return null;
     long index_offset = 4;
     const int name_length = 0x20;
     uint index_size = (uint)(count * (name_length + 8));
     if (index_size > file.View.Reserve (index_offset, index_size))
         return null;
     var dir = new List<Entry>();
     for (int i = 0; i < count; ++i)
     {
         string name = file.View.ReadString (index_offset, (uint)name_length);
         if (0 == name.Length)
             return null;
         index_offset += name_length;
         var entry = FormatCatalog.Instance.Create<Entry> (name);
         entry.Offset = file.View.ReadUInt32 (index_offset);
         entry.Size   = file.View.ReadUInt32 (index_offset+4);
         if (entry.Offset < index_size+4 || !entry.CheckPlacement (file.MaxOffset))
             return null;
         dir.Add (entry);
         index_offset += 8;
     }
     return new ArcFile (file, this, dir);
 }
开发者ID:Casidi,项目名称:GARbro,代码行数:27,代码来源:ArcARC.cs

示例6: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            if (!file.Name.EndsWith (".vpk", StringComparison.InvariantCultureIgnoreCase))
                return null;
            var vtb_name = Path.ChangeExtension (file.Name, "vtb");
            if (!VFS.FileExists (vtb_name))
                return null;
            var vtb_entry = VFS.FindFile (vtb_name);
            int count = (int)(vtb_entry.Size / 0x0C) - 1;
            if (!IsSaneCount (count))
                return null;

            using (var vtb = VFS.OpenView (vtb_entry))
            {
                vtb.View.Reserve (0, (uint)vtb.MaxOffset);
                uint index_offset = 0;
                uint next_offset = vtb.View.ReadUInt32 (8);
                var dir = new List<Entry> (count);
                for (int i = 0; i < count; ++i)
                {
                    string name = vtb.View.ReadString (index_offset, 8) + ".vaw";
                    var entry = FormatCatalog.Instance.Create<Entry> (name);
                    entry.Offset = next_offset;
                    index_offset += 0xC;
                    next_offset = vtb.View.ReadUInt32 (index_offset+8);
                    entry.Size = next_offset - (uint)entry.Offset;
                    if (!entry.CheckPlacement (file.MaxOffset))
                        return null;
                    dir.Add (entry);
                }
                return new ArcFile (file, this, dir);
            }
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:33,代码来源:ArcVPK.cs

示例7: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            long index_end = file.MaxOffset - 4;
            uint index_size = file.View.ReadUInt32 (index_end);
            if (0 == index_size || index_size >= index_end)
                return null;

            long index_offset = index_end - index_size;
            if (index_size > file.View.Reserve (index_offset, index_size))
                return null;

            var dir = new List<Entry>();
            while (index_offset < index_end)
            {
                uint name_len = file.View.ReadByte (index_offset++);
                if (0 == name_len)
                    break;
                if (name_len+14 > index_end-index_offset)
                    return null;
                string name = file.View.ReadString (index_offset, name_len);
                index_offset += name_len+6;
                var entry = FormatCatalog.Instance.Create<Entry> (name);
                entry.Size = file.View.ReadUInt32 (index_offset);
                entry.Offset = file.View.ReadUInt32 (index_offset+4);
                if (!entry.CheckPlacement (index_offset))
                    return null;
                dir.Add (entry);
                index_offset += 8;
            }
            if (0 == dir.Count)
                return null;
            return new ArcFile (file, this, dir);
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:33,代码来源:ArcPK.cs

示例8: TryOpen

 public override ArcFile TryOpen(ArcView file)
 {
     if (!file.Name.EndsWith (".pb", StringComparison.InvariantCultureIgnoreCase))
         return null;
     int count = file.View.ReadInt32 (0);
     if (count <= 0 || count > 0xfff)
         return null;
     var dir = new List<Entry> (count);
     int index_offset = 0x10;
     bool is_voice = Path.GetFileName (file.Name).Equals ("voice.pb", StringComparison.InvariantCultureIgnoreCase);
     int data_offset = index_offset + 8 * count;
     for (int i = 0; i < count; ++i)
     {
         uint offset = file.View.ReadUInt32 (index_offset);
         Entry entry;
         if (!is_voice)
             entry = AutoEntry.Create (file, offset, i.ToString ("D4"));
         else
             entry = new Entry { Name = string.Format ("{0:D4}.pb", i), Type = "archive", Offset = offset };
         entry.Size = file.View.ReadUInt32 (index_offset + 4);
         if (offset < data_offset || !entry.CheckPlacement (file.MaxOffset))
             return null;
         dir.Add (entry);
         index_offset += 8;
     }
     return new ArcFile (file, this, dir);
 }
开发者ID:Casidi,项目名称:GARbro,代码行数:27,代码来源:ArcKAAS.cs

示例9: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            uint index_offset = file.View.ReadUInt32 (4);
            if (index_offset >= file.MaxOffset)
                return null;
            int count = file.View.ReadInt32 (index_offset);
            if (!IsSaneCount (count))
                return null;
            index_offset += 4;
            uint index_size = (uint)(count * 0x88);
            if (index_size > file.View.Reserve (index_offset, index_size))
                return null;

            var dir = new List<Entry> (count);
            for (int i = 0; i < count; ++i)
            {
                string name = file.View.ReadString (index_offset+8, 0x80);
                var entry = FormatCatalog.Instance.Create<Entry> (name);
                entry.Offset = file.View.ReadUInt32 (index_offset);
                entry.Size   = file.View.ReadUInt32 (index_offset+4);
                if (!entry.CheckPlacement (file.MaxOffset))
                    return null;
                dir.Add (entry);
                index_offset += 0x88;
            }
            return new ArcFile (file, this, dir);
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:27,代码来源:ArcGPK2.cs

示例10: TryOpen

 public override ArcFile TryOpen(ArcView file)
 {
     int count = file.View.ReadInt32 (4);
     if (!IsSaneCount (count))
         return null;
     uint data_offset = file.View.ReadUInt32 (8);
     if (data_offset < 0x10 + count * 0x20)
         return null;
     if (data_offset > file.View.Reserve (0, data_offset))
         return null;
     uint index_offset = 0x10;
     var dir = new List<Entry> (count);
     for (int i = 0; i < count; ++i)
     {
         var name = file.View.ReadString (index_offset, 0x18);
         var entry = FormatCatalog.Instance.Create<Entry> (name);
         entry.Size   = file.View.ReadUInt32 (index_offset+0x18);
         entry.Offset = file.View.ReadUInt32 (index_offset+0x1C);
         if (entry.Offset < data_offset || !entry.CheckPlacement (file.MaxOffset))
             return null;
         dir.Add (entry);
         index_offset += 0x20;
     }
     return new ArcFile (file, this, dir);
 }
开发者ID:Casidi,项目名称:GARbro,代码行数:25,代码来源:ArcAdvSysT.cs

示例11: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            if (!file.View.AsciiEqual (0, "BSS-Composition\0"))
                return null;
            int count = file.View.ReadByte (0x11);
            if (0 == count)
                return null;

            string base_name = Path.GetFileNameWithoutExtension (file.Name);
            var dir = new List<Entry> (count);
            uint current_offset = 0x20;
            for (int i = 0; i < count; ++i)
            {
                var entry = new Entry {
                    Name    = string.Format ("{0}#{1:D3}.bsg", base_name, i),
                    Type    = "image",
                    Offset  = current_offset,
                    Size    = 0x40 + file.View.ReadUInt32 (current_offset+0x36),
                };
                if (!entry.CheckPlacement (file.MaxOffset))
                    return null;
                dir.Add (entry);
                current_offset += entry.Size;
            }
            return new ArcFile (file, this, dir);
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:26,代码来源:ArcBSC.cs

示例12: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            if (!file.View.AsciiEqual (4, "OggS"))
                return null;

            uint current_offset = 0;
            uint first_size = file.View.ReadUInt32 (current_offset);
            if (first_size >= file.MaxOffset)
                return null;

            var dir = new List<Entry>();
            int n = 0;
            while (current_offset < file.MaxOffset)
            {
                uint size = file.View.ReadUInt32 (current_offset);
                if (current_offset + 4 + (long)size > file.MaxOffset)
                    return null;
                if (file.View.AsciiEqual (current_offset+4, "OggS"))
                {
                    var entry = new Entry {
                        Name    = string.Format ("{0:D5}.ogg", n++),
                        Type    = "audio",
                        Offset  = current_offset + 4,
                        Size    = size,
                    };
                    dir.Add (entry);
                }
                current_offset += 4+size;
            }
            return new ArcFile (file, this, dir);
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:31,代码来源:ArcSUD.cs

示例13: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            int signature = file.View.ReadInt16 (0);
            if (0x4656 != signature && 0x4C56 != signature)
                return null;
            int version = file.View.ReadInt16 (2);
            int count = file.View.ReadInt16 (4);
            if (!IsSaneCount (count))
                return null;
            int entry_size = file.View.ReadInt16 (6);
            int index_size = file.View.ReadInt32 (8);
            if (entry_size <= 0 || index_size <= 0 || file.MaxOffset != file.View.ReadUInt32 (0xC))
                return null;
            if (version >= 0x0200)
                return OpenV2 (file, count, entry_size, index_size);

            int index_offset = 0x10;
            var dir = new List<Entry> (count);
            for (int i = 0; i < count; ++i)
            {
                var name = file.View.ReadString (index_offset, 0x13);
                var entry = FormatCatalog.Instance.Create<PackedEntry> (name);
                entry.Offset = file.View.ReadUInt32 (index_offset+0x13);
                entry.Size   = file.View.ReadUInt32 (index_offset+0x17);
                entry.UnpackedSize = file.View.ReadUInt32 (index_offset+0x1B);
                entry.IsPacked     = 0 != file.View.ReadByte (index_offset+0x1F);
                if (!entry.CheckPlacement (file.MaxOffset))
                    return null;
                dir.Add (entry);
                index_offset += entry_size;
            }
            return new ArcFile (file, this, dir);
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:33,代码来源:ArcVFS.cs

示例14: TryOpen

 public override ArcFile TryOpen(ArcView file)
 {
     int count = file.View.ReadInt32 (8);
     if (!IsSaneCount (count))
         return null;
     uint base_offset = file.View.ReadUInt32 (0x0c);
     uint index_offset = 0x10;
     uint index_size = 4u * (uint)count;
     if (base_offset >= file.MaxOffset || base_offset < (index_offset+index_size))
         return null;
     if (index_size > file.View.Reserve (index_offset, index_size))
         return null;
     var index = new List<uint> (count);
     for (int i = 0; i < count; ++i)
     {
         uint offset = file.View.ReadUInt32 (index_offset);
         if (offset != 0xffffffff)
             index.Add (base_offset + offset);
         index_offset += 4;
     }
     var dir = new List<Entry> (index.Count);
     for (int i = 0; i < index.Count; ++i)
     {
         long offset = index[i];
         string name = file.View.ReadString (offset, 0x20);
         var entry = FormatCatalog.Instance.Create<Entry> (name);
         entry.Offset = offset + 0x24;
         entry.Size   = file.View.ReadUInt32 (offset+0x20);
         dir.Add (entry);
     }
     return new ArcFile (file, this, dir);
 }
开发者ID:Casidi,项目名称:GARbro,代码行数:32,代码来源:ArcGSP.cs

示例15: TryOpen

        public override ArcFile TryOpen(ArcView file)
        {
            #pragma warning disable 219
            string type;
            if (file.View.AsciiEqual (0, "M2TYPE_WAV"))
                type = "wave";
            else if (file.View.AsciiEqual (0, "M2T_BMP"))
                type = "bmp_";
            else if (file.View.AsciiEqual (0, "M2T_WORD"))
                type = "word";
            else
                return null;
            #pragma warning restore 219

            uint index_size = file.View.ReadUInt32 (file.MaxOffset-12);
            long index_offset = file.MaxOffset-0x14-index_size;
            int count = file.View.ReadInt32 (file.MaxOffset-8);
            if (index_offset <= 0 || count <= 0 || count > 0xfffff)
                return null;
            file.View.Reserve (index_offset, index_size);
            var dir = new List<Entry> (count);
            for (int i = 0; i < count; ++i)
            {
                var name = file.View.ReadString (index_offset, 0x10);
                var entry = FormatCatalog.Instance.Create<Entry> (name);
                entry.Offset = file.View.ReadUInt32 (index_offset+0x10);
                entry.Size   = file.View.ReadUInt32 (index_offset+0x14);
                if (!entry.CheckPlacement (file.MaxOffset))
                    return null;
                dir.Add (entry);
                index_offset += 0x18;
            }
            return new ArcFile (file, this, dir);
        }
开发者ID:Casidi,项目名称:GARbro,代码行数:34,代码来源:ArcFFA.cs


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