Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                this.dlgFile.InitialDirectory = this.TargetPath;
                this.dlgFile.DefaultExt       = "blueprint";
                if (this.dlgFile.ShowDialog() == DialogResult.OK)
                {
                    var s  = this.dlgFile.FileName;
                    var bp = BlueprintFile.Load(s);
                    bp.LoadBlocks();

                    this.AddColorPalettePanel(bp.Colors, true);

                    var fi = new FileInfo(this.dlgFile.FileName);
                    this.TargetPath = fi.DirectoryName;
                    this.ColorPalettes.ColorPalettes.Add(new ColorPalette()
                    {
                        Colors = bp.Colors
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
Ejemplo n.º 2
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            var bpi = (BlueprintItem)this.bpListView.SelectedItems[0].Tag;
            var bp  = BlueprintFile.Load(bpi.Path);
            var f   = new Form2();

            f.Blueprint = bp;
            f.Show();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ブロック削除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void blockEraseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.bpListView.SelectedIndices.Count == 0)
            {
                return;
            }

            var bpi = (BlueprintItem)this.bpListView.SelectedItems[0].Tag;
            var f   = new FormBlockErase();
            var bp  = BlueprintFile.Load(bpi.Path);

            f.Blueprint = bp;
            f.ShowDialog();
        }
Ejemplo n.º 4
0
        private void ViewHistory(BlueprintItem bpi)
        {
            this.histroyListView.BeginUpdate();
            this.histroyListView.Clear();
            var related   = bpi.Path.Substring(this.backupMgr.TargetPath.Length);
            var dirPath   = related.Substring(0, related.Length - ".blueprint".Length);
            var bkDirPath = this.backupMgr.BackupPath + dirPath;
            var bkDir     = new DirectoryInfo(bkDirPath);

            if (!bkDir.Exists)
            {
                this.histroyListView.EndUpdate();
                return;
            }
            this.histroyListView.Columns.Clear();
            this.histroyListView.Columns.Add("Name").Width = 200;
            this.histroyListView.Columns.Add("Version");
            this.histroyListView.Columns.Add("Game Version");
            this.histroyListView.Columns.Add("Last Update Date").Width = 150;

            foreach (var f in bkDir.GetFiles())
            {
                var bp = BlueprintFile.Load(f.FullName);
                if (bp == null)
                {
                    continue;
                }
                var item = new ListViewItem(f.Name);
                item.SubItems.Add("v" + bp.Version.ToString());
                item.SubItems.Add(bp.Blueprint.GameVersion);
                item.SubItems.Add(f.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss"));

                item.Tag = new BlueprintItem()
                {
                    Path = f.FullName,
                };
                this.histroyListView.Items.Add(item);
                //Task.Factory.StartNew<ListViewItem>(() =>
                //{

                //    return item;
                //}).ContinueWith(res =>
                //{
                //    if (res.Result != null)
                //    {
                //    }
                //}, TaskScheduler.FromCurrentSynchronizationContext());
            }
            this.histroyListView.EndUpdate();
        }
Ejemplo n.º 5
0
        private void colorPaletteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.bpListView.SelectedIndices.Count == 0)
            {
                return;
            }

            var bpi = (BlueprintItem)this.bpListView.SelectedItems[0].Tag;
            var bp  = BlueprintFile.Load(bpi.Path);

            if (string.IsNullOrEmpty(colorPaletteForm.TargetPath))
            {
                colorPaletteForm.TargetPath = this.targetInput.Text;
            }
            colorPaletteForm.Blueprint = bp;
            colorPaletteForm.ShowDialog();
        }
Ejemplo n.º 6
0
        private void ViewList(string path)
        {
            this.bpListView.BeginUpdate();
            this.bpListView.Clear();
            this.bpListView.Columns.Clear();
            this.bpListView.Columns.Add("Name").Width = 200;
            this.bpListView.Columns.Add("Version");
            this.bpListView.Columns.Add("Game Version");
            this.bpListView.Columns.Add("Last Update Date").Width = 150;
            this.bpListView.EndUpdate();

            var dir = new DirectoryInfo(path);

            foreach (var f in dir.GetFiles("*.blueprint"))
            {
                Task.Factory.StartNew <ListViewItem>(() =>
                {
                    var bp   = BlueprintFile.Load(f.FullName);
                    var item = new ListViewItem(f.Name);
                    item.SubItems.Add("v" + bp.Version.ToString());
                    item.SubItems.Add(bp.Blueprint.GameVersion);
                    item.SubItems.Add(f.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss"));


                    item.Tag = new BlueprintItem()
                    {
                        Path = f.FullName,
                    };
                    return(item);
                }).ContinueWith(res =>
                {
                    this.bpListView.BeginUpdate();
                    this.bpListView.Items.Add(res.Result);
                    this.bpListView.EndUpdate();
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
        }