public static void Load(BinaryReader br) { Instance = null; long chunkOffset = br.FindChunk("TXTR"); br.Jump(chunkOffset); Instance = new TXTR(); Instance.LoadData(br); br.JumpBack(); }
private void Open_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog { Title = "Select data.win to open", CheckPathExists = true, CheckFileExists = true, Filter = "Game Maker .win files|*.win", FilterIndex = 0, Multiselect = false }; Stream fs = null; if (dialog.ShowDialog() == true) { fs = dialog.OpenFile(); } else { return; } using (BinaryReader br = new BinaryReader(fs)) { GEN8.Load(br); //GEN8 g = GEN8.Instance; //Console.WriteLine(string.Format("Filename: {0}\nName: {1}\nDisplayName: {2}\nSteamAppID: {3}", g.Filename, g.Name, g.DisplayName, g.SteamAppID)); TXTR.Load(br); SPRT.Load(br); BGND.Load(br); } List <Sprite> sprites = SPRT.Instance.Contents; SpriteList.Clear(); for (int i = 0; i < sprites.Count; i++) { Sprite spr = sprites[i]; if (spr.GetFrames().Length < 1) { continue; } AssetItem ai = new AssetItem(spr.Name, spr); SpriteList.Add(ai); } List <Background> backgrounds = BGND.Instance.Contents; BackgroundList.Clear(); for (int i = 0; i < backgrounds.Count; i++) { AssetItem ai = new AssetItem(backgrounds[i].Name, backgrounds[i]); BackgroundList.Add(ai); } GEN8 g = GEN8.Instance; GameInfoText.Inlines.Clear(); GameInfoText.Inlines.Add(new Bold(new Run("Name: "))); GameInfoText.Inlines.Add(new Run(g.DisplayName + "\n")); GameInfoText.Inlines.Add(new Bold(new Run("Development Name: "))); GameInfoText.Inlines.Add(new Run(g.Name + "\n")); GameInfoText.Inlines.Add(new Bold(new Run("Version: "))); GameInfoText.Inlines.Add(new Run(string.Format("{0}.{1}\n", g.MajorVersion, g.MinorVersion))); GameInfoText.Inlines.Add(new Bold(new Run("Build Version: "))); GameInfoText.Inlines.Add(new Run(g.BuildVersion + "\n")); GameInfoText.Inlines.Add(new Bold(new Run("Release Version: "))); GameInfoText.Inlines.Add(new Run(g.ReleaseVersion + "\n")); }