コード例 #1
0
ファイル: AssetsFile.cs プロジェクト: unusable/QuestomAssets
        public AssetsFile(AssetsManager manager, IAssetsFileProvider fileProvider, string assetsRootPath, string assetsFileName, bool loadData = true)
        {
            Manager        = manager;
            FileProvider   = fileProvider;
            AssetsRootPath = assetsRootPath;
            AssetsFilename = assetsFileName;

            OpenBaseStream();

            BaseStream.Seek(0, SeekOrigin.Begin);
            using (AssetsReader reader = new AssetsReader(BaseStream, false))
            {
                Header = new AssetsFileHeader(reader);
            }

            if (Header.MetadataSize > Header.FileSize || Header.ObjectDataOffset < Header.MetadataSize || Header.Version != 17)
            {
                throw new NotSupportedException($"{AssetsFilename} doesn't appear to be a valid assets file, or {Header.Version} is unsupported!");
            }

            if (loadData)
            {
                LoadData();
            }
        }
コード例 #2
0
        public static Node MakeNode(AssetsManager manager)
        {
            var trackedObjects = new Dictionary <object, Node>();
            var node           = new Node()
            {
                Text = "All Assets", TypeName = manager.GetType().Name, Obj = manager, Depth = 0
            };

            foreach (var f in manager.OpenFiles.OrderBy(x => x.AssetsFilename))
            {
                node.AddNode(MakeNode(f, 0, trackedObjects));
            }
            return(node);
        }
コード例 #3
0
ファイル: AssetsFile.cs プロジェクト: ivannpaz/QuestStopgap
 public AssetsFile(AssetsManager manager, string assetsFileName, Stream assetsFileStream, bool load = true)
 {
     Manager = manager;
     if (!assetsFileStream.CanSeek)
     {
         throw new NotSupportedException("Stream must support seeking!");
     }
     BaseStream     = assetsFileStream;
     AssetsFileName = assetsFileName;
     if (load)
     {
         Load();
     }
 }