Beispiel #1
0
        private void AddBlanksButton_Click(object sender, EventArgs e)
        {
            if (_library == null)
            {
                return;
            }
            if (_library._fileName == null)
            {
                return;
            }

            string value = "0";
            int    temp  = 0;

            if (InputBox("Add Blanks To End Of Library", "How Many Blank Images To Add:", 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;
            }
            for (int i = 0; i < newImages; i++)
            {
                Bitmap image = new Bitmap(1, 1);
                _library.AddImage(image, 0, 0);
            }
            PreviewListView.VirtualListSize = _library.Images.Count;
        }
Beispiel #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);
        }
Beispiel #3
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;
        }