public Member GetWinner() { //Kan bara få fram vinnare om man kört 3ggr if (GameSeries.Count() != 3) { return(null); } int player1ScoreNum = 0; int player2ScoreNum = 0; //Loppar alla serier foreach (GameSerie serie in GameSeries) { //Sumemrar ihop bådas score från alla serier o i slutet if ... player1ScoreNum += serie.Player1Score; player2ScoreNum += serie.Player2Score; } if (player1ScoreNum > player2ScoreNum) { return(Player1); } if (player2ScoreNum > player2ScoreNum) { return(Player2); } }
public void LoadMessage(byte[] input, GameSeries series) { _series = series; _mstream = new MemoryStream(input); LoadMessage(); }
public void CreateMessage(GameSeries series, params object[] input) { _series = series; _inType = "Msg"; _MsgConfigWrite(input); }
public void RegisterSerie(int serieNo, int player1Score, int player2Score) { GameSerie serie = new GameSerie(); serie.Player1Score = player1Score; serie.Player2Score = player2Score; GameSeries.Add(serie); }
public msg4u(byte[] input, GameSeries series) { _GSeries = series; MsgData = input; // place input data to byte array data container CheckingVersioning(); LoadMessage(); }
public ppItemData(byte[] input, GameSeries sres) { series = sres; MemoryStream strinput = new MemoryStream(input); BinaryReader binread = new BinaryReader(strinput); DataLenght = binread.ReadUInt32(); DataCount = binread.ReadUInt32(); odatas = new uint[DataCount]; switch (series) { case GameSeries.SOS2JP: for (int i = 0; i < DataCount; i++) { odatas[i] = binread.ReadUInt32(); } unkw = new uint[10]; binread.BaseStream.Position = odatas[0]; VariableTypeConfig = Encoding.GetEncoding(932).GetString(binread.ReadBytes((int)(odatas[1] - odatas[0]))).Replace("\0", ""); if (VariableTypeConfig.Equals("ItemData", StringComparison.Ordinal) == false) { return; } binread.BaseStream.Position = odatas[1]; TextVar = Encoding.Unicode.GetString(binread.ReadBytes((int)(odatas[2] - odatas[1]))).Replace("\0", ""); binread.BaseStream.Position = odatas[2]; ModelVar = Encoding.GetEncoding(932).GetString(binread.ReadBytes((int)(odatas[11] - odatas[2]))).Replace("\0", ""); binread.BaseStream.Position = odatas[11]; InfoVariableConfig = Encoding.GetEncoding(932).GetString(binread.ReadBytes((int)(DataLenght - odatas[11]))).Replace("\0", ""); for (int i = 0; i < 8; i++) { unkw[i] = odatas[i + 3]; } unkw[8] = odatas[12]; unkw[9] = odatas[13]; // 14 data~ break; } binread.Close(); strinput.Close(); }
public Member GetWinner() { if (GameSeries.Count() < 3) { return(null); } int player1ScoreNum = 0; int player2ScoreNum = 0; foreach (GameSerie serie in GameSeries) { player1ScoreNum += serie.Player1Score; player2ScoreNum += serie.Player2Score; } if (player1ScoreNum > player2ScoreNum) { return(Player1); } if (player1ScoreNum < player2ScoreNum) { return(Player2); } return(null); }
public void Create(GameSeries series, string varinput, string textinput, bool hasmessage = true) { _GSeries = series; CheckingVersioning(); byte[] variablestring = Encoding.GetEncoding(932).GetBytes((string)varinput); byte[] messagestring = Encoding.Unicode.GetBytes((string)textinput); uint ExtraSectionEU = 0; uint varcountleft = (uint)Utils.RecountLenght(variablestring.Length); // calculate lenght of variable string with padding 2^2 uint msgcountleft = (uint)Utils.RecountLenght(messagestring.Length); // calculate lenght of text string with padding 2^2 int configlenght = Encoding.ASCII.GetBytes(_GCType).Length; uint typecountleft = (uint)Utils.RecountLenght(configlenght); // calculate lenght of GConfig uint SectionNumber = 0; if (isJapaneseMessage || isUSMessage) { SectionNumber = 3; } if (isUSMessage && hasmessage == false) { SectionNumber = 2; } if (isEroupeMessage) { SectionNumber = 4; ExtraSectionEU = 4; } uint lenght = 4 // File Lenght (4 byte) + 4 // File Count (4 byte) + (4 * SectionNumber) // FAT section lenght (4 byte per each) + (uint)configlenght + (uint)variablestring.Length + (uint)messagestring.Length + varcountleft + msgcountleft + typecountleft + ExtraSectionEU; byte[] binnew = new byte[lenght]; _mstream = new MemoryStream(binnew); BinaryWriter spwri = new BinaryWriter(_mstream); if (isUSMessage) { if (hasmessage) { spwri.Write(BitConverter.GetBytes(lenght), 0, 4); spwri.Write(BitConverter.GetBytes(3), 0, 4); spwri.Write(BitConverter.GetBytes(20), 0, 4); } else { spwri.Write(BitConverter.GetBytes(lenght), 0, 4); spwri.Write(BitConverter.GetBytes(3), 0, 4); spwri.Write(BitConverter.GetBytes(14), 0, 4); } } if (isJapaneseMessage) { spwri.Write(BitConverter.GetBytes(lenght), 0, 4); spwri.Write(BitConverter.GetBytes(3), 0, 4); spwri.Write(BitConverter.GetBytes(20), 0, 4); } if (isEroupeMessage) { spwri.Write(BitConverter.GetBytes(lenght), 0, 4); spwri.Write(BitConverter.GetBytes(4), 0, 4); spwri.Write(BitConverter.GetBytes(24), 0, 4); } uint secondleft = 20 + (uint)configlenght + typecountleft; if (isUSMessage) { if (hasmessage) { spwri.Write(BitConverter.GetBytes(secondleft), 0, 4); } else { spwri.Write(BitConverter.GetBytes(secondleft - 4), 0, 4); } } if (isJapaneseMessage) { spwri.Write(BitConverter.GetBytes(secondleft), 0, 4); } if (isEroupeMessage) { spwri.Write(BitConverter.GetBytes(secondleft + 4), 0, 4); } byte[] tp = null; if (isUSMessage) { if (hasmessage) { spwri.Write(BitConverter.GetBytes(secondleft + variablestring.Length + varcountleft), 0, 4); tp = Encoding.ASCII.GetBytes(_GCType); spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); tp = variablestring; spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); tp = messagestring; spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); } else { spwri.Write(BitConverter.GetBytes(secondleft + variablestring.Length + varcountleft), 0, 4); tp = Encoding.ASCII.GetBytes(_GCType); spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); tp = variablestring; spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); } } if (isJapaneseMessage) { spwri.Write(BitConverter.GetBytes(secondleft + messagestring.Length + msgcountleft), 0, 4); tp = Encoding.ASCII.GetBytes(_GCType); spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); tp = messagestring; spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); tp = variablestring; spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); } if (isEroupeMessage) { spwri.Write(BitConverter.GetBytes(secondleft + variablestring.Length + varcountleft + 4), 0, 4); spwri.Write(BitConverter.GetBytes(secondleft + variablestring.Length + varcountleft + 4 + messagestring.Length + msgcountleft), 0, 4); tp = Encoding.ASCII.GetBytes(_GCType); spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); tp = variablestring; spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); tp = messagestring; spwri.Write(tp, 0, tp.Length); spwri.Write(new byte[Utils.RecountLenght(tp.Length)], 0, Utils.RecountLenght(tp.Length)); spwri.Write(BitConverter.GetBytes((int)lenght)); } MsgData = _mstream.ToArray(); _mstream.Close(); spwri.Close(); LoadMessage(); }
public uInformation() { InitializeComponent(); label4.Text = label4.Text.Replace("<file>", Path.GetFileName(Program.AConfig.FilePath[0])); textBox1.Text = Program.AConfig.FilePath[0]; label11.Text = ""; comboBox5.Items.Clear(); for (int i = 0; i < Program.mainXBB.getCount(); i++) { comboBox5.Items.Add(Program.mainXBB.getFileName(i)); } comboBox2.SelectedIndex = 0; comboBox3.SelectedIndex = 1; comboBox4.SelectedIndex = 2; comboBox5.SelectedIndex = 0; textBox13.TextAlign = HorizontalAlignment.Center; textBox14.TextAlign = HorizontalAlignment.Center; textBox15.TextAlign = HorizontalAlignment.Center; FileInfo fileinfo = new FileInfo(textBox1.Text); textBox2.Text = fileinfo.Name; textBox3.Text = fileinfo.Directory.ToString(); textBox4.Text = fileinfo.Length + " byte"; textBox5.Text = Program.mainXBB.getCount() + " file"; comboBox1.SelectedIndex = 0; progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainXBB.getCount(); GameSeries indexcombo = Utils.getSeries(Program.mainf.cb_method.SelectedIndex); Thread nTh = new Thread( new ThreadStart(() => { int counted = 0; int countblank = 0; int countmsgdata = 0; int countspace = 0; int countnewline = 0; int countlineall = 0; for (int i = 0; i < Program.mainXBB.getCount(); i++) { papa inputpapatemp = new papa(Program.mainXBB.getSelectedfile(i)); counted += (int)inputpapatemp.Count; countblank++; for (int j = 0; j < (inputpapatemp.Count - 1); j++) { msg4u msgtemp = new msg4u(inputpapatemp.getSelectedData(j), indexcombo); string strtemp = msgtemp.GetTextSection(); countlineall += strtemp.Length - strtemp.Replace(Environment.NewLine, string.Empty).Length; countmsgdata += strtemp.Length; countspace += strtemp.Count(Char.IsWhiteSpace); countnewline += strtemp.Count(Char.IsControl); } if (IsHandleCreated) { progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); } } this.BeginInvoke(new Action(() => { progressBar1.Value = 0; textBox6.Text = (counted - countblank) + " message, " + countblank + " blank"; textBox7.Text = countmsgdata + " character"; textBox13.Text = (countmsgdata - countspace - countnewline) + ""; textBox14.Text = countspace + ""; textBox15.Text = countnewline + ""; //textBox8.Text = (countmsgdata - countspace - countnewline) + " character without "+countspace+" space and "+countnewline+" controls"; textBox9.Text = countlineall + ""; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); }
private void button2_Click(object sender, EventArgs e) { Ookii.Dialogs.VistaFolderBrowserDialog folderdialog = new Ookii.Dialogs.VistaFolderBrowserDialog(); VistaSaveFileDialog folderdialog2 = new VistaSaveFileDialog(); string filename = ""; GameSeries indexcombo = Utils.getSeries(Program.mainf.cb_method.SelectedIndex); switch (comboBox1.SelectedIndex) { case 6: folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainXBB.getCount(); Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainXBB.getCount(); i++) { filename = Program.mainXBB.getFileName(i).Replace("\0", ""); papa tempapa = new papa(Program.mainXBB.getSelectedfile(i)); StringBuilder buildstr = new StringBuilder(); for (int j = 0; j < tempapa.Count - 1; j++) { msg4u newMsg = new msg4u(tempapa.getSelectedData(j), indexcombo); buildstr.AppendLine("============================================"); buildstr.AppendLine(newMsg.GetVariableSection()).Append("\n"); buildstr.AppendLine("--------------------------------------------"); buildstr.AppendLine(newMsg.GetTextSection()).Append("\n"); } progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + (i + 1) + " of " + Program.mainXBB.getCount(); })); File.WriteAllText(pathe + @"\" + filename + ".txt", buildstr.ToString(), Encoding.UTF8); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 0: folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainXBB.getCount(); Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainXBB.getCount(); i++) { File.WriteAllBytes(pathe + Program.mainXBB.getFileName(i).Replace("\0", "") + ".pp", Program.mainXBB.getSelectedfile(i)); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { progressBar1.Text = "Progress : " + i + " of " + Program.mainXBB.getCount(); })); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 1: folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainXBB.getCount(); Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainXBB.getCount(); i++) { filename = Program.mainXBB.getFileName(i).Replace("\0", ""); papa tempapa = new papa(Program.mainXBB.getSelectedfile(i)); ppmsg4 newtempjson = new ppmsg4(); newtempjson.Date = DateTime.Now; newtempjson.Author = "BokujoMessage4 JSON generated files"; newtempjson.Content = new pmsg4[tempapa.Count - 1]; for (int j = 0; j < tempapa.Count - 1; j++) { msg4u newMsg = new msg4u(tempapa.getSelectedData(j), indexcombo); newtempjson.Content[j].VardId = newMsg.GetVariableSection(); newtempjson.Content[j].Text = newMsg.GetTextSection(); } progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + i + " of " + Program.mainXBB.getCount(); })); File.WriteAllText(pathe + @"\" + filename + ".json", JsonConvert.SerializeObject(newtempjson, Formatting.Indented), Encoding.UTF8); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 2: filename = Program.mainf.cb_xbb.Text; folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + filename + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainPP.Count; Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainPP.Count - 1; i++) { msg4u newMsg = new msg4u(Program.mainPP.getSelectedData(i), indexcombo); File.WriteAllText(pathe + newMsg.GetVariableSection() + ".txt", newMsg.GetTextSection(), Encoding.UTF8); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + i + " of " + Program.mainPP.Count; })); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 3: filename = Program.mainf.cb_xbb.Text; folderdialog = new Ookii.Dialogs.VistaFolderBrowserDialog(); folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + filename + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainPP.Count; Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainPP.Count - 1; i++) { msg4u newMsg = new msg4u(Program.mainPP.getSelectedData(i), indexcombo); File.WriteAllBytes(pathe + newMsg.GetVariableSection() + ".msg4", newMsg.GetMSGData()); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + i + " of " + Program.mainPP.Count; })); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 5: folderdialog.SelectedPath = Program.AConfig.FilePath[0]; if (folderdialog.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainXBB.getCount(); Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainXBB.getCount(); i++) { filename = Program.mainXBB.getFileName(i).Replace("\0", ""); papa tempapa = new papa(Program.mainXBB.getSelectedfile(i)); FileInfo newFile = new FileInfo(pathe + @"\" + filename + ".xlsx"); ExcelPackage pck = new ExcelPackage(newFile); if (File.Exists(newFile.FullName)) { File.Delete(newFile.FullName); } var ws = pck.Workbook.Worksheets.Add(filename); for (int j = 0; j < tempapa.Count - 1; j++) { msg4u newMsg = new msg4u(tempapa.getSelectedData(j), indexcombo); ws.Cells["A" + (j + 1)].Value = newMsg.GetVariableSection(); ws.Cells["B" + (j + 1)].Value = newMsg.GetTextSection(); } progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + (i + 1) + " of " + Program.mainXBB.getCount(); })); pck.Save(); } label11.BeginInvoke(new Action(() => { label11.Text = ""; })); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value = 0; })); uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); } break; case 4: filename = Program.mainf.cb_xbb.Text; folderdialog2.FileName = filename + ".json"; folderdialog2.Filter = "JSON files (*.json) | *.json"; folderdialog2.InitialDirectory = Program.AConfig.FilePath[0]; if (folderdialog2.ShowDialog() == DialogResult.OK) { uxTabControl1.Enabled = false; string pathe = Path.GetDirectoryName(folderdialog2.InitialDirectory) + @"\"; if (!Directory.Exists(pathe)) { Directory.CreateDirectory(pathe); } ppmsg4 newtempjson = new ppmsg4(); newtempjson.Date = DateTime.Now; newtempjson.Author = "BokujoMessage4 JSON generated files"; newtempjson.Content = new pmsg4[Program.mainPP.Count - 1]; progressBar1.Value = 0; progressBar1.Maximum = (int)Program.mainPP.Count; Thread nTh = new Thread( new ThreadStart(() => { for (int i = 0; i < Program.mainPP.Count - 1; i++) { msg4u newMsg = new msg4u(Program.mainPP.getSelectedData(i), indexcombo); newtempjson.Content[i].VardId = newMsg.GetVariableSection(); newtempjson.Content[i].Text = newMsg.GetTextSection(); progressBar1.BeginInvoke(new Action(() => { progressBar1.Value += 1; })); label11.BeginInvoke(new Action(() => { label11.Text = "Progress : " + i + " of " + Program.mainPP.Count; })); } uxTabControl1.BeginInvoke(new Action(() => { uxTabControl1.Enabled = true; })); GC.Collect(9, GCCollectionMode.Forced); })); nTh.Start(); File.WriteAllText(folderdialog2.FileName, JsonConvert.SerializeObject(newtempjson, Formatting.Indented), Encoding.UTF8); } break; } }
public byte[] GetData(GameSeries sres, params object[] input) { MemoryStream strinput = null; BinaryWriter binread; byte[] getdatatemp; int lenghtinput = 0; switch (series) { case GameSeries.SOS2JP: /* make sure input is 13 data : * 0 - Text name * 1 - model name * 2 - INFO var name * 3 - /*rest unknown value*///8-, -2 lenghtinput += (4 * 14) + (8); int variabletxtlenght = Encoding.GetEncoding(932).GetBytes("ItemData").Length; int minusrecal = Utils.RecountLenght(variabletxtlenght); variabletxtlenght += minusrecal; lenghtinput += variabletxtlenght; int texttxtlenght = Encoding.Unicode.GetBytes((string)input[0]).Length; int minusrecal1 = Utils.RecountLenght(texttxtlenght); texttxtlenght += minusrecal1; lenghtinput += texttxtlenght; int modelstrtxtlenght = Encoding.GetEncoding(932).GetBytes((string)input[1]).Length; int minusrecal2 = Utils.RecountLenght(modelstrtxtlenght); modelstrtxtlenght += minusrecal2; lenghtinput += modelstrtxtlenght; int infostrtxtlenght = Encoding.GetEncoding(932).GetBytes((string)input[2]).Length; int minusrecal3 = Utils.RecountLenght(infostrtxtlenght); infostrtxtlenght += minusrecal3; lenghtinput += infostrtxtlenght; getdatatemp = new byte[lenghtinput]; strinput = new MemoryStream(getdatatemp); binread = new BinaryWriter(strinput); binread.Write(BitConverter.GetBytes(lenghtinput), 0, 4); binread.Write(BitConverter.GetBytes(14), 0, 4); binread.Write(BitConverter.GetBytes(0x40), 0, 4); binread.Write(BitConverter.GetBytes(0x40 + variabletxtlenght), 0, 4); binread.Write(BitConverter.GetBytes(0x40 + variabletxtlenght + texttxtlenght), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[3]), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[4]), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[5]), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[6]), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[7]), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[8]), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[9]), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[10]), 0, 4); binread.Write(BitConverter.GetBytes(0x40 + variabletxtlenght + texttxtlenght + modelstrtxtlenght), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[11]), 0, 4); binread.Write(BitConverter.GetBytes((uint)input[12]), 0, 4); binread.Write(Encoding.GetEncoding(932).GetBytes("ItemData")); binread.Write(new byte[minusrecal]); binread.Write(Encoding.Unicode.GetBytes((string)input[0])); binread.Write(new byte[minusrecal1]); binread.Write(Encoding.GetEncoding(932).GetBytes((string)input[1])); binread.Write(new byte[minusrecal2]); binread.Write(Encoding.GetEncoding(932).GetBytes((string)input[2])); binread.Write(new byte[minusrecal3]); break; } return(strinput.ToArray()); }
public void setGameSeries(GameSeries series) { _series = series; }