Пример #1
0
        private void DropBoxMain_Load(object sender, EventArgs e)
        {
            //Create List.Txt
            File.WriteToTextFile("", list);

            //ComboBox
            comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBox1.SelectedIndex = 0;

            //ListView
            listView1.Visible = true;
            listView2.Visible = false;
            listView1.Clear();
            File.ReadTextFileAndDisplayToListView(list, listView1);

            //Is Logged In?
            if (SoulDB.isLoggedInDataAvaiable())
            {
                CreateDefaultFolders();
            }
            else
            {
                Authenticate();
            }

            this.Size = new Size(995, 650);
            this.CenterToScreen();
        }
Пример #2
0
        //Create Default Folders on DropBox
        public void CreateDefaultFolders()
        {
            //If already Logged In
            if (SoulDB.isLoggedInDataAvaiable())
            {
                _client = new DropboxClient(SoulDB.GetAccessTokenFromFile());
                if (SoulDB.isFolderExist("/DarkSouls", _client) == false)
                {
                    SoulDB.CreateFolder("/DarkSouls", _client);
                }

                if (SoulDB.isFolderExist("/DarkSoulsII", _client) == false)
                {
                    SoulDB.CreateFolder("/DarkSoulsII", _client);
                }

                if (SoulDB.isFolderExist("/DarkSoulsIII", _client) == false)
                {
                    SoulDB.CreateFolder("/DarkSoulsIII", _client);
                }

                if (SoulDB.isFolderExist("/Sekiro", _client) == false)
                {
                    SoulDB.CreateFolder("/Sekiro", _client);
                }
            }
            else
            {
                //not Logged in
                if (SoulDB.isFolderExist("/Darksouls", baseDropBox._client) == false)
                {
                    SoulDB.CreateFolder("/Darksouls", baseDropBox._client);
                }

                if (SoulDB.isFolderExist("/DarkSoulsII", _client) == false)
                {
                    SoulDB.CreateFolder("/DarkSoulsII", _client);
                }

                if (SoulDB.isFolderExist("/DarkSoulsIII", _client) == false)
                {
                    SoulDB.CreateFolder("/DarkSoulsIII", _client);
                }

                if (SoulDB.isFolderExist("/Sekiro", _client) == false)
                {
                    SoulDB.CreateFolder("/Sekiro", _client);
                }
            }
        }
Пример #3
0
        //Upload to dropBox
        public static bool UploadToDropbox(string UploadFolder, string Filename, string Source)
        {
            try {
                DropboxClient _c = new DropboxClient(SoulDB.GetAccessTokenFromFile());

                if (SoulDB.isLoggedInDataAvaiable())
                {
                    if (SoulDB.UploadFile(UploadFolder, Filename, Source, _c))
                    {
                        bStatus = true;
                    }
                    else
                    {
                        //Delete All files on Temp Folder
                        DirectoryInfo directoryInfo = new DirectoryInfo(Utilities.getApplicationPath() + @"\" + _dir);
                        foreach (FileInfo file in directoryInfo.EnumerateFiles())
                        {
                            file.Delete();
                        }

                        bStatus = false;
                    }
                }

                if (bStatus)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            } catch (Exception) {
                return(false);
            }
        }