private void Synch()
        {
            if (_gas != null && !string.IsNullOrWhiteSpace(_rootFolder) && items != null)
            {
                foreach (GoogleAccount gas in _gas)
                {
                    _CurrentGA       = gas;
                    gas.UploadBusy  -= ga_UploadBusy;
                    gas.UploadEnd   -= ga_UploadEnd;
                    gas.UploadStart -= ga_UploadStart;

                    gas.UploadBusy  += ga_UploadBusy;
                    gas.UploadEnd   += ga_UploadEnd;
                    gas.UploadStart += ga_UploadStart;

                    foreach (Item i in gas.UploadItems)
                    {
                        _CurrentItem = i;
                        string abspath = i.Path.Substring(_rootFolder.Length);
                        abspath = abspath.Substring(0, abspath.Length - i.Name.Length);
                        if (abspath == "\\")
                        {
                            abspath = "";
                        }
                        if (abspath.StartsWith("\\"))
                        {
                            abspath = abspath.Substring(1);
                        }
                        if (abspath.EndsWith("\\"))
                        {
                            abspath = abspath.Substring(0, abspath.Length - 1);
                        }
                        if (!i.IsFolder)
                        {
                            gas.UploadFile(i.Path, i.Name, abspath);
                            //Thread.Sleep(50);
                        }
                        else
                        {
                            gas.CreateFolder(i.Path, i.Name, abspath);
                            Thread.Sleep(50);
                        }
                        i.GoogleID       = gas.CurrentGoogleID;
                        i.UploadProgress = 100;

                        //Thread.Sleep(200);
                    }
                }
            }
        }
Example #2
0
        private void SynchWithLogging()
        {
            foreach (GoogleAccount ga in _GoogleAccounts)
            {
                _currentGA      = ga;
                ga.UploadBusy  -= ga_UploadBusy;
                ga.UploadEnd   -= ga_UploadEnd;
                ga.UploadStart -= ga_UploadStart;

                ga.UploadBusy  += ga_UploadBusy;
                ga.UploadEnd   += ga_UploadEnd;
                ga.UploadStart += ga_UploadStart;

                cs.CurrentAccount         = ga.Name;
                cs.TotalFileUploadValue   = 0;
                cs.CurrentFileUploadValue = 0;
                cs.CurrentFile            = "";
                cs.CurrentFolder          = "";

                if (ga.ItemListOnGoogleDrive == null || ga.ItemListOnGoogleDrive.Count == 0)
                {
                    //ga.FillItemListOnGoogleDrive();
                    ga.FillItemListOnGoogleDriveNew();
                }
                if (ga.ItemListToUpload != null && ga.ItemListToUpload.Count > 0)
                {
                    List <Item> lstItemsToUpload = ga.GetListOfItemsToUpload(ga.ItemListToUpload, _rootFolder);
                    if (lstItemsToUpload != null && lstItemsToUpload.Count > 0)
                    {
                        ga.UploadItems = lstItemsToUpload;
                    }
                }
            }
            UploadWindow wind = new UploadWindow();

            wind.Show();
            wind.SetItems(_GoogleAccounts, _rootFolder);
            System.Windows.Threading.Dispatcher.Run();
        }
Example #3
0
        private void Synch()
        {
            foreach (GoogleAccount ga in _GoogleAccounts)
            {
                _currentGA      = ga;
                ga.UploadBusy  -= ga_UploadBusy;
                ga.UploadEnd   -= ga_UploadEnd;
                ga.UploadStart -= ga_UploadStart;

                ga.UploadBusy  += ga_UploadBusy;
                ga.UploadEnd   += ga_UploadEnd;
                ga.UploadStart += ga_UploadStart;

                cs.CurrentAccount         = ga.Name;
                cs.TotalFileUploadValue   = 0;
                cs.CurrentFileUploadValue = 0;
                cs.CurrentFile            = "";
                cs.CurrentFolder          = "";

                if (ga.ItemListOnGoogleDrive == null || ga.ItemListOnGoogleDrive.Count == 0)
                {
                    //ga.FillItemListOnGoogleDrive();
                    ga.FillItemListOnGoogleDriveNew();
                }
                if (ga.ItemListToUpload != null && ga.ItemListToUpload.Count > 0)
                {
                    double breuk        = 100 / (double)ga.ItemListToUpload.Count;
                    double huidigtotaal = 0.0;
                    foreach (Item i in ga.ItemListToUpload)
                    {
                        huidigtotaal += breuk;
                        string abspath = i.Path.Substring(_rootFolder.Length);
                        abspath = abspath.Substring(0, abspath.Length - i.Name.Length);
                        if (abspath == "\\")
                        {
                            abspath = "";
                        }
                        if (abspath.StartsWith("\\"))
                        {
                            abspath = abspath.Substring(1);
                        }
                        if (abspath.EndsWith("\\"))
                        {
                            abspath = abspath.Substring(0, abspath.Length - 1);
                        }
                        if (!i.IsFolder)
                        {
                            cs.CurrentFile = i.Name;

                            ga.UploadFile(i.Path, i.Name, abspath);
                            //for (int tel = 0; tel <= 100; tel++)
                            //{
                            //    cs.CurrentFileUploadValue = tel;
                            //    Thread.Sleep(50);
                            //}
                        }
                        else
                        {
                            cs.CurrentFolder = i.Path;
                            ga.CreateFolder(i.Path, i.Name, abspath);
                            Thread.Sleep(50);
                        }
                        cs.CurrentFileUploadValue = 0;
                        cs.TotalFileUploadValue   = (int)huidigtotaal;
                    }
                    cs.TotalFileUploadValue = 100;
                }
            }
        }
Example #4
0
        private void AdaptGoogleAccountList()
        {
            if (_GoogleAccounts != null)
            {
                _GoogleAccounts.Clear();
            }
            else
            {
                _GoogleAccounts = new List <GoogleAccount>();
            }

            if (_xmlGoogleAccountSettings != null)
            {
                if (_xmlGoogleAccountSettings.HasChildNodes)
                {
                    XmlNodeList lstNodes = _xmlGoogleAccountSettings.GetElementsByTagName("GoogleAccount");
                    if (lstNodes != null && lstNodes.Count > 0)
                    {
                        foreach (XmlNode oNode in lstNodes)
                        {
                            GoogleAccount ga = new GoogleAccount();
                            XmlNodeList   lstNodesPerAccount = oNode.ChildNodes;
                            if (lstNodesPerAccount != null && lstNodesPerAccount.Count > 0)
                            {
                                foreach (XmlNode oNodeChild in lstNodesPerAccount)
                                {
                                    switch (oNodeChild.Name)
                                    {
                                    case "Name":
                                        ga.Name = oNodeChild.InnerText;
                                        break;

                                    case "Email":
                                        ga.Email = oNodeChild.InnerText;
                                        break;

                                    case "ClientId":
                                        ga.ClientId = oNodeChild.InnerText;
                                        break;

                                    case "ClientSecret":
                                        ga.ClientSecret = oNodeChild.InnerText;
                                        break;

                                    case "FileDataStore":
                                        ga.FileDataStore = oNodeChild.InnerText;
                                        break;

                                    case "FileFilter":
                                        ga.FileFilter = oNodeChild.InnerText;
                                        break;

                                    case "RootFolder":
                                        ga.RootFolder = oNodeChild.InnerText;
                                        break;
                                    }
                                }
                            }
                            _GoogleAccounts.Add(ga);
                        }
                    }
                }
            }
        }
        private void SynchWithLogging()
        {
            foreach (GoogleAccount ga in _GoogleAccounts)
            {
                _currentGA = ga;
                ga.UploadBusy -= ga_UploadBusy;
                ga.UploadEnd -= ga_UploadEnd;
                ga.UploadStart -= ga_UploadStart;

                ga.UploadBusy += ga_UploadBusy;
                ga.UploadEnd += ga_UploadEnd;
                ga.UploadStart += ga_UploadStart;

                cs.CurrentAccount = ga.Name;
                cs.TotalFileUploadValue = 0;
                cs.CurrentFileUploadValue = 0;
                cs.CurrentFile = "";
                cs.CurrentFolder = "";

                if (ga.ItemListOnGoogleDrive == null || ga.ItemListOnGoogleDrive.Count == 0)
                {
                    //ga.FillItemListOnGoogleDrive();
                    ga.FillItemListOnGoogleDriveNew();
                }
                if (ga.ItemListToUpload != null && ga.ItemListToUpload.Count > 0)
                {

                    List<Item> lstItemsToUpload = ga.GetListOfItemsToUpload(ga.ItemListToUpload, _rootFolder);
                    if (lstItemsToUpload != null && lstItemsToUpload.Count > 0)
                    {
                        ga.UploadItems = lstItemsToUpload;
                    }

                }
            }
            UploadWindow wind = new UploadWindow();
            wind.Show();
            wind.SetItems(_GoogleAccounts, _rootFolder);
            System.Windows.Threading.Dispatcher.Run();
        }
        private void Synch()
        {
            foreach (GoogleAccount ga in _GoogleAccounts)
            {
                _currentGA = ga;
                ga.UploadBusy -= ga_UploadBusy;
                ga.UploadEnd -= ga_UploadEnd;
                ga.UploadStart -= ga_UploadStart;

                ga.UploadBusy += ga_UploadBusy;
                ga.UploadEnd += ga_UploadEnd;
                ga.UploadStart += ga_UploadStart;

                cs.CurrentAccount = ga.Name;
                cs.TotalFileUploadValue = 0;
                cs.CurrentFileUploadValue = 0;
                cs.CurrentFile = "";
                cs.CurrentFolder = "";

                if (ga.ItemListOnGoogleDrive == null || ga.ItemListOnGoogleDrive.Count == 0)
                {
                    //ga.FillItemListOnGoogleDrive();
                    ga.FillItemListOnGoogleDriveNew();
                }
                if (ga.ItemListToUpload != null && ga.ItemListToUpload.Count > 0)
                {
                    double breuk = 100 / (double)ga.ItemListToUpload.Count;
                    double huidigtotaal = 0.0;
                    foreach (Item i in ga.ItemListToUpload)
                    {
                        huidigtotaal += breuk;
                        string abspath = i.Path.Substring(_rootFolder.Length);
                        abspath = abspath.Substring(0, abspath.Length - i.Name.Length);
                        if (abspath == "\\")
                        {
                            abspath = "";
                        }
                        if (abspath.StartsWith("\\"))
                        {
                            abspath = abspath.Substring(1);
                        }
                        if (abspath.EndsWith("\\"))
                        {
                            abspath = abspath.Substring(0, abspath.Length - 1);
                        }
                        if (!i.IsFolder)
                        {

                            cs.CurrentFile = i.Name;

                            ga.UploadFile(i.Path, i.Name, abspath);
                            //for (int tel = 0; tel <= 100; tel++)
                            //{
                            //    cs.CurrentFileUploadValue = tel;
                            //    Thread.Sleep(50);
                            //}
                        }
                        else
                        {
                            cs.CurrentFolder = i.Path;
                            ga.CreateFolder(i.Path, i.Name, abspath);
                            Thread.Sleep(50);
                        }
                        cs.CurrentFileUploadValue = 0;
                        cs.TotalFileUploadValue = (int)huidigtotaal;
                    }
                    cs.TotalFileUploadValue = 100;
                }
            }
        }
        private void AdaptGoogleAccountList()
        {
            if (_GoogleAccounts != null)
            {
                _GoogleAccounts.Clear();
            }
            else
            {
                _GoogleAccounts = new List<GoogleAccount>();
            }

            if (_xmlGoogleAccountSettings != null)
            {
                if (_xmlGoogleAccountSettings.HasChildNodes)
                {
                    XmlNodeList lstNodes = _xmlGoogleAccountSettings.GetElementsByTagName("GoogleAccount");
                    if (lstNodes != null && lstNodes.Count > 0)
                    {
                        foreach (XmlNode oNode in lstNodes)
                        {
                            GoogleAccount ga = new GoogleAccount();
                            XmlNodeList lstNodesPerAccount = oNode.ChildNodes;
                            if (lstNodesPerAccount != null && lstNodesPerAccount.Count > 0)
                            {
                                foreach (XmlNode oNodeChild in lstNodesPerAccount)
                                {
                                    switch (oNodeChild.Name)
                                    {
                                        case "Name":
                                            ga.Name = oNodeChild.InnerText;
                                            break;
                                        case "Email":
                                            ga.Email = oNodeChild.InnerText;
                                            break;
                                        case "ClientId":
                                            ga.ClientId = oNodeChild.InnerText;
                                            break;
                                        case "ClientSecret":
                                            ga.ClientSecret = oNodeChild.InnerText;
                                            break;
                                        case "FileDataStore":
                                            ga.FileDataStore = oNodeChild.InnerText;
                                            break;
                                        case "FileFilter":
                                            ga.FileFilter = oNodeChild.InnerText;
                                            break;
                                        case "RootFolder":
                                            ga.RootFolder = oNodeChild.InnerText;
                                            break;
                                    }
                                }
                            }
                            _GoogleAccounts.Add(ga);
                        }
                    }
                }

            }
        }
        private void Synch()
        {
            if (_gas != null && !string.IsNullOrWhiteSpace(_rootFolder) && items != null)
            {

                foreach (GoogleAccount gas in _gas)
                {
                    _CurrentGA = gas;
                    gas.UploadBusy -= ga_UploadBusy;
                    gas.UploadEnd -= ga_UploadEnd;
                    gas.UploadStart -= ga_UploadStart;

                    gas.UploadBusy += ga_UploadBusy;
                    gas.UploadEnd += ga_UploadEnd;
                    gas.UploadStart += ga_UploadStart;

                    foreach (Item i in gas.UploadItems)
                    {
                        _CurrentItem = i;
                        string abspath = i.Path.Substring(_rootFolder.Length);
                        abspath = abspath.Substring(0, abspath.Length - i.Name.Length);
                        if (abspath == "\\")
                        {
                            abspath = "";
                        }
                        if (abspath.StartsWith("\\"))
                        {
                            abspath = abspath.Substring(1);
                        }
                        if (abspath.EndsWith("\\"))
                        {
                            abspath = abspath.Substring(0, abspath.Length - 1);
                        }
                        if (!i.IsFolder)
                        {

                            gas.UploadFile(i.Path, i.Name, abspath);
                            //Thread.Sleep(50);
                        }
                        else
                        {
                            gas.CreateFolder(i.Path, i.Name, abspath);
                            Thread.Sleep(50);
                        }
                        i.GoogleID = gas.CurrentGoogleID;
                        i.UploadProgress = 100;

                        //Thread.Sleep(200);
                    }

                }

            }
        }