private void AutoOpen() { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { AutoOpen(); })); return; } if (autoLoad && autoOpenPath.Length > 0 && File.Exists(autoOpenPath)) { string path = autoOpenPath; if (Path.GetExtension(path) == ".pck") { unppack_path = path; } if (unppack_path.Length <= 1) { JMessageBox.Show(this, "Please select .pck!"); } else { if (openedPckFies != null) { openedPckFies.Dispose(); } openedPckFies = new PackHelper(unppack_path, true) { ReadTableIsDone = initialRead }; openedPckFies.progress_bar += progress_bar; this.fiullFilePath = unppack_path; } } }
private void LoadConfigs() { pathToConfigs = Path.GetDirectoryName(Application.ExecutablePath) + "\\Configs\\minimaps\\"; try { string[] configcontent = File.ReadAllLines(pathToConfigs + "config.txt"); foreach (string line in configcontent) { if (!line.StartsWith("#")) { ConfigStr cfg = new ConfigStr(); string[] split = line.Split('@'); cfg.GridSize = int.Parse(split[1]); cfg.ImageXoffset = int.Parse(split[2]); cfg.ImageYoffset = int.Parse(split[3]); cfg.rows = int.Parse(split[5]); cfg.cols = int.Parse(split[4]); cfg.ImageSize = int.Parse(split[6]); cfg.rowsStart = int.Parse(split[7]); cfg.colsStart = int.Parse(split[8]); configs.Add(split[0].ToLower().Trim(), cfg); } } } catch { JMessageBox.Show(this, "Unable to load config:" + pathToConfigs); return; } if (FilePath != null) { LoadMap(FilePath); } }
private void toolStripMenuItem2_Click(object sender, EventArgs e) { if (locked || !Loaded) { return; } if (Read == null) { return; } if (RegionDataGrid.CurrentCell == null && ZonesDataGrid.CurrentCell != null) { return; } try { int index = RegionDataGrid.CurrentCell.RowIndex; int zoneId = ZonesDataGrid.CurrentCell.RowIndex; if (zoneId == 0 || zoneId == Read.regions[index].Zones.Count - 1) { JMessageBox.Show(this, "Can't Delete first and last point!"); return; } Read.regions[index].Zones.RemoveAt(zoneId); ZonesDataGrid.RowCount = Read.regions[index].Zones.Count; ZonesDataGrid.Refresh(); listBox_items_SelectionChanged(null, null); ZonesDataGrid.ClearSelection(); int nRowIndex = ZonesDataGrid.Rows.Count - 1; int nColumnIndex = 0; ZonesDataGrid.Rows[nRowIndex].Selected = true; ZonesDataGrid.Rows[nRowIndex].Cells[nColumnIndex].Selected = true; } catch { } }
private void jButton1_Click(object sender, EventArgs e) { var ip = useriptb.Text; if (!ip.ValidateIP()) { JMessageBox.Show(this, "Invalid ip."); return; } var username = usernametb.Text; if (!StringUtils.IsAlphaNumericNoSpace(username) || !StringUtils.ValidLenght(username, 4, 20)) { JMessageBox.Show(this, "Invalid username."); return; } var passsword = passwordtb.Text; if (!StringUtils.IsAlphaNumericNoSpace(passsword) || !StringUtils.ValidLenght(passsword, 4, 20)) { JMessageBox.Show(this, "Invalid password."); return; } var entryName = jTextBox2.Text; if (!StringUtils.IsAlphaNumericNoSpace(passsword) || !StringUtils.ValidLenght(passsword, 4, 20)) { entryName = ip; } var port = 0; if (!int.TryParse(jTextBox1.Text, out port)) { JMessageBox.Show(this, "Invalid port."); return; } if (edit != null) { edit.Ip = ip; edit.port = port; edit.entryname = entryName; edit.username = username; edit.password = passsword; } else { edit = new DbEntry() { port = port, entryname = entryName, Ip = ip, username = username, password = passsword }; } DatabaseManager.Instance.AddOrUpdateEntry(edit); DatabaseManager.Instance.Save(); DialogResult = DialogResult.OK; this.Close(); }
private void pictureBox1_Click(object sender, EventArgs e) { unpacking = false; OpenFileDialog theDialog = new OpenFileDialog(); theDialog.Title = "Open Pck File"; theDialog.Filter = "Pck files|*.Pck"; if (theDialog.ShowDialog() == DialogResult.OK) { string path = theDialog.FileName; if (Path.GetExtension(path) == ".pck") { unppack_path = path; } if (unppack_path.Length <= 1) { JMessageBox.Show(this, "Please select .pck!"); } else { autoOpenPath = unppack_path; autoLoad = true; openedPckFies = new PackHelper(unppack_path, true); openedPckFies.ReadTableIsDone = initialRead; openedPckFies.progress_bar += progress_bar; this.fiullFilePath = unppack_path; } } }
private void jPictureBox1_Click(object sender, EventArgs e) { OpenFileDialog load = new OpenFileDialog(); load.Filter = "Icon Pack (*.dds)|*.dds|All files (*.*)|*.*"; load.DefaultExt = "dds"; if (load.ShowDialog() == System.Windows.Forms.DialogResult.OK && File.Exists(load.FileName)) { DialogResult dia = JMessageBox.Show(this, "Do you want to mearge the icon pack?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dia == DialogResult.Yes) { if (packer.LoadFiles(load.FileName, true)) { pictureBox1.Image = packer.sourceBitmap; pictureBox1.Refresh(); } } else { if (packer.LoadFiles(load.FileName, false)) { pictureBox1.Image = packer.sourceBitmap; pictureBox1.Refresh(); } } } }
private void jPictureBox1_Click(object sender, EventArgs e) { progress_bar("Creating...", 0, 0); RenameForm rf = new RenameForm(); DialogResult res = rf.ShowDialog(this); if (res == DialogResult.OK && RenameForm.value != null && RenameForm.value.Length > 0) { using (var fbd = new FolderBrowserDialog()) { DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { string path = Path.Combine(fbd.SelectedPath, Path.GetFileNameWithoutExtension(RenameForm.value) + ".pck"); File.WriteAllBytes(path, Resources.BlankPk); if (Path.GetExtension(path) == ".pck") { unppack_path = path; } if (unppack_path.Length <= 1) { JMessageBox.Show(this, "Please select .pck!"); } else { openedPckFies = new PackHelper(unppack_path, true); openedPckFies.ReadTableIsDone = initialRead; openedPckFies.progress_bar += progress_bar; this.fiullFilePath = unppack_path; } } } } progress_bar("Ready", 0, 0); }
private void SaveColor_BTN(object sender, EventArgs e) { int index = PaletteSelector.SelectedIndex; if (index > -1) { bool exist = false; var c = Color.FromArgb(jScreenColorPicker1.Color.ToArgb()); foreach (PaletteItem p in jColorPalette1.PaletteData) { if (p.Color.Equals(c)) { exist = true; break; } } if (exist) { JMessageBox.Show(this, "You already have this color."); return; } jColorPalette1.AddItem(ColorTranslator.ToHtml(c)); DatabaseManager.SetPaletteItems(index, jColorPalette1.PaletteData); } }
private void Convertclttosevfolder_Click(object sender, EventArgs e) { JMessageBox.Show(this, "Select save path."); using (var savePfb = new FolderBrowserDialog()) { DialogResult resultx = savePfb.ShowDialog(); if (resultx == DialogResult.OK && !string.IsNullOrWhiteSpace(savePfb.SelectedPath)) { string SavePath = savePfb.SelectedPath; JMessageBox.Show(this, "Select perfect world server map path."); using (var fbd = new FolderBrowserDialog()) { DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { var myFiles = Directory.GetFiles(fbd.SelectedPath, "precinct.clt", SearchOption.AllDirectories); foreach (string path in myFiles) { PretinctFile Region = new PretinctFile(); if (Region.ReadFile(path)) { string fileName = Path.GetFileName(path); string dirName = new DirectoryInfo(Path.GetDirectoryName(path)).Name; string savePath = Path.Combine(SavePath, dirName + "\\" + fileName); Region.SaveFile(savePath, false); } } } } } } JMessageBox.Show(this, "All saved."); }
private void StateChanged(DOWNLOAD_STATE state) { switch (state) { case DOWNLOAD_STATE.COMPLEATE: try { var process = new Process { StartInfo = new ProcessStartInfo { FileName = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "DLhelper.exe" //Arguments = string.Join(" ", Environment.GetCommandLineArgs()) } }; process.Start(); process.WaitForInputIdle(); } catch { JMessageBox.Show(this, "Unable to find the DLhelper.exe."); } Application.Exit(); Environment.Exit(0); break; case DOWNLOAD_STATE.CANCELED: case DOWNLOAD_STATE.ERROR: JMessageBox.Show(this, "The update information could not be downloaded."); break; } }
private void PretinctDataGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (!Loaded) { return; } try { if (PretinctDataGrid.CurrentCell != null) { int itemid = e.RowIndex; if (e.ColumnIndex == 0) { Read.zones[itemid].ID = int.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } if (e.ColumnIndex == 1) { Read.zones[itemid].name = PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString(); } if (e.ColumnIndex == 2) { Read.zones[itemid].m_iPriority = int.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } if (e.ColumnIndex == 3) { Read.zones[itemid].m_idDstIns = int.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } if (e.ColumnIndex == 4) { Read.zones[itemid].m_idSrcInst = int.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } if (e.ColumnIndex == 5) { Read.zones[itemid].m_idDomain = int.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } if (e.ColumnIndex == 6) { Read.zones[itemid].m_bPKProtect = byte.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } if (e.ColumnIndex == 7) { Read.zones[itemid].unk0 = int.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } if (e.ColumnIndex == 8) { Read.zones[itemid].unk1 = int.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } if (e.ColumnIndex == 9) { Read.zones[itemid].unk2 = int.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } if (e.ColumnIndex == 10) { Read.zones[itemid].unk3 = int.Parse(PretinctDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()); } } } catch { JMessageBox.Show(this, "Incorrect value."); } }
private void OpenLinkInDefaultBrowser(object sender, EventArgs e) { var confirmResult = JMessageBox.Show(this, "Are you sure to open in a new window this site ?", "Open in new window", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { System.Diagnostics.Process.Start(Url); } }
private void LoadMap(string mapName) { pathToFiles = Path.Combine(mapName, pathToConfigs); try { Regex rgx = new Regex("[^a-zA-Z0-9-]"); string key = rgx.Replace(mapName, "").ToLower().Trim(); if (configs.ContainsKey(key)) { currentConfig = configs[key]; currentImage = new Bitmap(currentConfig.rows * currentConfig.ImageSize, currentConfig.cols * currentConfig.ImageSize); using (Graphics g = Graphics.FromImage(currentImage)) { for (int col = 0; col < currentConfig.cols; col++) { for (int row = 0; row < currentConfig.rows; row++) { string imageName = Path.Combine(pathToFiles + key, (col + currentConfig.colsStart).ToString("D2") + (row + currentConfig.rowsStart).ToString("D2") + ".dds"); int x = currentConfig.ImageSize * (row + currentConfig.rowsStart); int y = currentConfig.ImageSize * (col + currentConfig.colsStart); try { using (DevIL.ImageImporter imImport = new DevIL.ImageImporter()) { g.DrawImage(LoadImage(imImport, new MemoryStream(File.ReadAllBytes(imageName)), currentConfig.ImageSize, currentConfig.ImageSize), x, y, currentConfig.ImageSize, currentConfig.ImageSize); } } catch { g.DrawImage(new Bitmap(currentConfig.ImageSize, currentConfig.ImageSize), x, y, currentConfig.ImageSize, currentConfig.ImageSize); } } } } pictureBox_path.Width = currentConfig.rows * currentConfig.ImageSize; pictureBox_path.Height = currentConfig.cols * currentConfig.ImageSize; pictureBox_path.BackgroundImage = currentImage; pictureBox_path.Refresh(); comboBox_lists.Items.Clear(); foreach (string map in configs.Keys) { comboBox_lists.Items.Add(map); } autoSlected = true; comboBox_lists.SelectedIndex = comboBox_lists.FindString(key); autoSlected = false; Loaded = true; } else { JMessageBox.Show(this, "Unable to load images for :" + mapName + ".\rWill not continue without graphic suport!"); return; } } catch (Exception e) { JMessageBox.Show(this, "Unable to load config:" + e.ToString()); return; } }
private void jButton2_Click(object sender, EventArgs e) { if (speaches != null) { path = Path.Combine(jLabel1.Text, "sound_" + speaches.Id + ".mp3"); File.WriteAllBytes(path, speaches.m_AudioStream2.ToArray()); JMessageBox.Show(this, "Done!"); } }
private void jPictureBox2_Click(object sender, EventArgs e) { if (Read != null) { if (Read.SaveFile(autoOpenPath)) { JMessageBox.Show(this, "Precinct file saved."); } } }
private void jPictureBox2_Click(object sender, EventArgs e) { if (Read != null) { if (Read.SaveFile(autoOpenPath)) { JMessageBox.Show(this, "Region has been saved!"); } } }
private void LogicReplace(object sender, EventArgs e) { if (lockedCheck) { return; } if (dynObjcts == null) { return; } lockedCheck = true; PckMoveFixer pathfixer = new PckMoveFixer(); pathfixer.ShowDialog(this); int replaced = 0; if (pathfixer.DialogResult == DialogResult.OK) { List <string> replaceValues = PckMoveFixer.oldValue.Split(',').ToList(); //models/npcs,//models2/npcs for (int i = 0; i < replaceValues.Count; i++) { replaceValues[i] = replaceValues[i] + "(.*)".ToLower(); } string valueStr = PckMoveFixer.newValue.ToLower() + "$1"; //shaders/npcs for (int selectedRowx = 0; selectedRowx < dynObjcts.objects.Length; selectedRowx++) { progress_bar("Fixing ...", selectedRowx, listBox_items.SelectedRows.Count); string valueNow = dynObjcts.objects[selectedRowx].Path.Value.ToLower(); foreach (string oldvalue in replaceValues) { try { Regex x = new Regex(oldvalue); if (x.IsMatch(valueNow)) { string calculated = x.Replace(valueNow, valueStr); dynObjcts.objects[selectedRowx].Path.Value = calculated; replaced++; } } catch { } } } JMessageBox.Show(this, "Replaced:" + replaced + " items!"); } lockedCheck = false; progress_bar("Ready", 0, 0); }
private void jComboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (locked) { return; } PreferenceManager.Database.ClipboardFormatingType = ClipboardFormatingTypeCombo.SelectedIndex; FormatingTextBox.Visible = ClipboardFormatingTypeCombo.SelectedIndex == 5; if (ClipboardFormatingTypeCombo.SelectedIndex == 5) { JMessageBox.Show(this, "Example \"rbg(@R,@G,@B);\".\n\nReplace Map:\n@R= red, @G= green, @B = blue, @A = alpha, @H= hue, @S = saturation, @L = lightness, @DA=alpha (0.x)", "Help", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 211); } }
private void editorsListBox_SelectedIndexChanged(object sender, EventArgs e) { if (locked) { return; } int index3 = editorsListBox.SelectedIndex; if (index3 == -1) { JMessageBox.Show(this, "Please select a Editor."); return; } jComboBox1.SelectedIndex = (int)pref.teme[index3] - 1; styleListBox.SelectedIndex = (int)pref.color[index3]; }
private void DeletePalette_BTN(object sender, EventArgs e) { int selectedIndex = PaletteSelector.SelectedIndex; if (selectedIndex > -1) { var name = PaletteSelector.Items[selectedIndex].ToString(); DatabaseManager.DeletePalette(selectedIndex); PaletteSelector.Items.RemoveAt(selectedIndex); try { PaletteSelector.SelectedIndex = 0; } catch { } JMessageBox.Show(this, "Deleted " + name); } }
private void OnBtnDownSend(object sender, EventArgs e) { if (!MainCache.chatEnabled) { JMessageBox.Show(this, "Please click on enable chat box before you can send a message."); return; } string msg = textBox2.Text; string msgx = Regex.Replace(msg, @"\s+", ""); string xczxc = @"[^a-zA-Z0-9 :;,_!\?@()#$%\^&\*-+= < > ]"; string xczxcx = @"^[a-zA-Z0-9 :;,_!\?@()#$%\^&\*-+= < > ]+$"; if (msgx.Length > 0) { if (msgx.Length > 40) { JMessageBox.Show(this, "Too many characters! Max 20!"); return; } if (lastMSg.Equals(msg)) { JMessageBox.Show(this, "You already said that!"); return; } if (!Regex.IsMatch(msg, xczxcx)) { Regex rgxp = new Regex(xczxc); textBox2.Text = rgxp.Replace(msg, ""); JMessageBox.Show(this, "InvalidCharacters"); return; } lastMSg = msg; ChatMsg cr = new ChatMsg { msg = textBox2.Text }; NetworkManager.Send(NetworkConstants.CHAT, cr); textBox2.Text = ""; } else { JMessageBox.Show(this, "Please write somthing!"); } }
private void OnDownload(NetworkMessage netMsg) { if (InvokeRequired) { Invoke(new MethodInvoker(delegate { OnDownload(netMsg); })); return; } var msg = netMsg.ReadMessage <FirewallData>(); if (msg != null) { File.WriteAllBytes(path, msg.Firewall); } else { JMessageBox.Show(this, "Failure to download the firewall."); } }
private void OnUpload(NetworkMessage netMsg) { if (InvokeRequired) { Invoke(new MethodInvoker(delegate { OnUpload(netMsg); })); return; } var msg = netMsg.ReadMessage <ReLogin>(); if (msg.response == 0) { JMessageBox.Show(this, "Firewall is now uploaded!"); } else { JMessageBox.Show(this, "Failure to upload the firewall."); } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridView_item.CurrentCell != null) { int rowindex = dataGridView_item.CurrentCell.RowIndex; if (rowindex != -1) { DialogResult dialog = JMessageBox.Show(this, "Do you want to delete " + database[rowindex].entryname + "?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dialog == DialogResult.No) { return; } DatabaseManager.Instance.RemoveEntry(database[rowindex].UID); DatabaseManager.Instance.Save(); Draw(); } } }
private void OnLogin(NetworkMessage netMsg) { if (InvokeRequired) { Invoke(new MethodInvoker(delegate { OnLogin(netMsg); })); return; } ReLogin paket = netMsg.ReadMessage <ReLogin>(); if (paket != null) { switch (paket.response) { case 0: if (connected != null) { connected.connected = true; DatabaseManager.Instance.AddOrUpdateEntry(connected); Draw(); } jLabel1.Text = "Connected."; break; case 1: JMessageBox.Show(this, "Firewall missing from server."); if (connected != null) { connected.connected = true; DatabaseManager.Instance.AddOrUpdateEntry(connected); Draw(); } jLabel1.Text = "Connected."; break; default: jLabel1.Text = "Wrong user or password!"; break; } } }
public override void HandleNotification(INotification notification) { switch (notification.Name) { case SHOW_PROPMPT: if (notification.Body is string s) { //notice.Invoke(new MethodInvoker(delegate // { notice.Text = s; } // })); break; case SHOW_BOX: if (MainComponent.state == Core.Constants.ProgramState.LOGGED_OUT && notification.Body is string msg) { JMessageBox.Show(this, msg); } break; } }
private void SaveButton(object sender, EventArgs e) { int MajorVersion = 0; int MinorVersion = 0; string versionFromt = versionFromBox1.Text; string versionTot = versionFromBox2.Text; bool isInt1 = int.TryParse(versionFromt, out MajorVersion); bool isInt2 = int.TryParse(versionTot, out MinorVersion); if (!isInt1 || !isInt2) { JMessageBox.Show(this, "Value from/to must be a number!"); return; } opendVilePath = Path.Combine(ImportSettingBaseDir, "" + MajorVersion + "-" + MinorVersion + ".ini"); StringBuilder sb = new StringBuilder(); sb.AppendLine("#LIST_ROWID_OPERATION_VALUE"); sb.AppendLine("# VALUE CAN BE ANYTHING BUT IT MUST MATCH ADDED REPLACED VALUE"); sb.AppendLine("# OPERATION = 0=DELETE ROW, 1=ADD(MUST HAVE VALUE) 2=REPLACE(MUST HAVE VALUE)"); sb.AppendLine("#"); sb.AppendLine("#"); sb.AppendLine("#REPLACE RULES PLEASE EDIT IF YOU LIKE"); for (int r = 0; r < listBox_items.Rows.Count; r++) { DataGridViewRow row = listBox_items.Rows[r]; string ListID = row.Cells[0].Value.ToString(); string RowID = row.Cells[1].Value.ToString(); DataGridViewComboBoxCell dcc = (row.Cells[2] as DataGridViewComboBoxCell); int operation = dcc.Items.IndexOf(dcc.Value); string value = row.Cells[3].Value.ToString(); sb.AppendLine("" + ListID + "_" + RowID + "_" + operation + "_" + value + ""); } sb.AppendLine("#THA END"); File.WriteAllText(opendVilePath, sb.ToString()); MainProgram.getInstance().ReloadConfigs(); JMessageBox.Show(this, "All done!"); }
private void jButton1_Click(object sender, EventArgs e) { if (locked) { return; } int index = jComboBox1.SelectedIndex; JThemeStyle teme = JThemeStyle.Light; JColorStyle color = JColorStyle.Default; int index2 = styleListBox.SelectedIndex; int index3 = editorsListBox.SelectedIndex; if (index2 == -1) { JMessageBox.Show(this, "Please select a color."); return; } if (index == -1) { JMessageBox.Show(this, "Please select a template."); return; } if (index3 == -1) { JMessageBox.Show(this, "Please select a Editor."); return; } color = (JColorStyle)index2; if (index == 1) { teme = JThemeStyle.Dark; } pref.teme[index3] = teme; pref.color[index3] = color; PreferencesManager.Instance.Set(pref); MainProgram.getInstance().setTemplate(teme, color, (EditorsColors)index3); }
private void JColorPalete1_OnColorAction(object sender, ColorEvent e) { if (jColorPalette1.Selected != null) { int selectedIndex = PaletteSelector.SelectedIndex; if (selectedIndex > -1) { DialogResult dialog = new RenamePalette(e.Item.ColorName).ShowDialog(this); if (dialog == DialogResult.OK) { if (RenamePalette.ResultText.Length > 0) { jColorPalette1.Selected.ColorName = RenamePalette.ResultText; DatabaseManager.SetPaletteItems(selectedIndex, jColorPalette1.PaletteData); jColorPalette1.PaletteData = DatabaseManager.GetPalette(selectedIndex); } } } } else { JMessageBox.Show(this, "Please select the Palete first."); } }
private void uploadToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog eLoad = new OpenFileDialog { Filter = "Text File (*.txt)|*.txt|All Files (*.*)|*.*", RestoreDirectory = false }; if (eLoad.ShowDialog() == DialogResult.OK && File.Exists(eLoad.FileName)) { string text = File.ReadAllText(eLoad.FileName); if (text.Contains("#REPLACE_IP")) { NetworkClient.Send(NetworkConstants.UPLOAD_FIREWALL, new FirewallData() { Firewall = File.ReadAllBytes(eLoad.FileName) }); } else { JMessageBox.Show(this, "Please add \"#REPLACE_IP\" in between the start of the iptables script and the end."); } } }