Example #1
0
        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

        }
Example #2
0
        static void Main()
        {
            // DataSchema.DataClassGenerator.FindPossibleValuesForKey(@"E:\Dota2SDK\root\scripts\npc\items.txt", "ItemDeclarations");

            #if GENERATECLASSES
            string outputDir = "../../DataClasses/";
            string unitDir = outputDir + "ScriptTypes/";
            string inputDir = "../../DataSchema/";
            DataSchema.DataClassGenerator.GenerateClassForSchema(inputDir + "BaseUnitSchema.txt", unitDir);
            DataSchema.DataClassGenerator.GenerateClassForSchema(inputDir + "HeroSchema.txt", unitDir);
            DataSchema.DataClassGenerator.GenerateClassForSchema(inputDir + "UnitSchema.txt", unitDir);
            DataSchema.DataClassGenerator.GenerateClassForSchema(inputDir + "AbilitySchema.txt", unitDir);
            DataSchema.DataClassGenerator.GenerateClassForSchema(inputDir + "ItemSchema.txt", unitDir);
            #else
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!Properties.Settings.Default.ranonce)
            {
                InitialSetup initial = new InitialSetup(true);
                if (initial.ShowDialog() == DialogResult.OK) {
                    Properties.Settings.Default.ranonce = true;
                    Properties.Settings.Default.Save();
                }
                else {
                    Application.Exit();
                    return;
                }
            }

            AssetLoadingDialog assets = new AssetLoadingDialog();
            assets.ShowDialog(AssetLoadingDialog.InitialLoad);
            if (Properties.Settings.Default.AddonPath != "")
            {
                assets = new AssetLoadingDialog();
                assets.ShowDialog(AssetLoadingDialog.AddonLoadTasks);
            }
            Application.ApplicationExit += Application_ApplicationExit;

            Application.Run(mainForm = new MainForm());

            Properties.Settings.Default.Save();
            #endif
        }
Example #3
0
        private void addonToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();
            dialog.SelectedPath = Properties.Settings.Default.dotadir + Path.DirectorySeparatorChar + "dota" + Path.DirectorySeparatorChar + "addons";
            if (dialog.ShowDialog() != DialogResult.OK) return;
            string folder = dialog.SelectedPath + Path.DirectorySeparatorChar;

            if(!File.Exists(folder + "addoninfo.txt"))
            {
                MessageBox.Show("That's not an addon folder!\nSelect a folder with an addoninfo.txt", "Invalid Folder", MessageBoxButtons.OK);
                return;
            }

            Properties.Settings.Default.AddonPath = folder;
            Properties.Settings.Default.Save();

            AssetLoadingDialog loader = new AssetLoadingDialog();
            loader.ShowDialog(AssetLoadingDialog.AddonLoadTasks);

            InitTabs();
        }
Example #4
0
        static void Main()
        {
            #if GENERATECLASSES
            GenerateClasses();
            #else
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!Properties.Settings.Default.ranonce)
            {
                InitialSetup initial = new InitialSetup(true);
                if (initial.ShowDialog() == DialogResult.OK) {
                    Properties.Settings.Default.ranonce = true;
                    Properties.Settings.Default.Save();
                }
                else {
                    Application.Exit();
                    return;
                }
            }

            AssetLoadingDialog assets = new AssetLoadingDialog();
            assets.ShowDialog(AssetLoadingDialog.InitialLoad);
            if (Properties.Settings.Default.AddonPath != "")
            {
                assets = new AssetLoadingDialog();
                assets.ShowDialog(AssetLoadingDialog.AddonLoadTasks);
            }
            Application.ApplicationExit += Application_ApplicationExit;

            System.Threading.Thread.CurrentThread.CurrentUICulture =
                System.Globalization.CultureInfo.CreateSpecificCulture(Properties.Settings.Default.language);

            Application.Run(mainForm = new MainForm());

            Properties.Settings.Default.Save();
            #endif
        }
Example #5
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(Properties.Settings.Default.AddonPath == "") //If we don't have an addon loaded, create a new one
            {
                addonToolStripMenuItem1_Click(null, null);
                if (Properties.Settings.Default.AddonPath == "") return; //if we still don't have an addon loaded, don't even bother
            }

            AssetLoadingDialog dialog = new AssetLoadingDialog();
            dialog.ShowDialog(AssetLoadingDialog.AddonSaveTasks);
        }
Example #6
0
        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);
        }