private void Read(PTP ptp, Encoding newEncoding) { foreach (var a in ptp.Names) { Name.Add(new BMDName(a.Index, a.NewName.GetTextBases(newEncoding).GetByteArray())); } foreach (var a in ptp.Msg) { Msg.Add(new BMDMSG { Index = a.Index, Name = a.Name, Type = a.Type, NameIndex = a.CharacterIndex, MsgStrings = a.Strings.Select(x => x.GetNew(newEncoding)).ToArray() }); } }
public BMD(PTP ptp, Encoding newEncoding) { Read(ptp, newEncoding); }
/// <summary> /// Tries to open a file with the specified data type. /// </summary> /// <param name="name">Name of file</param> /// <param name="data">Data of file</param> /// <param name="type">Type of file</param> /// <returns>Return ObjectContainer for this file or null if an error occurred.</returns> public static GameFile OpenFile(string name, byte[] data, FormatEnum type) { try { IGameData Obj; if (type == FormatEnum.BIN) { Obj = new FileContainer.BIN(data); } else if (type == FormatEnum.SPR) { Obj = new SpriteContainer.SPR(data); } else if (type == FormatEnum.TMX) { Obj = new Sprite.TMX(data); } else if (type == FormatEnum.BF) { Obj = new FileContainer.BF(data, name); } else if (type == FormatEnum.PM1) { Obj = new FileContainer.PM1(data); } else if (type == FormatEnum.BMD) { Obj = new Text.BMD(data); } else if (type == FormatEnum.PTP) { Obj = new Text.PTP(data); } else if (type == FormatEnum.FNT) { Obj = new FNT(data); } else if (type == FormatEnum.FNT0) { Obj = new FNT0(data); } else if (type == FormatEnum.BVP) { Obj = new FileContainer.BVP(name, data); } else if (type == FormatEnum.TBL) { try { Obj = new FileContainer.TBL(data, name); } catch { Obj = new FileContainer.BIN(data); } } else if (type == FormatEnum.FTD) { Obj = new FTD(data); } else if (type == FormatEnum.DDS) { try { Obj = new Sprite.DDS(data); } catch { Obj = new Sprite.DDSAtlus(data); } } else if (type == FormatEnum.SPD) { Obj = new SpriteContainer.SPD(data); } else { Obj = new DAT(data); } return(new GameFile(name, Obj)); } catch { return(null); } }