void ValidateCheckpoint(byte[] headerHash, int headerHeight)
            {
                int hightHighestCheckpoint = Headerchain.Checkpoints.Max(x => x.Height);

                if (
                    hightHighestCheckpoint <= Headerchain.MainChain.Height &&
                    headerHeight <= hightHighestCheckpoint)
                {
                    throw new ChainException(
                              string.Format("Attempt to insert header {0} at hight {1} prior to checkpoint hight {2}",
                                            headerHash.ToHexString(),
                                            headerHeight,
                                            hightHighestCheckpoint));
                }

                HeaderLocation checkpoint = Headerchain.Checkpoints.Find(c => c.Height == headerHeight);

                if (checkpoint != null && !checkpoint.Hash.IsEqual(headerHash))
                {
                    throw new ChainException(
                              string.Format("Header {0} at hight {1} not equal to checkpoint hash {2}",
                                            headerHash.ToHexString(),
                                            headerHeight,
                                            checkpoint.Hash.ToHexString()));
                }
            }
Пример #2
0
        /// <summary>
        /// Value copy form the provided source to ourself.
        /// </summary>
        /// <param name="source">Source instance.</param>
        public void CopyFrom(ButtonSpecHeaderGroup source)
        {
            // Copy class specific values
            HeaderLocation = source.HeaderLocation;

            // Let base class copy the base values
            base.CopyFrom(source);
        }
Пример #3
0
        /// <summary>
        /// Initialize a new instance of the ButtonSpecNavFixed class.
        /// </summary>
        /// <param name="navigator">Reference to owning navigator instance.</param>
        /// <param name="fixedStyle">Fixed style to use.</param>
        public ButtonSpecNavFixed(KryptonNavigator navigator,
                                  PaletteButtonSpecStyle fixedStyle)
        {
            Debug.Assert(navigator != null);

            // Remember back reference to owning navigator.
            _navigator = navigator;

            // Fix the type
            ProtectedType = fixedStyle;

            // Default other properties
            _location = HeaderLocation.PrimaryHeader;
        }
Пример #4
0
        /// <summary>
        /// Initialize a new instance of the ButtonSpecNavFixed class.
        /// </summary>
        /// <param name="navigator">Reference to owning navigator instance.</param>
        /// <param name="fixedStyle">Fixed style to use.</param>
        public ButtonSpecNavFixed(KryptonNavigator navigator,
                                  PaletteButtonSpecStyle fixedStyle)
        {
            Debug.Assert(navigator != null);

            // Remember back reference to owning navigator.
            _navigator = navigator;

            // Fix the type
            ProtectedType = fixedStyle;

            // Default other properties
            _location = HeaderLocation.PrimaryHeader;
        }
        private int GetTargetDockerIndex(HeaderLocation location)
        {
            switch (location)
            {
            case HeaderLocation.PrimaryHeader:
                return(0);

            case HeaderLocation.SecondaryHeader:
                return(1);

            default:
                // Should never happen!
                Debug.Assert(false);
                break;
            }

            return(-1);
        }
Пример #6
0
 /// <summary>
 /// Resets the HeaderLocation property to its default value.
 /// </summary>
 public void ResetHeaderLocation()
 {
     HeaderLocation = HeaderLocation.PrimaryHeader;
 }
 /// <summary>
 /// Initialize a new instance of the HeaderGroupButtonSpec class.
 /// </summary>
 public ButtonSpecHeaderGroup()
 {
     _location = HeaderLocation.PrimaryHeader;
 }
Пример #8
0
 /// <summary>
 /// Initialize a new instance of the HeaderGroupButtonSpec class.
 /// </summary>
 public ButtonSpecHeaderGroup()
 {
     _location = HeaderLocation.PrimaryHeader;
 }