示例#1
0
 private Image GetImage(INode node)
 {
     if (IconSource is null)
     {
         return(null);
     }
     if (node is NbtFileNode)
     {
         return(IconSource.GetImage(IconType.File).Image);
     }
     if (node is FolderNode)
     {
         return(IconSource.GetImage(IconType.Folder).Image);
     }
     if (node is RegionFileNode)
     {
         return(IconSource.GetImage(IconType.Region).Image);
     }
     if (node is ChunkNode)
     {
         return(IconSource.GetImage(IconType.Chunk).Image);
     }
     if (node is NbtTagNode tag)
     {
         return(NbtUtil.TagTypeImage(IconSource, tag.Tag.TagType).Image);
     }
     return(null);
 }
示例#2
0
 public ExportWindow(IconSource source, ExportSettings template, string destination_path)
 {
     InitializeComponent();
     this.Icon = source.GetImage(IconType.Save).Icon;
     CompressionBox.Items.Add(new CompressionDisplay("Uncompressed", NbtCompression.None));
     CompressionBox.Items.Add(new CompressionDisplay("G-Zip", NbtCompression.GZip));
     CompressionBox.Items.Add(new CompressionDisplay("ZLib", NbtCompression.ZLib));
     CompressionBox.SelectedIndex = 0;
     if (template is not null)
     {
         RadioSnbt.Checked           = template.Snbt;
         RadioNbt.Checked            = !template.Snbt;
         CompressionBox.SelectedItem = CompressionBox.Items.Cast <CompressionDisplay>().FirstOrDefault(x => x.Compression == template.Compression);
         CheckMinify.Checked         = template.Minified;
         CheckJson.Checked           = template.Json;
         CheckLittleEndian.Checked   = !template.BigEndian;
         CheckBedrockHeader.Checked  = template.BedrockHeader;
     }
     else
     {
         string extension = Path.GetExtension(destination_path);
         bool?  binary    = NbtUtil.BinaryExtension(extension);
         RadioSnbt.Checked         = binary == false;
         RadioNbt.Checked          = binary == true;
         CheckLittleEndian.Checked = extension == ".mcstructure";
         CheckJson.Checked         = extension == ".json";
     }
     SetEnables();
     Tooltips.SetToolTip(CheckLittleEndian, "Required for all Bedrock Edition files");
     Tooltips.SetToolTip(CheckBedrockHeader, "Required for Bedrock Edition level.dat files");
     Tooltips.SetToolTip(CheckJson, "Quotes all keys, removes type suffixes and list indicators");
 }
示例#3
0
 public IconSetWindow(IconSource current)
 {
     InitializeComponent();
     CurrentSource = current;
     this.Icon     = current.GetImage(IconType.Refresh).Icon;
     RefreshIcons();
 }
示例#4
0
        private RenameFileWindow(IconSource source, IHavePath file)
        {
            InitializeComponent();

            OriginalItem = file;
            this.Icon    = source.GetImage(IconType.Rename).Icon;
            NameBox.SetItem(file);
            NameBox.SelectAll();
        }
示例#5
0
        public FindWindow(IconSource source, NbtTreeModel model, NbtTreeView view)
        {
            InitializeComponent();

            SearchingModel = model;
            SearchingView  = view;
            this.Icon      = source.GetImage(IconType.Search).Icon;
            UpdateButtons();
        }
        public FullIconPreviewWindow(IconSource source)
        {
            InitializeComponent();
            var preview = new IconSourcePreview(source, false, (IconType[])Enum.GetValues(typeof(IconType)));

            preview.MaximumSize = new Size(470, 0);
            preview.Dock        = DockStyle.Fill;
            Controls.Add(preview);
            this.Text = source.Name + " Icon Set";
            this.Icon = source.GetImage(IconType.Search).Icon;
        }
示例#7
0
        public UpdateWindow(IconSource source, AvailableUpdate update)
        {
            InitializeComponent();

            AvailableUpdate            = update;
            this.Icon                  = source.GetImage(IconType.NbtStudio).Icon;
            CurrentVersionValue.Text   = Updater.GetCurrentVersion().ToString(false);
            AvailableVersionValue.Text = update.Version.ToString(false);
            ChangelogBox.Text          = update.Changelog;
            ButtonOk.Select();
        }
示例#8
0
        private PictureBox MakePictureBox(IconSource source, IconType type)
        {
            var box = new SpecialPictureBox
            {
                Height            = 32,
                Width             = 32,
                Margin            = new Padding(5),
                Image             = source.GetImage(type).Image,
                SizeMode          = PictureBoxSizeMode.Zoom,
                InterpolationMode = InterpolationMode.NearestNeighbor
            };

            if (source is DeferToDefaultIconSource defer && defer.IsDeferring(type))
            {
                box.Enabled = false;
            }
            return(box);
        }
示例#9
0
        private EditChunkWindow(IconSource source, Chunk chunk, RegionFile region, ChunkEditPurpose purpose)
        {
            InitializeComponent();

            WorkingChunk = chunk;
            ChunkRegion  = region;
            Manager      = new ChunkCoordsEditControls(chunk, region, XBox, ZBox);

            this.Icon = source.GetImage(IconType.Chunk).Icon;
            if (purpose == ChunkEditPurpose.Create)
            {
                this.Text = $"Create Chunk";
            }
            else if (purpose == ChunkEditPurpose.Move)
            {
                this.Text = $"Move Chunk";
            }

            XBox.Select();
        }
示例#10
0
 public AboutWindow(IconSource source)
 {
     InitializeComponent();
     this.Icon      = source.GetImage(IconType.NbtStudio).Icon;
     NameLabel.Text = String.Format(NameLabel.Text, Updater.GetCurrentVersion().ToString(false));
 }