コード例 #1
0
ファイル: Range.cs プロジェクト: zua07/Nexus-Mod-Manager
        /// <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);
        }
コード例 #2
0
ファイル: ViewController.cs プロジェクト: cheetodust/VRC-Mac
        partial void EndByteDecrease(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;
            }

            EndByte = EndByte - Increment;
            if (EndByte < StartByte)
            {
                EndByte = StartByte;
            }
            EndByteField.StringValue = EndByte.ToString("X");
        }