Exemplo n.º 1
0
        static void Main(string[] args)
        {
            string accountId      = Console.ReadLine();
            string applicationKey = Console.ReadLine();
            // This is all just testing code, it doesn't really matter what happens here
            B2SDK    sdk       = new B2SDK(accountId, applicationKey);
            B2Bucket newBucket = sdk.b2_create_bucket("ThisIsAnAwesomeBucket", "allPrivate");

            Console.WriteLine(newBucket.accountId + newBucket.bucketId + newBucket.bucketName + newBucket.bucketType);

            B2Bucket deletedBucket = sdk.b2_delete_bucket(newBucket.bucketId);

            if (deletedBucket.bucketId == newBucket.bucketId)
            {
                Console.WriteLine("Delete Successful");
            }

            // fun test code that will delete all files in our buckets!!
            List <B2Bucket> buckets = sdk.b2_list_buckets();

            foreach (B2Bucket bucket in buckets)
            {
                foreach (B2File file in sdk.b2_list_file_versions(bucket.bucketId, "").files)
                {
                    sdk.b2_delete_file_version(file.fileName, file.fileId);
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string accountId = Console.ReadLine();
            string applicationKey = Console.ReadLine();
            // This is all just testing code, it doesn't really matter what happens here
            B2SDK sdk = new B2SDK(accountId, applicationKey);
            B2Bucket newBucket = sdk.b2_create_bucket("ThisIsAnAwesomeBucket", "allPrivate");
            Console.WriteLine(newBucket.accountId + newBucket.bucketId + newBucket.bucketName + newBucket.bucketType);

            B2Bucket deletedBucket = sdk.b2_delete_bucket(newBucket.bucketId);
            if (deletedBucket.bucketId == newBucket.bucketId)
            {
                Console.WriteLine("Delete Successful");
            }

            // fun test code that will delete all files in our buckets!!
            List<B2Bucket> buckets = sdk.b2_list_buckets();

            foreach(B2Bucket bucket in buckets)
            {
                foreach(B2File file in sdk.b2_list_file_versions(bucket.bucketId, "").files)
                {
                    sdk.b2_delete_file_version(file.fileName, file.fileId);
                }
            }
        }
Exemplo n.º 3
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     B2SDK sdk = new B2SDK(b2AccountId.Text, b2ApplicationKey.Text);
     Form2 realDataForm = new Form2(sdk);
     realDataForm.Closed += (s, args) => this.Close();
     realDataForm.Show();
     this.Hide();
 }
Exemplo n.º 4
0
        public Form2(B2SDK sdk)
        {
            InitializeComponent();
            authorizedSDK = sdk;
            SqlQuery dbConnection = new SqlQuery(dbName);
            if (System.IO.File.Exists(dbName))
            {
                string bucketName = dbConnection.getPrefferedBucketName();
                txtBucketName.Text = bucketName;

                string directoryName = dbConnection.getDirectoryName();
                txtFolderToSync.Text = directoryName;
            }
        }