/// <summary> /// Loads all of the AiFiles objects into the Global Namespace /// </summary> /// <param name="ConFile">The AI file to parse</param> /// <returns>Returns whether or not the file could be fully parsed</returns> public static bool RegisterFileObjects(AiFile ConFile) { // Parsing this file will add all objects to the Globals try { AiFileParser.Parse(ConFile); return(true); } catch (Exception) { // Remove all objects in the AiFile foreach (var item in Globals.Where(x => x.Value.FilePath == ConFile.FilePath).ToList()) { Globals.Remove(item.Key); } return(false); } }
/// <summary> /// Saves the Objects changes into the AiFile /// </summary> public void Save() { string fullPath = Path.Combine(Application.StartupPath, "Temp", FilePath); File.WriteAllText(fullPath, AiFileParser.ToFileFormat(this)); }
/// <summary> /// Returns all of this files objects into the Ai file format /// </summary> /// <returns></returns> public string GetParsedContents() { return(AiFileParser.ToFileFormat(this)); }