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 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(); } }); }