コード例 #1
0
ファイル: Program.cs プロジェクト: darocha/B2-CSharp-SDK
        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);
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: bsankara/B2-CSharp-SDK
        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);
                }
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: bsankara/FileSync
 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();
 }
コード例 #4
0
ファイル: Form2.cs プロジェクト: bsankara/FileSync
        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;
            }
        }