Example #1
0
        public static void WriteFile(string fullPath, string output, Boolean append)
        {
            ShareFileClient file = new ShareFileClient(CONNECTIONSTRING, SHARENAME, fullPath);

            string original = "";

            if (!append && file.Exists())
            {
                file.Delete();
            }
            if (append)
            {
                if (file.Exists())
                {
                    ShareFileDownloadInfo download = file.Download();
                    original = GetStreamContents(download.Content) + "\n";
                }
            }

            using (Stream outStream = GenerateStreamFromString(original + output)) {
//                if (!file.Exists())
                file.Create(outStream.Length);
                file.UploadRange(new HttpRange(0, outStream.Length), outStream);
            }
        }
Example #2
0
        public static void CopyToAzureFileShare(string localPath, string azurePath)
        {
            ShareFileClient newFile = new ShareFileClient(CONNECTIONSTRING, SHARENAME, azurePath);

            if (newFile.Exists())
            {
                newFile.Delete();
            }
            using (FileStream stream = File.OpenRead(localPath)) {
                newFile.Create(stream.Length);
                if (stream.Length > 0)
                {
                    newFile.UploadRange(new HttpRange(0, stream.Length), stream);
                }
            }
        }
Example #3
0
        public static void DeleteFile(string fullPath)
        {
            ShareFileClient share = new ShareFileClient(CONNECTIONSTRING, SHARENAME, fullPath);

            share.Delete();
        }