Пример #1
0
        private void copyToToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (PreviewListView.SelectedIndices.Count == 0)
            {
                return;
            }
            if (SaveLibraryDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            MLibraryV2 tempLibrary = new MLibraryV2(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++)
            {
                MLibraryV2.MImage image = _library.GetMImage(copyList[i]);
                tempLibrary.AddImage(image.Image, image.MaskImage, image.X, image.Y);
            }

            tempLibrary.Save();
        }
Пример #2
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (_library == null)
            {
                return;
            }
            if (_library.FileName == null)
            {
                return;
            }

            if (ImportImageDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            List <string> fileNames = new List <string>(ImportImageDialog.FileNames);

            //fileNames.Sort();
            toolStripProgressBar.Value   = 0;
            toolStripProgressBar.Maximum = fileNames.Count;

            for (int i = 0; i < fileNames.Count; i++)
            {
                string fileName = fileNames[i];
                Bitmap image;

                try
                {
                    image = new Bitmap(fileName);
                }
                catch
                {
                    continue;
                }

                fileName = Path.Combine(Path.GetDirectoryName(fileName), "Placements", Path.GetFileNameWithoutExtension(fileName));
                fileName = Path.ChangeExtension(fileName, ".txt");

                short x = 0;
                short y = 0;

                if (File.Exists(fileName))
                {
                    string[] placements = File.ReadAllLines(fileName);

                    if (placements.Length > 0)
                    {
                        short.TryParse(placements[0], out x);
                    }
                    if (placements.Length > 1)
                    {
                        short.TryParse(placements[1], out y);
                    }
                }

                _library.AddImage(image, x, y);
                toolStripProgressBar.Value++;
                //image.Dispose();
            }

            PreviewListView.VirtualListSize = _library.Images.Count;
            toolStripProgressBar.Value      = 0;
        }
Пример #3
0
        private void copyToToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (PreviewListView.SelectedIndices.Count == 0) return;
            if (SaveLibraryDialog.ShowDialog() != DialogResult.OK) return;

            MLibraryV2 tempLibrary = new MLibraryV2(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++)
            {
                MLibraryV2.MImage image = _library.GetMImage(copyList[i]);
                tempLibrary.AddImage(image.Image, image.X, image.Y);
            }

            tempLibrary.Save();
        }