Example #1
0
        static void Main(string[] args)
        {
            var openDialog = new OpenFileDialog("This is a test dialog");
            var filter     = "Text files(*.txt) | *.txt | Png files(*.png) | *.png | All files(*.*) | *.*";

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

            Console.ReadKey();

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

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

            Console.ReadKey();
        }
Example #2
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();
        }
Example #3
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();
        }