Example #1
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (_library == null)
     {
         return;
     }
     _library.Save(_library.FileName);
 }
Example #2
0
        private void copyToToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (PreviewListView.SelectedIndices.Count == 0)
            {
                return;
            }
            if (SaveLibraryDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Mir3Library tempLibrary = new Mir3Library(SaveLibraryDialog.FileName);

            List <int> copyList = new List <int>();

            for (int i = 0; i < PreviewListView.SelectedIndices.Count; i++)
            {
                copyList.Add(PreviewListView.SelectedIndices[i]);
            }

            copyList.Sort();

            for (int i = 0; i < copyList.Count; i++)
            {
                Mir3Library.Mir3Image image = _library.GetImage(copyList[i]);
                tempLibrary.AddImage(image.Image, image.OffSetX, image.OffSetY);
            }

            tempLibrary.Save(SaveLibraryDialog.FileName);
        }
Example #3
0
        public void ToMLibrary()
        {
            string fileName = Path.ChangeExtension(FileName, ".Zl");

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            Mir3Library library = new Mir3Library(fileName);

            library.Images.AddRange(Enumerable.Repeat(new Mir3Library.Mir3Image(), Images.Count));
            //library.Save();

            ParallelOptions options = new ParallelOptions {
                MaxDegreeOfParallelism = 8
            };

            try
            {
                Parallel.For(0, Images.Count, options, i =>
                {
                    MImage image = Images[i];
                    if (image.HasMask)
                    {
                        library.Images[i] = new Mir3Library.Mir3Image(image.Image, null, image.MaskImage)
                        {
                            OffSetX = image.X, OffSetY = image.Y, ShadowOffSetX = image.ShadowX, ShadowOffSetY = image.ShadowY
                        }
                    }
                    ;
                    else
                    {
                        library.Images[i] = new Mir3Library.Mir3Image(image.Image)
                        {
                            OffSetX = image.X, OffSetY = image.Y, ShadowOffSetX = image.ShadowX, ShadowOffSetY = image.ShadowY
                        }
                    };
                });
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                library.Save(fileName);
            }

            // Operation finished.
            // System.Windows.Forms.MessageBox.Show("Converted " + fileName + " successfully.",
            //    "Wemade Information",
            //        System.Windows.Forms.MessageBoxButtons.OK,
            //            System.Windows.Forms.MessageBoxIcon.Information,
            //                System.Windows.Forms.MessageBoxDefaultButton.Button1);
        }
Example #4
0
        public void ToMLibrary()
        {
            string fileName = Path.ChangeExtension(_fileName, ".Zl");

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            Mir3Library library = new Mir3Library(fileName)
            {
                Images = new List <Mir3Library.Mir3Image>(Images.Length)
            };

            //library.Save();

            for (int i = 0; i < Images.Length; i++)
            {
                library.Images.Add(null);
            }

            ParallelOptions options = new ParallelOptions {
                MaxDegreeOfParallelism = 8
            };

            try
            {
                Parallel.For(0, Images.Length, options, i =>
                {
                    WeMadeImage image = Images[i];
                    //if (image.HasMask)
                    //    library.Images[i] = new MLibraryV2.MImage(image.Image, image.MaskImage) { X = image.X, Y = image.Y, ShadowX = image.ShadowX, ShadowY = image.ShadowY, Shadow = image.boHasShadow ? (byte)1 : (byte)0, MaskX = image.X, MaskY = image.Y };
                    // else
                    library.Images[i] = new Mir3Library.Mir3Image(image.Image)
                    {
                        OffSetX = image.X, OffSetY = image.Y, ShadowOffSetX = image.ShadowX, ShadowOffSetY = image.ShadowY
                    };
                });
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                library.Save(fileName);
            }

            // Operation finished.
            // System.Windows.Forms.MessageBox.Show("Converted " + fileName + " successfully.",
            //    "Wemade Information",
            //        System.Windows.Forms.MessageBoxButtons.OK,
            //            System.Windows.Forms.MessageBoxIcon.Information,
            //                System.Windows.Forms.MessageBoxDefaultButton.Button1);
        }
Example #5
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (SaveLibraryDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (_library != null)
            {
                _library.Close();
            }
            _library = new Mir3Library(SaveLibraryDialog.FileName);
            PreviewListView.VirtualListSize = 0;
            _library.Save(SaveLibraryDialog.FileName);
        }