//imported constructor public NBNKFile(BinaryReader br, SupportedGames mode) { holding = new List <byte[]>(); while (br.BaseStream.Position < br.BaseStream.Length) { byte[] magicArr = br.ReadBytes(4); string magic = Encoding.UTF8.GetString(magicArr); switch (magic) { case "BKHD": uint SLength = br.ReadUInt32(); BankHeader = new BKHD(SLength, br); uint bnkId = BankHeader.dwSoundbankID; string path = Directory.GetCurrentDirectory() + "/" + mode.ToString() + "/BNK/" + bnkId.ToString() + ".lbl"; if (File.Exists(path)) { MessageBoxResult labelRead = MessageBox.Show("Label file found. Read labels?", "Labels", MessageBoxButton.YesNo); if (labelRead == MessageBoxResult.Yes) { labels = new Labels(XmlReader.Create(path)); } else { labels = new Labels(); } } else { labels = new Labels(); } break; case "DIDX": DataIndex = new DIDX(br, labels); break; /*case "HIRC": * ObjectHierarchy = new HIRC(br); * break;*/ default: //this adds support to not-immediately-interpreted versions of WWise, assuming that the main 3 (BKHD, DIDX, DATA) do not change in structure SLength = br.ReadUInt32(); byte[] tLength = BitConverter.GetBytes(SLength); byte[] data = br.ReadBytes((int)SLength); byte[] section = HelperFunctions.Combine(HelperFunctions.Combine(magicArr, tLength), data); holding.Add(section); break; } } br.Close(); }
private void SaveLabels(object sender, CancelEventArgs e) { if (LabelsChanged) { //prompt user MessageBoxResult saveLabels = MessageBox.Show("Save changed labels?", "", MessageBoxButton.YesNo); if (saveLabels == MessageBoxResult.Yes) { nbnk.labels.Export(Directory.GetCurrentDirectory() + "/" + mode.ToString() + "/BNK/" + nbnk.BankHeader.dwSoundbankID.ToString() + ".lbl", nbnk.DataIndex.wemList, changedIds); } } LabelsChanged = false; changedIds = new List <uint>(); }
//imported constructor public NPCKHeader(BinaryReader br, SupportedGames Mode, string fileName) { mode = Mode; string labelPath = Directory.GetCurrentDirectory() + "/" + mode.ToString() + "/PCK/" + fileName + ".lbl"; if (File.Exists(labelPath)) { MessageBoxResult labelRead = MessageBox.Show("Label file found. Read labels?", "Labels", MessageBoxButton.YesNo); if (labelRead == MessageBoxResult.Yes) { labels = new Labels(XmlReader.Create(labelPath)); } } char[] magicBytes = br.ReadChars(4); uint headerLen = br.ReadUInt32(); unkn2 = br.ReadUInt32(); languageLength = br.ReadUInt32(); bnkTableLength = br.ReadUInt32(); wemTableLength = br.ReadUInt32(); unknStructLength = br.ReadUInt32(); long stringHeaderStart = br.BaseStream.Position; uint stringCount = br.ReadUInt32(); for (int i = 0; i < stringCount; i++) { PCKString stringData = new PCKString(br, Mode, stringHeaderStart); pckStrings.Add(stringData); } br.BaseStream.Seek(stringHeaderStart + languageLength, SeekOrigin.Begin); for (int i = 0; i < bnkTableLength / 4; i++) { br.ReadUInt32(); } //this is 4-aligned at least in RE Engine games uint wemACount = br.ReadUInt32(); for (int i = 0; i < wemACount; i++) { uint id = br.ReadUInt32(); uint one = br.ReadUInt32(); uint length = br.ReadUInt32(); uint offset = br.ReadUInt32(); uint languageEnum = br.ReadUInt32(); int workingOffset = (int)br.BaseStream.Position; br.BaseStream.Seek(offset, SeekOrigin.Begin); byte[] file = br.ReadBytes((int)length); br.BaseStream.Seek(workingOffset, SeekOrigin.Begin); string name; if (labels.wemLabels.ContainsKey(id)) { name = labels.wemLabels[id]; } else { name = "Imported Wem " + i; } Wem newWem = new Wem(name, id, file, languageEnum); WemList.Add(newWem); } //the unknStruct uint is right here, but we've already read what we need }
private void ChangeView() { GameSelect.Header = "Mode: " + mode.ToString(); MainControl.Content = mode; }
// You shouldn't ever need to sight a player. Only the main Metabans plugin should ever need to do this. public MetabansAPI mb_sight_player(SupportedGames game_name, string player_uid, string player_name, string group_name, string player_ip, string alternate_uid) { var hash = new Hashtable(); hash.Add("action", "mb_sight_player"); hash.Add("game_name", game_name.ToString()); hash.Add("player_uid", player_uid); hash.Add("player_name", player_name); hash.Add("group_name", group_name); if (player_ip != null) { hash.Add("player_ip", player_ip.Split(':')[0]); } hash.Add("alternate_uid", alternate_uid); m_requests.Add(hash); return this; }
public MetabansAPI mb_assess_player(SupportedGames game_name, string player_uid, AssessmentTypes assessment_type, string reason, int assessment_length) { var hash = new Hashtable(); hash.Add("action", "mb_assess_player"); hash.Add("game_name", game_name.ToString()); hash.Add("player_uid", player_uid); hash.Add("assessment_type", assessment_type.ToString()); hash.Add("reason", reason); hash.Add("assessment_length", assessment_length.ToString()); m_requests.Add(hash); return this; }