Beispiel #1
0
        private void buttonAddList_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(comboBoxHex.Text) && string.IsNullOrEmpty(comboBoxBin.Text))
            {
                string message = "Please select a file to save to \nthe firmware folder.";
                labelMessages(message);
            }
            else if (string.IsNullOrEmpty(comboBoxBin.Text))
            {
                string message       = ".hex file has been saved.";
                string userProfile   = textBoxFirmLocation.Text + "\\" + comboBoxHex.Text;
                string boxProfile    = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                string boxsubFolders = @"Box Sync\Tna\TnA Configs\Programs\LC prog\Firmware\";

                var dBox = Path.Combine(boxProfile, boxsubFolders);

                FlashManager box = new FlashManager();
                box.Xcopy(userProfile, dBox);
                labelMessages(message);
            }
            else if (string.IsNullOrEmpty(comboBoxHex.Text))
            {
                string message       = ".bin file has been saved.";
                string userProfile   = textBoxFirmLocation.Text + "\\" + comboBoxBin.Text;
                string boxProfile    = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                string boxsubFolders = @"Box Sync\Tna\TnA Configs\Programs\LC prog\Firmware\";

                var dBox = Path.Combine(boxProfile, boxsubFolders);

                FlashManager box = new FlashManager();
                box.Xcopy(userProfile, dBox);
                labelMessages(message);
            }
            else
            {
                string message       = ".hex file has been saved. \n.bin file has been saved.";
                string userProfile   = textBoxFirmLocation.Text + "\\" + comboBoxHex.Text;
                string userProfile2  = textBoxFirmLocation.Text + "\\" + comboBoxBin.Text;
                string boxProfile    = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                string boxsubFolders = @"Box Sync\Tna\TnA Configs\Programs\LC prog\Firmware\";

                var dBox = Path.Combine(boxProfile, boxsubFolders);

                FlashManager box = new FlashManager();
                box.Xcopy(userProfile, dBox);
                box.Xcopy(userProfile2, dBox);
                labelMessages(message);
            }
        }
        private void buttonLeftArrow_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(comboBoxUSBDevice.Text))
            {
                MessageBox.Show("Please select a USB Device.", "Warning");
                return;
            }
            else
            {
                string fSystem;
                string dLetter;
                string dL;
                string dLC;

                dLetter = comboBoxUSBDevice.SelectedItem.ToString();
                dL      = dLetter.Substring(0, 2);
                dLC     = dLetter.Substring(0, 3);

                if (radioButtonFAT.Checked == true)
                {
                    fSystem = radioButtonFAT.Text;
                }
                else if (radioButtonFAT32.Checked == true)
                {
                    fSystem = radioButtonFAT32.Text;
                }
                else if (radioButtonEXFAT.Checked == true)
                {
                    fSystem = radioButtonEXFAT.Text;
                }
                else if (radioButtonNTFS.Checked == true)
                {
                    fSystem = radioButtonNTFS.Text;
                }
                else if (radioButtonUDF.Checked == true)
                {
                    fSystem = radioButtonUDF.Text;
                }
                else
                {
                    MessageBox.Show("Please select a File System to format.");
                    return;
                }

                DialogResult areYouSure = MessageBox.Show("Are you sure you want to format this usb drive and load the Left Arrow Firmware", "Warning", MessageBoxButtons.YesNo);

                if (areYouSure == DialogResult.Yes)
                {
                    Cursor = Cursors.WaitCursor;

                    FlashManager format = new FlashManager();
                    format.FormatFlash(dL, fSystem, "Left_Arrow");

                    FlashManager xcopy = new FlashManager();
                    xcopy.FlashFileCopyLeft(dLC);

                    Cursor = Cursors.Default;
                }
                else if (areYouSure == DialogResult.No)
                {
                    return;
                }

                MessageBox.Show("Format Completed and Left Arrow Firmware loaded");
            }
        }