/// <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); }
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"); }