/// <summary> /// Populates a GSC file with the strings stored in this translation file. /// </summary> /// <param name="file"></param> internal void Populate(GscFile file) { for (int i = 0; i < _Strings.Count && i < file.Strings.Length; i++) { file.Strings[i] = _Strings[i]; } }
public static GscFile FromBytes(byte[] bytes) { using (var stream = new MemoryStream(bytes)) { return(GscFile.FromStream(stream)); } }
public static GscFile FromFile(string path) { using (var stream = File.OpenRead(path)) { return(GscFile.FromStream(stream)); } }
/// <summary> /// Turns this translation file into a GSC file that can be used in the game. /// </summary> /// <param name="refGsc">Path to the reference GSC.</param> /// <returns>The GSC representation of this translation file.</returns> public GscFile ToGSC(string refGsc) { var gsc = GscFile.FromFile(refGsc); Populate(gsc); return(gsc); }
/// <summary> /// Converts a GSC file (internal representation) into a TransFile (easily translatable). /// </summary> /// <param name="file">The file to be converted.</param> /// <returns>The TransFile representation of the GSC file.</returns> public static TransFile FromGSC(GscFile file) { var trans = new TransFile(); trans.PopulateFrom(file); return(trans); }
/// <summary> /// Converts a GSC file (internal representation) into a TransFile (easily translatable). /// </summary> /// <param name="file">The file to be converted.</param> /// <returns>The TransFile representation of the GSC file.</returns> public static TransFile FromGSC(string file) { return(TransFile.FromGSC(GscFile.FromFile(file))); }
/// <summary> /// Loads the strings defined by a GSC file into this translation file. /// </summary> /// <param name="file"></param> internal void PopulateFrom(GscFile file) { _Strings = file.Strings.ToList(); }