Ejemplo n.º 1
0
        public string SaveFileName()
        {
            var dialog = new ChooseFileDialog();

            dialog.ShowDialog();
            return(dialog.DocumentName);
        }
Ejemplo n.º 2
0
        private void bLoad_Click(object sender, EventArgs e)
        {
            ChooseFileDialog.InitialDirectory = "c:\\";
            ChooseFileDialog.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            ChooseFileDialog.FilterIndex      = 2;
            ChooseFileDialog.RestoreDirectory = true;

            var path     = string.Empty;
            var pathFull = string.Empty;
            var content  = string.Empty;

            if (ChooseFileDialog.ShowDialog() == DialogResult.OK)
            {
                pathFull          = ChooseFileDialog.FileName;
                path              = ChooseFileDialog.SafeFileName;
                lChoosenFile.Text = $"File: {path}";

                var fileStream = ChooseFileDialog.OpenFile();

                using (StreamReader reader = new StreamReader(fileStream))
                {
                    content = reader.ReadToEnd();
                }
            }
            else
            {
                throw new FormatException();
            }

            content.Replace(",", ".");

            NeuralNetwork.Create(pathFull, content);

            lNetwork.Text = NeuralNetwork.ToString();
        }
Ejemplo n.º 3
0
        public string NameImage(string baseName)
        {
            var dialog = new ChooseFileDialog(baseName);

            dialog.ShowDialog();
            return(dialog.DocumentName);
        }
Ejemplo n.º 4
0
        private void FileButton_Click(object sender, EventArgs e)
        {
            filepath = "";
            if (ChooseFileDialog.ShowDialog() == DialogResult.OK)
            {
                filepath = ChooseFileDialog.FileName;
            }
            if (filepath == "")
            {
                return;
            }
            Console.WriteLine(filepath);

            TagLib.File tagFile = TagLib.File.Create(filepath);

            this.NameTextBox.Text    = tagFile.Tag.Title;
            this.ArtistTextbox.Text  = tagFile.Tag.FirstPerformer;
            this.albumTextBox.Text   = tagFile.Tag.Album;
            this.GenreTextBox.Text   = tagFile.Tag.FirstGenre;
            this.ReleaseDateBox.Text = tagFile.Tag.Year + "";
            this.Track_NoBox.Text    = tagFile.Tag.Track + "";
            length = (int)tagFile.Properties.Duration.TotalSeconds;

            System.Console.WriteLine(tagFile.Properties.Duration + "");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Prepares for server start, then starts the server
        /// </summary>
        private void StartServer()
        {
            ChooseFileDialog.Filter = "Minecraft Server Files (*.jar)|*.jar";
            if (ServerManager.Restart || ChooseFileDialog.ShowDialog() != DialogResult.Cancel)
            {
                ConsoleWindow.AppendText("Loading...");

                //Server starts here
                ServerManager.StartServer(ChooseFileDialog.FileName, this);
                listBox1.Items.Clear();
                startToolStripMenuItem.Disable();
                toolsToolStripMenuItem.Enabled = true;
                importCommandBlockLanguageFileToolStripMenuItem.Enable();
                batchImportCommandBlockLanguageFilesToolStripMenuItem.Enable();
                stopToolStripMenuItem.Enable();
                restartToolStripMenuItem.Enable();
                switchToolStripMenuItem.Enable();
            }
            ServerManager.Restart = false;
            ServerManager.Switch  = false;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Imports a MCCBL file
 /// </summary>
 /// <param name="reimport">Whether or not to reimport the last import</param>
 /// <param name="selector">Selector at which to import</param>
 private void ImportFile(bool reimport = false, string selector = null)
 {
     if (!reimport)
     {
         //Opens a file dialog and then imports the selected file
         ChooseFileDialog.Filter = "CommandBlock Language Files (*.mccbl)|*.mccbl";
         if (ChooseFileDialog.ShowDialog() != DialogResult.Cancel)
         {
             CBLInterpreter interpreter = new CBLInterpreter(this, ChooseFileDialog.SafeFileName);
             ConsoleWindow.AppendText("Importing " + ChooseFileDialog.SafeFileName);
             SendCommand(ChatTools.MultiTellraw("@a", new TellrawColor[] { TellrawColor.gold, TellrawColor.aqua }, new string[] { "Importing ", ChooseFileDialog.SafeFileName }));
             //SendCommand("say §6Importing §b§l" + ChooseFileDialog.SafeFileName);
             CBLFile importer = interpreter.Interpret(ChooseFileDialog.FileName);
             if (importer != null && importer.Import(this))
             {
                 SendCommand(ChatTools.MultiTellraw("@a", new TellrawColor[] { TellrawColor.green, TellrawColor.yellow, TellrawColor.green }, new string[] { "Successfully imported ", importer.Commands.Count.ToString(), " commands" }));
                 ConsoleWindow.AppendText("Successfully imported " + importer.Commands.Count + " commands");
                 SendCommand(ChatTools.Tellraw("@a", TellrawColor.red, "Don't forget to enable the first Command Block if necessary"));
                 //SendCommand("say §aSuccessfully §aimported §e§l" + importer.Commands.Count + " §acommands");
                 //SendCommand("say §c§l§nDon't §c§l§nforget §cto §cenable §cthe §cfirst §cCommand §cBlock §cif §cnecessary");
             }
             else
             {
                 SendCommand(ChatTools.Tellraw("@a", TellrawColor.red, "[ERROR] Import was cancelled or failed"));
             }
         }
         else
         {
             SendCommand(ChatTools.Tellraw("@a", TellrawColor.red, "[ERROR] Import was cancelled or failed"));
         }
     }
     else
     {
         //Reimports the previously imported commands
         if (ChooseFileDialog.SafeFileName.EndsWith(".mccbl"))
         {
             CBLInterpreter interpreter = new CBLInterpreter(this, ChooseFileDialog.SafeFileName, false, selector ?? Settings.Default.LastSelector);
             ConsoleWindow.AppendText("Reimporting " + ChooseFileDialog.SafeFileName);
             SendCommand(ChatTools.MultiTellraw("@a", new TellrawColor[] { TellrawColor.gold, TellrawColor.aqua }, new string[] { "Reimporting ", ChooseFileDialog.SafeFileName }));
             //SendCommand("say §6Reimporting §b§l" + ChooseFileDialog.SafeFileName);
             CBLFile importer = interpreter.Interpret(ChooseFileDialog.FileName);
             if (importer != null && importer.Import(this))
             {
                 ConsoleWindow.AppendText("Successfully imported " + importer.Commands.Count + " commands");
                 SendCommand(ChatTools.MultiTellraw("@a", new TellrawColor[] { TellrawColor.green, TellrawColor.yellow, TellrawColor.green }, new string[] { "Successfully imported ", importer.Commands.Count.ToString(), " commands" }));
                 SendCommand(ChatTools.Tellraw("@a", TellrawColor.red, "Don't forget to enable the first Command Block if necessary"));
                 //SendCommand("say §aSuccessfully §areimported §e§l" + importer.Commands.Count + " §acommands");
                 //SendCommand("say §c§l§nDon't §c§l§nforget §cto §cenable §cthe §cfirst §cCommand §cBlock §cif §cnecessary");
             }
             else
             {
                 SendCommand(ChatTools.Tellraw("@a", TellrawColor.red, "[ERROR] Reimport was cancelled or failed"));
             }
         }
         else
         {
             SendCommand(ChatTools.MultiTellraw("@a", new TellrawColor[] { TellrawColor.red, TellrawColor.aqua, TellrawColor.red }, new string[] { "Reimporting ", ChooseFileDialog.SafeFileName, " Failed!" }));
             //SendCommand("say §cReimporting §b§l" + ChooseFileDialog.SafeFileName + " §cFailed!");
         }
     }
 }