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

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