private void ReloadData() { if (sss.OtherCodesIgnoredInSameFile > 0) { MessageBox.Show(this, "More than one Custom SSS code found in the codeset. All but the last one will be ignored.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } var screen1 = new List<StagePair>(); var screen2 = new List<StagePair>(); var definitions = new List<StagePair>(); for (int i = 0; i < sss.sss3.Length; i += 2) { definitions.Add(new StagePair { stage = sss.sss3[i], icon = sss.sss3[i + 1], }); } foreach (byte b in sss.sss1) { screen1.Add(definitions[b]); } foreach (byte b in sss.sss2) { screen2.Add(definitions[b]); } PairListModel model = new PairListModel(); for (int i = 0; i < model.songsByStage.Length; i++) { Song s; model.songsByStage[i] = sss.SongLoaders.TryGetSong((byte)i, out s) ? s : null; } for (int i = 0; i < model.icons.Length; i++) { var tex = new TextureContainer(md80, i); if (tex.icon_tex0 != null) { using (MemoryStream ms = new MemoryStream()) { tex.icon_tex0.GetImage(0).Save(ms, ImageFormat.Png); model.icons[i] = ms.ToArray(); } } } for (int i=0; i<definitions.Count; i++) { StagePair pair = definitions[i]; model.pairs.Add(new ModelPair { icon = pair.icon, stage = pair.stage, origId = i }); } model.screen1 = sss.sss1; model.screen2 = sss.sss2; html = webBrowser1.DocumentText = RazorEngine.Engine.Razor.RunCompile(Resources.PairList, "PairList", typeof(PairListModel), model); }
private void ReloadData() { if (sss.OtherCodesIgnoredInSameFile > 0) { MessageBox.Show(this, "More than one Custom SSS code found in the codeset. All but the last one will be ignored.", Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } List <StagePair> screen1 = new List <StagePair>(); List <StagePair> screen2 = new List <StagePair>(); List <StagePair> definitions = new List <StagePair>(); for (int i = 0; i < sss.sss3.Length; i += 2) { definitions.Add(new StagePair { stage = sss.sss3[i], icon = sss.sss3[i + 1], }); } foreach (byte b in sss.sss1) { screen1.Add(definitions[b]); } foreach (byte b in sss.sss2) { screen2.Add(definitions[b]); } PairListModel model = new PairListModel(); for (int i = 0; i < model.songsByStage.Length; i++) { model.songsByStage[i] = sss.SongLoaders.GetSong(i); } for (int i = 0; i < model.icons.Length; i++) { TextureContainer tex = new TextureContainer(md80, i); if (tex.icon_tex0 != null) { using (MemoryStream ms = new MemoryStream()) { tex.icon_tex0.GetImage(0).Save(ms, ImageFormat.Png); model.icons[i] = ms.ToArray(); } } } for (int i = 0; i < definitions.Count; i++) { StagePair pair = definitions[i]; model.pairs.Add(new ModelPair { icon = pair.icon, stage = pair.stage, origId = i }); } model.screen1 = sss.sss1; model.screen2 = sss.sss2; html = webBrowser1.DocumentText = RazorEngine.Engine.Razor.RunCompile(Resources.PairList, "PairList", typeof(PairListModel), model); }