Example #1
0
        public MainForm()
        {
            InitializeComponent();

            /// hactool.exe Depedency Check!
            string[] files = { "hactool.exe", "libmbedcrypto.dll", "libmbedtls.dll", "libmbedx509.dll" };
            foreach (string fileName in files)
            {
                if (!File.Exists(fileName))
                {
                    MessageBox.Show($@"{fileName} must be in your current directory to continue!", @"¯\_(ツ)_/¯", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Environment.Exit(0);
                }
            }

            /// Default Keys Check!
            if (!File.Exists(defaultKeysFile))
            {
                /// If the switch home directory doesn't exist, create it!
                Directory.CreateDirectory(switchHome);

                /// Import Keys?
                if (MessageBox.Show("Do you want to import your keys?", "Import", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (OpenKeysDialog.ShowDialog() == DialogResult.OK)
                    {
                        File.Copy(OpenKeysDialog.FileName, defaultKeysFile);
                    }
                    else
                    {
                        MessageBox.Show("Be sure to import a keys file before starting...", "No default keys file", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
            }
        }
Example #2
0
        private void OpenKeys_Click(object sender, EventArgs e)
        {
            /// Pick a keys file
            if (OpenKeysDialog.ShowDialog() == DialogResult.OK)
            {
                /// Keys file chosen
                keyFile = $@"-k {Path.GetFileName(OpenKeysDialog.FileName)}";
            }

            /// If no Default Keys file, ask if they want it to be?
            if (!File.Exists(defaultKeysFile))
            {
                if (MessageBox.Show("Do you want to set this as your default keys file?", "Set Default Keys", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    File.Copy(OpenKeysDialog.FileName, defaultKeysFile);
                }
            }
        }