예제 #1
0
        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"));
        }
예제 #2
0
        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"));
        }
예제 #3
0
파일: LMain.cs 프로젝트: mstation/mir2
        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"));
        }