/// <summary> /// Loads the specified binary tag structure and merges its tags with the current structure. The current structure is cleared in the process. /// </summary> /// <param name="stream">The stream that contains data about the binary tag structure.</param> public void LoadFrom(Stream stream) { BinaryTagStructure structure = new BinaryTagStructure(); structure.LoadStructure(stream); this.Clear(); this.Merge(structure, MergeMethod.Overwrite); }
/// <summary> /// Loads the binary tag structure from its file path. /// </summary> public void Load() { // Will only attempt to load the structure if the file exists. if (File.Exists(this.Path)) { BinaryTagStructure structure = new BinaryTagStructure(); structure.LoadStructure(new FileStream(this.Path, FileMode.Open, FileAccess.Read)); this.Merge(structure, MergeMethod.Overwrite); } }
/// <summary> /// Loads a binary tag structure from a stream. /// </summary> /// <param name="stream">The stream that contains data about the binary tag structure.</param> /// <returns>Returns a new binary tag structure loaded from a stream.</returns> public static BinaryTagStructure FromStream(Stream stream) { BinaryTagStructure structure = new BinaryTagStructure(); structure.LoadFrom(stream); return structure; }
/// <summary> /// Loads a binary tag structure from a file path. /// </summary> /// <param name="path">The file path of the binary tag structure.</param> /// <returns>Returns a new binary tag structure loaded from an external file path.</returns> public static BinaryTagStructure FromFile(string path) { BinaryTagStructure structure = new BinaryTagStructure(path); structure.Load(); return structure; }
/// <summary> /// Saves a copy of the binary tag structure to the specified file path. /// </summary> /// <param name="path">The file path of the binary tag structure.</param> public void SaveTo(string path) { BinaryTagStructure structure = new BinaryTagStructure(); structure.Merge(this, MergeMethod.Overwrite); structure.Save(); }
/// <summary> /// Loads the specified binary tag structure and merges its tags with the current property file using the specified merging method. /// </summary> /// <param name="path">The file path of the binary tag structure.</param> /// <param name="method">The method of merging.</param> public void MergeFrom(string path, MergeMethod method) { BinaryTagStructure structure = new BinaryTagStructure(path); structure.Load(); this.Merge(structure, method); }
/// <summary> /// Merges the given structure with the current structure using the specified merging method. /// </summary> /// <param name="structure">The structure to merge.</param> /// <param name="method">The method of merging.</param> public void Merge(BinaryTagStructure structure, MergeMethod method) { MergeCompound(this, structure, method); }