public void Load(string filePath, ClientType clientType) { StatusManager.AddLog("Starting loading TSI : " + filePath); try { this.Path = filePath; this.clientType = clientType; BinaryReader br = new BinaryReader(File.Open(filePath, FileMode.Open)); short DDSCount = br.ReadInt16(); this.listDDS = new List <DDS>(DDSCount); for (int i = 0; i < DDSCount; i++) { DDS newDDS = new DDS(); newDDS.Path = RoseFile.ReadSString(ref br); newDDS.ColourKey = br.ReadInt32(); this.listDDS.Add(newDDS); } short TotalementCount = br.ReadInt16(); for (int i = 0; i < DDSCount; i++) { short ElementCount = br.ReadInt16(); listDDS[i].ListDDS_element = new List <DDS.DDSElement>(ElementCount); for (int a = 0; a < ElementCount; a++) { DDS.DDSElement newElement = new DDS.DDSElement(); newElement.OwnerId = br.ReadInt16(); newElement.X = br.ReadInt32(); newElement.Y = br.ReadInt32(); newElement.Width = br.ReadInt32() - newElement.X; newElement.Height = br.ReadInt32() - newElement.Y; newElement.Color = br.ReadInt32(); newElement.Name = RoseFile.ReadFString(ref br, 0x20); listDDS[i].ListDDS_element.Add(newElement); } } br.Close(); StatusManager.AddLog("TSI successfully loaded"); } catch (Exception e) { StatusManager.AddLog("Error loading TSI : " + e.Message); } }
public void Load(string filePath) { this.Path = filePath; FileHandler = new RoseFileHandler(filePath, FileMode.Open, Encoding.GetEncoding("EUC-KR")); short DDSCount = FileHandler.Read <short>(); this.listDDS = new List <DDS>(DDSCount); for (int i = 0; i < DDSCount; i++) { DDS newDDS = new DDS(); newDDS.Path = FileHandler.ReadSString(); newDDS.ColourKey = FileHandler.Read <int>(); this.listDDS.Add(newDDS); } short TotalementCount = FileHandler.Read <short>(); for (int i = 0; i < DDSCount; i++) { short ElementCount = FileHandler.Read <short>(); listDDS[i].ListDDS_element = new List <DDS.DDSElement>(ElementCount); for (int a = 0; a < ElementCount; a++) { DDS.DDSElement newElement = new DDS.DDSElement(); newElement.OwnerId = FileHandler.Read <short>(); newElement.X = FileHandler.Read <int>(); newElement.Y = FileHandler.Read <int>(); newElement.Width = FileHandler.Read <int>() - newElement.X; newElement.Height = FileHandler.Read <int>() - newElement.Y; newElement.Color = FileHandler.Read <int>(); newElement.Name = FileHandler.Read <string>(0x20); listDDS[i].ListDDS_element.Add(newElement); } } FileHandler.Dispose(); }