示例#1
0
 public FormLogin()
 {
     InitializeComponent();
     this.copyOps = new CopyOps();
     gHook        = new GlobalKeyboardHook();
     this.SetUpKeyboardHook(gHook);
     this.pasteOps = new PasteOps();
 }
示例#2
0
        private async Task makeHeader(WorkItemMessage message)
        {
            await cloudContainer.CreateIfNotExistsAsync();

            SharedAccessBlobPermissions permissions = SharedAccessBlobPermissions.Read;

            TimeSpan clockSkew      = TimeSpan.FromMinutes(15d);
            TimeSpan accessDuration = TimeSpan.FromMinutes(15d);

            string serializedMessage = JsonConvert.SerializeObject(message);

            Console.WriteLine(serializedMessage);

            foreach (string filePath in message.content)
            {
                string key = Path.GetFileName(filePath);
                CopyOps.uploadBlob(cloudContainer, key, filePath, true);
            }

            var blobSAS = new SharedAccessBlobPolicy
            {
                SharedAccessStartTime  = DateTime.UtcNow.Subtract(clockSkew),
                SharedAccessExpiryTime = DateTime.UtcNow.Add(accessDuration) + clockSkew,
                Permissions            = permissions
            };

            foreach (string filePath in message.content)
            {
                string key = Path.GetFileName(filePath);

                var blobRef      = cloudContainer.GetBlockBlobReference(key);
                var sasBlobToken = blobRef.GetSharedAccessSignature(blobSAS);

                var blobUri  = blobRef.Uri.AbsoluteUri;
                var queueUrl = blobUri + sasBlobToken;
            }

            var blobRef2  = cloudContainer.GetBlockBlobReference("Shanthi Insurance Policy.pdf");
            var blockBlob = cloudContainer.GetBlockBlobReference("Shanthi Insurance Policy.pdf");

            var downloadsPathOnServer = Path.Combine("C:\\SEM 2", "Shanthi Insurance Policy.pdf");

            using (var fileStream = File.OpenWrite(downloadsPathOnServer))
            {
                await blockBlob.DownloadToStreamAsync(fileStream);
            }

            var test = cloudContainer.ListBlobs("Shanthi Insurance Policy.pdf");

            foreach (var item in test)
            {
                Console.WriteLine(item);
            }
        }