Ejemplo n.º 1
0
        // ---------- From here onwards, we shall read the unique resource files ---------- //

        public static ResourceClass.IResource ReadIResourceFile(bool headerOnly,
                                                                ChitinKey ckey, ResourceStruct.DelegateResourceFileReader resourceFileReader)
        {
            string overrideFile =
                ApplicationService.FindOverrideFile(ckey.name, ckey.resourceType);

            FileStream fileStream;
            int        fileOffset;
            int        fileSize;

            if (overrideFile != null) // Found it in override, so just use it
            {
                fileStream = Utils.ReadFileStream(overrideFile);
                fileOffset = 0;
                fileSize   = 0;
            }
            else if (ckey.isBiffed) // Load from biff file
            {
                ChitinBiff cbiff = ApplicationRuntime.ChitinIndex.CbiffCollection[ckey.biffIndex];

                if ((fileStream = ReadChitinBiffFile(cbiff)) == null)
                {
                    return(null);
                }

                if (ckey.resourceType != ResourceStruct.ResourceType.RTypeGTIS)
                {
                    fileOffset = cbiff.fileList[ckey.ckeyIndex].offset;
                    fileSize   = cbiff.fileList[ckey.ckeyIndex].size;
                }
                else
                {
                    fileOffset = cbiff.tileList[ckey.tileIndex].tileOffset;
                    fileSize   = cbiff.tileList[ckey.tileIndex].tileSize;
                }
            }
            else
            {
                return(null);
            }

            try
            {
                // apply the delegate here
                return(resourceFileReader(headerOnly, ckey, fileStream, fileOffset, fileSize));
            }
            catch (Exception e)
            {
                throw new ArgumentException(e.Message);
                //return null;
            }
        }
        static ApplicationRuntime()
        {
            appPaths  = new ApplicationPaths();
            appParams = new ApplicationParameters();

            ApplicationService.
            InitApplicationConfiguration(appPaths, appParams);

            InitializeInfinityFiles();
            InitializeCriticalControls();

            RichTextBoxLink.InitializeStaticPatterns();
        }
Ejemplo n.º 3
0
        public static void SelectNode(ChitinKey ckey)
        {
            string overrideFile =
                ApplicationService.FindOverrideFile(ckey.name, ckey.resourceType);

            if (overrideFile != null)
            {
                ApplicationRuntime.Workbench.StatusTSSL.Text = overrideFile;
            }
            else
            {
                ApplicationRuntime.Workbench.StatusTSSL.Text =
                    Path.Combine(ApplicationRuntime.AppPaths.GameDirectory,
                                 ApplicationRuntime.ChitinIndex.CbiffCollection[ckey.biffIndex].name);
            }
        }