Beispiel #1
0
        public string Upload(string file)
        {
            OAuthToken oauthAccessToken = LoadOAuthToken();

            // Login in Dropbox
            IDropbox dropbox = dropboxServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);

            // Display user name (from his profile)
            DropboxProfile profile = dropbox.GetUserProfileAsync().Result;

            // Create new folder
            string newFolderName     = "New_Folder_" + DateTime.Now.Ticks;
            Entry  createFolderEntry = dropbox.CreateFolderAsync(newFolderName).Result;

            var    splitetFileDirectory = file.Split(new char[] { '/', '\\' });
            string fileName             = splitetFileDirectory[splitetFileDirectory.Length - 1];

            // Upload a file
            Entry uploadFileEntry = dropbox.UploadFileAsync(
                new FileResource(file),                 //("../../DropboxExample.cs"),
                "/" + newFolderName + fileName).Result; //"/DropboxExample.cs").Result;

            // Share a file
            DropboxLink sharedUrl = dropbox.GetShareableLinkAsync(uploadFileEntry.Path).Result;

            //Open the file location
            return(sharedUrl.Url.ToString());
        }
        public static void Main(string[] args)
        {
            // Pleace fill the DropboxAppKey and DropboxAppSecret with your credentionals before you test the app.
            DropboxServiceProvider dropboxServiceProvider =
                new DropboxServiceProvider(DropboxAppKey, DropboxAppSecret, AccessLevel.AppFolder);

            var oauthAccessToken = AuthorizeAppOAuth(dropboxServiceProvider);

            IDropbox dropbox = dropboxServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);

            DropboxProfile profile = dropbox.GetUserProfileAsync().Result;

            Console.WriteLine("Hi " + profile.DisplayName + "!");

            string newFolderName     = "Your_New_Images_Folder";
            Entry  createFolderEntry = dropbox.CreateFolderAsync(newFolderName).Result;

            var imageAsFileResource = new FileResource("../../Images/image1.jpg");
            var pathToUpload        = "/" + newFolderName + "/image1.jpg";

            Entry uploadFileEntry = dropbox.UploadFileAsync(imageAsFileResource, pathToUpload).Result;

            Console.WriteLine("Uploaded a file: {0}", uploadFileEntry.Path);

            DropboxLink sharedUrl = dropbox.GetShareableLinkAsync(uploadFileEntry.Path).Result;

            Process.Start(sharedUrl.Url);
        }
    public string UploadFile()
    {
        DropboxServiceProvider dropboxServiceProvider =
            new DropboxServiceProvider(DropboxAppKey, DropboxAppSecret, AccessLevel.AppFolder);

        // Authenticate the application (if not authenticated) and load the OAuth token
        //if (!File.Exists(OAuthTokenFileName))
        //{
        //    AuthorizeAppOAuth(dropboxServiceProvider);
        //}
        OAuthToken oauthAccessToken = new OAuthToken("fvjpvp0isfjsgyd7", "2u9zc9h1r0say01");

        // Login in Dropbox
        IDropbox dropbox = dropboxServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);

        // Display user name (from his profile)
        DropboxProfile profile = dropbox.GetUserProfileAsync().Result;

        Console.WriteLine("Hi " + profile.DisplayName + "!");

        // Create new folder
        string newFolderName = "RecipeImages";

        Directory.CreateDirectory("../../DropboxLisa");
        using (FileStream output = File.OpenWrite("../../DropboxLisa/" + DateTime.Now.Ticks + this.fileName))
        {
            CopyStream(imageStream, output);
        }

        // Upload a file
        string[]     files         = Directory.GetFiles("../../DropboxLisa");
        List <Entry> uploadedFiles = new List <Entry>();

        foreach (var file in files)
        {
            Entry uploadFileEntry = dropbox.UploadFileAsync(
                new FileResource(Path.GetFullPath(file)),
                "/" + newFolderName + "/" + Path.GetFileName(file)).Result;
            uploadedFiles.Add(uploadFileEntry);
            Console.WriteLine("Uploaded a file: {0}", uploadFileEntry.Path);
        }

        //Delete the file
        DeleteDirectory("\\DropboxLisa");


        string fileUrl = string.Empty;

        foreach (var file in uploadedFiles)
        {
            DropboxLink fileShareUrl = dropbox.GetMediaLinkAsync(file.Path).Result; // files
            fileUrl = fileShareUrl.Url;
        }

        return(fileUrl);
    }
Beispiel #4
0
        public DropboxService()
        {
            DropboxServiceProvider dropboxServiceProvider =
                new DropboxServiceProvider(DropboxAppKey, DropboxAppSecret, AccessLevel.AppFolder);

            IDropbox dropbox = dropboxServiceProvider.GetApi(appToken, appTokenSecret);

            DropboxProfile profile = dropbox.GetUserProfileAsync().Result;

            this.currentDropbox = dropbox;
        }
        public void ShowProfile()
        {
            IDropbox dropboxClient = this.DropboxServiceProvider.GetApi(this.OAuthToken.Value, this.OAuthToken.Secret);

            dropboxClient.GetUserProfileAsync(
                r =>
            {
                if (r.Error == null)
                {
                    this.Profile = r.Response;
                }
            });
        }
        // GET: /Dropbox/Callback
        public ActionResult Callback()
        {
            OAuthToken             requestToken           = Session["RequestToken"] as OAuthToken;
            AuthorizedRequestToken authorizedRequestToken = new AuthorizedRequestToken(requestToken, null);
            OAuthToken             token = dropboxProvider.OAuthOperations.ExchangeForAccessTokenAsync(authorizedRequestToken, null).Result;

            Session["TokenValue"]  = token.Value;
            Session["TokenSecret"] = token.Secret;

            IDropbox       dropboxClient = dropboxProvider.GetApi(token.Value, token.Secret);
            DropboxProfile profile       = dropboxClient.GetUserProfileAsync().Result;

            return(View(profile));
        }
Beispiel #7
0
        static void Main()
        {
            DropboxServiceProvider dropboxServiceProvider =
                new DropboxServiceProvider(DropboxAppKey, DropboxAppSecret, AccessLevel.AppFolder);

            // Authenticate the application (if not authenticated) and load the OAuth token
            if (!File.Exists(OAuthTokenFileName))
            {
                AuthorizeAppOAuth(dropboxServiceProvider);
            }
            OAuthToken oauthAccessToken = LoadOAuthToken();

            // Login in Dropbox
            IDropbox dropbox = dropboxServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);

            // Display user name (from his profile)
            DropboxProfile profile = dropbox.GetUserProfileAsync().Result;

            Console.WriteLine("Hi " + profile.DisplayName + "!");

            // Create new folder
            string    newFolderName = "BatmanAlbum";
            DeltaPage deltaPage     = dropbox.DeltaAsync(null).Result;
            var       isFolderExist = deltaPage.Entries.Any(x => x.Path == ("/" + newFolderName).ToLower());

            if (!isFolderExist)
            {
                Entry createFolderEntry = dropbox.CreateFolderAsync(newFolderName).Result;
                Console.WriteLine("Created folder: {0}", createFolderEntry.Path);
            }

            var           folderPath     = @"../../Pics";
            DirectoryInfo picturesFolder = new DirectoryInfo(folderPath);

            foreach (var fileName in picturesFolder.GetFiles("*.jpg"))
            {
                // Upload a file
                Entry uploadFileEntry = dropbox.UploadFileAsync(
                    new FileResource(fileName.FullName),
                    "/" + newFolderName + "/" + fileName.Name).Result;
                Console.WriteLine("Uploaded a file: {0}", uploadFileEntry.Path);

                // Share a file
                DropboxLink sharedUrl = dropbox.GetShareableLinkAsync(uploadFileEntry.Path).Result;
                Process.Start(sharedUrl.Url);
            }
        }
Beispiel #8
0
        static void Main()
        {
            DropboxServiceProvider dropboxServiceProvider =
                new DropboxServiceProvider(DropboxAppKey, DropboxAppSecret, AccessLevel.AppFolder);

            // Authenticate the application (if not authenticated) and load the OAuth token
            if (!File.Exists(OAuthTokenFileName))
            {
                AuthorizeAppOAuth(dropboxServiceProvider);
            }
            OAuthToken oauthAccessToken = LoadOAuthToken();

            // Login in Dropbox
            IDropbox dropbox = dropboxServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);

            // Display user name (from his profile)
            DropboxProfile profile = dropbox.GetUserProfileAsync().Result;

            Console.WriteLine("Hi " + profile.DisplayName + "!");

            // Create new folder
            string newFolderName     = "PhotoAlbum_" + DateTime.Now.Ticks;
            Entry  createFolderEntry = dropbox.CreateFolderAsync(newFolderName).Result;

            Console.WriteLine("Created folder: {0}", createFolderEntry.Path);

            // Upload a file
            Entry uploadFileEntry = dropbox.UploadFileAsync(
                new FileResource("../../girl1.jpg"),
                "/" + newFolderName + "/girl1.jpg").Result;

            Console.WriteLine("Uploaded a file: {0}", uploadFileEntry.Path);

            Entry uploadFileEntry2 = dropbox.UploadFileAsync(
                new FileResource("../../girl2.jpg"),
                "/" + newFolderName + "/girl12.jpg").Result;

            Console.WriteLine("Uploaded a file: {0}", uploadFileEntry.Path);

            // Share a file
            DropboxLink sharedUrl = dropbox.GetShareableLinkAsync(createFolderEntry.Path).Result;

            Process.Start(sharedUrl.Url);
        }
        public void GetUserProfile()
        {
            mockServer.ExpectNewRequest()
            .AndExpectUri("https://api.dropbox.com/1/account/info")
            .AndExpectMethod(HttpMethod.GET)
            .AndRespondWith(EmbeddedResource("Dropbox_Profile.json"), responseHeaders);

#if NET_4_0 || SILVERLIGHT_5
            DropboxProfile profile = dropbox.GetUserProfileAsync().Result;
#else
            DropboxProfile profile = dropbox.GetUserProfile();
#endif
            Assert.AreEqual("US", profile.Country);
            Assert.AreEqual("John P. User", profile.DisplayName);
            Assert.AreEqual("*****@*****.**", profile.Email);
            Assert.AreEqual(12345678, profile.ID);
            Assert.AreEqual(107374182400000, profile.Quota);
            Assert.AreEqual(680031877871, profile.QuotaNormal);
            Assert.AreEqual(253738410565, profile.QuotaShared);
            Assert.AreEqual("https://www.dropbox.com/referrals/r1a2n3d4m5s6t7", profile.ReferralLink);
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            try
            {
                DropboxServiceProvider dropboxServiceProvider = new DropboxServiceProvider(DropboxAppKey, DropboxAppSecret, AccessLevel.Full);

#if NET_4_0
                /* OAuth 1.0 'dance' */

                // Authorization without callback url
                Console.Write("Getting request token...");
                OAuthToken oauthToken = dropboxServiceProvider.OAuthOperations.FetchRequestTokenAsync(null, null).Result;
                Console.WriteLine("Done");

                OAuth1Parameters parameters = new OAuth1Parameters();
                //parameters.Add("locale", CultureInfo.CurrentUICulture.IetfLanguageTag); // for a localized version of the authorization website
                string authenticateUrl = dropboxServiceProvider.OAuthOperations.BuildAuthorizeUrl(oauthToken.Value, parameters);
                Console.WriteLine("Redirect user for authorization");
                Process.Start(authenticateUrl);
                Console.Write("Press any key when authorization attempt has succeeded");
                Console.ReadLine();

                Console.Write("Getting access token...");
                AuthorizedRequestToken requestToken     = new AuthorizedRequestToken(oauthToken, null);
                OAuthToken             oauthAccessToken = dropboxServiceProvider.OAuthOperations.ExchangeForAccessTokenAsync(requestToken, null).Result;
                Console.WriteLine("Done");

                /* API */

                IDropbox dropbox = dropboxServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);
                //dropbox.Locale = CultureInfo.CurrentUICulture.IetfLanguageTag;

                DropboxProfile profile = dropbox.GetUserProfileAsync().Result;
                Console.WriteLine("Hi " + profile.DisplayName + "!");

                // Use step by step debugging, or not

/*
 *              Entry createFolderEntry = dropbox.CreateFolderAsync("Spring Social").Result;
 *              Entry uploadFileEntry = dropbox.UploadFileAsync(
 *                  new AssemblyResource("assembly://Spring.ConsoleQuickStart/Spring.ConsoleQuickStart/File.txt"),
 *                  "/Spring Social/File.txt", true, null, CancellationToken.None).Result;
 *              Entry copyEntry = dropbox.CopyAsync("Spring Social/File.txt", "Spring Social/File_copy.txt").Result;
 *              Entry deleteEntry = dropbox.DeleteAsync("Spring Social/File.txt").Result;
 *              Entry moveEntry = dropbox.MoveAsync("Spring Social/File_copy.txt", "Spring Social/File.txt").Result;
 *              dropbox.DownloadFileAsync("Spring Social/File.txt")
 *                  .ContinueWith(task =>
 *                  {
 *                      Console.WriteLine("File '{0}' downloaded ({1})", task.Result.Metadata.Path, task.Result.Metadata.Size);
 *                      // Save file to "C:\Spring Social.txt"
 *                      using (FileStream fileStream = new FileStream(@"C:\Spring Social.txt", FileMode.Create))
 *                      {
 *                          fileStream.Write(task.Result.Content, 0, task.Result.Content.Length);
 *                      }
 *                  });
 *              Entry folderMetadata = dropbox.GetMetadataAsync("Spring Social").Result;
 *              IList<Entry> revisionsEntries = dropbox.GetRevisionsAsync("Spring Social/File.txt").Result;
 *              Entry restoreEntry = dropbox.RestoreAsync("Spring Social/File.txt", revisionsEntries[2].Revision).Result;
 *              IList<Entry> searchResults = dropbox.SearchAsync("Spring Social/", ".txt").Result;
 *              DropboxLink shareableLink = dropbox.GetShareableLinkAsync("Spring Social/File.txt").Result;
 *              DropboxLink mediaLink = dropbox.GetMediaLinkAsync("Spring Social/File.txt").Result;
 *              Entry uploadImageEntry = dropbox.UploadFileAsync(
 *                  new AssemblyResource("assembly://Spring.ConsoleQuickStart/Spring.ConsoleQuickStart/Image.png"),
 *                  "/Spring Social/Image.png", true, null, CancellationToken.None).Result;
 *              dropbox.DownloadThumbnailAsync("Spring Social/Image.png", ThumbnailFormat.Png, ThumbnailSize.Medium)
 *                  .ContinueWith(task =>
 *                  {
 *                      Console.WriteLine("Thumbnail '{0}' downloaded ({1})", task.Result.Metadata.Path, task.Result.Metadata.Size);
 *                      // Save file to "C:\Thumbnail_Medium.png"
 *                      using (FileStream fileStream = new FileStream(@"C:\Thumbnail_Medium.png", FileMode.Create))
 *                      {
 *                          fileStream.Write(task.Result.Content, 0, task.Result.Content.Length);
 *                      }
 *                  });
 */
            }
            catch (AggregateException ae)
            {
                ae.Handle(ex =>
                {
                    if (ex is DropboxApiException)
                    {
                        Console.WriteLine(ex.Message);
                        return(true);
                    }
                    return(false);
                });
            }
#else
                /* OAuth 1.0 'dance' */

                // Authorization without callback url
                Console.Write("Getting request token...");
                OAuthToken oauthToken = dropboxServiceProvider.OAuthOperations.FetchRequestToken(null, null);
                Console.WriteLine("Done");

                OAuth1Parameters parameters = new OAuth1Parameters();
                //parameters.Add("locale", CultureInfo.CurrentUICulture.IetfLanguageTag); // for a localized version of the authorization website
                string authenticateUrl = dropboxServiceProvider.OAuthOperations.BuildAuthorizeUrl(oauthToken.Value, parameters);
                Console.WriteLine("Redirect user for authorization");
                Process.Start(authenticateUrl);
                Console.Write("Press any key when authorization attempt has succeeded");
                Console.ReadLine();

                Console.Write("Getting access token...");
                AuthorizedRequestToken requestToken = new AuthorizedRequestToken(oauthToken, null);
                OAuthToken oauthAccessToken         = dropboxServiceProvider.OAuthOperations.ExchangeForAccessToken(requestToken, null);
                Console.WriteLine("Done");

                /* API */

                IDropbox dropbox = dropboxServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);
                //dropbox.Locale = CultureInfo.CurrentUICulture.IetfLanguageTag;

                DropboxProfile profile = dropbox.GetUserProfile();
                Console.WriteLine("Hi " + profile.DisplayName + "!");

                // Use step by step debugging, or not

/*
 *              Entry createFolderEntry = dropbox.CreateFolder("Spring Social");
 *              Entry uploadFileEntry = dropbox.UploadFile(
 *                  new AssemblyResource("assembly://Spring.ConsoleQuickStart/Spring.ConsoleQuickStart/File.txt"),
 *                  "/Spring Social/File.txt", true, null);
 *              Entry copyEntry = dropbox.Copy("Spring Social/File.txt", "Spring Social/File_copy.txt");
 *              Entry deleteEntry = dropbox.Delete("Spring Social/File.txt");
 *              Entry moveEntry = dropbox.Move("Spring Social/File_copy.txt", "Spring Social/File.txt");
 *              var fileCanceler = dropbox.DownloadFileAsync("Spring Social/File.txt",
 *                  r =>
 *                  {
 *                      Console.WriteLine("File '{0}' downloaded ({1})", r.Response.Metadata.Path, r.Response.Metadata.Size);
 *                      // Save file to "C:\Spring Social.txt"
 *                      using (FileStream fileStream = new FileStream(@"C:\Spring Social.txt", FileMode.Create))
 *                      {
 *                          fileStream.Write(r.Response.Content, 0, r.Response.Content.Length);
 *                      }
 *                  });
 *              Entry folderMetadata = dropbox.GetMetadata("Spring Social");
 *              IList<Entry> revisionsEntries = dropbox.GetRevisions("Spring Social/File.txt");
 *              Entry restoreEntry = dropbox.Restore("Spring Social/File.txt", revisionsEntries[2].Revision);
 *              IList<Entry> searchResults = dropbox.Search("Spring Social/", ".txt");
 *              DropboxLink shareableLink = dropbox.GetShareableLink("Spring Social/File.txt");
 *              DropboxLink mediaLink = dropbox.GetMediaLink("Spring Social/File.txt");
 *              Entry uploadImageEntry = dropbox.UploadFile(
 *                  new AssemblyResource("assembly://Spring.ConsoleQuickStart/Spring.ConsoleQuickStart/Image.png"),
 *                  "/Spring Social/Image.png", true, null);
 *              var thumbnailCanceler = dropbox.DownloadThumbnailAsync("Spring Social/Image.png", ThumbnailFormat.Png, ThumbnailSize.Medium,
 *                  r =>
 *                  {
 *                      Console.WriteLine("Thumbnail '{0}' downloaded ({1})", r.Response.Metadata.Path, r.Response.Metadata.Size);
 *                      // Save file to "C:\Thumbnail_Medium.png"
 *                      using (FileStream fileStream = new FileStream(@"C:\Thumbnail_Medium.png", FileMode.Create))
 *                      {
 *                          fileStream.Write(r.Response.Content, 0, r.Response.Content.Length);
 *                      }
 *                  });
 */
            }
Beispiel #11
0
        private void Worker()
        {
            Interface.Oxide.LogInfo("[DropBox] Initialized");
            _Settings = _DataFileSystem.ReadObject <Settings>(Path.Combine(_ConfigDirectory, "DropBox"));

            if (_Settings.FileList == null)
            {
                _Settings = new Settings();

                _Settings.BackupOxideConfig  = true;
                _Settings.BackupOxideData    = true;
                _Settings.BackupOxideLang    = true;
                _Settings.BackupOxideLogs    = true;
                _Settings.BackupOxidePlugins = true;

                _Settings.FileList       = new List <string>();
                _Settings.UserToken      = "";
                _Settings.UserSecret     = "";
                _Settings.BackupName     = "Oxide DropBox Extension";
                _Settings.BackupInterval = 3600;
                _Settings.DropboxApi     = new Dictionary <string, string>();
                _Settings.DropboxApi.Add("DropboxAppKey", "");
                _Settings.DropboxApi.Add("DropboxAppSecret", "");
                _DataFileSystem.WriteObject <Settings>(Path.Combine(_ConfigDirectory, "DropBox"), _Settings);
            }

            if (_Settings.BackupInterval < 3600)
            {
                Interface.Oxide.LogError("[DropBox] You can't set backup interval lower than 1 hour.");
                _Settings.BackupInterval = 3600;
                _DataFileSystem.WriteObject <Settings>(Path.Combine(_ConfigDirectory, "DropBox"), _Settings);
            }

            if ((string.IsNullOrEmpty(_Settings.DropboxApi["DropboxAppKey"])) || (string.IsNullOrEmpty(_Settings.DropboxApi["DropboxAppSecret"])))
            {
                _running = false;
                Interface.Oxide.LogWarning("[DropBox] To able to use DropBox Extension you need to set DropboxAppKey and DropboxAppSecret in config file.");
            }
            if (_running)
            {
                DropboxServiceProvider dropboxServiceProvider = new DropboxServiceProvider(_Settings.DropboxApi["DropboxAppKey"], _Settings.DropboxApi["DropboxAppSecret"], AccessLevel.Full);

                OAuthToken oauthAccessToken = null;
                bool       Authorized       = false;
                IDropbox   dropbox          = null;
                do
                {
                    if ((_running) && (string.IsNullOrEmpty(_Settings.UserToken) || string.IsNullOrEmpty(_Settings.UserSecret)))
                    {
                        Interface.Oxide.LogInfo("[DropBox] Getting request token...");
                        OAuthToken oauthToken = dropboxServiceProvider.OAuthOperations.FetchRequestToken(null, null);
                        Interface.Oxide.LogInfo("[DropBox] Done");
                        OAuth1Parameters parameters      = new OAuth1Parameters();
                        string           authenticateUrl = dropboxServiceProvider.OAuthOperations.BuildAuthenticateUrl(oauthToken.Value, parameters);
                        Interface.Oxide.LogInfo("[DropBox] Redirect user for authorization");
                        Interface.Oxide.LogInfo("[DropBox] {0}", authenticateUrl);
                        while ((_running) && (Authorized == false))
                        {
                            try
                            {
                                AuthorizedRequestToken requestToken = new AuthorizedRequestToken(oauthToken, null);
                                oauthAccessToken     = dropboxServiceProvider.OAuthOperations.ExchangeForAccessToken(requestToken, null);
                                Authorized           = true;
                                _Settings.UserToken  = oauthAccessToken.Value;
                                _Settings.UserSecret = oauthAccessToken.Secret;
                                _DataFileSystem.WriteObject <Settings>(Path.Combine(_ConfigDirectory, "DropBox"), _Settings);
                            }
                            catch
                            {
                                Thread.Sleep(5000);
                            }
                        }
                    }
                    else if (_running)
                    {
                        oauthAccessToken = new OAuthToken(_Settings.UserToken, _Settings.UserSecret);
                    }
                    if (_running)
                    {
                        try
                        {
                            Interface.Oxide.LogInfo("[DropBox] Authorizing");
                            dropbox = dropboxServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);
                            Interface.Oxide.LogInfo("[DropBox] Authorization Succeed");
                            Authorized = true;
                        }
                        catch
                        {
                            Interface.Oxide.LogWarning("[DropBox] Authorization Failed");
                            _Settings.UserToken  = "";
                            _Settings.UserSecret = "";
                            _DataFileSystem.WriteObject <Settings>(Path.Combine(_ConfigDirectory, "DropBox"), _Settings);
                            Authorized = false;
                        }
                    }
                } while ((_running) && (Authorized == false));
                if ((_running) && (dropbox != null) && (Authorized == true))
                {
                    DropboxProfile profile = dropbox.GetUserProfile();
                    Interface.Oxide.LogInfo("[DropBox] Current Dropbox User : {0}({1})", profile.DisplayName, profile.Email);
                    DateTime NextUpdate = DateTime.Now.AddSeconds(60);
                    Interface.Oxide.LogInfo("[DropBox] First Backup : {0}", NextUpdate.ToString());
                    while (_running)
                    {
                        if (DateTime.Now < NextUpdate)
                        {
                            Thread.Sleep(1000);
                        }
                        else
                        {
                            string BackUpRoot      = Path.Combine(Interface.Oxide.RootDirectory, "OxideExtBackup");
                            string OxideBackUpRoot = Path.Combine(BackUpRoot, "Oxide");
                            string FileBackUpRoot  = Path.Combine(BackUpRoot, "Files");

                            Directory.CreateDirectory(BackUpRoot);
                            DirectoryInfo OxideExtBackup = new DirectoryInfo(BackUpRoot);
                            foreach (FileInfo file in OxideExtBackup.GetFiles())
                            {
                                file.Delete();
                            }
                            foreach (DirectoryInfo subDirectory in OxideExtBackup.GetDirectories())
                            {
                                subDirectory.Delete(true);
                            }

                            Directory.CreateDirectory(OxideBackUpRoot);
                            Directory.CreateDirectory(FileBackUpRoot);

                            if (_Settings.BackupOxideConfig)
                            {
                                DirectoryCopy(Interface.Oxide.ConfigDirectory, Path.Combine(OxideBackUpRoot, "config"), true);
                            }

                            if (_Settings.BackupOxideData)
                            {
                                DirectoryCopy(Interface.Oxide.DataDirectory, Path.Combine(OxideBackUpRoot, "data"), true);
                            }

                            if (_Settings.BackupOxideLang)
                            {
                                DirectoryCopy(Interface.Oxide.LangDirectory, Path.Combine(OxideBackUpRoot, "lang"), true);
                            }

                            if (_Settings.BackupOxideLogs)
                            {
                                DirectoryCopy(Interface.Oxide.LogDirectory, Path.Combine(OxideBackUpRoot, "logs"), true);
                            }

                            if (_Settings.BackupOxidePlugins)
                            {
                                DirectoryCopy(Interface.Oxide.PluginDirectory, Path.Combine(OxideBackUpRoot, "plugins"), true);
                            }

                            foreach (string Current in _Settings.FileList)
                            {
                                if (!string.IsNullOrEmpty(Current))
                                {
                                    string CurrentPath = Path.GetFullPath(Path.Combine(Interface.Oxide.RootDirectory, Current));
                                    if (!CurrentPath.StartsWith(Interface.Oxide.RootDirectory, StringComparison.Ordinal))
                                    {
                                        Interface.Oxide.LogError("[DropBox] You may only access game releated directories...");
                                    }
                                    else if ((File.GetAttributes(CurrentPath) & FileAttributes.Directory) == FileAttributes.Directory)
                                    {
                                        if (CurrentPath != Interface.Oxide.RootDirectory)
                                        {
                                            DirectoryCopy(CurrentPath, Path.Combine(FileBackUpRoot, new DirectoryInfo(CurrentPath).Name), true);
                                        }
                                    }
                                    else
                                    {
                                        File.Copy(CurrentPath, Path.Combine(FileBackUpRoot, new FileInfo(CurrentPath).Name));
                                    }
                                }
                            }
                            string          FileName  = string.Format("{0}.{1}.{2}.{3}.{4}.{5}.zip", DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, DateTime.UtcNow.Second);
                            FileStream      fsOut     = File.Create(Path.Combine(Interface.Oxide.RootDirectory, FileName));
                            ZipOutputStream zipStream = new ZipOutputStream(fsOut);
                            zipStream.SetLevel(3);
                            string folderName   = Path.Combine(Interface.Oxide.RootDirectory, "OxideExtBackup");
                            int    folderOffset = folderName.Length + (folderName.EndsWith("\\") ? 0 : 1);
                            CompressFolder(folderName, zipStream, folderOffset);
                            zipStream.IsStreamOwner = true;
                            zipStream.Close();
                            Interface.Oxide.LogInfo("[DropBox] Uploading...");
                            Entry uploadFileEntry = dropbox.UploadFile(new FileResource(Path.Combine(Interface.Oxide.RootDirectory, FileName)), string.Format("/{0}/{1}", _Settings.BackupName, FileName), true, null);
                            Directory.Delete(folderName, true);
                            File.Delete(Path.Combine(Interface.Oxide.RootDirectory, FileName));
                            NextUpdate = NextUpdate.AddSeconds(_Settings.BackupInterval);
                            Interface.Oxide.LogInfo("[DropBox] Uploading Complated.Next Backup : {0}", NextUpdate.ToString());
                        }
                    }
                }
            }
        }