Esempio n. 1
0
    public FileContainerOptions(IRandomAccess <byte> physicalFile, FileContainerFlags flags, PathParser pathParser)
    {
        if (flags == FileContainerFlags.None)
        {
            throw new ArgumentOutOfRangeException(nameof(flags));
        }

        this.PhysicalFile = physicalFile;
        this.Flags        = flags;
        this.PathParser   = pathParser;
    }
Esempio n. 2
0
        public FileImpl(VfsRandomAccessFile file, IRandomAccess <byte> randomAccessBase, string fullPath, FileSystem fileSystem, FileParameters fileParams)
            : base(new ConcurrentRandomAccess <byte>(randomAccessBase), fileSystem, fileParams)
        {
            this.File = file;
            this.File.AddHandleRef();

            try
            {
                this.FullPath = fullPath;
            }
            catch
            {
                this.File.ReleaseHandleRef();
                throw;
            }
        }
Esempio n. 3
0
 protected GitFileObject(GitFileSystem fileSystem, FileParameters fileParams, IRandomAccess <byte> baseRandomAccess) : base(fileSystem, fileParams, baseRandomAccess)
 {
 }
 public ZipContainerOptions(IRandomAccess <byte> physicalFile, FileContainerFlags flags = FileContainerFlags.CreateNewSequential, PathParser?pathParser = null)
     : base(physicalFile, flags, pathParser ?? PathParser.Mac)
 {
 }
Esempio n. 5
0
        // メタデータ読み取りとパース試行
        public static async Task <ResultOrExeption <XtsAesRandomAccessMetaData> > TryReadMetaDataAsync(IRandomAccess <byte> physical, CancellationToken cancel = default)
        {
            Memory <byte> firseSectorData = new byte[XtsAesMetaDataSize];

            // ヘッダの読み込みを試行する
            int readSize = await physical.ReadRandomAsync(0, firseSectorData, cancel);

            if (readSize == XtsAesMetaDataSize)
            {
                return(TryParseMetaData(firseSectorData));
            }
            else if (readSize == 0)
            {
                throw new CoresException("The file contents is empty.");
            }
            else
            {
                throw new CoresException("readSize != XtsAesMetaDataSize");
            }
        }
Esempio n. 6
0
 public XtsAesRandomAccess(IRandomAccess <byte> physical, string password, bool disposeObject = false, int metaDataFlushInterval = 0)
     : base(physical, XtsAesSectorSize, XtsAesMetaDataSize, disposeObject, metaDataFlushInterval)
 {
     this.CurrentPassword = password;
 }
Esempio n. 7
0
 /// <summary>
 /// Overload of <see cref="IsIndexAndCountInRange{T,TSeq}"/> for type inference.
 /// </summary>
 public static Validation IsIndexAndCountInRange <T>(this Validation validation, IRandomAccess <T> seq, int index, int count, string indexParamName, string countParamName)
 {
     return(validation.IsIndexAndCountInRange <T, IRandomAccess <T> >(seq, index, count, indexParamName, countParamName));
 }
Esempio n. 8
0
 /// <summary>
 /// Overload of <see cref="IsIndexInRange{T,TSeq}"/> for type inference.
 /// </summary>
 public static Validation IsIndexInRange <T>(this Validation validation, IRandomAccess <T> seq, int index, string paramName)
 {
     return(validation.IsIndexInRange <T, IRandomAccess <T> >(seq, index, paramName));
 }