예제 #1
0
        public static void Save([NotNull] this IBlobFile source, [NotNull] string filepath)
        {
            source.ThrowIfNull(nameof(source));
            Requires.NotNullOrEmpty(filepath, nameof(filepath));

            using var stream = new FileStream(filepath, FileMode.Create, FileAccess.Write);
            source.Save(stream);
        }
예제 #2
0
        public static void Load([NotNull] this IBlobFile source, [NotNull] string filepath)
        {
            source.ThrowIfNull(nameof(source));
            Requires.FileExists(filepath, nameof(filepath));

            using var stream = new FileStream(filepath, FileMode.Open, FileAccess.Read);
            source.Load(stream);
        }
예제 #3
0
 public BlobController(IBlobFile blobFile)
 {
     _blobFile = blobFile;
 }
예제 #4
0
        public static byte[] GetOffsetBytes([NotNull] this IBlobFile source, int offset, int length = 1)
        {
            source.ThrowIfNull(nameof(source));
            Requires.LessThanOrEqual(offset + length, source.Buffer.Length, nameof(offset));

            return(source.Buffer[offset..(offset + length)]);
예제 #5
0
 public static byte GetOffsetByte([NotNull] this IBlobFile source, int offset)
 {
     source.ThrowIfNull(nameof(source));
     return(source.GetOffsetBytes(offset, 1)[0]);
 }