private void btnSaveBackground_Click(object sender, RoutedEventArgs e) { App.SetStatus("Saving..."); Octgn.Game g = new Octgn.Game(Octgn.Definitions.GameDef.FromO8G(App.Game.Filename)); for (int i = 0; i < App.Relationships.Count; i++) { if (App.Relationships[i].Target.Equals(g.Table.Definition.background)) { App.Relationships[i].Target = cbImageList.Text; break; } } App.Save_Relationships(); App.Save_Game_File(); App.SetStatus(""); }
private void btnStart_Click(object sender, RoutedEventArgs e) { btnStart.IsEnabled = false; listBox1.Items.Clear(); echo("Game File Location Correct :" + App.Game.Filename, Brushes.Green); echo("Set File Locations Correct", Brushes.Green); echo("Unzipping game file"); App.Unzip_Files(); Octgn.Game g = new Octgn.Game(Octgn.Definitions.GameDef.FromO8G(App.Game.Filename)); echo("Loading Relationship File..."); App.Load_Relationships(); echo("Verifying Relationship file targets..."); foreach (Relationship r in App.Relationships) { string checkloc = App.UnzipPath + r.Target.Replace("/", "\\"); if (File.Exists(checkloc)) { echo(" " + "Target: " + r.Target + " Exists.", Brushes.Green); } else { echo(" " + "Target: " + r.Target + " Doesn't Exist!", Brushes.Red); } } echo("Done Verifying Relationship File Targets."); //XmlStuff x = new XmlStuff(); //if (x.validateXml(App.UnzipPath + "\\" + App.gameFilePrefix + ".xml")) //{ // echo(App.gameFilePrefix + ".xml Is valid."); //} //else //{ // echo(App.gameFilePrefix + ".xml is corrupt, you should redownload this file.", Brushes.Red); //} btnStart.IsEnabled = true; }
private void Reload_Stuff() { App.SetStatus("Getting main file name..."); Octgn.Game g = new Octgn.Game(Octgn.Definitions.GameDef.FromO8G(App.Game.Filename)); App.addDebugLine(g.Definition.TableDefinition.background); App.Unzip_Files(); App.SetStatus("Main file name='" + App.gameFilePrefix + "'"); App.SetStatus("Loading relationships..."); App.Load_Relationships(); App.SetStatus("Loading image list..."); Load_Images(); String bfile = g.Definition.TableDefinition.background.Replace('/', '\\'); cbImageList.IsEditable = true; cbImageList.IsReadOnly = true; cbImageList.Text = bfile; String f = cbImageList.Text.Replace('/', '\\'); f = App.UnzipPath + f; Uri uri = new Uri("file://" + f); imgBackground.Source = new BitmapImage(uri); App.SetStatus(""); }
private void GameEdit_Loaded(object sender, RoutedEventArgs e) { App.SetStatus("Getting main file name..."); Octgn.Game g = new Octgn.Game(Octgn.Definitions.GameDef.FromO8G(App.Game.Filename)); App.addDebugLine(g.Definition.TableDefinition.background); App.Unzip_Files(); App.SetStatus("Main file name='" + App.gameFilePrefix + "'"); App.SetStatus("Loading relationships..."); App.Load_Relationships(); App.SetStatus("Loading image list..."); Load_Images(); String bfile = g.Definition.TableDefinition.background.Replace('/', '\\'); cbImageList.IsEditable = true; cbImageList.IsReadOnly = true; cbImageList.Text = bfile; String f = cbImageList.Text.Replace('/', '\\'); f = App.UnzipPath + f; Uri uri = new Uri("file://" + f); System.IO.Stream stream = new FileStream(f, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); if (bi != null) { bi.StreamSource.Close(); bi.StreamSource.Dispose(); bi = null; } bi = new BitmapImage(); bi.CacheOption = BitmapCacheOption.OnLoad; bi.UriSource = null; bi.BeginInit(); bi.StreamSource = stream; bi.EndInit(); imgBackground.Source = bi; //bi.StreamSource.Close(); App.SetStatus(""); }