Exemplo n.º 1
0
        private void Deserialize(Stream input)
        {
            if (input.ReadValueU32(Endian.Big) != 0x44435800) // 'DCX\0'
            {
                throw new FormatException();
            }

            if (input.ReadValueU32(Endian.Big) != 0x10000)
            {
                throw new FormatException();
            }

            var headerSize = input.ReadValueU32(Endian.Big);

            if (headerSize != 24)
            {
                throw new FormatException();
            }

            var unknown0C = input.ReadValueU32(Endian.Big);
            var unknown10 = input.ReadValueU32(Endian.Big);
            var unknown14 = input.ReadValueU32(Endian.Big);

            this._Size = new SizeBlock();
            this._Size.Deserialize(input);

            this._Setup = new ParameterBlock();
            this._Setup.Deserialize(input);

            this._Extra = new ExtraBlock();
            this._Extra.Deserialize(input);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NuGenToolTipInfoEditorUI"/> class.
        /// </summary>
        /// <param name="serviceContext"></param>
        /// <param name="serviceProvider">
        /// <para>Requires:</para>
        /// <para><see cref="INuGenToolTipLayoutManager"/></para>
        /// <para><see cref="INuGenToolTipRenderer"/></para>
        /// </param>
        /// <param name="initialTooltipInfo"></param>
        /// <exception cref="ArgumentNullException">
        /// <para>
        ///		<paramref name="serviceProvider"/> is <see langword="null"/>.
        /// </para>
        /// -or-
        /// <para>
        ///		<paramref name="serviceContext"/> is <see langword="null"/>.
        /// </para>
        /// </exception>
        public NuGenToolTipInfoEditorUI(
            INuGenServiceProvider serviceProvider,
            NuGenToolTipInfo initialTooltipInfo,
            NuGenCustomTypeEditorServiceContext serviceContext
            )
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            if (serviceContext == null)
            {
                throw new ArgumentNullException("serviceContext");
            }

            _serviceProvider = serviceProvider;

            this.SuspendLayout();

            _mainBlock        = new MainBlock(serviceContext);
            _mainBlock.Parent = this;

            _remarksBlock        = new RemarksBlock(serviceContext);
            _remarksBlock.Height = 100;
            _remarksBlock.Parent = this;

            _okButton = new Button();
            _okButton.DialogResult = DialogResult.OK;
            _okButton.TabIndex     = 0;
            _okButton.Text         = Resources.Text_ToolTipInfoEditor_okButton;

            _cancelButton = new Button();
            _cancelButton.DialogResult = DialogResult.Cancel;
            _cancelButton.TabIndex     = 1;
            _cancelButton.Text         = Resources.Text_ToolTipInfoEditor_cancelButton;

            _sizeBlock        = new SizeBlock();
            _sizeBlock.Parent = this;

            _dialogLayoutPanel = new DialogFlowLayoutPanel();
            _dialogLayoutPanel.Controls.Add(_cancelButton);
            _dialogLayoutPanel.Controls.Add(_okButton);
            _dialogLayoutPanel.Parent = this;

            this.CancelButton    = _cancelButton;
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            this.Padding         = new Padding(3);
            this.ShowIcon        = false;
            this.ShowInTaskbar   = false;
            this.Size            = new Size(350, 400);
            this.StartPosition   = FormStartPosition.CenterParent;
            this.Text            = Resources.Text_ToolTipInfoEditor_EditorForm;

            this.SetStateFromTooltipInfo(initialTooltipInfo);
            this.ResumeLayout(false);
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenToolTipInfoEditorUI"/> class.
		/// </summary>
		/// <param name="serviceContext"></param>
		/// <param name="serviceProvider">
		/// <para>Requires:</para>
		/// <para><see cref="INuGenToolTipLayoutManager"/></para>
		/// <para><see cref="INuGenToolTipRenderer"/></para>
		/// </param>
		/// <param name="initialTooltipInfo"></param>
		/// <exception cref="ArgumentNullException">
		/// <para>
		///		<paramref name="serviceProvider"/> is <see langword="null"/>.
		/// </para>
		/// -or-
		/// <para>
		///		<paramref name="serviceContext"/> is <see langword="null"/>.
		/// </para>
		/// </exception>
		public NuGenToolTipInfoEditorUI(
			INuGenServiceProvider serviceProvider,
			NuGenToolTipInfo initialTooltipInfo,
			NuGenCustomTypeEditorServiceContext serviceContext
			)
		{
			if (serviceProvider == null)
			{
				throw new ArgumentNullException("serviceProvider");
			}

			if (serviceContext == null)
			{
				throw new ArgumentNullException("serviceContext");
			}

			_serviceProvider = serviceProvider;

			this.SuspendLayout();

			_mainBlock = new MainBlock(serviceContext);
			_mainBlock.Parent = this;

			_remarksBlock = new RemarksBlock(serviceContext);
			_remarksBlock.Height = 100;
			_remarksBlock.Parent = this;

			_okButton = new Button();
			_okButton.DialogResult = DialogResult.OK;
			_okButton.TabIndex = 0;
			_okButton.Text = Resources.Text_ToolTipInfoEditor_okButton;

			_cancelButton = new Button();
			_cancelButton.DialogResult = DialogResult.Cancel;
			_cancelButton.TabIndex = 1;
			_cancelButton.Text = Resources.Text_ToolTipInfoEditor_cancelButton;

			_sizeBlock = new SizeBlock();
			_sizeBlock.Parent = this;

			_dialogLayoutPanel = new DialogFlowLayoutPanel();
			_dialogLayoutPanel.Controls.Add(_cancelButton);
			_dialogLayoutPanel.Controls.Add(_okButton);
			_dialogLayoutPanel.Parent = this;

			this.CancelButton = _cancelButton;
			this.FormBorderStyle = FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Padding = new Padding(3);
			this.ShowIcon = false;
			this.ShowInTaskbar = false;
			this.Size = new Size(350, 400);
			this.StartPosition = FormStartPosition.CenterParent;
			this.Text = Resources.Text_ToolTipInfoEditor_EditorForm;
			
			this.SetStateFromTooltipInfo(initialTooltipInfo);
			this.ResumeLayout(false);
		}