public void LoadProject(string path) { Properties.Settings.Default.LoadedAddonDirectory = path; Properties.Settings.Default.Save(); Console.WriteLine("Loading Project: " + path); AssetLoadingDialog loader = new AssetLoadingDialog(); loader.ShowDialog(AssetLoadingDialog.AddonLoadTasks); InitTabs(); ProjectView = new ProjectView(); ProjectView.Show(dockPanel, DockState.DockLeft); ObjectBrowser = new DotaObjectBrowser(); ObjectBrowser.Show(dockPanel, DockState.DockLeft); string addonName = Path.GetFileName(path.Remove(path.Length - 1)); this.Text = "Worldsmith - " + addonName; AddToRecentAddonsList(addonName); UpdateStartPage(); Console.WriteLine("Successfully Loaded Project: " + path); }
static void Main() { #if GENERATECLASSES GenerateClasses(); #else ConsoleRedirect = new ConsoleStringWriter(); Console.SetOut(ConsoleRedirect); //Set up the crash handler AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Prompt the user to specify the Dota 2 path if it has not been set InitialSetup initial = new InitialSetup(true); if (!initial.IsDotaDirSet()) { Application.Exit(); return; } // Ensure that the AddOnPath user setting was set if (!initial.IsAddOnPathSet()) { Application.Exit(); return; } Application.ApplicationExit += Application_ApplicationExit; System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture(Properties.Settings.Default.Language); // Extract the Dota 2 pack01_dir VPK file and load all of the data AssetLoadingDialog assets = new AssetLoadingDialog(); assets.ShowDialog(AssetLoadingDialog.InitialLoad); //Construct the main form and load the default project (if any). MainForm mainForm = new MainForm(); if (IsLoaddedAddonDirectoryValid()) { mainForm.LoadProject(Properties.Settings.Default.LoadedAddonDirectory); } CheckForUpdate.Check(true); Application.Run(mainForm); Properties.Settings.Default.Save(); #endif }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { if (Properties.Settings.Default.LoadedAddonDirectory == "") //If we don't have an addon loaded, create a new one { addonToolStripMenuItem1_Click(null, null); if (Properties.Settings.Default.LoadedAddonDirectory == "") { return; //if we still don't have an addon loaded, don't even bother } } AssetLoadingDialog dialog = new AssetLoadingDialog(); dialog.ShowDialog(AssetLoadingDialog.AddonSaveTasks); }
static void Main() { #if GENERATECLASSES GenerateClasses(); #else Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Prompt the user to specify the Dota 2 path if it has not been set InitialSetup initial = new InitialSetup(true); if (!initial.IsDotaDirSet()) { Application.Exit(); return; } // Ensure that the AddOnPath user setting was set if (!initial.IsAddOnPathSet()) { Application.Exit(); return; } Application.ApplicationExit += Application_ApplicationExit; System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture(Properties.Settings.Default.Language); HighlightingManager.Manager.AddSyntaxModeFileProvider(new FileSyntaxModeProvider(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "Resources")); // Extract the Dota 2 pack01_dir VPK file and load all of the data AssetLoadingDialog assets = new AssetLoadingDialog(); assets.ShowDialog(AssetLoadingDialog.InitialLoad); //Construct the main form and load the default project (if any). MainForm mainForm = new MainForm(); if (!String.IsNullOrEmpty(Properties.Settings.Default.LoadedAddonDirectory)) { mainForm.LoadProject(Properties.Settings.Default.LoadedAddonDirectory); } Application.Run(mainForm); Properties.Settings.Default.Save(); #endif }
public void LoadProject(string path) { if (this.Text != "Worldsmith") { UnloadProject(); //This prevents some duplicated stuff } if (!Directory.Exists(path)) { Console.WriteLine("Error: Directory does not exists. \"" + path + "\""); return; } Properties.Settings.Default.LoadedAddonDirectory = path; Properties.Settings.Default.Save(); Console.WriteLine("Loading Project: " + path); AssetLoadingDialog loader = new AssetLoadingDialog(); loader.ShowDialog(AssetLoadingDialog.AddonLoadTasks); ProjectView = new ProjectView(); ProjectView.Show(dockPanel, DockState.DockLeft); ObjectBrowser = new DotaObjectBrowser(); ObjectBrowser.Show(dockPanel, DockState.DockLeft); string addonName = Path.GetFileName(path.Remove(path.Length - 1)); this.Text = "Worldsmith - " + addonName; projectExplorerToolStripMenuItem.Enabled = true; objectBrowserToolStripMenuItem.Enabled = true; AddToRecentAddonsList(addonName); UpdateStartPage(); Console.WriteLine("Successfully Loaded Project: " + path); }