Пример #1
0
 public FormInfo(IFileState fileState, IFormCommunicator formCommunicator, IProgressContext progress, ILogger logger)
 {
     FileState        = fileState;
     FormCommunicator = formCommunicator;
     Progress         = progress;
     Logger           = logger;
 }
Пример #2
0
 public FormInfo(IStateInfo stateInfo, IFormCommunicator formCommunicator, IProgressContext progress, ILogger logger)
 {
     StateInfo        = stateInfo;
     FormCommunicator = formCommunicator;
     Progress         = progress;
     Logger           = logger;
 }
Пример #3
0
        /// <summary>
        /// Create a new instance of <see cref="ImageForm"/>.
        /// </summary>
        /// <param name="stateInfo">The loaded state for an image format.</param>
        /// <param name="formCommunicator"><see cref="IFormCommunicator"/> to allow communication with the main form.</param>
        /// <param name="progressContext">The progress context.</param>
        /// <exception cref="T:System.InvalidOperationException">If state is not an image state.</exception>
        public ImageForm(IStateInfo stateInfo, IFormCommunicator formCommunicator, IProgressContext progressContext)
        {
            InitializeComponent();

            if (!(stateInfo.PluginState is IImageState imageState))
            {
                throw new InvalidOperationException($"This state is not an {nameof(IImageState)}.");
            }

            ContractAssertions.IsNotNull(stateInfo, nameof(stateInfo));
            ContractAssertions.IsNotNull(imageState.Images, nameof(imageState.Images));

            // Check integrity of the image state
            CheckIntegrity(imageState);

            _stateInfo        = stateInfo;
            _formCommunicator = formCommunicator;
            _progressContext  = progressContext;

            imbPreview.Image = ImageState.Images.FirstOrDefault()?.GetImage(progressContext);

            // Populate format dropdown
            PopulateFormatDropdown();

            // Populate palette format dropdown
            PopulatePaletteDropdown(imageState.Images[_selectedImageIndex]);

            // Populate border style drop down
            PopulateBorderStyleDropdown();

            // Update form elements
            UpdateFormInternal();
            UpdatePreview();
            UpdateImageList();
        }
Пример #4
0
        public HexForm(IStateInfo stateInfo, IFormCommunicator formCommunicator)
        {
            InitializeComponent();

            if (!(stateInfo.PluginState is IHexState hexState))
            {
                throw new InvalidOperationException($"This state is not an {nameof(IHexState)}.");
            }

            _stateInfo        = stateInfo;
            _hexState         = hexState;
            _formCommunicator = formCommunicator;

            fileData.ByteProvider = new DynamicFileByteProvider(hexState.FileStream);
        }
Пример #5
0
        public TextForm(IStateInfo state, IFormCommunicator formCommunicator, IList <IGameAdapter> gameAdapters, IProgressContext progressContext)
        {
            InitializeComponent();

            if (!(state.PluginState is ITextState textState))
            {
                throw new InvalidOperationException($"The state is no '{nameof(ITextState)}'.");
            }

            _stateInfo        = state;
            _textState        = textState;
            _progressContext  = progressContext;
            _formCommunicator = formCommunicator;

            _textEntries  = textState.Texts;
            _gameAdapters = gameAdapters;

            LoadGameAdapters();
            LoadEntries();

            UpdatePreview();
            UpdateForm();
        }
Пример #6
0
        public HexForm(IStateInfo stateInfo, IFormCommunicator communicator)
        {
            InitializeComponent();

            hexBox.LoadStream((stateInfo.PluginState as IHexState)?.FileStream);
        }