public Sha256StreamHashSource(ISource source) { this.Size = 32L; this.m_source = source; this.m_hashCalculator = new SHA256CryptoServiceProvider(); this.m_status = new SourceStatus(); this.m_status.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); }
public StreamSource(Stream stream, long offset, long size) { this.m_stream = stream; this.m_offset = offset; this.Size = size; this.m_status = new SourceStatus(); this.m_status.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); }
public FileSource(string filePath, long offset, long size) { this.m_filePath = filePath; this.m_offset = offset; this.Size = size; this.m_status = new SourceStatus(); this.m_status.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); }
public FileSystemArchvieFileSource(IFileSystemArchiveReader reader, string fileName) { this.m_Reader = reader; this.m_FileName = fileName; this.Size = this.m_Reader.GetFileSize(this.m_FileName); this.m_status = new SourceStatus(); this.m_status.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); }
public UpdatableMemorySource(byte[] buffer, int offset, int size) { this.m_buffer = buffer; this.m_offset = offset; this.Size = (long)size; this.m_status = new SourceStatus(); this.m_status.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); }
public MemorySource(byte[] buffer, int offset, int size) { this.m_buffer = new byte[buffer.Length]; Buffer.BlockCopy((Array)buffer, 0, (Array)this.m_buffer, 0, this.m_buffer.Length); this.m_offset = offset; this.Size = (long)size; this.m_status = new SourceStatus(); this.m_status.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); }
public SourceStatus QueryStatus() { SourceStatus sourceStatus = new SourceStatus(); if (this.m_sink.QueryStatus().IsFilled) { sourceStatus.AvailableRangeList.MergingAdd(new Range(0L, this.m_source.Size)); } return(sourceStatus); }
public SourceStatus QueryStatus() { SourceStatus sourceStatus = new SourceStatus(); foreach (ConcatenatedSource.Element element in this.Elements) { foreach (Range availableRange in (List <Range>)element.Source.QueryStatus().AvailableRangeList) { sourceStatus.AvailableRangeList.MergingAdd(new Range(availableRange.Offset + element.Offset, availableRange.Size)); } } return(sourceStatus); }
public SourceStatus QueryStatus() { RangeList availableRangeList = this.m_rootPartitionFsHeaderHashSource.QueryStatus().AvailableRangeList; if (availableRangeList.Count == 0 || availableRangeList[0].Size != this.m_rootPartitionFsHeaderHashSource.Size) { return(new SourceStatus()); } SourceStatus sourceStatus = new SourceStatus(); sourceStatus.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); return(sourceStatus); }
public SourceStatus QueryStatus() { SourceStatus sourceStatus = new SourceStatus(); RangeList availableRangeList = this.m_source.QueryStatus().AvailableRangeList; RangeList rangeList1 = new RangeList(); rangeList1.Add(new Range(0L, this.m_offset)); rangeList1.Add(new Range(this.m_offset + this.Size, this.m_source.Size - (this.m_offset + this.Size))); RangeList rangeList2 = rangeList1; foreach (Range duplicatedDeleted in (List <Range>)availableRangeList.GetDuplicatedDeletedList(rangeList2)) { sourceStatus.AvailableRangeList.MergingAdd(new Range(duplicatedDeleted.Offset - this.m_offset, duplicatedDeleted.Size)); } return(sourceStatus); }
public SourceStatus QueryStatus() { SourceStatus sourceStatus = new SourceStatus(); foreach (ContentHashSource hashSource in this.m_hashSources) { if (hashSource.Source != null) { RangeList availableRangeList = hashSource.Source.QueryStatus().AvailableRangeList; if (availableRangeList.Count != 1 || availableRangeList.Count == 1 && availableRangeList[0].Size != hashSource.Source.Size) { return(sourceStatus); } } } sourceStatus.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); return(sourceStatus); }
public SourceStatus QueryStatus() { foreach (ISource source in new List <ISource>() { this.m_contentMetaBase.GetSource(), this.m_MetaHashSource }) { RangeList availableRangeList = source.QueryStatus().AvailableRangeList; if (availableRangeList.Count == 0 || availableRangeList[0].Size != source.Size) { return(new SourceStatus()); } } SourceStatus sourceStatus = new SourceStatus(); sourceStatus.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); return(sourceStatus); }
public void Run() { SourceStatus sourceStatus = new SourceStatus(); bool flag1 = false; while (!flag1) { bool flag2 = false; foreach (Connection connection in this.m_connectionList) { foreach (Range duplicatedDeleted in (List <Range>)connection.Source.QueryStatus().AvailableRangeList.GetDuplicatedDeletedList(connection.Sink.QueryStatus().FilledRangeList)) { long num1 = 0; int length = 8388608; byte[] array1 = new byte[length]; long num2 = 0; while (num1 < duplicatedDeleted.Size) { int size = (int)Math.Min(duplicatedDeleted.Size - num1 - num2, (long)length); ByteData data1 = connection.Source.PullData(duplicatedDeleted.Offset + num1 + num2, size); ArraySegment <byte> buffer; if (num2 + (long)data1.Buffer.Count <= (long)length) { buffer = data1.Buffer; if (buffer.Count != 0 || num2 == 0L) { goto label_9; } } num1 += (long)connection.Sink.PushData(new ByteData(new ArraySegment <byte>(array1, 0, (int)num2)), duplicatedDeleted.Offset + num1); num2 = 0L; buffer = data1.Buffer; if (buffer.Count == 0) { continue; } label_9: buffer = data1.Buffer; if (buffer.Count == size) { if (0L < num2) { buffer = data1.Buffer; byte[] array2 = buffer.Array; int srcOffset = 0; byte[] numArray = array1; int dstOffset = (int)num2; buffer = data1.Buffer; int count1 = buffer.Count; Buffer.BlockCopy((Array)array2, srcOffset, (Array)numArray, dstOffset, count1); long num3 = num1; ISink sink = connection.Sink; byte[] array3 = array1; int offset1 = 0; int num4 = (int)num2; buffer = data1.Buffer; int count2 = buffer.Count; int count3 = num4 + count2; ByteData data2 = new ByteData(new ArraySegment <byte>(array3, offset1, count3)); long offset2 = duplicatedDeleted.Offset + num1; long num5 = (long)sink.PushData(data2, offset2); num1 = num3 + num5; num2 = 0L; } else { num1 += (long)connection.Sink.PushData(data1, duplicatedDeleted.Offset + num1); } } else { buffer = data1.Buffer; byte[] array2 = buffer.Array; int srcOffset = 0; byte[] numArray = array1; int dstOffset = (int)num2; buffer = data1.Buffer; int count1 = buffer.Count; Buffer.BlockCopy((Array)array2, srcOffset, (Array)numArray, dstOffset, count1); long num3 = num2; buffer = data1.Buffer; long count2 = (long)buffer.Count; num2 = num3 + count2; } } if (num1 > 0L) { flag2 = true; } } } flag1 = true; foreach (Connection connection in this.m_connectionList) { if (!connection.Sink.QueryStatus().IsFilled) { flag1 = false; break; } } if (!flag1 && !flag2) { throw new ApplicationException("Failed to resolve dependencies for archiving. Please contact to NintendoSDK support."); } } }
public PaddingSource(long size) { this.Size = size; this.m_status = new SourceStatus(); this.m_status.AvailableRangeList.MergingAdd(new Range(0L, this.Size)); }