Пример #1
0
        private void ToolStripMenuItem3_Click(object sender, EventArgs e)
        {
            if (this.treeProject.SelectedNodes.Count <= 0)
            {
                return;
            }

            var createScriptDialog = new CreateScriptDialog();

            if (createScriptDialog.ShowDialog() == DialogResult.OK)
            {
                var scriptFile = _project.AddScriptToGameContent(this.treeProject.SelectedNodes[0].Tag as FileInfo, createScriptDialog.ScriptName);

                var fileNode = new DarkTreeNode(scriptFile.Name)
                {
                    Tag  = scriptFile,
                    Icon = Icons.document_16xLG,
                };

                this.treeProject.SelectedNodes[0].Nodes.Add(fileNode);

                // We have to load up the Dialogue and attach the script to it.
                var dialogueFile = (this.treeProject.SelectedNodes[0].Tag as FileInfo);
                var dialogue     = _project.LoadDialogue(dialogueFile.FullName);

                if (File.Exists(dialogue.ScriptPath))
                {
                    var response = DarkMessageBox.ShowWarning("Creating a new script will replace existing script file.", "Warning!", DarkDialogButton.OkCancel);

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

                // If there was a previous script in the scriptmap, remove it
                if (_project.ScriptMap.ContainsKey(dialogue.Name))
                {
                    _project.ScriptMap[dialogue.Name].ToObject <JArray>().Remove(dialogue.ScriptPath);
                }

                dialogue.ScriptPath = Helpers.MakeRelative(scriptFile.FullName, _project.ServerRootDirectory.FullName + "/");
                this.FileSelected.Invoke(this, new FileEventArgs(dialogueFile));

                // We do this at the very end to ensure our script document is focused, because attaching a script to a piece of content will inherently load and open it as a document even if it wasn't prior.
                this.FileCreated?.Invoke(this, new FileEventArgs(scriptFile));
            }
        }
Пример #2
0
        private bool CanMoveNodes(IEnumerable <DarkTreeNode> dragNodes, DarkTreeNode dropNode, bool isMoving = false)
        {
            if (dropNode == null)
            {
                return(false);
            }

            foreach (var node in dragNodes)
            {
                if (node == dropNode)
                {
                    if (isMoving)
                    {
                        DarkMessageBox.Show(this, $"Cannot move {node.Text}. The destination folder is the same as the source folder.,", Application.ProductName, MessageBoxIcon.Error);
                    }

                    return(false);
                }

                if (node.ParentNode != null && node.ParentNode == dropNode)
                {
                    if (isMoving)
                    {
                        DarkMessageBox.Show(this, $"Cannot move {node.Text}. The destination folder is the same as the source folder.", Application.ProductName, MessageBoxIcon.Error);
                    }

                    return(false);
                }

                var parentNode = dropNode.ParentNode;
                while (parentNode != null)
                {
                    if (node == parentNode)
                    {
                        if (isMoving)
                        {
                            DarkMessageBox.Show(this, $"Cannot move {node.Text}. The destination folder is a subfolder of the source folder.", Application.ProductName, MessageBoxIcon.Error);
                        }

                        return(false);
                    }

                    parentNode = parentNode.ParentNode;
                }
            }

            return(true);
        }
Пример #3
0
        protected virtual bool CanMoveNodes(List <DarkTreeNode> dragNodes, DarkTreeNode dropNode, bool isMoving = false)
        {
            if (dropNode == null)
            {
                return(false);
            }

            foreach (var node in dragNodes)
            {
                if (node == dropNode)
                {
                    if (isMoving)
                    {
                        DarkMessageBox.ShowError("Cannot move " + node.Text + ". The destination folder is the same as the source folder.", Application.ProductName);
                    }

                    return(false);
                }

                if (node.ParentNode != null && node.ParentNode == dropNode)
                {
                    if (isMoving)
                    {
                        DarkMessageBox.ShowError("Cannot move " + node.Text + ". The destination folder is the same as the source folder.", Application.ProductName);
                    }

                    return(false);
                }

                var parentNode = dropNode.ParentNode;
                while (parentNode != null)
                {
                    if (node == parentNode)
                    {
                        if (isMoving)
                        {
                            DarkMessageBox.ShowError("Cannot move " + node.Text + ". The destination folder is a subfolder of the source folder.", Application.ProductName);
                        }

                        return(false);
                    }

                    parentNode = parentNode.ParentNode;
                }
            }

            return(true);
        }
        private void button_RenameLauncher_Click(object sender, EventArgs e)
        {
            if (!File.Exists(_ide.Project.LaunchFilePath))
            {
                DarkMessageBox.Show(this, "Couldn't find the launcher executable of the project.\n" +
                                    "Please restart TombIDE to resolve any issues.", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            using (FormRenameLauncher form = new FormRenameLauncher(_ide))
                form.ShowDialog(this);

            textBox_LauncherName.Text = Path.GetFileName(_ide.Project.LaunchFilePath);
        }
Пример #5
0
 private void ucTextBoxEx_VisuAddress_Leave(object sender, EventArgs e)
 {
     try
     {
         ushort newAddress = Convert.ToUInt16(ucTextBoxEx_VisuAddress.InputText);
         if (startVisuAddress != newAddress || startVisuAddress == 0)
         {
             addressChangedVisu = true;
         }
     }
     catch (Exception ex)
     {
         DarkMessageBox.ShowError(ex.Message.ToString(), "Error");
         ucTextBoxEx_VisuAddress.InputText = "0";
     }
 }
Пример #6
0
        /// <summary>
        /// Verifica se há dados corretos no textbox.
        /// </summary>
        /// <returns></returns>
        private bool VerifyTextbox()
        {
            if (txt_user.Text.Trim().Length < 4)
            {
                DarkMessageBox.ShowInformation("O nome de usuário deve ser maior que 4 digítos.", "Informação");
                return(false);
            }

            if (txt_password.Text.Trim().Length < 4)
            {
                DarkMessageBox.ShowInformation("A senha de usuário deve ser maior que 4 digítos.", "Informação");
                return(false);
            }

            return(true);
        }
 private void commandList_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
 {
     if (commandList.Columns[e.ColumnIndex].Name == commandListColumnHotkeys.Name)
     {
         // Parse
         string errorMessage;
         HotkeySets.ParseHotkeys(e.FormattedValue.ToString(), out errorMessage);
         if (errorMessage != null)
         {
             if (DarkMessageBox.Show(this, errorMessage, "Invalid input", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) != DialogResult.Cancel)
             {
                 e.Cancel = true; // We cancel the cell parsing, the user can retry inputting something.
             }
         }
     }
 }
Пример #8
0
        private void UpdatePreview()
        {
            try
            {
                string pakFilePath = Path.Combine(_ide.Project.EnginePath, @"data\uklogo.pak");
                byte[] pakData     = PakFile.GetDecompressedData(pakFilePath);

                panel_Preview.BackgroundImage = ImageHandling.GetImageFromRawData(pakData, 512, 256);

                label_Blank.Visible = IsBlankImage(pakData);
            }
            catch (Exception ex)
            {
                DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void button_Delete_Click(object sender, EventArgs e)
        {
            Plugin affectedPlugin = (Plugin)treeView_Available.SelectedNodes[0].Tag;

            DialogResult result = DarkMessageBox.Show(this,
                                                      "Are you sure you want to delete the \"" + affectedPlugin.Name + "\" plugin?\n" +
                                                      "This will send the plugin folder with all its files into the recycle bin.", "Are you sure?",
                                                      MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                FileSystem.DeleteDirectory(Path.GetDirectoryName(affectedPlugin.InternalDllPath), UIOption.AllDialogs, RecycleOption.SendToRecycleBin);
            }

            // The lists will refresh themself, because ProjectMaster.cs is watching the plugin folders
        }
Пример #10
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (textBox_ProjectName.Text.ToLower() == "engine")             // This will ONLY happen when the user intentionally tries to break the software
            {
                DarkMessageBox.Show(this, "LOL you did that on purpose, didn't you? Your project directory cannot be named \"Engine\",\n" +
                                    "because it will cause many conflicts inside the software. Please rename the directory before importing.", "Why?",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                DialogResult = DialogResult.Cancel;
                return;
            }

            textBox_ProjectName.Focus();
        }
Пример #11
0
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            if (JsonConfig.firstRun && ThemeManager.currentTheme == null)
            {
                DialogResult result = DarkMessageBox.ShowWarning("WinDynamicDesktop cannot " +
                                                                 "dynamically update your wallpaper until you have selected a theme. Are you " +
                                                                 "sure you want to continue without a theme selected?", "Question",
                                                                 DarkDialogButton.YesNo);

                if (result != DialogResult.Yes)
                {
                    e.Cancel = true;
                    this.Show();
                }
            }
        }
        private void button_DeleteLogs_Click(object sender, EventArgs e)
        {
            try
            {
                string[] files = Directory.GetFiles(_ide.Project.EnginePath);

                bool wereFilesDeleted = false;

                foreach (string file in files)
                {
                    string fileName = Path.GetFileName(file);

                    if (fileName == "db_patches_crash.bin" ||
                        fileName == "DETECTED CRASH.txt" ||
                        fileName == "LastExtraction.lst" ||
                        (fileName.StartsWith("Last_Crash_") && (fileName.EndsWith(".txt") || fileName.EndsWith(".mem"))) ||
                        fileName.EndsWith("_warm_up_log.txt"))
                    {
                        File.Delete(file);
                        wereFilesDeleted = true;
                    }
                }

                string logsDirectory = Path.Combine(_ide.Project.EnginePath, "logs");

                if (Directory.Exists(logsDirectory))
                {
                    Directory.Delete(logsDirectory, true);
                    wereFilesDeleted = true;
                }

                if (wereFilesDeleted)
                {
                    DarkMessageBox.Show(this, "Successfully deleted all log files\n" +
                                        "and error dumps from the project folder.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    DarkMessageBox.Show(this, "No log files or error dumps were found.", "Information",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #13
0
        private void BtnEntrySave_Click(object sender, EventArgs e)
        {
            if (selectedFileName.Length == 0)
            {
                return;
            }

            if (vaultFile.Save(selectedFileName))
            {
                sndSuccess.Play();
            }
            else
            {
                sndFailed.Play();
                DarkMessageBox.ShowError("Failed to save vault file", "Error");
            }
        }
Пример #14
0
        private void editCodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            canShow = true;

            if (form1.currentProject != null && File.Exists(Path.GetFullPath(form1.currentProject.RootPath + "/Objects/" + lastNode.Text + ".cs")))
            {
                // Launch new edit code window
                ScriptEditor se = new ScriptEditor();
                se.DockText       = "Code editor - " + lastNode.Text;
                se.scintilla.Text = File.ReadAllText(Path.GetFullPath(form1.currentProject.RootPath + "/Objects/" + lastNode.Text + ".cs"));
                form1.darkDockPanel1.AddContent(se);
            }
            else
            {
                DarkMessageBox.Show("No code found for the object - class doesn't exist", "Simplex Engine");
            }
        }
Пример #15
0
        private void menuItem_Uninstall_Click(object sender, EventArgs e)         // TODO: REFACTOR !!!
        {
            DarkTreeNode node = treeView.SelectedNodes[0];

            try
            {
                // Remove the plugin DLL file from the current project folder

                string dllFilePath = ((Plugin)node.Tag).InternalDllPath;

                if (string.IsNullOrEmpty(dllFilePath))
                {
                    if (ModifierKeys.HasFlag(Keys.Shift))
                    {
                        FileSystem.DeleteFile(Path.Combine(_ide.Project.EnginePath, ((Plugin)node.Tag).Name), UIOption.AllDialogs, RecycleOption.SendToRecycleBin);
                    }
                    else
                    {
                        DialogResult result = DarkMessageBox.Show(this,
                                                                  "The \"" + ((Plugin)node.Tag).Name + "\" plugin is not installed in TombIDE.\n" +
                                                                  "Would you like to move the DLL file into the recycle bin instead?", "Are you sure?",
                                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        if (result == DialogResult.Yes)
                        {
                            FileSystem.DeleteFile(Path.Combine(_ide.Project.EnginePath, ((Plugin)node.Tag).Name), UIOption.AllDialogs, RecycleOption.SendToRecycleBin);
                        }
                    }
                }
                else
                {
                    string dllProjectPath = Path.Combine(_ide.Project.EnginePath, Path.GetFileName(dllFilePath));

                    if (File.Exists(dllProjectPath))
                    {
                        File.Delete(dllProjectPath);
                    }
                }

                // The lists will refresh themself, because ProjectMaster.cs is watching the plugin folders
            }
            catch (Exception ex)
            {
                DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #16
0
        private async void removeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int         itemIndex = listView1.FocusedItem.Index;
            ThemeConfig theme     = ThemeManager.themeSettings[itemIndex - 1];

            DialogResult result = DarkMessageBox.ShowWarning("Are you sure you want to remove " +
                                                             "the '" + theme.themeName.Replace('_', ' ') + "' theme?", "Question",
                                                             DarkDialogButton.YesNo);

            if (result == DialogResult.Yes)
            {
                listView1.Items.RemoveAt(itemIndex);
                listView1.Items[itemIndex - 1].Selected = true;

                await Task.Run(() => ThemeManager.RemoveTheme(theme));
            }
        }
Пример #17
0
        public void OpenTrprojWithTombIDE(string trprojFilePath)
        {
            try
            {
                Project openedProject = Project.FromFile(trprojFilePath);

                string errorMessage;

                if (!ProjectChecker.IsValidProject(openedProject, out errorMessage))
                {
                    throw new ArgumentException(errorMessage);
                }

                // Check if a project with the same name but different paths already exists on the list
                foreach (DarkTreeNode node in treeView.Nodes)
                {
                    Project nodeProject = (Project)node.Tag;

                    if (nodeProject.Name.ToLower() == openedProject.Name.ToLower() &&
                        nodeProject.ProjectPath.ToLower() != openedProject.ProjectPath.ToLower())
                    {
                        if (AskForProjectNodeReplacement(openedProject, node))
                        {
                            break;                             // The user confirmed replacing the node
                        }
                        else
                        {
                            return;                             // The user declined replacing the node
                        }
                    }
                }

                if (!IsProjectOnList(openedProject))
                {
                    AddProjectToList(openedProject, true);
                }

                _ide.IDEConfiguration.RememberedProject = openedProject.Name;

                // Continue code in Program.cs
            }
            catch (Exception ex)
            {
                DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #18
0
        private void OnProjectPathsChanged(IIDEEvent obj)
        {
            DialogResult result = DarkMessageBox.Show(this, "To apply the changes, you must restart TombIDE.\n" +
                                                      "Are you sure you want to do that?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                if (!_ide.CanClose())
                {
                    // User pressed "Cancel"

                    DarkMessageBox.Show(this, "Operation cancelled.\nNo paths have been affected.", "Operation cancelled",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);

                    return;
                }

                if (obj is IDE.ProjectScriptPathChangedEvent)
                {
                    _ide.Project.ScriptPath = ((IDE.ProjectScriptPathChangedEvent)obj).NewPath;
                }
                else if (obj is IDE.ProjectLevelsPathChangedEvent)
                {
                    List <ProjectLevel> projectLevels = new List <ProjectLevel>();
                    projectLevels.AddRange(_ide.Project.Levels);

                    // Remove all internal level entries from the project's Levels list (for safety)
                    foreach (ProjectLevel projectLevel in projectLevels)
                    {
                        if (projectLevel.FolderPath.StartsWith(_ide.Project.LevelsPath, StringComparison.OrdinalIgnoreCase))
                        {
                            _ide.Project.Levels.Remove(projectLevel);
                        }
                    }

                    _ide.Project.LevelsPath = ((IDE.ProjectLevelsPathChangedEvent)obj).NewPath;
                }

                RestartApplication();
            }
            else if (result == DialogResult.No)
            {
                DarkMessageBox.Show(this, "Operation cancelled.\nNo paths have been affected.", "Operation cancelled",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #19
0
 /// <summary>
 /// </summary>
 /// <param name="backupFile"></param>
 public void BackupGameFile(BackupFile backupFile)
 {
     try
     {
         FtpExtensions.DownloadFile(backupFile.LocalPath, backupFile.InstallPath);
         _ = DarkMessageBox.Show(this,
                                 $"Successfully backed up file {backupFile.FileName} from {backupFile.InstallPath}.",
                                 "Success", MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         Program.Log.Error($"Unable to backup game file. Error: {ex.Message}", ex);
         _ = DarkMessageBox.Show(this,
                                 "There was a problem downloading the file. Make sure the file exists on your console.",
                                 "Error", MessageBoxIcon.Error);
     }
 }
Пример #20
0
 private bool CheckForSavedChanges()
 {
     if (!_saved)
     {
         if (DarkMessageBox.Show(this, "Save changes to already opened file?",
                                 "Confirm unsaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             SaveArchive(_currentArchive);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }
Пример #21
0
        private void SwitchCustomBumpmap()
        {
            if (textureMap.VisibleTexture != null)
            {
                var currentTexture = textureMap.VisibleTexture;

                if (cbUseCustomFile.Checked)
                {
                    currentTexture.BumpPath = null;
                }
                else
                {
                    using (OpenFileDialog dialog = new OpenFileDialog())
                    {
                        dialog.Multiselect = false;
                        dialog.Filter      = ImageC.FromFileFileExtensions.GetFilter();
                        dialog.Title       = "Open custom bump/normal map image";

                        if (!string.IsNullOrWhiteSpace(currentTexture.Path))
                        {
                            dialog.InitialDirectory = _editor.Level?.Settings?.MakeAbsolute(currentTexture.Path) ?? currentTexture.Path;
                        }

                        if (dialog.ShowDialog(this) != DialogResult.OK)
                        {
                            currentTexture.BumpPath = null;
                        }
                        else
                        {
                            var tempImage = ImageC.FromFile(dialog.FileName);
                            if (tempImage.Size != currentTexture.Image.Size)
                            {
                                DarkMessageBox.Show(this, "Selected image file has different size. Please select image with size similar to original texture file.", "Wrong image size", MessageBoxIcon.Error);
                                currentTexture.BumpPath = null;
                            }
                            else
                            {
                                currentTexture.BumpPath = _editor.Level?.Settings?.MakeRelative(dialog.FileName, VariableType.LevelDirectory);
                            }
                        }
                    }
                }
            }

            UpdateDialog();
        }
Пример #22
0
        private void btExport_Click(object sender, EventArgs e)
        {
            using (var fileDialog = new SaveFileDialog())
            {
                fileDialog.Filter = ImageC.SaveFileFileExtensions.GetFilter(true);
                if (!string.IsNullOrWhiteSpace(_currentPath))
                {
                    try
                    {
                        fileDialog.InitialDirectory = Path.GetDirectoryName(_currentPath);
                        fileDialog.FileName         = Path.GetFileName(_currentPath);
                    }
                    catch { }
                }
                fileDialog.Title        = "Choose a sprite file name.";
                fileDialog.AddExtension = true;

                DialogResult dialogResult = fileDialog.ShowDialog(this);
                _currentPath = fileDialog.FileName;
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }

                // Save sprites
                try
                {
                    foreach (DataGridViewRow row in dataGridView.SelectedRows)
                    {
                        string fileName = fileDialog.FileName;
                        if (dataGridView.SelectedRows.Count > 1)
                        {
                            fileName = Path.Combine(Path.GetDirectoryName(fileName),
                                                    Path.GetFileNameWithoutExtension(fileName) + row.Index.ToString("0000") + Path.GetExtension(fileName));
                        }
                        ((WadSprite)row.DataBoundItem).Texture.Image.Save(fileName);
                    }
                }
                catch (Exception exc)
                {
                    logger.Error(exc, "Unable to save file '" + fileDialog.FileName + "'.");
                    DarkMessageBox.Show(this, "Unable to save sprite. " + exc, "Saving sprite failed.", MessageBoxIcon.Error);
                }
            }
        }
Пример #23
0
        private static void OnDownloadDialogClosed(object sender, EventArgs e)
        {
            MainMenu.themeItem.Enabled = true;
            List <ThemeConfig> missingThemes = FindMissingThemes();

            if (missingThemes.Count == 0)
            {
                ReadyUp();
            }
            else if (currentTheme != null && missingThemes.Contains(currentTheme))
            {
                DialogResult result = DarkMessageBox.ShowError("Failed to download images. " +
                                                               "Click Retry to try again or Cancel to exit the program.", "Error",
                                                               DarkDialogButton.RetryCancel);

                if (result == DialogResult.Retry)
                {
                    DownloadMissingImages(missingThemes);
                }
                else
                {
                    Environment.Exit(0);
                }
            }
            else
            {
                DialogResult result = DarkMessageBox.ShowWarning("Failed to download images. " +
                                                                 "Click Retry to try again or Cancel to continue with some themes disabled.",
                                                                 "Error", DarkDialogButton.RetryCancel);

                if (result == DialogResult.Retry)
                {
                    DownloadMissingImages(missingThemes);
                }
                else
                {
                    foreach (ThemeConfig theme in missingThemes)
                    {
                        themeSettings.Remove(theme);
                    }

                    ReadyUp();
                }
            }
        }
Пример #24
0
        public bool Save(String file)
        {
            try
            {
                // make a backup...
                if (File.Exists(file))
                {
                    File.Copy(file, file + ".bak", true);
                }

                // TODO:
                // check for a .journal file and notify user...??
                if (File.Exists(file))
                {
                    File.Delete(file);
                }

                BinaryWriter bw = new BinaryWriter(File.Open(file, FileMode.OpenOrCreate));

                // Header
                bw.Write((uint)VAULT_MAGIC);
                bw.Write((ushort)VAULT_VERSION);
                bw.Write((uint)keyValues.Count);

                foreach (KeyValuePair <VaultEntry, String> entry in keyValues)
                {
                    bw.Write((UInt32)entry.Key.timestamp);
                    bw.Write((byte)entry.Key.key.Length);
                    bw.Write((UInt16)entry.Value.Length);

                    bw.Write((char[])entry.Key.key.ToCharArray());
                    bw.Write((char[])entry.Value.ToCharArray());
                }

                bw.Flush();
                bw.Close();

                return(true);
            }
            catch (Exception e)
            {
                DarkMessageBox.ShowError("Failed to save vault file\n" + e.Message, "Error");
                return(false);
            }
        }
Пример #25
0
        private void radioButton_Standard_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton_Standard.Checked)
            {
                try
                {
                    using (Image image = Image.FromFile(Path.Combine(_ide.Project.EnginePath, "load.bmp")))
                        panel_Preview.BackgroundImage = ImageHandling.ResizeImage(image, 320, 240);

                    _ide.IDEConfiguration.StandardAspectRatioPreviewEnabled = true;
                    _ide.IDEConfiguration.Save();
                }
                catch (Exception ex)
                {
                    DarkMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #26
0
        private void NodeDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.Tag.GetType() == typeof(MapListMap))
            {
                if (Globals.CurrentMap != null &&
                    Globals.CurrentMap.Changed() &&
                    DarkMessageBox.ShowInformation(
                        Strings.Mapping.savemapdialogue, Strings.Mapping.savemap, DarkDialogButton.YesNo,
                        Properties.Resources.Icon
                        ) ==
                    DialogResult.Yes)
                {
                    SaveMap();
                }

                Globals.MainForm.EnterMap(((MapListMap)e.Node.Tag).MapId);
            }
        }
Пример #27
0
        public static ThemeConfig ImportTheme(string themePath)
        {
            string themeName   = Path.GetFileNameWithoutExtension(themePath);
            bool   isInstalled = themeSettings.FindIndex(
                theme => theme.themeName == themeName) != -1;

            if (isInstalled)
            {
                DialogResult result = DarkMessageBox.ShowWarning("The '" +
                                                                 themeName.Replace('_', ' ') + "' theme is already installed. Do you want to " +
                                                                 "overwrite it?", "Question", DarkDialogButton.YesNo);

                if (result != DialogResult.Yes)
                {
                    return(null);
                }
            }

            try
            {
                if (Path.GetExtension(themePath) == ".zip")
                {
                    using (ZipArchive archive = ZipFile.OpenRead(themePath))
                    {
                        ZipArchiveEntry themeJson = archive.Entries.Single(
                            entry => Path.GetExtension(entry.Name) == ".json");
                        themeJson.ExtractToFile(Path.Combine("themes", themeName + ".json"), true);
                    }

                    ExtractTheme(themePath);
                }
                else
                {
                    File.Copy(themePath, Path.Combine("themes", themeName + ".json"), true);
                }

                return(JsonConfig.LoadTheme(themeName));
            }
            catch (Exception e)
            {
                DarkMessageBox.ShowWarning("Failed to import theme:\n" + e.Message, "Error");
                return(null);
            }
        }
Пример #28
0
 private void SendOrbisPayload_Click(object sender, EventArgs e)
 {
     try
     {
         Int32 selectedCellCount = TargetList.GetCellCount(DataGridViewElementStates.Selected);
         if (selectedCellCount > 0)
         {
             int    index      = TargetList.SelectedRows[0].Index;
             string TargetName = Convert.ToString(TargetList.Rows[index].Cells["mTargetName"].Value);
             if (!PS4.Target[TargetName].Payload.InjectPayload())
             {
                 DarkMessageBox.ShowError("Failed to send payload to target please try again.", "Error: Failed to inject payload.");
             }
         }
     }
     catch
     {
     }
 }
Пример #29
0
        private void InitializeDatabase()
        {
            // carrega o arquivo de configuração
            Configuration.ParseConfigFile("Config.txt");

            MySQL.GameDB          = new CommonDB();
            MySQL.GameDB.Server   = Configuration.GetString("game_ip");
            MySQL.GameDB.Port     = Configuration.GetInt32("game_port");
            MySQL.GameDB.Username = Configuration.GetString("game_user");
            MySQL.GameDB.Password = Configuration.GetString("game_password");
            MySQL.GameDB.Database = Configuration.GetString("game_database");

            var error = string.Empty;

            if (!MySQL.GameDB.Open(out error))
            {
                DarkMessageBox.ShowError(error, "Ocorreu um erro ao conectar ao MySQL.");
            }
        }
Пример #30
0
        public OrbisTargetSettings()
        {
            InitializeComponent();

            if (PS4.TargetManagement.TargetList.Count <= 0) //TODO: Could add a "Add Target" Option instead and disable the other options.
            {
                DarkMessageBox.ShowError("Target list is empty nothing to show.", "Target List Empty", DarkDialogButton.Ok, FormStartPosition.CenterScreen);
                Environment.Exit(0);
            }

            //Select the inital first member.
            SelectTarget(PS4.TargetManagement.TargetList[0].Name);

            //Update initial list.
            UpdateTargetList();

            //Events.
            PS4.Events.DBTouched += Events_DBTouched;
        }