示例#1
0
        public blobCollection list()
        {
            blobCollection fileSet = new blobCollection();
            List<CloudBlockBlob> tempBlobList = new List<CloudBlockBlob>();
            List<string> tempBlobNames = new List<string>();
            try
            {
                string blobPrefix = null;
                bool useFlatBlobListing = true;
                var blobs = container.ListBlobs(blobPrefix, useFlatBlobListing, BlobListingDetails.None);
                foreach (IListBlobItem item in blobs)
                {
                    if (item.GetType() == typeof(CloudBlockBlob))
                    {
                        CloudBlockBlob file = (CloudBlockBlob)item;

                        tempBlobList.Add(file);
                        tempBlobNames.Add(file.Name);
                        fileSet.blobList = tempBlobList;
                        fileSet.blobNames = tempBlobNames;
                    }
                }
            }
            catch (Exception e)
            {
                Program.ClientForm.addtoConsole(e.ToString());
                System.Windows.Forms.MessageBox.Show(e.ToString());
            }

            return fileSet;
        }
示例#2
0
文件: Form2.cs 项目: hangmiao/DBLike
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int i = listBox1.SelectedIndex;

            blobscollect2 = new blobCollection();
            blobscollect2 = VC.listSnapshot(blobscollect.blobList[i]);
            listBox2.DataSource = blobscollect2.snapShotNames;
            blobscollect.snapShotList = blobscollect2.snapShotList;
            blobscollect.snapShotNames = blobscollect2.snapShotNames;
        }
示例#3
0
文件: Form2.cs 项目: hangmiao/DBLike
        public Form2()
        {
            Program.ClientForm.addtoConsole("Initializing Form2");
            InitializeComponent();
            //Configuration.userInfo.containerURI = "null";
            VCThread vcThread = new VCThread();
            Thread thread = new Thread(() => vcThread.start());
            //thread.Start();
            Program.ClientForm.addtoConsole("vcThread Started");
            //thread.Join();

            VC = new VCmanager(Configuration.userInfo.containerURI);
            blobscollect = VC.list();
            listBox1.DataSource = blobscollect.blobNames;
        }
示例#4
0
        public blobCollection listSnapshot(CloudBlockBlob blobRef)
        {
            blobCollection blobset = new blobCollection();
            List<CloudBlockBlob> tempSnapshots = new List<CloudBlockBlob>();
            List<string> tempSnamshotsName = new List<string>();

            try
            {
                string blobPrefix = null;
                bool useFlatBlobListing = true;

                var snapshots = container.ListBlobs(blobPrefix, useFlatBlobListing,
                BlobListingDetails.Snapshots).Where(item => ((CloudBlockBlob)item).SnapshotTime.HasValue && item.Uri.Equals(blobRef.Uri)).ToList<IListBlobItem>();

                if (snapshots.Count < 1)
                {
                    Console.WriteLine("snapshot was not created");
                }
                else
                {
                    int j = 0;
                    foreach (IListBlobItem item in snapshots)
                    {
                        CloudBlockBlob blob = (CloudBlockBlob)item;
                        blob.FetchAttributes();
                        string name = "V" + j+" , "+blob.Metadata["timestamp"];
                        tempSnapshots.Add(blob);
                        tempSnamshotsName.Add(name);
                        blobset.snapShotList = tempSnapshots;
                        blobset.snapShotNames = tempSnamshotsName;
                        j++;
                    }
                    //snapshots.ForEach(item => Console.WriteLine(String.Format("{0} {1} ", ((CloudBlockBlob)item).Name, ((CloudBlockBlob)item).Metadata["timestamp"])));
                }
            }
            catch (Exception e)
            {
                Program.ClientForm.addtoConsole(e.ToString());
                System.Windows.Forms.MessageBox.Show(e.ToString());

            }

            return blobset;
        }
示例#5
0
文件: Form2.cs 项目: hangmiao/DBLike
 private void Refreshbtn_Click(object sender, EventArgs e)
 {
     blobscollect = VC.list();
        listBox1.DataSource = blobscollect.blobNames;
 }