public ImageEditorTabPage(IEnumerable<FirmwareDefinition> definitions, ResourcePackManager resourcePackManager)
        {
            m_definitions = definitions;
            m_resourcePackManager = resourcePackManager;

            InitializeComponent();
            InitializeControls();
        }
        public ResourcePacksTabPage([NotNull] ResourcePackManager resourcePackManager)
        {
            if (resourcePackManager == null) throw new ArgumentNullException("resourcePackManager");

            m_resourcePackManager = resourcePackManager;
            InitializeComponent();

            ResourcePackListView.Resize += (s, e) =>
            {
                NameColumnHeader.Width = ResourcePackListView.ClientRectangle.Width - FileNameColumnHeader.Width - VersionColumnHeader.Width - 1;
            };
            ResourcePackListView.SelectedIndexChanged += ResourcePackListView_SelectedIndexChanged;
            ResourcePackListView.ItemActivate += ResourcePackListView_ItemActivate;
            ResourcePackListView.ColumnClick += ListViewItemComparer.ListViewColumnClick;
            PreviewResourcePackButton.Click += PreviewResourcePackButton_Click;
            ImportResourcePackButton.Click += ImportResourcePackButton_Click;
            ReloadResourcePacksButton.Click += ReloadResourcePacksButton_Click;
        }
Exemple #3
0
        public void SetData([NotNull] List <bool[, ]> images)
        {
            if (images == null)
            {
                throw new ArgumentNullException("images");
            }

            var data = new List <ExportedImage>();

            foreach (var image in images)
            {
                var size = FirmwareImageProcessor.GetImageSize(image);
                data.Add(new ExportedImage(0, size, image)
                {
                    DataString = ResourcePackManager.WriteImageToAsciiString(size.Width, size.Height, image)
                });
            }
            var buffer = Serializer.Write(data);

            Clipboard.SetText(buffer);
        }
        public CreateResourcePackWindow(
            [NotNull] ResourcePackManager resourcePackManager,
            [NotNull] IEnumerable<FirmwareDefinition> definitions,
            [NotNull] string definition,
            [NotNull] List<ExportedImage> exportedImages,
            [CanBeNull] ResourcePackFile existedResourcePack
            )
            : this()
        {
            if (resourcePackManager == null) throw new ArgumentNullException("resourcePackManager");
            if (definitions == null) throw new ArgumentNullException("definitions");
            if (string.IsNullOrEmpty(definition)) throw new ArgumentNullException("definition");
            if (exportedImages == null) throw new ArgumentNullException("exportedImages");

            m_resourcePackManager = resourcePackManager;
            m_exportedImages = exportedImages.ToList();

            definitions.ForEach(x => DefinitionComboBox.Items.Add(x));
            if (existedResourcePack == null)
            {
                DefinitionComboBox.Text = definition;
                AuthorTextBox.Text = Environment.UserName;
            }
            else
            {
                NameTextBox.Text = existedResourcePack.Name;
                VersionTextBox.Text = existedResourcePack.Version;
                AuthorTextBox.Text = existedResourcePack.Author;
                DefinitionComboBox.Text = existedResourcePack.Definition;
                DescriptionTextBox.Text = existedResourcePack.Description;
            }
            flowLayoutPanel1.SuspendLayout();
            foreach (var exportedImage in exportedImages.Select(x => x.Data))
            {
                flowLayoutPanel1.Controls.Add(CreateGrid(exportedImage));
            }
            flowLayoutPanel1.ResumeLayout();
        }
Exemple #5
0
        public List <bool[, ]> GetData()
        {
            var images = new List <bool[, ]>();

            try
            {
                var buffer = Clipboard.GetText();
                var data   = Serializer.Read <List <ExportedImage> >(buffer);
                if (data == null)
                {
                    return(images);
                }

                foreach (var exportedImage in data)
                {
                    images.Add(ResourcePackManager.ReadImageFromAsciiString(exportedImage.Width, exportedImage.Height, exportedImage.DataString));
                }
                return(images);
            }
            catch
            {
                return(images);
            }
        }