System.Windows.Forms.CommonDialog.ShowDialog()

Here are the examples of the csharp api System.Windows.Forms.CommonDialog.ShowDialog() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3087 Examples 7

19 Source : Form1.cs
with MIT License
from Amine-Smahi

private void bt_start_Click( object sender, EventArgs e )
        {
            try
            {
                if ( this.tb_SaveFolder.Text.Length < 1 )
                {
                    FolderBrowserDialog fbd = new FolderBrowserDialog();
                    if ( fbd.ShowDialog() == DialogResult.OK )
                    {
                        this.StartRec( fbd.SelectedPath );
                    }
                }
                else
                {
                    this.StartRec( this.tb_SaveFolder.Text );
                }
                if (tb_SaveFolder.Text.Length == 0)
                {
                    panel1.Visible = false;
                }
            }
            catch ( Exception exc )
            {
                MessageBox.Show( exc.Message );
            }
        }

19 Source : MainForm.cs
with Mozilla Public License 2.0
from amrali-eg

private void OnExport(object sender, EventArgs e)
        {
            if (lstResults.CheckedItems.Count <= 0)
            {
                ShowWarning("Select one or more files to export");
                return;
            }

            string filename1 = "";
            SaveFileDialog saveFileDialog1 = new SaveFileDialog
            {
                replacedle = "Export to a Text File",
                Filter = "txt files (*.txt)|*.txt",
                RestoreDirectory = true
            };
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                filename1 = saveFileDialog1.FileName;
            }

            if (filename1 != "")
            {
                try
                {
                    using (StreamWriter sw = new StreamWriter(filename1))
                    {
                        foreach (ListViewItem item in lstResults.CheckedItems)
                        {
                            string charset = item.SubItems[RESULTS_COLUMN_CHARSET].Text;
                            string fileName = item.SubItems[RESULTS_COLUMN_FILE_NAME].Text;
                            string directory = item.SubItems[RESULTS_COLUMN_DIRECTORY].Text;
                            sw.WriteLine("{0}\t{1}\\{2}", charset, directory, fileName);
                        }
                    }
                }
                catch
                {
                    // do nothing
                }
            }
        }

19 Source : FormGUI.cs
with MIT License
from AndnixSH

private void selBinFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "Il2Cpp binary file|*.*";
            ofd.replacedle = "Select Il2Cpp binary file";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                binFileTxtBox.Text = ofd.FileName;
                CodeRegistrationTxtBox.Text = "";
                metadataRegistrationTxtBox.Text = "";
                if (Settings.Default.AutoSetDir)
                {
                    outputTxtBox.Text = Path.GetDirectoryName(binFileTxtBox.Text) + "\\";
                }
            }
        }

19 Source : FormGUI.cs
with MIT License
from AndnixSH

private void selDatFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "global-metadata|global-metadata.dat";
            ofd.replacedle = "Select global-metadata.dat";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                datFileTxtBox.Text = ofd.FileName;
                CodeRegistrationTxtBox.Text = "";
                metadataRegistrationTxtBox.Text = "";
            }
        }

19 Source : FormGUI.cs
with MIT License
from AndnixSH

private void selOutDir_Click(object sender, EventArgs e)
        {
            var fbd = new FolderBrowserDialog();
            if (fbd.ShowDialog() == DialogResult.OK)
            {
                outputTxtBox.Text = fbd.SelectedPath + "\\"; //Show the path in label
            }
        }

19 Source : ProjectView.cs
with MIT License
from AndresTraks

private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dialog = new SaveFileDialog();
            dialog.FileName = Project.NamespaceName + ".xml";
            dialog.InitialDirectory = Project.FullProjectPath;
            dialog.Filter = "XML files|*.xml";
            var result = dialog.ShowDialog();
            if (result != DialogResult.OK)
            {
                return;
            }

            var settings = new XmlWriterSettings
            {
                Indent = true
            };
            using (var writer = XmlWriter.Create(dialog.FileName, settings))
            {
                writer.WriteStartElement("WrapperProject");
                writer.WriteStartElement("CppCodeModel");
                Project.WriteSourceItemXml(writer, Project.RootFolder, Path.GetDirectoryName(dialog.FileName) + Path.DirectorySeparatorChar);
            }
        }

19 Source : StartWizard.cs
with MIT License
from AndresTraks

private void browseButton_Click(object sender, EventArgs e)
        {
            var folderBrowse = new FolderBrowserDialog();
            var path = Application.UserAppDataRegistry.GetValue("SourceFolder") as string;
            if (path != null)
            {
                path = path.Replace('/', '\\');
                folderBrowse.SelectedPath = path;
            }
            folderBrowse.ShowNewFolderButton = false;
            var result = folderBrowse.ShowDialog();
            if (result == DialogResult.OK)
            {
                sourceFolder.Text = folderBrowse.SelectedPath;
            }
        }

19 Source : StartWizard.cs
with MIT License
from AndresTraks

private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog();
            dialog.Filter = "XML files|*.xml";
            var result = dialog.ShowDialog();
            if (result != DialogResult.OK)
            {
                return;
            }

            InputPath = dialog.FileName;
            Action = WizardAction.Open;
            Close();
        }

19 Source : FindUngroupedWindow.xaml.cs
with MIT License
from andydandy74

public void selectSource_Click(object sender, RoutedEventArgs e)
		{
			var openDialog = new FolderBrowserDialog
			{
				ShowNewFolderButton = true
			};

			if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
			{
				FindUngroupedViewModel vm = (FindUngroupedViewModel)findUngroupedPanel.DataContext;
				vm.OnBatchFixUngroupedClicked(openDialog.SelectedPath);
			}
		}

19 Source : PlayerInputsWindow.xaml.cs
with MIT License
from andydandy74

public void selectSourceInputs_Click(object sender, RoutedEventArgs e)
		{
			var openDialog = new FolderBrowserDialog
			{
				ShowNewFolderButton = true
			};

			if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
			{
				PlayerInputsViewModel vm = (PlayerInputsViewModel)playerInputsPanel.DataContext;
				vm.OnBatchResetInputsClicked(openDialog.SelectedPath);
			}
		}

19 Source : UnfancifyWindow.xaml.cs
with MIT License
from andydandy74

public void selectSource_Click(object sender, RoutedEventArgs e)
        {
            var openDialog = new FolderBrowserDialog
            {
                ShowNewFolderButton = true
            };

            if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                UnfancifyViewModel vm = (UnfancifyViewModel)unfancifyPanel.DataContext;
                vm.OnBatchUnfancifyClicked(openDialog.SelectedPath);
            }
        }

19 Source : NotepadViewModel.cs
with MIT License
from AngryCarrot789

public void OpenNotepadsFromDirectoryExplorer()
        {
            System.Windows.Forms.FolderBrowserDialog ofd =
                new System.Windows.Forms.FolderBrowserDialog();
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                int i;
                if (ofd.SelectedPath.IsDirectory())
                {
                    try
                    {
                        string[] files = Directory.GetFiles(ofd.SelectedPath);
                        for (i = 0; i < files.Length; i++)
                        {
                            string file = files[i];
                            OpenNotepadFromPath(file);
                        }
                        Information.Show($"Opened {i} files", InfoTypes.FileIO);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(
                            $"Error opening all files in a directory:  {e.Message}",
                            "Error opening a directory");
                    }
                }
            }
        }

19 Source : Settings.xaml.cs
with Apache License 2.0
from AnkiUniversal

private void OnSaveOcrFolderButtonClick(object sender, RoutedEventArgs e)
        {
            using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
            {
                System.Windows.Forms.DialogResult result = dialog.ShowDialog();
                if(result == System.Windows.Forms.DialogResult.OK)
                {
                    saveOcrFolderTextBox.Text = dialog.SelectedPath;            
                }
            }
        }

19 Source : HelpViewModel.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

private async void SaveSupportInfo()
        {
            try
            {
                this.Wait = true;

                var result = this.saveFileDialog.ShowDialog();
                if (result != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                await Task.Run(() =>
                    this.SaveSupportInfoCore(this.saveFileDialog.FileName));

                ModernMessageBox.ShowDialog(
                    "SupportInfo Saved.",
                    "ACT.Hojoring");
            }
            catch (Exception ex)
            {
                ModernMessageBox.ShowDialog(
                    "Fatal Error.",
                    "ACT.Hojoring",
                    MessageBoxButton.OK,
                    ex);
            }
            finally
            {
                this.Wait = false;
            }
        }

19 Source : AddDownloadWindow.xaml.cs
with GNU General Public License v3.0
from antikmozib

private void btnBrowse_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog();

            if (Directory.Exists(cboDestination.Text))
            {
                dlg.SelectedPath = cboDestination.Text;
            }
            else
            {
                dlg.SelectedPath = AppPaths.DownloadsFolder;
            }

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!cboDestination.Items.Contains(dlg.SelectedPath))
                    cboDestination.Items.Add(dlg.SelectedPath);
                cboDestination.Text = dlg.SelectedPath;
            }
        }

19 Source : MainForm.cs
with MIT License
from appsonsf

private void buttonChoose_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter = "AllFiles|*.*";
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    //Get the path of specified file
                    textLocation.Text = openFileDialog.FileName;
                }
            }
        }

19 Source : MainForm.cs
with MIT License
from appsonsf

private void BtnAttachment_SelectFile_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter = "AllFiles|*.*";
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    txtAttachment_FilePath.Text = openFileDialog.FileName;
                }
            }
        }

19 Source : ColorSetupForm.cs
with MIT License
from ar1st0crat

private void _colorPanel_MouseClick(object sender, MouseEventArgs e)
        {
            var colorDialog = new ColorDialog();
            if (colorDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            
            var position = (float)e.X / _colorPanel.Width;
            
            var idx = ~Positions.BinarySearch(position);
            
            // wow, can it really happen?! ))
            if (idx < 0)
            {
                idx = ~idx;
            }

            Positions.Insert(idx, position);
            Colors.Insert(idx, colorDialog.Color);

            var panel = new Panel()
            {
                BorderStyle = BorderStyle.FixedSingle,
                BackColor = colorDialog.Color,
                Left = e.X + _colorPanel.Left,
                Top = _color1.Top,
                Width = _color1.Width,
                Height = _color1.Height,
                Tag = 1
            };
            panel.MouseClick += _color_MouseClick;
            Controls.Add(panel);

            _panels.Insert(idx, panel);

            for (var i = 0; i < _panels.Count; i++)
            {
                _panels[i].Tag = i;
            }

            Invalidate();
        }

19 Source : ColorSetupForm.cs
with MIT License
from ar1st0crat

private void _color_MouseClick(object sender, MouseEventArgs e)
        {
            var colorDialog = new ColorDialog();
            if (colorDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var panel = sender as Panel;
            Colors[(int)panel.Tag] = colorDialog.Color;
            panel.BackColor = colorDialog.Color;
            Invalidate();
        }

19 Source : OpenFileDialogAdapter.cs
with MIT License
from arasplm

public OpenFileDialogResult ShowDialog()
		{
			DialogResult dialogResult = this.view.ShowDialog();
			return new OpenFileDialogResult()
			{
				DialogResult = dialogResult,
				FileName = view.FileName
			};
		}

19 Source : Form1.cs
with MIT License
from Arefu

private void LoadToolStripMenuItem_Click(object Sender, EventArgs Args)
        {
            listBox1.Items.Clear();

            using (var Ofd = new OpenFileDialog())
            {
                Ofd.replacedle = "Select File To Decode";
                Ofd.Filter = "Language file (*.bnd) | *.bnd";
                if (Ofd.ShowDialog() != DialogResult.OK) return;

                LanguageFile = Ofd.SafeFileName;
                using (var Reader = new BinaryReader(File.Open(Ofd.FileName, FileMode.Open, FileAccess.Read)))
                {
                    var AmountOfStrings =
                        Convert.ToInt32(
                            Utilities.HexToDec(Utilities.ByteArrayToString(Reader.ReadBytes(4)).TrimStart('0'))) - 1;
                    var JumpTo =
                        Convert.ToInt32(
                            Utilities.HexToDec(Utilities.ByteArrayToString(Reader.ReadBytes(4)).TrimStart('0')));
                    var CurrentPos = Reader.BaseStream.Position;
                    Reader.BaseStream.Position = JumpTo - 4;
                    Reader.BaseStream.Position = CurrentPos;

                    var Count = 0;
                    var StringOffsets = new List<int>();
                    do
                    {
                        StringOffsets.Add(Convert.ToInt32(
                            Utilities.HexToDec(Utilities.ByteArrayToString(Reader.ReadBytes(4)).TrimStart('0'))));
                        Count++;
                    } while (Count < AmountOfStrings);

                    for (Count = 0; Count < StringOffsets.Count; Count++)
                        listBox1.Items.Add(Count != StringOffsets.Count - 1
                            ? Encoding.BigEndianUnicode.GetString(
                                Reader.ReadBytes(StringOffsets[Count] - (int) Reader.BaseStream.Position))
                            : Encoding.BigEndianUnicode.GetString(
                                Reader.ReadBytes((int) Reader.BaseStream.Length - (int) Reader.BaseStream.Position)));
                }
            }
        }

19 Source : Utilities.cs
with MIT License
from Arefu

public static List<string> ParseTocFile()
        {
            StreamReader Reader;
            var LocalVarFiles = new List<string>();
            try
            {
                Reader = new StreamReader($"{GetInstallDir()}\\YGO_DATA.TOC");
            }
            catch (Exception)
            {
                using (var Ofd = new OpenFileDialog())
                {
                    Ofd.replacedle = "Select YuGiOh.exe";
                    Ofd.Filter = "YuGiOh.exe | YuGiOh.exe";
                    var Result = Ofd.ShowDialog();
                    if (Result != DialogResult.OK) Environment.Exit(1);
                    Reader = new StreamReader(File.Open($"{new FileInfo(Ofd.FileName).DirectoryName}\\YGO_DATA.TOC",
                        FileMode.Open, FileAccess.Read));
                }
            }

            Reader.ReadLine(); //Dispose First Line.
            while (!Reader.EndOfStream)
            {
                var Line = Reader.ReadLine();
                if (Line == null) continue;

                Line = Line.TrimStart(' '); //Trim Starting Spaces.
                Line = Regex.Replace(Line, @"  +", " ", RegexOptions.Compiled); //Remove All Extra Spaces.
                var LineData = Line.Split(' '); //Split Into Chunks.
                LocalVarFiles.Add(LineData[2]); //Add To List For Manip.
            }

            return LocalVarFiles;
        }

19 Source : Cyclone.cs
with MIT License
from Arefu

[STAThread]
        private static void Main()
        {
            //Load ZIB.
            var ZibFolder = "";
            using (var Fbd = new FolderBrowserDialog())
            {
                Fbd.ShowNewFolderButton = false;
                Fbd.Description = "Select the ZIB folder.";
                Fbd.SelectedPath = Application.StartupPath;

                if (Fbd.ShowDialog() != DialogResult.OK)
                    Environment.Exit(1);
                else
                    ZibFolder = Fbd.SelectedPath;
            }

            switch (new DirectoryInfo(ZibFolder).Name.Replace(" Unpacked", string.Empty))
            {
                // PC version .zib files
                case "busts.zib":
                    Packer.Pack(ZibFolder, 0x2390);
                    break;
                case "cardcropHD400.jpg.zib":
                    Packer.Pack(ZibFolder);
                    break;
                case "cardcropHD401.jpg.zib":
                    Packer.Pack(ZibFolder);
                    break;
                case "decks.zib":
                    Packer.Pack(ZibFolder, 0x8650);
                    break;
                case "packs.zib":
                    Packer.Pack(ZibFolder, 0x750);
                    break;

                // switch version .zib files
                case "cardcropHD400.illust_a.jpg.zib":
                    Packer.Pack(ZibFolder, 0xE750);
                    break;
                case "cardcropHD400.illust_j.jpg.zib":
                    Packer.Pack(ZibFolder, 0x903D0);
                    break;
                default:
                    throw new Exception("This is either an unsupported ZIB");
            }
        }

19 Source : Form1.cs
with MIT License
from Arefu

private void opemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var OFD = new OpenFileDialog())
            {
                OFD.replacedle = "Select Your Save File...";
                OFD.Multiselect = false;
                OFD.Filter = "Save file (*.dat) | *.dat";

                if (OFD.ShowDialog() != DialogResult.OK)
                    return;


                //Start Parsing Save File Populating Items.
                //Check If Save File.
                using (var Reader = new BinaryReader(File.Open(OFD.FileName, FileMode.Open, FileAccess.Read)))
                {
                    var SaveHeader = Reader.ReadBytes(10);
                    var KnownHeader = new byte[] {0xF9, 0x29, 0xCE, 0x54, 0x02, 0x4D, 0x71, 0x04, 0x4D, 0x71};

                    if (!KnownHeader.SequenceEqual(SaveHeader))
                    {
                        MessageBox.Show(
                            "This Is Either A Corrupted Save, Or Not A Save File. Refer To Wiki For Information",
                            "Invalid Save!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    Reader.Close();
                    tabControl1.Enabled = true;
                    SaveFile = OFD.FileName;
                }
            }
        }

19 Source : Program.cs
with MIT License
from Arefu

[STAThread]
        private static void Main()
        {
            Console.replacedle = "Lithe";
            var Credits = "";
            using (var Ofd = new OpenFileDialog())
            {
                Ofd.replacedle = "Select Credits To Encode/Decode";
                Ofd.Filter = "Credits file (*.dat, *.txt) | *.dat; *.txt";
                if (Ofd.ShowDialog() == DialogResult.OK)
                    Credits = Ofd.FileName;
                else
                    Environment.Exit(1);
            }

            if (Utilities.IsExt(Credits, ".dat"))
            {
                using (var Reader = new BinaryReader(File.Open(Credits, FileMode.Open, FileAccess.Read)))
                {
                    var CreditsContent = Reader.ReadBytes((int) new FileInfo(Credits).Length);
                    File.WriteAllText("credits.txt",
                        Encoding.Unicode.GetString(CreditsContent)
                            .Replace("?",
                                string.Empty)); //Two Start Characters Are A Magic Byte Letting The Game Know To In-Line Images
                    Utilities.Log("Finished Parsing.", Utilities.Event.Information);
                }
            }
            else
            {
                using (var Writer = new BinaryWriter(File.Open("credits.dat", FileMode.Append, FileAccess.Write)))
                {
                    using (var Reader =
                        new BinaryReader(File.Open("credits.txt", FileMode.OpenOrCreate, FileAccess.Read)))
                    {
                        var Content = Reader.ReadBytes((int) Reader.BaseStream.Length);
                        Writer.Write(new byte[] {0xFF, 0xFE});
                        foreach (var Char in Encoding.ASCII.GetString(Content))
                            switch (Char)
                            {
                                case '\r':
                                    Writer.Write(new byte[] {0x0D, 0x00});
                                    break;

                                case '\n':
                                    Writer.Write(new byte[] {0x0A, 0x00});
                                    break;

                                default:
                                    Writer.Write(new byte[] {Convert.ToByte(Char), 0x00});
                                    break;
                            }
                    }
                }

                Utilities.Log("Finished Encoding.", Utilities.Event.Information);
            }
        }

19 Source : Program.cs
with MIT License
from Arefu

[STAThread]
        private static void Main(string[] Args)
        {
            var UseArgs = false;
            var TocFileLocation = "";

            if (Args.Length > 0)
            {
                TocFileLocation = Args.FirstOrDefault(File.Exists);
                if (TocFileLocation != null)
                    UseArgs = true;
                else
                    Utilities.Log("Coun't Find TOC File.", Utilities.Event.Warning);
            }

            Console.replacedle = "Onomatopaira";

            using (var FileDialog = new OpenFileDialog())
            {
                FileDialog.replacedle = "Open Yu-Gi-Oh TOC File...";
                FileDialog.Filter = "Yu-Gi-Oh! Wolf TOC File |*.toc";
                if (UseArgs == false)
                {
                    if (FileDialog.ShowDialog() != DialogResult.OK) return;
                    TocFileLocation = FileDialog.FileName;
                }

                try
                {
                    using (var reader = new StreamReader(TocFileLocation))
                    {
                        if (!File.Exists(TocFileLocation.Replace(".toc", ".dat")))
                            Utilities.Log("Can't Find DAT File.", Utilities.Event.Error, true, 1);
                        var datReader =
                            new BinaryReader(File.Open(TocFileLocation.Replace(".toc", ".dat"), FileMode.Open));
                        reader.ReadLine();

                        while (!reader.EndOfStream)
                        {
                            var line = reader.ReadLine();
                            if (line == null) continue;

                            line = line.TrimStart(' ');
                            line = Regex.Replace(line, @"  +", " ", RegexOptions.Compiled);
                            var Data = new FileInformation(line.Split(new char[] { ' ' }, 3));

                            Utilities.Log(
                                $"Extracting File: {new FileInfo(Data.FileName).Name} ({Data.FileSize} Bytes)",
                                Utilities.Event.Information);

                            new FileInfo("YGO_DATA/" + Data.FileName).Directory?.Create();

                            var ExtraBytes = Utilities.HexToDec(Data.FileSize);
                            if (Utilities.HexToDec(Data.FileSize) % 4 != 0)
                                while (ExtraBytes % 4 != 0)
                                    ExtraBytes = ExtraBytes + 1;

                            using (var FileWriter = new BinaryWriter(File.Open("YGO_DATA/" + Data.FileName,
                                FileMode.Create, FileAccess.Write)))
                            {
                                FileWriter.Write(datReader.ReadBytes(Utilities.HexToDec(Data.FileSize)));
                                FileWriter.Flush();
                            }

                            datReader.BaseStream.Position += ExtraBytes - Utilities.HexToDec(Data.FileSize);
                        }
                    }
                }
                catch (Exception Ex)
                {
                    Utilities.Log($"Exception Caught: {Ex.Message}", Utilities.Event.Error, true, 1);
                }
            }
        }

19 Source : Program.cs
with MIT License
from Arefu

[STAThread]
        private static void Main()
        {
            Console.replacedle = "Vortex";

            if (File.Exists("YGO_DATA.dat"))
                File.Delete("YGO_DATA.dat");
            if (File.Exists("YGO_DATA.toc"))
                File.Delete("YGO_DATA.toc");

            var YgoFolder = "";
            using (var Fbd = new FolderBrowserDialog())
            {
                Fbd.ShowNewFolderButton = false;
                Fbd.Description = "Select the YGO_DATA folder.";
                Fbd.SelectedPath = Application.StartupPath;

                if (Fbd.ShowDialog() != DialogResult.OK)
                    Environment.Exit(1);
                else
                    YgoFolder = Fbd.SelectedPath;
            }

            if (!YgoFolder.Contains("YGO_DATA"))
                throw new Exception("YGO_DATA Folder Not Found!");

            Files = Utilities.ParseTocFile();
            FilesToPack = Directory.GetFiles($"{YgoFolder}", "*.*", SearchOption.AllDirectories);

            File.AppendAllText("YGO_DATA.toc", "UT\n");

            using (var Writer = new BinaryWriter(File.Open("YGO_DATA.dat", FileMode.Append, FileAccess.Write)))
            {
                foreach (var Item in Files)
                {
                    var CurrentFileName = FilesToPack?.First(File => File.Contains(Item));

                    Utilities.Log($"Packing File: {CurrentFileName}.", Utilities.Event.Information);
                    var CurrentFileNameLength = Utilities.DecToHex(CurrentFileName
                        .Split(new[] {"YGO_DATA"}, StringSplitOptions.None).Last().TrimStart('\\').Length);
                    var CurrentFileSize = Utilities.DecToHex(new FileInfo($"{CurrentFileName}").Length);

                    while (CurrentFileSize.Length != 12)
                        CurrentFileSize = CurrentFileSize.Insert(0, " ");
                    while (CurrentFileNameLength.Length != 2)
                        CurrentFileNameLength = CurrentFileNameLength.Insert(0, " ");

                    var Reader = new BinaryReader(File.Open(CurrentFileName, FileMode.Open, FileAccess.Read));
                    var NewSize = new FileInfo(CurrentFileName).Length;
                    while (NewSize % 4 != 0)
                        NewSize = NewSize + 1;

                    var BufferSize = NewSize - new FileInfo(CurrentFileName).Length;
                    Writer.Write(Reader.ReadBytes((int) new FileInfo(CurrentFileName).Length));

                    if (BufferSize > 0)
                        while (BufferSize != 0)
                        {
                            Writer.Write(new byte[] {00});
                            BufferSize = BufferSize - 1;
                        }

                    File.AppendAllText("YGO_DATA.toc",
                        $"{CurrentFileSize} {CurrentFileNameLength} {CurrentFileName.Split(new[] {"YGO_DATA\\"}, StringSplitOptions.None).Last()}\n");
                }
            }

            Utilities.Log("Finished Packing Files.", Utilities.Event.Information);
        }

19 Source : Form1.cs
with MIT License
from Arefu

private void installToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var OFD = new OpenFileDialog())
            {
                OFD.replacedle = "Select Mod To Enable";
                OFD.Filter = "Wolf Mod Data |*.moddta";
                if (OFD.ShowDialog() != DialogResult.OK) return;

                if (!File.Exists(OFD.FileName.Replace("moddta", "modpkg")))
                    throw new Exception("Mod Package Not Found! Please Read The Wiki On How To Create Mods.");

                var ModFileInfo = new JavaScriptSerializer().Deserialize<ModInfo>(File.ReadAllText(OFD.FileName));

                var AllFilesFound = true;
                var CompareSizes = new Dictionary<long, ModFile>();
                Reader?.Close();

                using (var GetFileSizeReader = new StreamReader(File.Open($"{Utilities.GetInstallDir()}\\YGO_DATA.TOC", FileMode.Open, FileAccess.Read)))
                {
                    for (var Count = 0; Count < ModFileInfo.Files.Count; Count++)
                    {
                        GetFileSizeReader.BaseStream.Position = 0;
                        GetFileSizeReader.ReadLine();
                        while (!GetFileSizeReader.EndOfStream)
                        {
                            var Line = GetFileSizeReader.ReadLine();
                            if (Line == null) break;
                            Line = Line.TrimStart(' ');
                            Line = Regex.Replace(Line, @"  +", " ", RegexOptions.Compiled);
                            var LineData = Line.Split(' ');

                            if (new FileInfo(LineData[2]).Name == new FileInfo(ModFileInfo.Files[Count]).Name)
                            {
                                GetFileSizeReader.BaseStream.Position = 0; //Because We're Breaking We Need To Reset Stream DUH
                                GetFileSizeReader.ReadLine();
                                AllFilesFound = true;
                                CompareSizes.Add(Utilities.HexToDec(LineData[0]), new ModFile(ModFileInfo, Count));
                                break;
                            }
                            AllFilesFound = false;
                        }
                    }
                }

                if (AllFilesFound == false)
                {
                    var Reply = MessageBox.Show("Not All Files Were Found In The TOC File, Do You Want To Contiue?", "Lost Files Found In Mod!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (Reply == DialogResult.No) return;
                }

                using (var LogWriter = File.AppendText("Install_Log.log"))
                {
                    foreach (var ModFile in CompareSizes)
                        if (ModFile.Key < ModFile.Value.FileSize)
                        {
                            var Reply = MessageBox.Show("File Already In Game Is Bigger, Do You Want To Continue?", "File Size Mismatch!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (Reply == DialogResult.No)
                            {
                                LogWriter.Write($"[{DateTime.Now}]: Didn't Inject {ModFile.Value.FileName}, Discarded By User!\n\r");
                                continue;
                            }

                            LogWriter.Write($"[{DateTime.Now}]: Injecting {ModFile.Value.FileName} With Size Of {ModFile.Value.FileSize} The original file is bigger\n\r");

                            //Open DAT, Insert In Right Place...
                        }
                        else
                        {
                            LogWriter.Write($"[{DateTime.Now}]: Injecting {ModFile.Value.FileName} With Size Of {ModFile.Value.FileSize} This File Is Smaller!\n\r");
                            var Sum = 0L;
                            var NullOutSize = 0L;
                            Reader?.Close();
                            using (Reader = new StreamReader(File.Open($"{InstallDir}\\YGO_DATA.TOC", FileMode.Open, FileAccess.Read)))
                            {
                                Reader.BaseStream.Position = 0;
                                Reader.ReadLine();
                                while (!Reader.EndOfStream
                                ) //Breaks on 116a658 44 D3D11\characters\m9575_number_39_utopia\m9575_number_39_utopia.phyre ?
                                {
                                    var Line = Reader.ReadLine();
                                    if (Line == null) break;
                                    Line = Line.TrimStart(' ');
                                    Line = Regex.Replace(Line, @"  +", " ", RegexOptions.Compiled);
                                    var LineData = Line.Split(' ');
                                    if (LineData[2] == ModFile.Value.FileName)
                                    {
                                        NullOutSize = Utilities.HexToDec(LineData[0]);
                                        break;
                                    }

                                    Sum = Sum + Utilities.HexToDec(LineData[0]);
                                }

                                Debug.WriteLine(Sum);
                                using (var Writer = new BinaryWriter(File.Open($"{InstallDir}\\YGO_DATA.DAT", FileMode.Open, FileAccess.ReadWrite)))
                                {
                                    Writer.BaseStream.Position = Sum;
                                    var NullCount = 0L;
                                    do
                                    {
                                        Writer.Write(0x00);
                                        NullCount++;
                                    } while (NullCount < NullOutSize);
                                }
                            }
                        }
                }
            }
        }

19 Source : ModViewer.cs
with MIT License
from Arefu

private void button1_Click(object sender, EventArgs e)
        {
            using (var Ofd = new OpenFileDialog())
            {
                Ofd.replacedle = "Select Your MODDTA File";
                Ofd.Filter = "Wolf Mod Data |*.moddta";

                if (Ofd.ShowDialog() != DialogResult.OK) return;

                var ModData = new JavaScriptSerializer().Deserialize<ModInfo>(File.ReadAllText(Ofd.FileName));
                for (var Count = 0; Count < ModData.Files.Count; Count++)
                {
                    var CurrentFile = new ListViewItem(ModData.Files[Count]);
                    CurrentFile.SubItems.Add(Utilities.GiveFileSize(ModData.Sizes[Count]));

                    listView1.Items.Add(CurrentFile);
                }
            }

            listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }

19 Source : LOTD_Archive.cs
with MIT License
from Arefu

public static string GetInstallDirectory()
        {
            try
            {
                using (var Root = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
                {
                    using (var Key =Root.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 480650"))
                    {
                        if (Key?.GetValue("InstallLocation").ToString() != null)
                        {
                            return Key?.GetValue("InstallLocation").ToString();
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            using (var Ofd = new FolderBrowserDialog())
            {
                Ofd.Description = "Please Navigate To Your Install Directory";

                if (Ofd.ShowDialog() == DialogResult.OK)
                {
                    InstallDir = Ofd.SelectedPath;
                    return InstallDir;
                }

                return null;
            }
        }

19 Source : Program.cs
with MIT License
from Arefu

[STAThread]
        private static void Main(string[] args)
        {
            Console.replacedle = "Relinquished";
            var ZibFileName = "";
            using (var FileDialog = new OpenFileDialog())
            {
                FileDialog.replacedle = "Open Yu-Gi-Oh ZIB File...";
                FileDialog.Filter = "Yu-Gi-Oh! Wolf ZIB File |*.zib";
                if (FileDialog.ShowDialog() != DialogResult.OK) return;

                ZibFileName = new FileInfo(FileDialog.FileName).Name;

                if (Directory.Exists($"{ZibFileName} Unpacked") || File.Exists($"{ZibFileName} Unpacked/Index.zib"))
                    return;

                Directory.CreateDirectory($"{ZibFileName} Unpacked");
                File.Create($"{ZibFileName} Unpacked/Index.zib").Close();
                File.SetAttributes($"{ZibFileName} Unpacked/Index.zib",
                    File.GetAttributes($"{ZibFileName} Unpacked/Index.zib") | FileAttributes.Hidden);

                using (var IndexWriter = new StreamWriter(File.Open($"{ZibFileName} Unpacked/Index.zib", FileMode.Open,
                    FileAccess.Write)))
                {
                    using (var Reader =
                        new BinaryReader(File.Open(FileDialog.FileName, FileMode.Open, FileAccess.Read)))
                    {
                        var DataStartOffset = long.MaxValue;
                        var ReadSize = 4;
                        var ZibFileSize = Reader.BaseStream.Length;
                        while (Reader.BaseStream.Position + 64 <= DataStartOffset)
                        {
                            // offset is aligned to 4 bytes
                            var CurrentStartOffset = (BitConverter.ToUInt32(Reader.ReadBytes(ReadSize).Reverse().ToArray(), 0) / 4) *4;

                            if (CurrentStartOffset == 0)
                            {
                                if (ReadSize == 4)
                                {
                                    // switch to 64 bit header format & try again
                                    Reader.BaseStream.Seek(0, SeekOrigin.Begin);
                                    ReadSize = 8;
                                    continue;
                                }
                                else
                                {
                                    throw new Exception("Not valid ZIB File");
                                }
                            }

                            var CurrentFileSize = (int)BitConverter.ToUInt32(Reader.ReadBytes(ReadSize).Reverse().ToArray(), 0);
                            var CurrentFileName = Utilities.GetText(Reader.ReadBytes(64 - ReadSize * 2));

                            // sanity check
                            if (CurrentStartOffset + CurrentFileSize > ZibFileSize) throw new Exception("Not valid ZIB File");

                            // update first known file offset
                            if (CurrentStartOffset < DataStartOffset) DataStartOffset = CurrentStartOffset;

                            Utilities.Log($"Exporting {CurrentFileName} ({CurrentFileSize} Bytes)",
                                Utilities.Event.Information);

                            var SnapBack = Reader.BaseStream.Position;
                            Reader.BaseStream.Position = CurrentStartOffset;
                            using (var Writer = new BinaryWriter(File.Open($"{ZibFileName} Unpacked/" + CurrentFileName,
                                FileMode.Create, FileAccess.Write)))
                            {
                                Writer.Write(Reader.ReadBytes(CurrentFileSize));
                                IndexWriter.Write(CurrentFileName + "\n");
                            }

                            Reader.BaseStream.Position = SnapBack;
                        }
                    }
                }
            }
        }

19 Source : Form1.cs
with MIT License
from Arefu

private void OpenToolStripMenuItem_Click(object Sender, EventArgs Args)
        {
            if (FileQuickViewList.Nodes.Count != 0) return;

            Reader?.Close();
            try
            {
                InstallDir = Utilities.GetInstallDir();
                Reader = new StreamReader(File.Open($"{InstallDir}\\YGO_DATA.TOC", FileMode.Open, FileAccess.Read));
            }
            catch
            {
                var Reply = MessageBox.Show(this, "Do You Want To Locate Game?", "Game Not Fuond!",
                    MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
                if (Reply == DialogResult.No) Environment.Exit(1);
                else
                    using (var Ofd = new OpenFileDialog())
                    {
                        Ofd.replacedle = "Select YuGiOh.exe";
                        Ofd.Filter = "YuGiOh.exe | YuGiOh.exe";
                        var Result = Ofd.ShowDialog();
                        if (Result != DialogResult.OK) Environment.Exit(1);
                        Reader = new StreamReader(File.Open($"{new FileInfo(Ofd.FileName).DirectoryName}\\YGO_DATA.TOC",
                            FileMode.Open, FileAccess.Read));
                        InstallDir = new FileInfo(Ofd.FileName).DirectoryName;
                    }
            }

            Reader.ReadLine();

            GameLocLabel.ForeColor = Color.Green;
            GameLocLabel.Text = "Game Loaded";

            var RootNode = new TreeNode("YGO_DATA");
            FileQuickViewList.Nodes.Add(RootNode);
            while (!Reader.EndOfStream)
            {
                var Line = Reader.ReadLine();
                if (Line == null) continue;
                Line = Line.TrimStart(' ');
                Line = Regex.Replace(Line, @"  +", " ", RegexOptions.Compiled);
                var LineData = Line.Split(' ');
                Data.Add(new FileData(Utilities.HexToDec(LineData[0]), Utilities.HexToDec(LineData[1]), LineData[2]));
                LineData[2].Split('\\').Aggregate(RootNode,
                    (Current, File) => Current.Nodes.ContainsKey(File)
                        ? Current.Nodes[File]
                        : Current.Nodes.Add(File, File));
            }

            Reader?.Close();
            GiveIcons(FileQuickViewList.Nodes[0]);
            FileQuickViewList.Nodes[0].Expand();
            FileQuickViewList.SelectedNode = FileQuickViewList.Nodes[0];
            FileQuickViewList_NodeMouseClick(new object(),
                new TreeNodeMouseClickEventArgs(FileQuickViewList.Nodes[0], MouseButtons.Left, 1, 0, 0));
        }

19 Source : Program.cs
with MIT License
from Arefu

[STAThread]
        private static void Main()
        {
            Console.replacedle = "Embargo";

            using (var Ofd = new OpenFileDialog())
            {
                Ofd.replacedle = "Select DLL To Inject";
                Ofd.Filter = "Language file (*.dll) | *.dll";
                if (Ofd.ShowDialog() != DialogResult.OK)
                    Environment.Exit(1);

                var ResultStatus = Injector.Inject("YuGiOh", Ofd.FileName);
                if (ResultStatus != InjectionStatus.Success)
                    MessageBox.Show("Error Status: " + ResultStatus, "Error During Inject!", MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
            }
        }

19 Source : Game_Save_Helpers.cs
with MIT License
from Arefu

public static string GetSaveFilePath()
        {
            var InstallDir = LOTD_Archive.GetInstallDirectory();
            if (string.IsNullOrEmpty(InstallDir)) return null;

            var SteamAppId = 0;

            var AppIdFile = Path.Combine(InstallDir, "steam_appid.txt");
            if (File.Exists(AppIdFile))
            {
                var Lines = File.ReadAllLines(AppIdFile);
                if (Lines.Length > 0) int.TryParse(Lines[0], out SteamAppId);
            }

            if (SteamAppId > 0)
            {
                var UserdataDir = Path.Combine(InstallDir, "..\\..\\..\\userdata\\");
                if (Directory.Exists(Path.GetFullPath(UserdataDir)))
                {
                    var Dirs = Directory.GetDirectories(UserdataDir);
                    foreach (var Dir in Dirs)
                    {
                        var DirName = new DirectoryInfo(Dir).Name;

                        if (!long.TryParse(DirName, out var Userid)) continue;
                        var SaveDataDir = Path.Combine(Dir, string.Empty + SteamAppId, "remote");
                        if (Directory.Exists(SaveDataDir))
                        {
                            var SaveDataFile = Path.Combine(SaveDataDir, "savegame.dat");
                            if (File.Exists(SaveDataFile)) return Path.GetFullPath(SaveDataFile);
                        }

                        break;
                    }
                }
            }

            using (var Ofd = new OpenFileDialog())
            {
                Ofd.replacedle = "Please locate Save File";
                var Res = Ofd.ShowDialog();
                if (Res != DialogResult.OK) return null;

                SaveFileLocation = Ofd.FileName;
                return SaveFileLocation;
            }
        }

19 Source : ModUI.cs
with MIT License
from Arefu

private void button1_Click(object sender, EventArgs e)
        {
            using (var OFD = new OpenFileDialog())
            {
                OFD.replacedle = "Select Files To Add To Mod...";
                OFD.Multiselect = true;
                if (OFD.ShowDialog() != DialogResult.OK) return;

                foreach (var Item in OFD.FileNames)
                {
                    var File = new FileInfo(Item);
                    if (File.Directory != null && !File.Directory.FullName.Contains("YGO_DATA"))
                    {
                        MessageBox.Show("YGO_DATA Structure Breach: Refer to Wiki for more Information (Link in clipboard)", "YGO_DATA Structure Breach!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Clipboard.SetText("https://github.com/Arefu/Wolf/wiki/YGO_DATA-Structure-Breach");
                        return;
                    }

                    listBox1.Items.Add($"YGO_DATA{File.FullName.Split(new[] {"YGO_DATA"}, StringSplitOptions.None)[1]}");
                }
            }
        }

19 Source : ExecuteForm.cs
with MIT License
from arsium

private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListViewItem I = new ListViewItem();

            using (OpenFileDialog o = new OpenFileDialog())
            {
                o.DefaultExt = ".dll";
                if (o.ShowDialog() == DialogResult.OK)
                {
                    I.Text = o.FileName;
                    string S = Interaction.InputBox("Insert the entrypoint of your dll : [Namespace.Clreplaced.Function]");
                    I.SubItems.Add(S);
                    I.SubItems.Add(Utilities.Numeric2Bytes(new FileInfo(o.FileName).Length));
                    managedListView.Items.Add(I);
                }
            }
        }

19 Source : ExecuteForm.cs
with MIT License
from arsium

private void addToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            ListViewItem I = new ListViewItem();

            using (OpenFileDialog o = new OpenFileDialog())
            {
                o.DefaultExt = ".dll";
                if (o.ShowDialog() == DialogResult.OK)
                {
                    I.Text = o.FileName;
                    I.SubItems.Add(Utilities.Numeric2Bytes(new FileInfo(o.FileName).Length));
                    unmanagedListView.Items.Add(I);
                }
            }
        }

19 Source : ExecuteForm.cs
with MIT License
from arsium

private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            ListViewItem I = new ListViewItem();

            using (OpenFileDialog o = new OpenFileDialog())
            {
                o.DefaultExt = ".dll";
                if (o.ShowDialog() == DialogResult.OK)
                {
                    I.Text = o.FileName;
                    I.SubItems.Add(Utilities.Numeric2Bytes(new FileInfo(o.FileName).Length));
                    shellCodeListView.Items.Add(I);
                }
            }
        }

19 Source : ExecuteForm.cs
with MIT License
from arsium

private void toolStripMenuItem4_Click(object sender, EventArgs e)
        {
            ListViewItem I = new ListViewItem();

            using (OpenFileDialog o = new OpenFileDialog())
            {
                o.DefaultExt = ".dll";
                if (o.ShowDialog() == DialogResult.OK)
                {
                    I.Text = o.FileName;
                    I.SubItems.Add(Utilities.Numeric2Bytes(new FileInfo(o.FileName).Length));
                    nativePEListView.Items.Add(I);
                }
            }
        }

19 Source : Main.cs
with MIT License
from arsium

private void dllInjectionManagedMreplacedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog O = new OpenFileDialog())
            {
                if (O.ShowDialog() == DialogResult.OK)
                {
                    string etp = Interaction.InputBox("Insert the entrypoint of your dll : [Namespace.Clreplaced.Function]");
                    ListViewItem Task = new ListViewItem("Dll Innjection [Managed]");
                    Task.SubItems.Add(O.FileName + "||" + etp);
                    Task.Name = Utilities.SplitPath(O.FileName) + "Managed";
                    mreplacedListView.Items.Add(Task);
                }
            }
        }

19 Source : RemoteDesktopForm.cs
with MIT License
from arsium

private void changeWallPaperToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListViewItem I = new ListViewItem();

            using (OpenFileDialog o = new OpenFileDialog())
            {
                if (o.ShowDialog() == DialogResult.OK)
                {
                    byte[] file = Shared.Compressor.QuickLZ.Compress(System.IO.File.ReadAllBytes(o.FileName), 1);
                    Client C = Client.ClientDictionary[this.IP_Origin];
                    Data D = new Data();
                    D.Type = Shared.PacketTypes.PacketType.PLUGIN;
                    D.Plugin = Plugins.Miscellaneous;
                    D.IP_Origin = C.IP;
                    D.HWID = C.HWID;
                    D.DataReturn = new object[] { Shared.PacketTypes.PacketType.SET_DESK_WP, file , Path.GetExtension(o.FileName)};
                    Task.Run(() => C.SendData(D.Serialize()));
                }
            }
        }

19 Source : BuilderHelper.cs
with MIT License
from arsium

public void Build(bool bits64, string HostsList, string taskName, string time)
        {
            ModuleDefMD asmDef;
            if (bits64)
            {
                asmDef = ModuleDefMD.Load(Utilities.GPath + "\\Stubs\\Client64.exe");
            }
            else
            {
                asmDef = ModuleDefMD.Load(Utilities.GPath + "\\Stubs\\Client.exe");
            }
            try
            {
                using (asmDef)
                {
                    using (SaveFileDialog saveFileDialog1 = new SaveFileDialog())
                    {
                        saveFileDialog1.Filter = ".exe (*.exe)|*.exe";
                        saveFileDialog1.InitialDirectory = Utilities.GPath;
                        saveFileDialog1.OverwritePrompt = false;
                        saveFileDialog1.FileName = "Client";
                        if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                        {
                            WriteSettings(asmDef, saveFileDialog1.FileName, HostsList, taskName, time);
                            asmDef.Write(saveFileDialog1.FileName);
                            asmDef.Dispose();
                            MessageBox.Show("Done !", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
            catch (Exception)
            {
                asmDef?.Dispose();
            }
        }

19 Source : Main.cs
with MIT License
from arsium

private void dllInjectionManagedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog O = new OpenFileDialog())
            {
                if (O.ShowDialog() == DialogResult.OK)
                {
                    string etp = Interaction.InputBox("Insert the entrypoint of your dll : [Namespace.Clreplaced.Function]");
                    ListViewItem Task = new ListViewItem("Dll Innjection [Managed]");
                    Task.SubItems.Add(O.FileName + "||" + etp);
                    Task.Name = Utilities.SplitPath(O.FileName) + "Managed";
                    tasksListView.Items.Add(Task);
                }
            }
        }

19 Source : FileManagerForm.cs
with MIT License
from arsium

private void currentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog o = new OpenFileDialog())
            {
                if (o.ShowDialog() == DialogResult.OK)
                {
                    byte[] B = Shared.Compressor.QuickLZ.Compress(System.IO.File.ReadAllBytes(o.FileName), 1);
                    string path = labelPath.Text + Utilities.SplitPath(o.FileName);
                    Client C = Client.ClientDictionary[this.IP_Origin];
                    Data D = new Data();
                    D.Type = Shared.PacketTypes.PacketType.PLUGIN;
                    D.Plugin = Plugins.FilesManager;
                    D.IP_Origin = C.IP;
                    D.HWID = C.HWID;
                    D.DataReturn = new object[] { Shared.PacketTypes.PacketType.UPLOAD_F, path, B };
                    Task.Run(() => C.SendData(D.Serialize()));
                }
            }
        }

19 Source : FileManagerForm.cs
with MIT License
from arsium

private void selectedFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (filesListView.SelectedItems[0].Tag.ToString() == "FOLDER" && filesListView.SelectedItems.Count == 1)
            {
                using (OpenFileDialog o = new OpenFileDialog())
                {
                    if (o.ShowDialog() == DialogResult.OK)
                    {
                        byte[] B = Shared.Compressor.QuickLZ.Compress(System.IO.File.ReadAllBytes(o.FileName), 1);
                        string path = labelPath.Text + filesListView.SelectedItems[0].Text + "\\" + Utilities.SplitPath(o.FileName);
                        Client C = Client.ClientDictionary[this.IP_Origin];
                        Data D = new Data();
                        D.Type = Shared.PacketTypes.PacketType.PLUGIN;
                        D.Plugin = Plugins.FilesManager;
                        D.IP_Origin = C.IP;
                        D.HWID = C.HWID;
                        D.DataReturn = new object[] { Shared.PacketTypes.PacketType.UPLOAD_F, path, B };
                        Task.Run(() => C.SendData(D.Serialize()));
                    }
                }
            }
        }

19 Source : Main.cs
with MIT License
from arsium

private void dllInjectionUnmanagedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog O = new OpenFileDialog())
            {
                if (O.ShowDialog() == DialogResult.OK)
                {
                    ListViewItem Task = new ListViewItem("Dll Innjection [Unmanaged]");
                    Task.SubItems.Add(O.FileName);
                    Task.Name = Utilities.SplitPath(O.FileName) + "Unmanaged";
                    tasksListView.Items.Add(Task);
                }
            }
        }

19 Source : Main.cs
with MIT License
from arsium

private void dllInjectionUnmanagedMreplacedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog O = new OpenFileDialog())
            {
                if (O.ShowDialog() == DialogResult.OK)
                {
                    ListViewItem Task = new ListViewItem("Dll Innjection [Unmanaged]");
                    Task.SubItems.Add(O.FileName);
                    Task.Name = Utilities.SplitPath(O.FileName) + "Unmanaged";
                    mreplacedListView.Items.Add(Task);
                }
            }
        }

19 Source : MainForm.cs
with MIT License
from Ashesh3

private void BtnProfileSelectImg_Click(object sender, EventArgs e)
        {
            var openDialog = new OpenFileDialog()
            {
                Filter = "Image files|*.png;*.jpg;*.jpeg;*.gif|All files|*.*",
            };

            if (openDialog.ShowDialog() != DialogResult.OK)
                return;

            var fileInfo = new FileInfo(openDialog.FileName);
            if (fileInfo.Length > PHOTO_MAX_SIZE)
            {
                MessageBox.Show(this, "Cannot use this file. It cannot be larger than 1024kb.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            TbProfileImagePath.Text = openDialog.FileName;
        }

19 Source : PrintToDefaultPrinter.cs
with MIT License
from aspose-pdf

public static void ShowPrintDialog()
        {
          
            // The path to the doreplacedents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing();

            // Create PdfViewer object
            PdfViewer viewer = new PdfViewer();

            // Open input PDF file
            viewer.BindPdf( dataDir + "input.pdf");

            // Set attributes for printing
            viewer.AutoResize = true;         // Print the file with adjusted size
            viewer.AutoRotate = true;         // Print the file with adjusted rotation
            viewer.PrintPageDialog = false;   // Do not produce the page number dialog when printing

            // Create objects for printer and page settings and PrintDoreplacedent
            System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
            System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
            System.Drawing.Printing.PrintDoreplacedent prtdoc = new System.Drawing.Printing.PrintDoreplacedent();

            // Set printer name
            ps.PrinterName = prtdoc.PrinterSettings.PrinterName;

            // Set PageSize (if required)
            pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

            // Set PageMargins (if required)
            pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            // ExStart:PrintDialog
            System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
            if (printDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Doreplacedent printing code goes here
                // Print doreplacedent using printer and page settings
                viewer.PrintDoreplacedentWithSettings(pgs, ps);
            }
            // ExEnd:PrintDialog            

            // Close the PDF file after priting
            viewer.Close();
        }

19 Source : ProfileSelector.cs
with MIT License
from AstroTechies

private void ForceExportProfile()
        {
            if (listBox1.SelectedValue == null || SelectedProfile == null)
            {
                this.ShowBasicButton("Please select a profile to export it as a .zip file.", "OK", null, null);
                return;
            }

            var dialog = new SaveFileDialog();
            dialog.Filter = "ZIP files (*.zip)|*.zip|All files (*.*)|*.*";
            dialog.replacedle = "Export a profile";
            dialog.RestoreDirectory = true;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string targetFolderPath = Path.Combine(Path.GetTempPath(), "AstroModLoader", "export");
                Directory.CreateDirectory(targetFolderPath);

                ModProfile creatingProfile = new ModProfile();
                creatingProfile.ProfileData = new Dictionary<string, Mod>();
                creatingProfile.Name = listBox1.SelectedValue as string;
                creatingProfile.Info = "Exported by " + AMLUtils.UserAgent + " at " + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffK");

                List<KeyValuePair<string, Mod>> plannedOrdering = new List<KeyValuePair<string, Mod>>();
                foreach (KeyValuePair<string, Mod> entry in SelectedProfile.ProfileData)
                {
                    if (entry.Value.Enabled) plannedOrdering.Add(entry);
                }
                plannedOrdering = new List<KeyValuePair<string, Mod>>(plannedOrdering.OrderBy(o => o.Value.Priority).ToList());

                for (int i = 0; i < plannedOrdering.Count; i++)
                {
                    plannedOrdering[i].Value.Priority = i + 1;
                    creatingProfile.ProfileData[plannedOrdering[i].Key] = plannedOrdering[i].Value;

                    // Copy mod pak to the zip as well
                    string onePathOnDisk = OurParentForm.ModManager.GetPathOnDisk(plannedOrdering[i].Value, plannedOrdering[i].Key);
                    if (!string.IsNullOrEmpty(onePathOnDisk)) File.Copy(onePathOnDisk, Path.Combine(targetFolderPath, Path.GetFileName(onePathOnDisk)));
                }

                File.WriteAllBytes(Path.Combine(targetFolderPath, "profile1.json"), Encoding.UTF8.GetBytes(AMLUtils.SerializeObject(creatingProfile)));

                ZipFile.CreateFromDirectory(targetFolderPath, dialog.FileName);
                Directory.Delete(targetFolderPath, true);

                RefreshBox();
                statusLabel.Text = "Successfully exported profile.";
            }
        }

See More Examples