public List <string> AddAssetPath(string title, string path, TreeNode root)
        {
            if (string.IsNullOrEmpty(path) || !Directory.Exists(path))
            {
                TreeNode tn = new TreeNode(title, (int)EAssetImageList.FolderBad, (int)EAssetImageList.FolderBad);
                tvAssets.Nodes.Add(tn);
                return(new List <string>());
            }
            else
            {
                ScanPathForm spf = new ScanPathForm();
                spf.StartScan(path);

                if (spf.Found.Count > 0)
                {
                    AddAssetPath(title, spf.Found, root);
                    return(spf.Found);
                }
                else
                {
                    TreeNode tn = new TreeNode(title, (int)EAssetImageList.FolderBad, (int)EAssetImageList.FolderBad);
                    tvAssets.Nodes.Add(tn);
                    return(new List <string>());
                }
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            foreach (string ptr in PathsToRemove)
            {
                string title = Globals.AppSettings.GetTitleForPath(ptr);
                Globals.AppSettings.RemoveAssetScanPath(ptr);
                Globals.AppForm.RemoveAssetGroupByTitle(title);
            }

            foreach (string ptc in PathsToChange)
            {
                CachedAsset ca = Globals.AppSettings.CachedAssets.Find(tca => tca.Path == ptc);
                for (int i = 0; i < lvASP.Items.Count; i++)
                {
                    if (lvASP.Items[i].SubItems[1].Text == ptc)
                    {
                        Globals.AppForm.ChangeAssetTitle(ca.Title, lvASP.Items[i].Text);
                        ca.Title = lvASP.Items[i].Text;
                    }
                }
            }

            ScanPathForm spf = null;

            foreach (string pta in PathsToAdd)
            {
                if (spf == null)
                {
                    spf = new ScanPathForm();
                }
                for (int i = 0; i < lvASP.Items.Count; i++)
                {
                    if (lvASP.Items[i].SubItems[1].Text == pta)
                    {
                        CachedAsset ca = new CachedAsset();
                        ca.Path  = lvASP.Items[i].SubItems[1].Text;
                        ca.Title = lvASP.Items[i].Text;
                        Globals.AppSettings.CachedAssets.Add(ca);
                        spf.StartScan(ca.Path);
                        Globals.AppForm.AddAssetPath(ca.Title, spf.Found, null);
                        ca.SetAssetsFromFoundList(spf.Found);
                        break;
                    }
                }
            }

            Globals.AppSettings.SaveSettings();

            Close();
        }