Exemplo n.º 1
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (DarkMessageBox.ShowWarning("Are you sure?\nThis operation cannot be undone!", "Confirm Delete", DarkDialogButton.YesNo) == DialogResult.Yes)
            {
                status.Text = "Deleting branch :'( #savethetrees";
                ContextMenuStrip cms      = (ContextMenuStrip)((ToolStripMenuItem)sender).Owner;
                TreeView         treeView = (TreeView)cms.SourceControl;
                TreeNode         node     = treeView.GetNodeAt(treeView.PointToClient(cms.Location));
                TreeNode         parent   = node.Parent;

                string source = node.Text;
                string root   = parent.Text;

                string logfile = debug ? " >>mods/logs/" + ts(DateTime.Now) + ".txt" : "";
                cmd("echo Deleting " + source + logfile
                    + " && rmdir mods\\branches\\" + root + "\\" + source + " /Q /S" + logfile
                    , false, true);

                node.Remove();

                if (node.Checked == true)
                {
                    treeLoading    = true;
                    node.Checked   = false;
                    parent.Checked = true;
                    treeLoading    = false;
                }
                status.Text = "";

                //deleteTimeout.Enabled = true;
            }
        }
        /// <summary>
        /// Apaga o usuário.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void strip_delete_Click(object sender, EventArgs e)
        {
            if (pData.ID == 0)
            {
                DarkMessageBox.ShowInformation("Você precisa carregar um usuário para fazer essa ação.", "Aviso");
                return;
            }

            var result = DarkMessageBox.ShowWarning("Deseja realmente apagar este usuário?", "Aviso", DarkDialogButton.YesNo);

            if (result == DialogResult.No)
            {
                return;
            }

            if (AccountDB.DeleteAccountData(pData.ID) > 0)
            {
                DarkMessageBox.ShowInformation("Usuário deletado.", "Aviso");

                CharacterDB.DeleteAllCharacter(pData.ID);

                Clear();
                pData.Clear();
                return;
            }

            DarkMessageBox.ShowWarning("Não foi possível fazer a exclusão.", "Aviso");
        }
Exemplo n.º 3
0
        private async void LoadImportedTheme()
        {
            ThemeManager.themeSettings.Add(tempTheme);
            ThemeManager.themeSettings.Sort((t1, t2) => t1.themeName.CompareTo(t2.themeName));

            List <ThemeConfig> missingThemes = ThemeManager.FindMissingThemes();
            bool isInstalled = missingThemes.IndexOf(tempTheme) == -1;

            if (isInstalled)
            {
                int itemIndex = ThemeManager.themeSettings.IndexOf(tempTheme) + 1;
                listView1.LargeImageList.Images.Add(GetThumbnailImage(tempTheme, 192, 108));
                listView1.Items.Insert(itemIndex, tempTheme.themeName.Replace('_', ' '),
                                       listView1.LargeImageList.Images.Count - 1);
                listView1.Items[itemIndex].Selected = true;
            }
            else
            {
                DarkMessageBox.ShowWarning("Failed to install the '" +
                                           tempTheme.themeName.Replace('_', ' ') + "' theme.", "Error");
                await Task.Run(() => ThemeManager.RemoveTheme(tempTheme));
            }

            tempTheme = null;
        }
Exemplo n.º 4
0
        public static void CheckManual()
        {
            string currentVersion = GetCurrentVersion();
            string latestVersion  = GetLatestVersion();

            if (latestVersion == null)
            {
                DarkMessageBox.ShowWarning("WinDynamicDesktop could not connect to the Internet " +
                                           "to check for updates.", "Error");
            }
            else if (IsUpdateAvailable(currentVersion, latestVersion))
            {
                DialogResult result = DarkMessageBox.ShowInformation("There is a newer version " +
                                                                     "of WinDynamicDesktop available. Do you want to download the update now?\n\n" +
                                                                     "Current Version: " + currentVersion + "\nLatest Version: " + latestVersion,
                                                                     "Update Available", DarkDialogButton.YesNo);

                if (result == DialogResult.Yes)
                {
                    UwpDesktop.GetHelper().OpenUpdateLink();
                }
            }
            else
            {
                DarkMessageBox.ShowInformation("You already have the latest version of " +
                                               "WinDynamicDesktop installed.", "Up To Date");
            }
        }
        /// <summary>
        /// Salva os dados.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void strip_save_Click(object sender, EventArgs e)
        {
            if (!VerifyTextbox())
            {
                return;
            }

            FillPlayerData();

            if (pData.ChangePass)
            {
                if (pData.LastPassword.CompareTo(pData.Password) == 0)
                {
                    pData.ChangePass = false;
                }
            }

            if (pData.ChangePin)
            {
                if (pData.LastPin.CompareTo(pData.Pin) == 0)
                {
                    pData.ChangePin = false;
                }
            }

            if (AccountDB.SaveAccountData(pData) > 0)
            {
                DarkMessageBox.ShowInformation("As informações do usuário foram atualizadas.", "Aviso");

                Clear();
                return;
            }

            DarkMessageBox.ShowWarning("Não foi possível salvar os dados.", "Aviso");
        }
Exemplo n.º 6
0
        private async void darkButtonAttach_Click(object sender, EventArgs e)
        {
            try {
                this.darkButtonAttach.Enabled = false;
                bool result = await this.devkits.AttachProcessAsync();

                if (result)
                {
                    DarkMessageBox.ShowInformation("Current game process is attached successfully !", Application.ProductName, DarkDialogButton.Ok);
                }
                else
                {
                    DarkMessageBox.ShowWarning($"No game process found", Application.ProductName, DarkDialogButton.Ok);
                }
            }
            catch (DevKitAttachProcessFailedException ex) {
                DarkMessageBox.ShowWarning($"No game process found\r\n{ex.Message}", Application.ProductName, DarkDialogButton.Ok);
            }
            catch (Exception ex) {
                DarkMessageBox.ShowError(ex.Message, $"Error - {Application.ProductName}", DarkDialogButton.Ok);
            }

            finally {
                this.darkButtonAttach.Enabled = true;
            }
        }
Exemplo n.º 7
0
        private void btnNewMap_Click(object sender, EventArgs e)
        {
            if (DarkMessageBox.ShowWarning(
                    Strings.Mapping.newmap, Strings.Mapping.newmapcaption, DarkDialogButton.YesNo,
                    Properties.Resources.Icon
                    ) !=
                DialogResult.Yes)
            {
                return;
            }

            if (Globals.CurrentMap.Changed() &&
                DarkMessageBox.ShowInformation(
                    Strings.Mapping.savemapdialogue, Strings.Mapping.savemap, DarkDialogButton.YesNo,
                    Properties.Resources.Icon
                    ) ==
                DialogResult.Yes)
            {
                SaveMap();
            }

            if (mapTreeList.list.SelectedNode == null)
            {
                PacketSender.SendCreateMap(-1, Globals.CurrentMap.Id, null);
            }
            else
            {
                PacketSender.SendCreateMap(-1, Globals.CurrentMap.Id, (MapListItem)mapTreeList.list.SelectedNode.Tag);
            }
        }
Exemplo n.º 8
0
        public void ScreenshotWorld()
        {
            var fileDialog = new SaveFileDialog()
            {
                Filter = "Png Image|*.png|JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif",
                Title  = Strings.MapGrid.savescreenshotdialogue
            };

            fileDialog.ShowDialog();
            if (fileDialog.FileName != "")
            {
                if (DarkMessageBox.ShowWarning(
                        Strings.MapGrid.savescreenshotconfirm, Strings.MapGrid.savescreenshottitle,
                        DarkDialogButton.YesNo, Properties.Resources.Icon
                        ) ==
                    DialogResult.Yes)
                {
                    FetchMissingPreviews(false);
                    Globals.PreviewProgressForm = new FrmProgress();
                    Globals.PreviewProgressForm.SetTitle(Strings.MapGrid.savingscreenshot);
                    var screenShotThread = new Thread(() => ScreenshotWorld(fileDialog.FileName));
                    screenShotThread.Start();
                    Globals.PreviewProgressForm.ShowDialog();
                }
            }
        }
Exemplo n.º 9
0
        private async void darkButtonConnect_Click(object sender, EventArgs e)
        {
            this.darkButtonConnect.Enabled  = false;
            this.darkComboBoxDevkit.Enabled = false;

            try {
                ConnectionStatus status = await this.devkits.ConnectTargetAsync();

                switch (status)
                {
                case ConnectionStatus.Connected:
                    if (this.devkits.DevkitTarget == DevkitTarget.PS3)
                    {
                        this.darkButtonAttach.Enabled = true;
                    }

                    this.darkButtonConnect.Enabled = false;
                    this.darkButtonConnect.Text    = "Connected";
                    DarkMessageBox.ShowInformation($"Connected to Target", "Devkit", DarkDialogButton.Ok);
                    break;

                default:
                    this.darkButtonConnect.Enabled = true;
                    DarkMessageBox.ShowWarning("Connection error", "Devkit", DarkDialogButton.Ok);
                    break;
                }
            }
            catch (Exception ex) {
                DarkMessageBox.ShowError(ex.Message, $"Error - {Application.ProductName}", DarkDialogButton.Ok);
                this.darkButtonConnect.Enabled = true;
            }
            finally {
                this.darkComboBoxDevkit.Enabled = true;
            }
        }
Exemplo n.º 10
0
        private void Export(bool normalformat)
        {
            string export = string.Empty;

            try
            {
                DarkTreeNode node  = accTree.SelectedNodes[0];
                string[]     title = node.Text.Split('|');
                string       gid   = title[1].Replace(" ", null);
                string       date  = title[2];
                string       pw    = node.Nodes[0].Text;
                string       lw    = node.Nodes[1].Text;
                if (normalformat)
                {
                    export = $"<= Exported by Pollery =>\r\n -> Date: {date} \r\n -> Grow ID: {gid} \r\n -> Password(s): {pw} \r\n -> Last world: {lw}";
                }
                else
                {
                    export = $"{gid}:{pw}";
                }
            }
            catch
            {
                DarkMessageBox.ShowWarning("Please select a valid account node.", "Invalid Node", DarkDialogButton.Ok);
                return;
            }
            File.WriteAllText("accounts.txt", export);
            DarkMessageBox.ShowInformation("Exported to account.txt!", "Exported successfully.", DarkDialogButton.Ok);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Insere um novo personagem.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void strip_save_Click(object sender, System.EventArgs e)
        {
            VerifyTextbox();

            if (CharacterDB.ExistCharacter(txt_user.Text))
            {
                DarkMessageBox.ShowWarning("Este usuário já está sendo utilizado.", "Aviso");
                return;
            }

            var index     = list_classes.SelectedIndices[0];
            var character = FillCharacterData();
            var classe    = Static.Classes[index];

            if (CharacterDB.InsertCharacter(_accountID, character, classe) > 0)
            {
                DarkMessageBox.ShowInformation("O personagem foi cadastrado.", "Aviso");
                Program.AccountForm.FillPlayerNames();
                Clear();
            }
            else
            {
                DarkMessageBox.ShowWarning("Não foi possível cadastrar.", "Aviso");
            }
        }
        /// <summary>
        /// Salva as alterações do personagem.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void strip_save_Click(object sender, EventArgs e)
        {
            if (txt_name.Text.Trim().Length < 4)
            {
                DarkMessageBox.ShowInformation("O nome de personagem precisa ser maior que 4 caracteres.", "Aviso");
                return;
            }

            //verifica todos os campos
            VerifyTextbox();

            //se não há classes, sai do metodo
            if (Static.Classes.Count == 0)
            {
                return;
            }

            //preenche os dados
            FillCharacterData();


            if (CharacterDB.SaveCharacterData(pData) > 0)
            {
                DarkMessageBox.ShowInformation("O personagem foi salvo.", "Aviso");

                //carrega novamente os nomes dos personagens.
                Program.AccountForm.FillPlayerNames();
            }
            else
            {
                DarkMessageBox.ShowWarning("Não foi possível salvar as informações.", "Aviso");
            }
        }
        /// <summary>
        /// Deleta o personagem.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void strip_delete_Click(object sender, EventArgs e)
        {
            if (pData.ID == 0)
            {
                return;
            }

            var result = DarkMessageBox.ShowWarning("Deseja realmente apagar o personagem?", "Aviso", DarkDialogButton.YesNo);

            if (result == DialogResult.No)
            {
                return;
            }

            if (CharacterDB.DeleteCharacter(pData.ID) > 0)
            {
                DarkMessageBox.ShowInformation("O personagem foi deletado.", "Aviso");

                //carrega novamente os nomes dos personagens.
                Program.AccountForm.FillPlayerNames();

                Close();
            }
            else
            {
                DarkMessageBox.ShowWarning("Não foi possível fazer a exclusão.", "Aviso");
            }
        }
Exemplo n.º 14
0
        private async void okButton_Click(object sender, EventArgs e)
        {
            okButton.Enabled = false;

            if (!locationCheckBox.Checked)
            {
                LocationIQData data = LocationIQService.GetLocationData(inputBox.Text);

                if (data != null)
                {
                    JsonConfig.settings.location  = inputBox.Text;
                    JsonConfig.settings.latitude  = data.lat;
                    JsonConfig.settings.longitude = data.lon;

                    this.Hide();

                    if (ThemeManager.isReady)
                    {
                        AppContext.wcsService.RunScheduler();
                    }

                    DarkMessageBox.ShowInformation("Location set successfully to: " +
                                                   data.display_name + "\n(Latitude = " + data.lat + ", Longitude = " +
                                                   data.lon + ")", "Success");

                    this.Close();
                }
                else
                {
                    DarkMessageBox.ShowWarning("The location you entered was invalid, or you " +
                                               "are not connected to the Internet.", "Error");
                }
            }
            else
            {
                this.Hide();
                bool locationUpdated = await UwpLocation.UpdateGeoposition();

                if (locationUpdated)
                {
                    if (ThemeManager.isReady)
                    {
                        AppContext.wcsService.RunScheduler();
                    }

                    this.Close();
                }
                else
                {
                    DarkMessageBox.ShowWarning("Failed to get location from Windows location " +
                                               "service.", "Error");

                    this.Show();
                }
            }

            okButton.Enabled = true;
        }
Exemplo n.º 15
0
        private void darkButton1_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog savepath = new FolderBrowserDialog();

            if (savepath.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var numbersAndWords = idEntryList.Zip(nameEntryList, (n, w) => new { id = n, name = w });
                    foreach (var nw in numbersAndWords)
                    {
                        var pkgPath = filenames;
                        var idx     = int.Parse(nw.id);
                        var name    = nw.name;
                        var outPath = savepath.SelectedPath + "\\" + name.Replace("_SHA", ".SHA").Replace("_DAT", ".DAT").Replace("_SFO", ".SFO").Replace("_XML", ".XML").Replace("_SIG", ".SIG").Replace("_PNG", ".PNG").Replace("_JSON", ".JSON").Replace("_DDS", ".DDS").Replace("_TRP", ".TRP").Replace("_AT9", ".AT9");;

                        using (var pkgFile = File.OpenRead(pkgPath))
                        {
                            var pkg = new PkgReader(pkgFile).ReadPkg();
                            if (idx < 0 || idx >= pkg.Metas.Metas.Count)
                            {
                                DarkMessageBox.ShowError("Error: entry number out of range", "PS4 PKG Tool");
                                return;
                            }
                            using (var outFile = File.Create(outPath))
                            {
                                var meta = pkg.Metas.Metas[idx];
                                outFile.SetLength(meta.DataSize);
                                if (meta.Encrypted)
                                {
                                    if (passcode == null)
                                    {
                                        DarkMessageBox.ShowWarning("Warning: Entry is encrypted but no passcode was provided! Saving encrypted bytes.", "PS4 PKG Tool");
                                    }
                                    else
                                    {
                                        var entry = new SubStream(pkgFile, meta.DataOffset, (meta.DataSize + 15) & ~15);
                                        var tmp   = new byte[entry.Length];
                                        entry.Read(tmp, 0, tmp.Length);
                                        tmp = LibOrbisPkg.PKG.Entry.Decrypt(tmp, pkg.Header.content_id, passcode, meta);
                                        outFile.Write(tmp, 0, (int)meta.DataSize);
                                        return;
                                    }
                                }
                                new SubStream(pkgFile, meta.DataOffset, meta.DataSize).CopyTo(outFile);
                            }
                        }
                    }

                    DarkMessageBox.ShowInformation("All entry item extracted", "PS4 PKG Tool");
                }
                catch (Exception a)
                {
                    DarkMessageBox.ShowError(a.Message, "PS4 PKG Tool");
                }
            }
        }
Exemplo n.º 16
0
        private async void startCoin_Click(object sender, EventArgs e)
        {
            if (useLightMode.Checked)
            {
                DialogResult lmodewarning = DarkMessageBox.ShowWarning($"Using Light mode will limit ram usage and cpu priority," +
                                                                       $" HOWEVER the process will be A LOT slower. If the process is too slow, mining won't work." +
                                                                       $"\r\nIf your PC has less than 6 logical processors, you should NOT enable this option." +
                                                                       $"\r\n\r\nYour logical processors: {Environment.ProcessorCount}\r\nProceed?", "Light Mode Warning", DarkDialogButton.Ok);
                if (lmodewarning == DialogResult.No)
                {
                    return;
                }
            }

            statL.Text        = "Status: starting";
            stopCoin.Enabled  = true;
            startCoin.Enabled = false;
            var proc = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName               = @"P-Coin\xmrig.exe",
                    Arguments              = MiningConstructor(),
                    UseShellExecute        = false,
                    RedirectStandardOutput = true,
                    RedirectStandardInput  = true,
                    CreateNoWindow         = true
                }
            };

            proc.Start();

            statL.Text             = "Status: running";
            cpuNum.Enabled         = false;
            gpuSelectPanel.Enabled = false;
            dbox.titleLabel.Text   = "P-Coin Mining Logs";
            dbox.Show();

            await Task.Run(() =>
            {
                StreamReader sr = proc.StandardOutput;
                StreamWriter sw = proc.StandardInput;
                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();
                    dbox.descriptionLabel.AppendText(line + "\r\n");
                    if (line.Contains("accepted"))
                    {
                        sw.WriteLine('h');
                    }
                    else if (line.Contains("speed"))
                    {
                    }
                }
            });
        }
Exemplo n.º 17
0
        public override void Close()
        {
            var result = DarkMessageBox.ShowWarning(@"You will lose any unsaved changes. Continue?", @"Close document", DarkDialogButton.YesNo);

            if (result == DialogResult.No)
            {
                return;
            }

            base.Close();
        }
Exemplo n.º 18
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            InitializeDatabase();

            Static.Classes = ClasseDB.LoadClasseData();

            if (Static.Classes.Count == 0)
            {
                DarkMessageBox.ShowWarning("Não foi encontrado nenhuma informação de classes.\nPortanto, as opções de edição e criação de personagem não estarão disponíveis.\nPor favor, crie classes e tente novamente.", "Importante");
            }
        }
Exemplo n.º 19
0
        private void BtnPrune_Click(object sender, EventArgs e)
        {
            if (DarkMessageBox.ShowWarning("Are you sure you wish to prune the selected date range?", "Continue", DarkDialogButton.YesNo) == DialogResult.Yes)
            {
                MainWindow.mainWindow.PruneEntries(
                    Convert.ToDateTime(monthStart.SelectionStart.ToShortDateString()),
                    Convert.ToDateTime(monthEnd.SelectionStart.ToShortDateString())
                    );

                this.Close();
            }
        }
Exemplo n.º 20
0
 private void toolStripItemDelete_Click(object sender, EventArgs e)
 {
     if (mEditorItem != null && lstAnimations.Focused)
     {
         if (DarkMessageBox.ShowWarning(
                 Strings.AnimationEditor.deleteprompt, Strings.AnimationEditor.deletetitle,
                 DarkDialogButton.YesNo, Properties.Resources.Icon
                 ) ==
             DialogResult.Yes)
         {
             PacketSender.SendDeleteObject(mEditorItem);
         }
     }
 }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (mEditorItem != null)
     {
         if (DarkMessageBox.ShowWarning(
                 Strings.VariableEditor.deleteprompt, Strings.VariableEditor.deletecaption,
                 DarkDialogButton.YesNo, Properties.Resources.Icon
                 ) ==
             DialogResult.Yes)
         {
             PacketSender.SendDeleteObject(mEditorItem);
         }
     }
 }
Exemplo n.º 22
0
 private void UnlinkMapItem_Click(object sender, EventArgs e)
 {
     if (mContextMap != null && mContextMap.MapId != Guid.Empty)
     {
         if (DarkMessageBox.ShowWarning(
                 Strings.MapGrid.unlinkprompt.ToString(mContextMap.Name), Strings.MapGrid.unlinkcaption,
                 DarkDialogButton.YesNo, Properties.Resources.Icon
                 ) ==
             DialogResult.Yes)
         {
             PacketSender.SendUnlinkMap(mContextMap.MapId);
         }
     }
 }
Exemplo n.º 23
0
        private void EnforceSingleInstance()
        {
            _mutex = new Mutex(true, @"Global\WinDynamicDesktop", out bool isFirstInstance);
            GC.KeepAlive(_mutex);

            if (!isFirstInstance)
            {
                DarkMessageBox.ShowWarning("Another instance of WinDynamicDesktop is already " +
                                           "running. You can access it by clicking on the icon in the system tray.",
                                           "Error");

                Environment.Exit(0);
            }
        }
Exemplo n.º 24
0
 private void toolStripItemUndo_Click(object sender, EventArgs e)
 {
     if (mChanged.Contains(mEditorItem) && mEditorItem != null)
     {
         if (DarkMessageBox.ShowWarning(
                 Strings.AnimationEditor.undoprompt, Strings.AnimationEditor.undotitle, DarkDialogButton.YesNo,
                 Properties.Resources.Icon
                 ) ==
             DialogResult.Yes)
         {
             mEditorItem.RestoreBackup();
             UpdateEditor();
         }
     }
 }
Exemplo n.º 25
0
 private void exitButton_Click(object sender, EventArgs e)
 {
     if (unsavedSettings)
     {
         DialogResult unsavedDialog = DarkMessageBox.ShowWarning("You have unsaved changes, are you sure you want to close this window?", "Unsaved changes", DarkDialogButton.YesNo);
         if (unsavedDialog == DialogResult.Yes)
         {
             Close();
         }
     }
     else
     {
         Close();
     }
 }
Exemplo n.º 26
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));
            }
        }
Exemplo n.º 27
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();
                }
            }
        }
Exemplo n.º 28
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));
            }
        }
Exemplo n.º 29
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();
                }
            }
        }
Exemplo n.º 30
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);
            }
        }