コード例 #1
0
        public MainForm()
        {
            testToolStripMenuItem_Click(null, null);

            if (Properties.Settings.Default.ProjectsDirectory == null)
                Properties.Settings.Default.ProjectsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Sunfish 2011\\Projects");
            if(!Directory.Exists(Properties.Settings.Default.ProjectsDirectory))
                Directory.CreateDirectory(Properties.Settings.Default.ProjectsDirectory);

            InitializeComponent();

            LoadDefaultWorkspace(); 

            #region Status Handler

            Globals.StatusChangeHandler s = new Globals.StatusChangeHandler(Status);
            Globals.StatusChanged += s;



            #endregion

            #region Dialogs Initialization

            openMapDialog = new OpenFileDialog();
            openMapDialog.Filter = "Halo 2 Cache File (*.map) | *.map";

            openProjectDialog = new OpenFileDialog();
            openProjectDialog.Filter = "Sunfish Project File (*.h2proj) | *.h2proj";
            openProjectDialog.InitialDirectory = Properties.Settings.Default.ProjectsDirectory;

            saveTagDialog = new SaveFileDialog();
            saveTagDialog.Filter = "Sunfish Tag File (*.sf) | *.sf";
            saveFilters = new Dictionary<string, int>(Index.Types.Length);
            for (int i = 0; i < Index.Types.Length; i++)
            {
                saveFilters.Add(Index.Types[i].ToString(), i + 2);
                saveTagDialog.Filter += String.Format("|Sunfish {0} File (*.{1}.sf) | *.{1}.sf", Index.Types[i].ToString(), Index.Types[i].ToPathSafeString());
            }
            saveTagDialog.SupportMultiDottedExtensions = true;
            saveTagDialog.AddExtension = true;

            #endregion

            #region auto load
#if DEBUG
            project = new Project();
            project.Load(@"O:\Sunfish 2011\Projects\taco\taco.h2proj");
            LoadProject();
#endif
            #endregion
        }
コード例 #2
0
 private void openProjectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (openProjectDialog.ShowDialog() == DialogResult.OK)
     {
         if (project != null) { CloseProject(); }
         project = new Project();
         project.Load(openProjectDialog.FileName);
         LoadProject();
     }
 }