Example #1
0
        /// <summary>
        /// Create a new MainMdi parent form.
        /// </summary>
        public MainMdi()
        {
            InitializeComponent();

            DirectoryInfo directoryInfo = Directory.GetParent(Application.StartupPath);
            toolkitInstallPath = directoryInfo.FullName + @"\Toolkit3\";

            //Set Menu Renders
            menuStrip.Renderer = new MenuRender();
            ToolStripManager.Renderer = new ToolstripRender();
            ((ToolstripRender)toolStrip.Renderer).RoundedEdges = false; //Get rid of toolstrip rounded edges.

            //Load RPGCode Reference
            SerializableData serializer = new SerializableData();
            rpgCodeReference = (RPGcode)serializer.Load(RPGCodeReferencePath, typeof(RPGcode));

            if (File.Exists(ConfigurationFilePath))
            {
                LoadConfiguration();
            }
            else
            {
                if (!CheckToolkitInstall(toolkitInstallPath))
                {
                    ShowToolkitPathDialog();
                }
            }

            CreateBasicLayout();
            Focus();
        }
Example #2
0
        /// <summary>
        /// Loads the information stored in the editors configuration file.
        /// </summary>
        private void LoadConfiguration()
        {
            try
            {
                SerializableData serializer = new SerializableData();
                configurationFile = (ConfigurationFile)serializer.Load(ConfigurationFilePath,
                    typeof(ConfigurationFile));

                if (Directory.Exists(toolkitInstallPath))
                {
                    CheckToolkitInstall(configurationFile.ToolkitPath);
                }
                else
                {
                    if (CheckToolkitInstall(toolkitInstallPath))
                    {
                        configurationFile.ToolkitPath = toolkitInstallPath;
                    }
                    else
                    {
                        ShowToolkitPathDialog();
                    }
                }
                if (configurationFile.ProjectFolder != null)
                {
                    if (Directory.Exists(configurationFile.ProjectFolder))
                    {
                        if (Directory.Exists(configurationFile.ProjectFolder + @"prg"))
                        {
                            projectPath = configurationFile.ProjectFolder + @"prg";
                        }
                        else
                        {
                            projectPath = configurationFile.ProjectFolder;
                        }

                        projectTitle = configurationFile.ProjectName;
                    }
                    else
                    {
                        throw new DirectoryNotFoundException();
                    }

                    projectLoaded = true;
                    this.Text = configurationFile.ProjectName + " - " + programVersion;
                }
            }
            catch (DirectoryNotFoundException)
            {
                string error = "The project folder " + configurationFile.ProjectFolder + " could not be found.";
                MessageBox.Show(error, "Project Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                File.Delete(ConfigurationFilePath);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ExecutablePath, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }