private void convertToolStripMenuItem_Click(object sender, EventArgs e) { if (OpenWeMadeDialog.ShowDialog() != DialogResult.OK) { return; } toolStripProgressBar.Maximum = OpenWeMadeDialog.FileNames.Length; toolStripProgressBar.Value = 0; try { ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 1 }; Parallel.For(0, OpenWeMadeDialog.FileNames.Length, options, i => { if (Path.GetExtension(OpenWeMadeDialog.FileNames[i]).ToUpper() == ".WTL") { WTLLibrary WTLlib = new WTLLibrary(OpenWeMadeDialog.FileNames[i]); WTLlib.ToMLibrary(); } else if (Path.GetExtension(OpenWeMadeDialog.FileNames[i]).ToUpper() == ".LIB") { FileStream stream = new FileStream(OpenWeMadeDialog.FileNames[i], FileMode.Open, FileAccess.ReadWrite); BinaryReader reader = new BinaryReader(stream); int CurrentVersion = reader.ReadInt32(); stream.Close(); stream.Dispose(); reader.Dispose(); if (CurrentVersion == 1) { MLibrary v1Lib = new MLibrary(OpenWeMadeDialog.FileNames[i]); v1Lib.ToMLibrary(); } else { MLibraryV2 v2Lib = new MLibraryV2(OpenWeMadeDialog.FileNames[i]); v2Lib.ToMLibrary(); } } else { WeMadeLibrary WILlib = new WeMadeLibrary(OpenWeMadeDialog.FileNames[i]); WILlib.ToMLibrary(); } toolStripProgressBar.Value++; }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } toolStripProgressBar.Value = 0; MessageBox.Show(string.Format("Successfully converted {0} {1}", (OpenWeMadeDialog.FileNames.Length).ToString(), (OpenWeMadeDialog.FileNames.Length > 1) ? "libraries" : "library")); }
private void convertToolStripMenuItem_Click_1(object sender, EventArgs e) { if (OpenWeMadeDialog.ShowDialog() != DialogResult.OK) { return; } ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 8 }; Parallel.For(0, OpenWeMadeDialog.FileNames.Length, options, i => { if (Path.GetExtension(OpenWeMadeDialog.FileNames[i]) == ".wtl") { WTLLibrary WTLlib = new WTLLibrary(OpenWeMadeDialog.FileNames[i]); WTLlib.ToMLibrary(); } else { WeMadeLibrary WILlib = new WeMadeLibrary(OpenWeMadeDialog.FileNames[i]); WILlib.ToMLibrary(); } }); }
private void Form1_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (Path.GetExtension(files[0]).ToUpper() == ".WIL" || Path.GetExtension(files[0]).ToUpper() == ".WZL" || Path.GetExtension(files[0]).ToUpper() == ".MIZ") { try { ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 8 }; Parallel.For(0, files.Length, options, i => { if (Path.GetExtension(files[i]) == ".wtl") { WTLLibrary WTLlib = new WTLLibrary(files[i]); WTLlib.ToMLibrary(); } else { WeMadeLibrary WILlib = new WeMadeLibrary(files[i]); WILlib.ToMLibrary(); } toolStripProgressBar.Value++; }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } toolStripProgressBar.Value = 0; MessageBox.Show( string.Format("Successfully converted {0} {1}", (OpenWeMadeDialog.FileNames.Length).ToString(), (OpenWeMadeDialog.FileNames.Length > 1) ? "libraries" : "library")); } else if (Path.GetExtension(files[0]).ToUpper() == ".LIB") { ClearInterface(); ImageList.Images.Clear(); PreviewListView.Items.Clear(); _indexList.Clear(); if (_library != null) _library.Close(); _library = new MLibraryV2(files[0]); PreviewListView.VirtualListSize = _library.Images.Count; PreviewListView.RedrawItems(0, PreviewListView.Items.Count - 1, true); // Show .Lib path in application title. this.Text = files[0].ToString(); } else { return; } }
private void convertToolStripMenuItem_Click(object sender, EventArgs e) { if (OpenWeMadeDialog.ShowDialog() != DialogResult.OK) { return; } toolStripProgressBar.Maximum = OpenWeMadeDialog.FileNames.Length; toolStripProgressBar.Value = 0; try { ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 8 }; Parallel.For(0, OpenWeMadeDialog.FileNames.Length, options, i => { if (Path.GetExtension(OpenWeMadeDialog.FileNames[i]) == ".wtl") { WTLLibrary WTLlib = new WTLLibrary(OpenWeMadeDialog.FileNames[i]); WTLlib.ToMLibrary(); } else if (Path.GetExtension(OpenWeMadeDialog.FileNames[i]) == ".Lib") { MLibraryV1 v1Lib = new MLibraryV1(OpenWeMadeDialog.FileNames[i]); v1Lib.ToMLibrary(); } else { WeMadeLibrary WILlib = new WeMadeLibrary(OpenWeMadeDialog.FileNames[i]); WILlib.ToMLibrary(); } toolStripProgressBar.Value++; }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } toolStripProgressBar.Value = 0; MessageBox.Show(string.Format("Successfully converted {0} {1}", (OpenWeMadeDialog.FileNames.Length).ToString(), (OpenWeMadeDialog.FileNames.Length > 1) ? "libraries" : "library")); }
private void Form1_DragDrop(object sender, DragEventArgs e) { return; //Not added yet string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (Path.GetExtension(files[0]).ToUpper() == ".WIL" || Path.GetExtension(files[0]).ToUpper() == ".WZL" || Path.GetExtension(files[0]).ToUpper() == ".MIZ") { try { ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 8 }; Parallel.For(0, files.Length, options, i => { if (Path.GetExtension(files[i]).ToUpper() == ".WTL") { WTLLibrary WTLlib = new WTLLibrary(files[i]); WTLlib.ToMLibrary(); } else { WeMadeLibrary WILlib = new WeMadeLibrary(files[i]); WILlib.ToMLibrary(); } toolStripProgressBar.Value++; }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } toolStripProgressBar.Value = 0; MessageBox.Show( string.Format("Successfully converted {0} {1}", (OpenWeMadeDialog.FileNames.Length).ToString(), (OpenWeMadeDialog.FileNames.Length > 1) ? "libraries" : "library")); } else if (Path.GetExtension(files[0]).ToUpper() == ".LIB") { ClearInterface(); ImageList.Images.Clear(); PreviewListView.Items.Clear(); _indexList.Clear(); if (_library != null) { _library.Close(); } //_library = new MLibraryV2(files[0]); //PreviewListView.VirtualListSize = _library.Images.Count; PreviewListView.RedrawItems(0, PreviewListView.Items.Count - 1, true); // Show .Lib path in application title. this.Text = files[0].ToString(); } else { return; } }
private void MergeButton_Click(object sender, EventArgs e) { if (_library == null) { return; } if (_library.FileName == null) { return; } string value = "1000"; int temp = 0; if (InputBox("Merge Blanks", "How Many Images Per Object:", ref value) == DialogResult.OK) { if (!int.TryParse(value, out temp)) { MessageBox.Show("Should be a numeric value"); return; } if (temp <= 0) { MessageBox.Show("Must be atleast 1"); return; } newImages = temp; } _library.AddBlanks(newImages); if (OpenMergeDialog.ShowDialog() != DialogResult.OK) { return; } toolStripProgressBar.Maximum = OpenMergeDialog.FileNames.Length; toolStripProgressBar.Value = 0; try { foreach (string file in OpenMergeDialog.FileNames) { if (Path.GetExtension(file).ToUpper() == ".ZL") { Mir3Library newLib = new Mir3Library(file); foreach (Mir3Library.Mir3Image image in newLib.Images) { _library.AddImage(image.Image, image.OffSetX, image.OffSetY); } } else if (Path.GetExtension(file).ToUpper() == ".WTL") { WTLLibrary WTLlib = new WTLLibrary(file); WTLlib.MergeToMLibrary(_library, newImages); } else if (Path.GetExtension(file).ToUpper() == ".LIB") { FileStream stream = new FileStream(file, FileMode.Open, FileAccess.ReadWrite); BinaryReader reader = new BinaryReader(stream); int CurrentVersion = reader.ReadInt32(); stream.Close(); stream.Dispose(); reader.Dispose(); if (CurrentVersion == 1) { MLibrary v1Lib = new MLibrary(file); v1Lib.MergeToMLibrary(_library, newImages); } else { MLibraryV2 v2Lib = new MLibraryV2(file); v2Lib.MergeToMLibrary(_library, newImages); } } else { WeMadeLibrary WILlib = new WeMadeLibrary(file); WILlib.MergeToMLibrary(_library, newImages); } toolStripProgressBar.Value++; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } toolStripProgressBar.Value = 0; MessageBox.Show(string.Format("Successfully merged {0} {1}", (OpenMergeDialog.FileNames.Length).ToString(), (OpenMergeDialog.FileNames.Length > 1) ? "libraries" : "library")); ImageList.Images.Clear(); _indexList.Clear(); PreviewListView.VirtualListSize = _library.Images.Count; _library.Save(_library.FileName); }
private void convertToolStripMenuItem_Click_1(object sender, EventArgs e) { if (OpenWeMadeDialog.ShowDialog() != DialogResult.OK) return; ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 8 }; Parallel.For(0, OpenWeMadeDialog.FileNames.Length, options, i => { WeMadeLibrary lib = new WeMadeLibrary(OpenWeMadeDialog.FileNames[i]); lib.ToMLibrary(); }); }
private void convertToolStripMenuItem_Click(object sender, EventArgs e) { if (OpenWeMadeDialog.ShowDialog() != DialogResult.OK) return; toolStripProgressBar.Maximum = OpenWeMadeDialog.FileNames.Length; toolStripProgressBar.Value = 0; try { ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 8 }; Parallel.For(0, OpenWeMadeDialog.FileNames.Length, options, i => { if (Path.GetExtension(OpenWeMadeDialog.FileNames[i]) == ".wtl") { WTLLibrary WTLlib = new WTLLibrary(OpenWeMadeDialog.FileNames[i]); WTLlib.ToMLibrary(); } else if (Path.GetExtension(OpenWeMadeDialog.FileNames[i]) == ".Lib") { MLibrary v1Lib = new MLibrary(OpenWeMadeDialog.FileNames[i]); v1Lib.ToMLibrary(); } else { WeMadeLibrary WILlib = new WeMadeLibrary(OpenWeMadeDialog.FileNames[i]); WILlib.ToMLibrary(); } toolStripProgressBar.Value++; }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } toolStripProgressBar.Value = 0; MessageBox.Show(string.Format("Successfully converted {0} {1}", (OpenWeMadeDialog.FileNames.Length).ToString(), (OpenWeMadeDialog.FileNames.Length > 1) ? "libraries" : "library")); }
private void convertToolStripMenuItem_Click_1(object sender, EventArgs e) { if (OpenWeMadeDialog.ShowDialog() != DialogResult.OK) return; ParallelOptions options = new ParallelOptions { MaxDegreeOfParallelism = 8 }; Parallel.For(0, OpenWeMadeDialog.FileNames.Length, options, i => { if (Path.GetExtension(OpenWeMadeDialog.FileNames[i]) == ".wtl") { WTLLibrary WTLlib = new WTLLibrary(OpenWeMadeDialog.FileNames[i]); WTLlib.ToMLibrary(); } else { WeMadeLibrary WILlib = new WeMadeLibrary(OpenWeMadeDialog.FileNames[i]); WILlib.ToMLibrary(); } }); }