Пример #1
0
        public void Delete(InSysContainer cntr, string str)
        {
            var gf = Path.Combine(RootPath, cntr.Name, str);

            if (File.Exists(gf))
            {
                File.Delete(gf);
            }
        }
Пример #2
0
        public void DownloadToStream(InSysContainer cntr, string name, Stream target)
        {
            var gf = Path.Combine(RootPath, cntr.Name, name);

            using (var fs = File.OpenRead(gf))
            {
                fs.CopyTo(target);
            }
        }
Пример #3
0
        public InSysDirectory(InSysContainer inSysContainer, string filename)
        {
            this.inSysContainer = inSysContainer;
            this.Name           = filename;

            if (this.inSysContainer.Container != null)
            {
                this.Directory = this.inSysContainer.Container.GetDirectoryReference(this.Name);
            }
        }
Пример #4
0
 public IEnumerable <InSysBlob> ListBlob(InSysContainer Cntr)
 {
     if (IsCloud)
     {
         return(AzureStorage.ListBlob(Cntr.Container).Where(x => x is CloudBlockBlob).Select(x => new InSysBlob(x as CloudBlockBlob)));
     }
     else
     {
         return(InSysStorage.ListBlob(Cntr));
     }
 }
Пример #5
0
 public InSysContainer Container(string Name)
 {
     if (IsCloud)
     {
         return(InSysContainer.Create(AzureStorage.Container(Name)));
     }
     else
     {
         return(InSysContainer.Create(Name));
     }
 }
Пример #6
0
 public void DownloadToFile(InSysContainer cntr, string filename, string fg)
 {
     if (IsCloud)
     {
         AzureStorage.DownloadToFile(cntr.Container, filename, fg);
     }
     else
     {
         InSysStorage.DownloadToFile(cntr, filename, fg);
     }
 }
Пример #7
0
 public void Upload(InSysContainer cntr, string filename, string base64)
 {
     if (IsCloud)
     {
         AzureStorage.Upload(cntr.Container, filename, base64);
     }
     else
     {
         InSysStorage.Upload(cntr, filename, base64);
     }
 }
Пример #8
0
 public void Upload(InSysContainer cntr, string filename, Stream fp)
 {
     if (IsCloud)
     {
         AzureStorage.Upload(cntr.Container, filename, fp);
     }
     else
     {
         InSysStorage.Upload(cntr, filename, fp);
     }
 }
Пример #9
0
 public void Delete(InSysContainer cntr, string str)
 {
     if (IsCloud)
     {
         AzureStorage.Delete(cntr.Container, str);
     }
     else
     {
         InSysStorage.Delete(cntr, str);
     }
 }
Пример #10
0
 public void DownloadToStream(InSysContainer Cntr, string Name, Stream Target)
 {
     if (IsCloud)
     {
         AzureStorage.DownloadToStream(Cntr.Container, Name, Target);
     }
     else
     {
         InSysStorage.DownloadToStream(Cntr, Name, Target);
     }
 }
Пример #11
0
        public void Upload(InSysContainer cntr, string filename, Stream fp)
        {
            var gf = Path.Combine(RootPath, cntr.Name, filename).CheckDir().DeleteFileIfExists();

            using (var fs = File.OpenWrite(gf))
            {
                fp.Seek(0, SeekOrigin.Begin);
                fp.CopyTo(fs);
                fs.Flush();
            }
        }
Пример #12
0
 public string DownloadString(InSysContainer Cntr, string str)
 {
     if (IsCloud)
     {
         return(AzureStorage.DownloadString(Cntr.Container, str));
     }
     else
     {
         return(InSysStorage.DownloadString(Cntr, str));
     }
 }
Пример #13
0
        public string DownloadString(InSysContainer cntr, string str)
        {
            var gf = Path.Combine(RootPath, cntr.Name, str);

            using (var fs = File.OpenRead(gf))
            {
                using (var ms = new MemoryStream())
                {
                    fs.CopyTo(ms);
                    return(Encoding.ASCII.GetString(ms.ToArray()));
                }
            }
        }
Пример #14
0
 public void Upload(InSysContainer cntr, string filename, string base64)
 {
     using (MemoryStream ms = new MemoryStream(ASCIIEncoding.Default.GetBytes(base64)))
     {
         var gg = Path.Combine(RootPath, cntr.Name, filename).CheckDir().DeleteFileIfExists();
         using (var fs = File.OpenWrite(gg))
         {
             ms.Seek(0, SeekOrigin.Begin);
             ms.CopyTo(fs);
             fs.Flush();
         }
     }
 }
Пример #15
0
        public void DownloadToFile(InSysContainer cntr, string filename, string fg)
        {
            var gf = Path.Combine(RootPath, cntr.Name, filename);

            using (var fs = File.OpenRead(gf))
            {
                using (var fd = File.OpenWrite(fg))
                {
                    fs.Seek(0, SeekOrigin.Begin);
                    fs.CopyTo(fd);
                    fd.Flush();
                }
            }
        }
Пример #16
0
 public IEnumerable <T> ListBlob <T>(InSysContainer cntr)
 {
     if (typeof(T) == typeof(InSysBlob))
     {
         return(Directory.GetFiles(Path.Combine(RootPath, cntr.Name)).Select(x => new InSysBlob(cntr, Path.GetFileName(x))).Cast <T>());
     }
     else if (typeof(T) == typeof(InSysDirectory))
     {
         return(Directory.GetDirectories(Path.Combine(RootPath, cntr.Name)).Select(x => new InSysDirectory(cntr, Path.GetDirectoryName(x))).Cast <T>());
     }
     else
     {
         return(null);
     }
 }
Пример #17
0
 public InSysBlob(InSysContainer Cntr, string Name)
 {
     this.Cntr = Cntr;
     this.Name = Name;
 }
Пример #18
0
 public InSysBlob(InSysDirectory dr, string v)
 {
     //this.dr = dr;
     this.Cntr = dr.inSysContainer;
     this.Name = Path.Combine(dr.Name, v);
 }
Пример #19
0
        public IEnumerable <InSysBlob> ListBlob(InSysContainer cntr)
        {
            var gh = Path.Combine(RootPath, cntr.Name);

            return(Directory.GetFiles(gh).Select(x => new InSysBlob(cntr, Path.GetFileName(x))));
        }