public void Config_Load()
        {
            DirectoryDialog.Description = Localizate.getMessage(Word.PLEASE_SELECT_SYSTEM_FOLDER);

            // Check DatFile Directory
            if (!Directory.Exists(RConfig.Instance.LineageDirectory))
            {
                new MessageBox(Localizate.getMessage(Word.SYSTEM_FOLDER_IS_EMPTY), true);

                DirectoryDialog.RootFolder = Environment.SpecialFolder.MyComputer;
                if (DirectoryDialog.ShowDialog() == DialogResult.OK)
                {
                    RConfig.Instance.LineageDirectory = DirectoryDialog.SelectedPath;
                    RConfig.Instance.save();
                }
            }
        }
 public void ChooseFolder()
 {
     try
     {
         if (DirectoryDialog.ShowDialog() == DialogResult.OK)
         {
             DirectoryBox.Text = DirectoryDialog.SelectedPath;
             isSelectedFolder  = true;
             path = DirectoryBox.Text;
         }
     }
     catch (Exception exc)
     {
         ErrorFrm errfrm = new ErrorFrm(exc.Message);
         errfrm.Show();
     }
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            var dirDialog = new DirectoryDialog("Select a directory");

            dirDialog.Open(result => OpenDirectory(result.FileName));

            Console.ReadKey();

            var openDialog = new OpenFileDialog("This is a test dialog");
            var filter     = "Text files(*.txt) | *.txt | Png files(*.png) | *.png | All files(*.*) | *.*";

            openDialog.Open(result => OpenFile(result.FileName), filter);

            Console.ReadKey();

            var saveDialog = new SaveFileDialog("Another test for saving");

            filter = "Text files(*.txt) | *.txt | Png files(*.png) | *.png | All files(*.*) | *.*";
            saveDialog.DefaultFileName = "filename.txt";
            saveDialog.Save(result => SaveFile(result.FileName), filter);

            Console.ReadKey();
        }
Beispiel #4
0
 private void ChooseDirectoryBTN_Click(object sender, EventArgs e)
 {
     try
     {
         if (DirectoryDialog.ShowDialog() == DialogResult.OK)
         {
             Playlist.Clear();
             string[] formats = { "*.aac", "*.aiff", "*.flac", "*.m4a",  "*.mmf",  "*.mp3",  "*.opus", "*.wav",   "*.wma",   "*.ogg",
                                  "*.3g2", " *.3gp", " *.avi", " *.flv", " *.mkv", " *.mov", " *.mp4", " *.mpeg", " *.webm", " *.wmv" };
             foreach (string format in formats)
             {
                 foreach (var item in Directory.GetFiles(DirectoryDialog.SelectedPath, format, SearchOption.AllDirectories))
                 {
                     var trackTags = TagLib.File.Create(item);
                     Playlist.Add(new Track()
                     {
                         TrackName    = trackTags.Tag.Title,
                         Year         = trackTags.Tag.Year.ToString(),
                         Genre        = trackTags.Tag.FirstGenre,
                         Author       = trackTags.Tag.FirstArtist,
                         Album        = trackTags.Tag.Album,
                         AudioChanels = trackTags.Properties.AudioChannels.ToString(),
                         Bits         = trackTags.Properties.AudioSampleRate.ToString(),
                         Length       = trackTags.Properties.Duration.ToString(),
                         Bitrate      = trackTags.Properties.AudioBitrate.ToString(),
                         FileSize     = (int)new FileInfo(item).Length
                     });
                 }
             }
             DirecoryPathTB.Text = DirectoryDialog.SelectedPath;
         }
     }
     catch
     {
         MessageBox.Show("Нет доступа к одной из выбранных папок", "System");
     }
 }
Beispiel #5
0
        public static void CheckGameDirectories()
        {
            bool writeGameDirFile = false;

            foreach (Game g in Game.Games)
            {
                if (g.GameDirectory == null)
                {
                    // if there was an empty entry in file, don't ask again
                    DirectoryDialog dlg = new DirectoryDialog()
                    {
                        Description = string.Format("Please point to Location of {0}\nCancel if not installed.", g.Id)
                    };
                    dlg.Refresh();
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        g.GameDirectory = dlg.SelectedPath;
                    }
                    else
                    {
                        // add empty entry to file for next time
                        g.GameDirectory = Game.NOT_INSTALLED;
                    }
                    writeGameDirFile = true;
                }
                else if (g.GameDirectory.Equals(Game.NOT_INSTALLED))
                {
                    // mark as invalid
                    g.GameDirectory = null;
                }
            }
            // don't write the file if user wasn't queried
            if (writeGameDirFile)
            {
                SaveGameDirs();
            }
        }
Beispiel #6
0
        private void ExportData(object sender, EventArgs e)
        {
            string extractTo = ModManager.Instance.CurrentModSet ? ModManager.Instance.CurrentModDirectory : null;

            if (extractTo == null)
            {
                DirectoryDialog dialog = new DirectoryDialog {
                    Description  = "Please point to folder to extract to",
                    SelectedPath = Settings.Default.LastPackDirectory
                };
                extractTo = dialog.ShowDialog() == DialogResult.OK ? dialog.SelectedPath : null;
            }
            if (!string.IsNullOrEmpty(extractTo))
            {
                List <PackedFile> files = new List <PackedFile>();
                files.Add(CurrentPackedFile);
                FileExtractor extractor = new FileExtractor(null, null, extractTo)
                {
                    Preprocessor = new TsvExtractionPreprocessor()
                };
                extractor.ExtractFiles(files);
                MessageBox.Show(string.Format("File exported to TSV."));
            }
        }
Beispiel #7
0
        public void Draw(Sdl2Window window)
        {
            ImGui.SetNextWindowPos(Vector2.Zero, ImGuiCond.Always, Vector2.Zero);
            ImGui.SetNextWindowSize(new Vector2(window.Width, window.Height), ImGuiCond.Always);

            ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0);
            bool open = false;

            ImGui.Begin("OpenSAGE Big Editor", ref open, ImGuiWindowFlags.MenuBar | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize);

            var wasOpenClicked        = false;
            var wasExportAllClicked   = false;
            var wasImportFilesClicked = false;
            var wasImportFileClicked  = false;

            if (ImGui.BeginMenuBar())
            {
                if (ImGui.BeginMenu("File"))
                {
                    if (ImGui.MenuItem("Open...", "Ctrl+O", false, true))
                    {
                        wasOpenClicked = true;
                    }
                    if (ImGui.MenuItem("Close", null, false, _bigArchive != null))
                    {
                        OpenBigFile(null);
                    }

                    ImGui.Separator();

                    if (ImGui.MenuItem("Exit", "Alt+F4", false, true))
                    {
                        Environment.Exit(0);
                    }

                    ImGui.EndMenu();
                }
                if (ImGui.BeginMenu("Edit"))
                {
                    if (ImGui.MenuItem("Export All", "Ctrl+E", false, _bigArchive != null))
                    {
                        wasExportAllClicked = true;
                    }

                    ImGui.Separator();

                    if (ImGui.MenuItem("Import Files", "Ctrl+Shift+I", false, _bigArchive != null))
                    {
                        wasImportFilesClicked = true;
                    }

                    if (ImGui.MenuItem("Import File...", "Ctrl+I", false, _bigArchive != null))
                    {
                        wasImportFileClicked = true;
                    }

                    ImGui.EndMenu();
                }

                ImGui.EndMenuBar();
            }

            if (wasOpenClicked)
            {
                var openDialog = new OpenFileDialog("Open .big file");
                openDialog.Open(result => OpenBigFile(result.FileName), "Big archive(*.big) | *.big");
            }
            if (wasExportAllClicked)
            {
                var dirDialog = new DirectoryDialog("Select folder for export files");
                dirDialog.Open(result => Export(result.FileName));
            }
            if (wasImportFilesClicked)
            {
                var dirDialog = new DirectoryDialog("Select folder for import files");
                dirDialog.Open(result => Import(result.FileName));
            }
            if (wasImportFileClicked)
            {
                var openDialog = new OpenFileDialog("Select file which you want to import");
                openDialog.Open(result => ImportFile(result.FileName));
            }

            if (_bigArchive != null)
            {
                ImGui.BeginChild("body", new Vector2(0, -36), false, 0);

                DrawFilesList(new Vector2(window.Width, window.Height));

                ImGui.SameLine();

                DrawFileContent();

                ImGui.EndChild(); // end body

                DrawStatusPanel();
            }
            else
            {
                ImGui.Text("Open a .big file to see its contents here.");
            }

            ImGui.End();
            ImGui.PopStyleVar();
        }
Beispiel #8
0
        string SelectScanPath(string initialFolder)
        {
            string result = null;
            DirectoryDialog dialog = new DirectoryDialog();
            dialog.BrowseFor = DirectoryDialog.BrowseForTypes.Directories;
            dialog.Title = "Select a folder to be scanned. Successfully scanned files will be added to the Playdar content library.";

            if (!string.IsNullOrEmpty(initialFolder))
                dialog.InitialPath = initialFolder;

            _inDirectoryDialog = true;
            if (dialog.ShowDialog(this) == DialogResult.OK)
                result = dialog.Selected;
            _inDirectoryDialog = false;
            return result;
        }