Exemple #1
0
        public void Delete(InSysContainer cntr, string str)
        {
            var gf = Path.Combine(RootPath, cntr.Name, str);

            if (File.Exists(gf))
            {
                File.Delete(gf);
            }
        }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
Exemple #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));
     }
 }
Exemple #5
0
 public InSysContainer Container(string Name)
 {
     if (IsCloud)
     {
         return(InSysContainer.Create(AzureStorage.Container(Name)));
     }
     else
     {
         return(InSysContainer.Create(Name));
     }
 }
Exemple #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);
     }
 }
Exemple #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);
     }
 }
Exemple #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);
     }
 }
Exemple #9
0
 public void Delete(InSysContainer cntr, string str)
 {
     if (IsCloud)
     {
         AzureStorage.Delete(cntr.Container, str);
     }
     else
     {
         InSysStorage.Delete(cntr, str);
     }
 }
Exemple #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);
     }
 }
Exemple #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();
            }
        }
Exemple #12
0
 public string DownloadString(InSysContainer Cntr, string str)
 {
     if (IsCloud)
     {
         return(AzureStorage.DownloadString(Cntr.Container, str));
     }
     else
     {
         return(InSysStorage.DownloadString(Cntr, str));
     }
 }
Exemple #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()));
                }
            }
        }
Exemple #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();
         }
     }
 }
Exemple #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();
                }
            }
        }
Exemple #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);
     }
 }
Exemple #17
0
 public InSysBlob(InSysContainer Cntr, string Name)
 {
     this.Cntr = Cntr;
     this.Name = Name;
 }
Exemple #18
0
 public InSysBlob(InSysDirectory dr, string v)
 {
     //this.dr = dr;
     this.Cntr = dr.inSysContainer;
     this.Name = Path.Combine(dr.Name, v);
 }
Exemple #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))));
        }