コード例 #1
0
        /// <summary>
        /// Compiles the file.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <returns></returns>
        private bool CompileFile(Components.ScintillaEx editor)
        {
            if (!editor.IsTemplate && !editor.IsModified)
            {
                var compilerDirectory = Path.GetDirectoryName(Application.ExecutablePath);

                List <Base.Entities.CompilerMessageItem> result
                    = Base.Facades.SampServer.Instance.BuildGamemode(compilerDirectory, editor.OpenedFile);

                if (result != null)
                {
                    var errorCount = result.Count;

                    ShowCompilerErrors(result);

                    return(errorCount == 0);
                }
            }
            else
            {
                MessageBoxAdv.Show("Cant compile unsaved file.");
            }

            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Creates the file.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="fileName">Name of the file.</param>
        private void CreateFile(Components.ScintillaEx editor, string fileName)
        {
            dockingManager.SetEnableDocking(editor, true);
            dockingManager.SetDockLabel(editor, fileName);
            dockingManager.SetAsMDIChild(editor, true);

            Base.Helpers.ControlHelper.DisposeHiddenControls <Components.ScintillaEx>(Controls);
        }
コード例 #3
0
        /// <summary>
        /// Updates the tab page text.
        /// </summary>
        /// <param name="editor">The editor.</param>
        private void UpdateTabPageText(Components.ScintillaEx editor)
        {
            if (editor.Parent is Form parentForm)
            {
                var tabPage = mdiManager.GetTabPageAdvFromForm(parentForm);

                tabPage.Text = Path.GetFileName(editor.OpenedFile);
            }
        }
コード例 #4
0
        /// <summary>
        /// Creates the editor.
        /// </summary>
        /// <returns></returns>
        private Components.ScintillaEx CreateEditor()
        {
            var editor = new Components.ScintillaEx()
            {
                Parent = this,
                Dock   = DockStyle.Fill,
            };

            editor.EditorStateChanged += Editor_EditorStateChanged;

            return(editor);
        }
コード例 #5
0
        /// <summary>
        /// Runs the game mode.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <returns></returns>
        private bool RunGameMode(Components.ScintillaEx editor)
        {
            if (CompileFile(editor))
            {
                var compiledFilePath = Path.GetDirectoryName(editor.OpenedFile) + "\\" + Path.GetFileNameWithoutExtension(editor.OpenedFile) + ".amx";
                var serversPath      = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + EditorPaths.servers;

                var servers = Base.Facades.SampServer.Instance.GetServers(serversPath);
                if (servers.Count() > 0)
                {
                    Base.Facades.SampServer.Instance.Run(compiledFilePath, serversPath, servers.OrderBy(s => s).FirstOrDefault());
                }
            }

            return(false);
        }
コード例 #6
0
        /// <summary>
        /// Saves the editor.
        /// </summary>
        /// <param name="editor">The editor.</param>
        private void SaveEditor(Components.ScintillaEx editor)
        {
            if (editor != null)
            {
                if (editor.IsTemplate && saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    editor.SaveFile(saveFileDialog.FileName);

                    workspaceBrowser.AddFile(saveFileDialog.FileName, editor);

                    UpdateTabPageText(editor);
                }
                else
                {
                    editor.SaveFile();
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Adds the file.
        /// </summary>
        /// <param name="path">The path.</param>
        public void AddFile(string path, Components.ScintillaEx editor)
        {
            if (workspace != null)
            {
                if (workspace.CanAddFile(path))
                {
                    var createdNode
                        = files.Nodes[0].Nodes.Add(new TreeNodeAdv(Path.GetFileName(path)));

                    workspace.AddFile(files.Nodes[0].Nodes[createdNode], editor.OpenedFile);

                    if (files.Nodes[0].Nodes.Count == 1)
                    {
                        files.ExpandAll();
                    }
                }
            }
        }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="fmMap"/> class.
 /// </summary>
 /// <param name="editor">The editor.</param>
 public fmMap(Components.ScintillaEx editor) : this()
 {
     mEditor = editor;
 }
コード例 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="fmJobGenerator"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public fmJobGenerator(Components.ScintillaEx editor)
        {
            InitializeComponent();

            mEditor = editor;
        }