void bw_DoWork(object sender, DoWorkEventArgs e) { BWArgs args = (BWArgs)e.Argument; BWResults results; DirectoryInfo di; try { di = new DirectoryInfo(args.FullPath); } catch { e.Result = new BWResults(null, null, args.FullPath, false); return; } //if (di.Exists) { FolderData fd = new FolderData(di); string[] d = null; try { d = Directory.GetDirectories(di.FullName); } catch { d = StringUtil.Empty; } for (int i = 0; i < d.Length; i++) { d[i] = d[i].Substring(d[i].LastIndexOf(Path.DirectorySeparatorChar) + 1); } results = new BWResults(fd, d, args.FullPath, di.Exists); //} else { //results = new BWResults(fd, StringUtil.Empty, args.FullPath, false); //} e.Result = results; }
private static string GetWriteArgs(BWArgs args) { var sendargs = ""; if ((args.Mode & BWArgs.Modes.Verify) == BWArgs.Modes.Verify) { sendargs = "v"; } switch (args.Device) { case MemoryDevice.NAND1: case MemoryDevice.NAND0: if ((args.Mode & BWArgs.Modes.Diff) == BWArgs.Modes.Diff) { var ofd = new OpenFileDialog { Title = Resources.SelectDiffFileToUse, FileName = string.Format("{0}.diff", Path.GetFileNameWithoutExtension(args.Src)), Filter = Resources.FilterDiff }; if (ofd.ShowDialog() != DialogResult.OK) { if (args.Offset >= 0) { if (args.Length > 0) { return(string.Format("{0}write \"{1}\" 0x{2:X} 0x{3:X}", sendargs, args.Src, args.Offset, args.Length)); } return(args.Offset > 0 ? string.Format("{0}write \"{1}\" 0x{2:X}", sendargs, args.Src, args.Offset) : string.Format("{0}write \"{1}\"", sendargs, args.Src)); } } else { return(string.Format("{0}writediff \"{1}\" \"{2}\"", sendargs, args.Src, ofd.FileName)); } } break; case MemoryDevice.NOR: if ((args.Mode & BWArgs.Modes.WordUnlockBypassMode) == BWArgs.Modes.WordUnlockBypassMode) { sendargs = string.Format("{0}writewordubm \"{1}\"", sendargs, args.Src); } else if ((args.Mode & BWArgs.Modes.Word) == BWArgs.Modes.Word) { sendargs = string.Format("{0}writeword \"{1}\"", sendargs, args.Src); } else { sendargs = string.Format("{0}write \"{1}\"", sendargs, args.Src); } if (args.Address > 0) { sendargs += string.Format(" 0x{0:X}", args.Address); } break; } return(sendargs); }
private void ErasebtnClick(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to erase?! you'll lose EVERYTHING!\nIf you do intend to erase Click on NO", "Are you sure?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) != DialogResult.No) { return; } outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.Erase); bw.RunWorkerAsync(args); SetAppState(true); }
private void ErasebtnClick(object sender, EventArgs e) { if (MessageBox.Show(Resources.EraseSafetyMessage, Resources.AreYouSure, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) != DialogResult.No) { return; } outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.Erase); bw.RunWorkerAsync(args); SetAppState(true); }
private bool GetBWArgs(BWArgs.Modes mode, out BWArgs args) { args = null; if (comports.SelectedIndex < 0) { MessageBox.Show(Resources.SelectPort); return(false); } if (memory.SelectedIndex < 0) { MessageBox.Show(Resources.SelectMemory); return(false); } args = new BWArgs(mode, ((ComboBoxItem <MemoryDevice>)memory.SelectedItem).Value, comports.SelectedItem as string); return(true); }
private void XsvfbtnClick(object sender, EventArgs e) { var ofd = new OpenFileDialog { FileName = "xc2c64a.xsvf", Title = "Select File to write" }; if (ofd.ShowDialog() != DialogResult.OK) { return; } outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.XSVF) { File = ofd.FileName }; bw.RunWorkerAsync(args); SetAppState(true); }
private void ReadbtnClick(object sender, EventArgs e) { var sfd = new SaveFileDialog { FileName = "flashdmp.bin", Title = "Select where to save the dump..." }; if (sfd.ShowDialog() != DialogResult.OK) { return; } outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.Read) { File = sfd.FileName }; bw.RunWorkerAsync(args); SetAppState(true); }
private void WritebtnClick(object sender, EventArgs e) { var ofd = new OpenFileDialog { FileName = "updflash.bin", Title = Resources.SelectFileToWrite }; if (ofd.ShowDialog() != DialogResult.OK) { return; } outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.Write) { File = ofd.FileName }; bw.RunWorkerAsync(args); SetAppState(true); }
private void XsvfbtnClick(object sender, EventArgs e) { var ofd = new OpenFileDialog { FileName = "xc2c64a.xsvf", Title = "Select File to write" }; if(ofd.ShowDialog() != DialogResult.OK) return; outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.XSVF) { File = ofd.FileName }; bw.RunWorkerAsync(args); SetAppState(true); }
private void ReadbtnClick(object sender, EventArgs e) { var sfd = new SaveFileDialog { FileName = "flashdmp.bin", Title = "Select where to save the dump..." }; if(sfd.ShowDialog() != DialogResult.OK) return; outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.Read) { File = sfd.FileName }; bw.RunWorkerAsync(args); SetAppState(true); }
private void ErasebtnClick(object sender, EventArgs e) { if(MessageBox.Show("Are you sure you want to erase?! you'll lose EVERYTHING!\nIf you do intend to erase Click on NO", "Are you sure?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) != DialogResult.No) return; outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.Erase); bw.RunWorkerAsync(args); SetAppState(true); }
private bool GetBWArgs(BWArgs.Modes mode, out BWArgs args) { args = null; if (comports.SelectedIndex < 0) { MessageBox.Show(Resources.SelectPort); return false; } if (memory.SelectedIndex < 0) { MessageBox.Show(Resources.SelectMemory); return false; } args = new BWArgs(mode, ((ComboBoxItem<MemoryDevice>) memory.SelectedItem).Value, comports.SelectedItem as string); return true; }
private static string GetWriteArgs(BWArgs args) { var sendargs = ""; if ((args.Mode & BWArgs.Modes.Verify) == BWArgs.Modes.Verify) sendargs = "v"; switch (args.Device) { case MemoryDevice.NAND1: case MemoryDevice.NAND0: if ((args.Mode & BWArgs.Modes.Diff) == BWArgs.Modes.Diff) { var ofd = new OpenFileDialog { Title = Resources.SelectDiffFileToUse, FileName = string.Format("{0}.diff", Path.GetFileNameWithoutExtension(args.Src)), Filter = Resources.FilterDiff }; if (ofd.ShowDialog() != DialogResult.OK) { if (args.Offset >= 0) { if (args.Length > 0) return string.Format("{0}write \"{1}\" 0x{2:X} 0x{3:X}", sendargs, args.Src, args.Offset, args.Length); return args.Offset > 0 ? string.Format("{0}write \"{1}\" 0x{2:X}", sendargs, args.Src, args.Offset) : string.Format("{0}write \"{1}\"", sendargs, args.Src); } } else return string.Format("{0}writediff \"{1}\" \"{2}\"", sendargs, args.Src, ofd.FileName); } break; case MemoryDevice.NOR: if ((args.Mode & BWArgs.Modes.WordUnlockBypassMode) == BWArgs.Modes.WordUnlockBypassMode) sendargs = string.Format("{0}writewordubm \"{1}\"", sendargs, args.Src); else if ((args.Mode & BWArgs.Modes.Word) == BWArgs.Modes.Word) sendargs = string.Format("{0}writeword \"{1}\"", sendargs, args.Src); else sendargs = string.Format("{0}write \"{1}\"", sendargs, args.Src); if (args.Address > 0) sendargs += string.Format(" 0x{0:X}", args.Address); break; } return sendargs; }
private void WritebtnClick(object sender, EventArgs e) { var ofd = new OpenFileDialog { FileName = "updflash.bin", Title = Resources.SelectFileToWrite }; if(ofd.ShowDialog() != DialogResult.OK) return; outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.Write) { File = ofd.FileName }; bw.RunWorkerAsync(args); SetAppState(true); }
private void ErasebtnClick(object sender, EventArgs e) { if(MessageBox.Show(Resources.EraseSafetyMessage, Resources.AreYouSure, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) != DialogResult.No) return; outputbox.Text = ""; var args = new BWArgs(BWArgs.Operations.Erase); bw.RunWorkerAsync(args); SetAppState(true); }