public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
            {
                OnProjectLoading();
            }

            var errortext = "Failed to open the project due to an unknown error.";

            try
            {
                _actionStack.Clear();
                _project = new PipelineProject();

                var parser        = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) =>
                {
                    errortext = string.Format(msg, args);
                    throw new Exception();
                });
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen  = true;
                ProjectDirty = false;

                PipelineSettings.Default.AddProjectHistory(projectFilePath);
                PipelineSettings.Default.StartupProject = projectFilePath;
                PipelineSettings.Default.Save();
                View.UpdateRecentList(PipelineSettings.Default.ProjectHistory);
            }
            catch (Exception)
            {
                View.ShowError("Error Opening Project", Path.GetFileName(projectFilePath) + ": " + errortext);
                return;
            }

            UpdateTree();
            View.UpdateTreeItem(_project);

            if (OnProjectLoaded != null)
            {
                OnProjectLoaded();
            }

            _watcher.Run();

            UpdateMenu();
        }
Пример #2
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
            {
                OnProjectLoading();
            }

            try
            {
                _actionStack.Clear();
                _project = new PipelineProject();

                var parser        = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen  = true;
                ProjectDirty = false;

                PipelineSettings.Default.AddProjectHistory(projectFilePath);
                PipelineSettings.Default.StartupProject = projectFilePath;
                PipelineSettings.Default.Save();
                View.UpdateRecentList(PipelineSettings.Default.ProjectHistory);
            }
            catch (Exception e)
            {
                View.ShowError("Open Project", "Failed to open project!");
                return;
            }

            UpdateTree();
            View.UpdateTreeItem(_project);

            if (OnProjectLoaded != null)
            {
                OnProjectLoaded();
            }

            _watcher.Run();

            UpdateMenu();
        }
Пример #3
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
            {
                OnProjectLoading();
            }

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();

                var parser        = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen  = true;
                ProjectDirty = false;

                History.Default.AddProjectHistory(projectFilePath);
                History.Default.StartupProject = projectFilePath;
                History.Default.Save();
            }
#if SHIPPING
            catch (Exception e)
            {
                _view.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
            {
                OnProjectLoaded();
            }
        }
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
                OnProjectLoading();

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();
                var parser = new PipelineProjectParser(this, _project);
                parser.OpenProject(projectFilePath);
                ResolveTypes();

                ProjectOpen = true;
                ProjectDiry = false;
            }
#if SHIPPING
            catch (Exception e)
            {
                _view.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
                OnProjectLoaded();
        }
Пример #5
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
            {
                OnProjectLoading();
            }

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();

                var parser        = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen  = true;
                ProjectDirty = false;

                watcher = new FileSystemWatcher(Path.GetDirectoryName(projectFilePath));
                watcher.NotifyFilter          = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.FileName;
                watcher.Filter                = "*.*";
                watcher.IncludeSubdirectories = true;
                watcher.Created              += delegate(object sender, FileSystemEventArgs e) {
                    HandleCreated(e.FullPath);
                };
                watcher.Deleted += delegate(object sender, FileSystemEventArgs e) {
                    HandleDeleted(e.FullPath);
                };
                watcher.Renamed += delegate(object sender, RenamedEventArgs e) {
                    HandleDeleted(e.OldFullPath);
                    HandleCreated(e.FullPath);
                };

                watcher.EnableRaisingEvents = true;

                History.Default.AddProjectHistory(projectFilePath);
                History.Default.StartupProject = projectFilePath;
                History.Default.Save();
            }
#if SHIPPING
            catch (Exception e)
            {
                View.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
            {
                OnProjectLoaded();
            }
        }
Пример #6
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
                OnProjectLoading();

#if !DEBUG
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();
                
                var parser = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen = true;
                ProjectDirty = false;

                PipelineSettings.Default.AddProjectHistory(projectFilePath);
                PipelineSettings.Default.StartupProject = projectFilePath;
                PipelineSettings.Default.Save();
            }
#if !DEBUG
            catch (Exception e)
            {
                View.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
                OnProjectLoaded();

            _watcher.Run();
        }
Пример #7
0
        public void OpenProject(string projectFilePath)
        {
            CloseProject();

            if (OnProjectLoading != null)
                OnProjectLoading();

#if SHIPPING
            try
#endif
            {
                _actionStack.Clear();
                _project = new PipelineProject();
                
                var parser = new PipelineProjectParser(this, _project);
                var errorCallback = new MGBuildParser.ErrorCallback((msg, args) => View.OutputAppend(string.Format(Path.GetFileName(projectFilePath) + ": " + msg, args)));
                parser.OpenProject(projectFilePath, errorCallback);

                ResolveTypes();

                ProjectOpen = true;
                ProjectDirty = false;

                watcher = new FileSystemWatcher (Path.GetDirectoryName (projectFilePath));
                watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.FileName;
                watcher.Filter = "*.*";
                watcher.IncludeSubdirectories = true;
                watcher.Created += delegate(object sender, FileSystemEventArgs e) {
                    HandleCreated(e.FullPath);
                };
                watcher.Deleted += delegate(object sender, FileSystemEventArgs e) {
                    HandleDeleted(e.FullPath);
                };
                watcher.Renamed += delegate(object sender, RenamedEventArgs e) {
                    HandleDeleted(e.OldFullPath);
                    HandleCreated(e.FullPath);
                };

                watcher.EnableRaisingEvents = true;

                History.Default.AddProjectHistory(projectFilePath);
                History.Default.StartupProject = projectFilePath;
                History.Default.Save();
            }
#if SHIPPING
            catch (Exception e)
            {
                View.ShowError("Open Project", "Failed to open project!");
                return;
            }
#endif

            UpdateTree();

            if (OnProjectLoaded != null)
                OnProjectLoaded();
        }