// ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="BfshaFileLoader"/> class loading data into the given /// <paramref name="bfshaFile"/> from the specified <paramref name="stream"/> which is optionally left open. /// </summary> /// <param name="bfshaFile">The <see cref="Bfsha.bfshaFile"/> instance to load data into.</param> /// <param name="stream">The <see cref="Stream"/> to read data from.</param> /// <param name="leaveOpen"><c>true</c> to leave the stream open after reading, otherwise <c>false</c>.</param> internal BfshaFileLoader(BfshaFile bfshaFile, Stream stream, bool leaveOpen = false) : base(stream, Encoding.ASCII, leaveOpen) { ByteOrder = ByteOrder.LittleEndian; BfshaFile = bfshaFile; _dataMap = new Dictionary <uint, IResData>(); }
public static void Save(BfshaFile bfshaFile, string FileName) { XmlDocument doc = new XmlDocument(); XmlNode mainNode = doc.CreateElement("SHARCFB"); AddAttribute(doc, "Name", bfshaFile.Name, mainNode); doc.AppendChild(mainNode); }
public void Load(Stream stream) { BfshaFile = new BfshaFile(stream); this.Header = BfshaFile.Name; foreach (var model in BfshaFile.ShaderModels.Values) { AddChild(LoadShaderModel(model)); } Tag = this; }
public void Load(System.IO.Stream stream) { Text = FileName; bool IsWiiU = CheckWiiU(new FileReader(stream, true)); if (IsWiiU) { } else { BfshaFile bfshaFile = new BfshaFile(stream); foreach (var model in bfshaFile.ShaderModels) { var wrapper = new ShaderModelWrapper(); wrapper.Read(model); Nodes.Add(wrapper); } } }
/// <summary> /// Initializes a new instance of the <see cref="BfshaFileSaver"/> class for the file with the given /// <paramref name="fileName"/>. /// </summary> /// <param name="BfshaFile">The <see cref="Bfsha.BfshaFile"/> instance to save.</param> /// <param name="fileName">The name of the file to save the data into.</param> internal BfshaFileSaver(BfshaFile BfshaFile, string fileName) : this(BfshaFile, new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Read), false) { }
// ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="BfshaFileSaver"/> class saving data from the given /// <paramref name="BfshaFile"/> into the specified <paramref name="stream"/> which is optionally left open. /// </summary> /// <param name="BfshaFile">The <see cref="Bfsha.BfshaFile"/> instance to save data from.</param> /// <param name="stream">The <see cref="Stream"/> to save data into.</param> /// <param name="leaveOpen"><c>true</c> to leave the stream open after writing, otherwise <c>false</c>.</param> internal BfshaFileSaver(BfshaFile bfshaFile, Stream stream, bool leaveOpen) : base(stream, Encoding.ASCII, leaveOpen) { ByteOrder = ByteOrder.LittleEndian; BfshaFile = bfshaFile; }
/// <summary> /// Initializes a new instance of the <see cref="BfshaFileLoader"/> class from the file with the given /// <paramref name="fileName"/>. /// </summary> /// <param name="BfshaFile">The <see cref="Bfsha.BfshaFile"/> instance to load data into.</param> /// <param name="fileName">The name of the file to load the data from.</param> internal BfshaFileLoader(BfshaFile BfshaFile, string fileName) : this(BfshaFile, new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { }