public override int GetHashCode() { return(RequestLength.GetHashCode() ^ DataOffset.GetHashCode() ^ PieceIndex.GetHashCode() ^ StartOffset.GetHashCode()); }
public byte[] Encode() { var header = new List <byte>(); header.AddRange(Identifier.GetBytes()); header.Add((byte)Filetype); header.Add(0); header.AddRange(StartOffset.GetBytes()); header.AddRange(UncompressedSize.GetBytes()); // don't know what this is for... header.AddRange(MysteryBytes); header.AddRange(0.GetBytes()); header.AddRange(CompressedSize.GetBytes()); header.AddRange(0.GetBytes()); header.AddRange(0.GetBytes()); header.AddRange(FileFormatIndexOffset.GetBytes()); header.AddRange(NameOffset.GetBytes()); if (header.Count < DetailsHeaderSize) { header.AddRange(new byte[DetailsHeaderSize - header.Count]); } return(header.ToArray()); }
public T Compute() { Contract.Requires <InvalidOperationException>(StartOffset.IsNoneOrPositive(), "You need to call SetRange before calling this"); Contract.Requires <InvalidOperationException>(Count >= 0, "You need to call SetRange before calling this"); #region prologue mAlgo.Initialize(); byte[] buffer = mAlgo.InternalBlockBuffer; int buffer_size = mAlgo.BlockSize; long orig_pos = mInputStream.Position; if (!StartOffsetIsStreamPosition && StartOffset != orig_pos) { mInputStream.Seek(StartOffset, SeekOrigin.Begin); } #endregion for (long bytes_remaining = Count; bytes_remaining > 0;) { long num_bytes_to_read = System.Math.Min(bytes_remaining, buffer_size); int num_bytes_read = 0; do { int n = mInputStream.Read(buffer, num_bytes_read, (int)num_bytes_to_read); if (n == 0) { break; } num_bytes_read += n; num_bytes_to_read -= n; } while (num_bytes_to_read > 0); if (num_bytes_read > 0) { mAlgo.TransformBlock(buffer, 0, num_bytes_read, null, 0); } else { break; } bytes_remaining -= num_bytes_read; } mAlgo.TransformFinalBlock(buffer, 0, 0); // yes, 0 bytes, all bytes should have been taken care of already #region epilogue if (mRestorePosition) { mInputStream.Seek(orig_pos, SeekOrigin.Begin); } #endregion return(mAlgo); }
/// <summary> /// Returns the hash code for the object. /// </summary> /// <returns>The hash code for the object.</returns> public override int GetHashCode() { int hashCode = -628491361; hashCode = hashCode * -1521134295 + ContentAlignment.GetHashCode(); hashCode = hashCode * -1521134295 + StartOffset.GetHashCode(); return(hashCode * -1521134295 + EndOffset.GetHashCode()); }
public void SetVisibility(string value) { if (value != Visibility.TextValue && (value == "Visible" || value == "Collapsed")) { Visibility.TextValue = value; StartOffset.SetVisibility(value); EndOffset.SetVisibility(value); } }
public int CompareTo(IndexEntry other) { if (StartOffset == other.StartOffset) { return(EndOffset.CompareTo(other.EndOffset)); } return(StartOffset.CompareTo(other.StartOffset)); }
public override int GetHashCode() { unchecked { var hashCode = SemitoneOffset; hashCode = (hashCode * 397) ^ StartOffset.GetHashCode(); hashCode = (hashCode * 397) ^ EndOffset.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { int hash = StartOffset.GetHashCode() ^ EndOffset.GetHashCode(); if (IsString) { return(hash ^ StringValue.GetHashCode()); } return(hash ^ ExtensionValue.GetHashCode()); }
/// <inheritdoc/> public override int GetHashCode() { unchecked { // NOTE: Exclude Path from comparison to allow easy testing with randomized TemporaryFiles int hashCode = (SubDir != null ? SubDir.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Destination != null ? Destination.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MimeType != null ? MimeType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ StartOffset.GetHashCode(); hashCode = (hashCode * 397) ^ (OriginalSource != null ? OriginalSource.GetHashCode() : 0); return(hashCode); } }
/// <summary> /// BitItems 태그에 값을 가진 BitItem Element를 추가한다. /// </summary> /// <param name="xDoc"></param> /// <param name="bitItemsNode"></param> /// <returns></returns> public XmlNode GetXml(XmlDocument xDoc, XmlNode bitItemsNode) { XmlNode root = XmlAdder.Element(xDoc, "BitItem", bitItemsNode); XmlAdder.Attribute(xDoc, "Name", BitName, root); XmlAdder.Attribute(xDoc, "StartOffset", StartOffset.ToString(), root); XmlAdder.Attribute(xDoc, "BitSize", BitSize.ToString(), root); XmlAdder.Attribute(xDoc, "PassCondition", PassCondition.Replace("<", "<").Replace(">", ">"), root); XmlAdder.Attribute(xDoc, "Description", Description, root); //XmlAdder.Attribute(xDoc, "Visible", Visible?"True":"False", root); XmlAdder.Attribute(xDoc, "ShowOnReport", ShowOnReport ? "True" : "False", root); return(root); }
public override bool Equals(object obj) { if (!(obj is GeneratedCodeMapping)) { return(false); } GeneratedCodeMapping other = (GeneratedCodeMapping)obj; return(CodeLength == other.CodeLength && StartColumn == other.StartColumn && StartGeneratedColumn == other.StartGeneratedColumn && StartLine == other.StartLine && // Null means it matches the other no matter what. (StartOffset == null || other.StartOffset == null || StartOffset.Equals(other.StartOffset))); }
/// <inheritdoc/> public override int GetHashCode() { unchecked { int result = base.GetHashCode(); if (MimeType != null) { result = (result * 397) ^ StringComparer.OrdinalIgnoreCase.GetHashCode(MimeType); } result = (result * 397) ^ StartOffset.GetHashCode(); result = (result * 397) ^ Extract?.GetHashCode() ?? 0; result = (result * 397) ^ Destination?.GetHashCode() ?? 0; return(result); } }
public override int GetHashCode() { int hash = 1; if (StartOffset != 0L) { hash ^= StartOffset.GetHashCode(); } if (EndOffset != 0L) { hash ^= EndOffset.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hashCode = 0; unchecked { if (CommentStart != null) { hashCode += 1000000007 * CommentStart.GetHashCode(); } if (CommentEnd != null) { hashCode += 1000000009 * CommentEnd.GetHashCode(); } hashCode += 1000000021 * StartOffset.GetHashCode(); hashCode += 1000000033 * EndOffset.GetHashCode(); } return(hashCode); }
public override int GetHashCode() { unchecked { int hash = ExtensionType.GetHashCode() ^ StartOffset.GetHashCode() ^ EndOffset.GetHashCode(); foreach (var value in PositionalArguments) { hash ^= value.GetHashCode(); } foreach (var pair in NamedArguments) { hash = hash ^ pair.Key.GetHashCode() ^ pair.Value.GetHashCode(); } return(hash); } }
internal void ValidateCollapsedLineSections() { if (!isFolded) { RemoveCollapsedLineSection(); return; } // It is possible that StartOffset/EndOffset get set to invalid values via the property setters in TextSegment, // so we coerce those values into the valid range. DocumentLine startLine = manager.document.GetLineByOffset(StartOffset.CoerceValue(0, manager.document.TextLength)); DocumentLine endLine = manager.document.GetLineByOffset(EndOffset.CoerceValue(0, manager.document.TextLength)); if (startLine == endLine) { RemoveCollapsedLineSection(); } else { if (collapsedSections == null) { collapsedSections = new CollapsedLineSection[manager.textViews.Count]; } // Validate collapsed line sections DocumentLine startLinePlusOne = startLine.NextLine; for (int i = 0; i < collapsedSections.Length; i++) { var collapsedSection = collapsedSections[i]; if (collapsedSection == null || collapsedSection.Start != startLinePlusOne || collapsedSection.End != endLine) { // recreate this collapsed section if (collapsedSection != null) { //Debug.WriteLine("CollapsedLineSection validation - recreate collapsed section from " + startLinePlusOne + " to " + endLine); collapsedSection.Uncollapse(); } collapsedSections[i] = manager.textViews[i].CollapseLines(startLinePlusOne, endLine); } } } }
public void WriteXml(XmlWriter writer) { if (Name != null) { writer.WriteAttributeString("Name", Name); } if (Author != null) { writer.WriteAttributeString("Author", Author); } if (Date != null) { writer.WriteAttributeString("Date", Date); } if (Version != null) { writer.WriteAttributeString("Version", Version); } if (Pin != PSpace.UNSHARED) { writer.WriteAttributeString("Pin", Pin.ToString()); } if (StartOffset != 0) { writer.WriteAttributeString("StartOffset", StartOffset.ToString()); } foreach (IInstruction i in Instructions) { writer.WriteStartElement("Instruction"); writer.WriteAttributeString("Operation", i.Operation.ToString()); writer.WriteAttributeString("Modifier", i.Modifier.ToString()); writer.WriteAttributeString("ModeA", ModeHelper.ToString(i.ModeA)); writer.WriteAttributeString("ValueA", i.ValueA.ToString()); writer.WriteAttributeString("ModeB", ModeHelper.ToString(i.ModeB)); writer.WriteAttributeString("ValueB", i.ValueB.ToString()); writer.WriteEndElement(); } }
public int CompareTo(object obj) { return(StartOffset.CompareTo((obj as TranscriptionOutput).StartOffset)); }
public override int GetHashCode() => RequestLength.GetHashCode() ^ PieceIndex.GetHashCode() ^ StartOffset.GetHashCode();
/// <summary> /// Writes the Subinterval's offsets to the console/ /// </summary> public override string ToString() { return(string.Format(CultureInfo.CurrentCulture, @"Subinterval Start:{0}, End:{1}", StartOffset?.ToString(CultureInfo.CurrentCulture), EndOffset?.ToString(CultureInfo.CurrentCulture))); }
public bool Equals(SampleState other) { return(SemitoneOffset == other.SemitoneOffset && StartOffset.Equals(other.StartOffset) && EndOffset.Equals(other.EndOffset)); }
/// <inheritdoc cref="object"/> public override int GetHashCode() => StartOffset.GetHashCode() * 397 ^ EndOffset.GetHashCode() * 397 ^ Count.GetHashCode() * 397;
public int CompareTo(object obj) { AudioSegment otherSegment = obj as AudioSegment; return(StartOffset.CompareTo(otherSegment.StartOffset)); }
protected bool Equals(StartOffset other) { return(Month == other.Month && Day == other.Day && Hour == other.Hour); }
private string GetConvertedAssembly() { var Path = Application.StartupPath; if (File.Exists(Path + "\\powerpc-eabi-elf-as.exe") && File.Exists(Path + "\\powerpc-eabi-elf-objcopy.exe")) { CompilerOutput = ""; var CommentStrippedText = StripComments(editor.Text); var TtextStrippedText = CheckAndGetTtextOffset(CommentStrippedText, out uint StartOffset); var TextFile = File.CreateText(Path + "\\in.txt"); TextFile.Write(TtextStrippedText); TextFile.Flush(); TextFile.Close(); RunExecutable(Path + "\\powerpc-eabi-elf-as.exe", "-mregnames -o out.o in.txt"); RunExecutable(Path + "\\powerpc-eabi-ld.exe", "-Ttext 0x" + StartOffset.ToString("X8") + " out.o"); RunExecutable(Path + "\\powerpc-eabi-elf-objcopy.exe", "-O binary out.o out.bin"); if (File.Exists(Path + "\\in.txt")) { File.Delete(Path + "\\in.txt"); } if (File.Exists(Path + "\\out.o")) { File.Delete(Path + "\\out.o"); } if (File.Exists(Path + "\\out.bin")) { try { string PPCHexAssemblyString = ""; var Data = File.ReadAllBytes(Path + "\\out.bin"); File.Delete(Path + "\\out.bin"); int[] ConvertedData = new int[Data.Length / 4]; for (int i = 0; i < ConvertedData.Length; i++) { int idx = i * 4; ConvertedData[i] = (Data[idx] << 24) | (Data[idx + 1] << 16) | (Data[idx + 2] << 8) | Data[idx + 3]; } for (int i = 0; i < ConvertedData.Length; i++) { PPCHexAssemblyString += ConvertedData[i].ToString("X8") + "\r\n"; } Debug.WriteLine(PPCHexAssemblyString); return(PPCHexAssemblyString); } catch { } } } return(CompilerOutput); }
public int CompareTo(FieldRange other) { return(StartOffset.CompareTo(other.StartOffset) != 0 ? StartOffset.CompareTo(other.StartOffset) : Length.CompareTo(other.Length)); }