Пример #1
0
        public void OpenProject()
        {
            if (GlobalSettings.DotaDirectory == null)
            {
                MessageBox.Show("Please set the dota directory in preferences!".Localize());
                return;
            }

            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.SelectedPath = GlobalSettings.DotaDirectory + Path.DirectorySeparatorChar + "dota" +
                                  Path.DirectorySeparatorChar + "addons";

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string folder = dialog.SelectedPath;

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

            AddonProject project = ProjectLoader.OpenProjectFromFolder(folder);

            projectLister.OpenProject(project);

            GlobalSettings.CurrentProjectDirectory = folder;
        }
Пример #2
0
        void IInitializable.Initialize()
        {
            // on initialization, register our tree control with the hosting service
            m_controlHostService.RegisterControl(
                TreeControl,
                new ControlInfo(
                    Localizer.Localize("Addon Explorer"),
                    Localizer.Localize("Displays the current addon"),
                    StandardControlGroup.Left), // don't show close button
                this);


            BoundPropertyDescriptor[] settings = new BoundPropertyDescriptor[] {
                new BoundPropertyDescriptor(typeof(GlobalSettings),
                                            () => GlobalSettings.CurrentProjectDirectory, "Current Project Directory".Localize(), "Paths".Localize(), "Path to current addon project.  Dont mess with this".Localize()),
            };

            this.settings.RegisterSettings(this, settings);

            TreeView = new ProjectView();
            this.TreeControl.DoubleClick += TreeControl_DoubleClick;

            SettingsService service = this.settings as SettingsService;

            service.LoadSettings();
            if (GlobalSettings.CurrentProjectDirectory != null)
            {
                OpenProject(ProjectLoader.OpenProjectFromFolder(GlobalSettings.CurrentProjectDirectory));
            }
            (TreeView as ProjectView).SelectionChanged += view_SelectionChanged;

            TreeControl.MouseUp += TreeControl_MouseUp;
        }