bool LoadSaveName(int save) { if (!saveGameDict.ContainsKey(save)) return false; FileProxy file = new FileProxy(Path.Combine(saveGameDict[save], SaveNameTxt), FileUsage.UseMemory, true); saveName = file.ReadCString(0, 0); file.Close(); return true; }
/// <summary> /// Loads a Daggerfall palette file (supports both .PAL and .COL files). /// </summary> /// <param name="FilePath">Absolute path to palette file.</param> /// <returns>True if successful, otherwise false.</returns> public bool Load(string FilePath) { FileProxy fileProxy = new FileProxy(FilePath, FileUsage.UseMemory, true); switch (fileProxy.Length) { case 768: headerLength = 0; break; case 776: headerLength = 8; break; default: return false; } // Read palette BinaryReader reader = fileProxy.GetReader(); if (fileProxy.Length != reader.Read(paletteBuffer, 0, (int)fileProxy.Length)) return false; return true; }
/// <summary> /// Load a text resource file. /// </summary> public void Load(string arena2Path, string filename, FileUsage usage = FileUsage.UseMemory, bool readOnly = true) { // Check text resource file is supported if (filename != Filename) { throw new Exception(string.Format("TextFile: File '{0}' is not a supported text file.", filename)); } // Setup new file header = new TextRecordDatabaseHeader(); recordIdToIndexDict.Clear(); isLoaded = false; // Load file fileProxy = new FileProxy(Path.Combine(arena2Path, filename), usage, readOnly); // Read file BinaryReader reader = fileProxy.GetReader(); ReadHeader(reader); ReadTextRecordHeaders(reader); // Raise loaded flag isLoaded = true; }