예제 #1
0
 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));
 }
예제 #2
0
 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));
 }
예제 #3
0
 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));
 }
예제 #4
0
 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));
 }
예제 #5
0
 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));
 }
예제 #6
0
 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));
 }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
        }
예제 #13
0
        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.");
                }
            }
        }
예제 #14
0
 public PaddingSource(long size)
 {
     this.Size     = size;
     this.m_status = new SourceStatus();
     this.m_status.AvailableRangeList.MergingAdd(new Range(0L, this.Size));
 }