Exemple #1
0
        /// <summary>
        /// Compares this <see cref="Range"/> to another.
        /// </summary>
        /// <remarks>
        /// <see cref="Range"/>s are strictly ordered by their <see cref="Range.StartByte"/>s, then
        /// by their <see cref="Range.EndByte"/>s.
        /// </remarks>
        /// <param name="other">The <see cref="Range"/> to which to compare this <see cref="Range"/>.</param>
        /// <returns>A value less than 0 if this <see cref="Range"/> is less than the other.
        /// 0 if this <see cref="Range"/> is equal to the other.
        /// A value greater than 0 if this <see cref="Range"/> is greater than the other.</returns>
        public int CompareTo(Range other)
        {
            Int32 intResult = StartByte.CompareTo(other.StartByte);

            if (intResult == 0)
            {
                intResult = EndByte.CompareTo(other.EndByte);
            }
            return(intResult);
        }
Exemple #2
0
        partial void StartByteIncrease(NSObject sender)
        {
            long StartByte;

            try
            {
                StartByte = Convert.ToInt64(StartByteField.StringValue, 16);
            }
            catch
            {
                new NSAlert {
                    MessageText = "Error", InformativeText = "Invalid start byte.", AlertStyle = NSAlertStyle.Informational
                }.RunModal();
                //MessageBox.Show("Invalid start byte.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            long EndByte;

            try
            {
                EndByte = Convert.ToInt64(EndByteField.StringValue, 16);
            }
            catch
            {
                new NSAlert {
                    MessageText = "Error", InformativeText = "Invalid end byte.", AlertStyle = NSAlertStyle.Informational
                }.RunModal();
                //MessageBox.Show("Invalid end byte.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            long Increment;

            try
            {
                Increment = Convert.ToInt64(IncrementField.StringValue, 16);
            }
            catch
            {
                new NSAlert {
                    MessageText = "Error", InformativeText = "Invalid increment.", AlertStyle = NSAlertStyle.Informational
                }.RunModal();
                //MessageBox.Show("Invalid increment.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            StartByte = StartByte + Increment;
            if (StartByte > EndByte)
            {
                StartByte = EndByte;
            }
            StartByteField.StringValue = StartByte.ToString("X");
        }
Exemple #3
0
        protected internal void ToShortText(ConsoleTable output, int indentLevel)
        {
            output.AddRow(
                StartByte.ToString(),
                (IndefiniteLength) ? "inf" : Asn1.GetTotalByteCount(this).ToString(),
                Constructed ? "cons" : "prim",
                Identifier.ToString(),
                string.Concat(string.Empty.PadLeft(indentLevel * 2, ' '), ShortDescription),
                DataText
                );

            if (Constructed)
            {
                foreach (Asn1Tag subTag in SubTags)
                {
                    subTag.ToShortText(output, indentLevel + 1);
                }
            }
        }