示例#1
0
 public void ConfigureUserAddIns(string addInInstallTemp, string userAddInPath)
 {
     AddInManager.AddInInstallTemp = addInInstallTemp;
     AddInManager.UserAddInPath    = userAddInPath;
     if (Directory.Exists(addInInstallTemp))
     {
         AddInManager.InstallAddIns(disabledAddIns);
     }
     if (Directory.Exists(userAddInPath))
     {
         AddAddInsFromDirectory(userAddInPath);
     }
 }
示例#2
0
 public void ConfigureUserAddIns(string addInInstallTemp, string userAddInPath)
 {
     if (!this.externalAddInsConfigured)
     {
         throw new System.InvalidOperationException("ConfigureExternalAddIns must be called before ConfigureUserAddIns");
     }
     AddInManager.AddInInstallTemp = addInInstallTemp;
     AddInManager.UserAddInPath    = userAddInPath;
     if (System.IO.Directory.Exists(addInInstallTemp))
     {
         AddInManager.InstallAddIns(this.disabledAddIns);
     }
     if (System.IO.Directory.Exists(userAddInPath))
     {
         this.AddAddInsFromDirectory(userAddInPath);
     }
 }
示例#3
0
 public void ConfigureExternalAddIns(string addInConfigurationFile)
 {
     this.externalAddInsConfigured      = true;
     AddInManager.ConfigurationFileName = addInConfigurationFile;
     AddInManager.LoadAddInConfiguration(this.addInFiles, this.disabledAddIns);
 }
示例#4
0
 public void ConfigureExternalAddIns(string addInConfigurationFile)
 {
     AddInManager.ConfigurationFileName = addInConfigurationFile;
     AddInManager.LoadAddInConfiguration(addInFiles, disabledAddIns);
 }
示例#5
0
        public static void InstallAddIns(System.Collections.Generic.List <string> disabled)
        {
            if (!System.IO.Directory.Exists(AddInManager.addInInstallTemp))
            {
                return;
            }
            if (!System.IO.Directory.Exists(AddInManager.userAddInPath))
            {
                System.IO.Directory.CreateDirectory(AddInManager.userAddInPath);
            }
            string path = System.IO.Path.Combine(AddInManager.addInInstallTemp, "remove.txt");
            bool   flag = true;

            System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
            if (System.IO.File.Exists(path))
            {
                using (System.IO.StreamReader streamReader = new System.IO.StreamReader(path))
                {
                    string text;
                    while ((text = streamReader.ReadLine()) != null)
                    {
                        text = text.Trim();
                        if (!string.IsNullOrEmpty(text))
                        {
                            string targetDir = System.IO.Path.Combine(AddInManager.userAddInPath, text);
                            if (!AddInManager.UninstallAddIn(disabled, text, targetDir))
                            {
                                list.Add(text);
                                flag = false;
                            }
                        }
                    }
                }
                if (list.Count == 0)
                {
                    System.IO.File.Delete(path);
                }
                else
                {
                    using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(path))
                    {
                        list.ForEach(new System.Action <string>(streamWriter.WriteLine));
                    }
                }
            }
            string[] directories = System.IO.Directory.GetDirectories(AddInManager.addInInstallTemp);
            for (int i = 0; i < directories.Length; i++)
            {
                string text2    = directories[i];
                string fileName = System.IO.Path.GetFileName(text2);
                string text3    = System.IO.Path.Combine(AddInManager.userAddInPath, fileName);
                if (!list.Contains(fileName))
                {
                    if (AddInManager.UninstallAddIn(disabled, fileName, text3))
                    {
                        System.IO.Directory.Move(text2, text3);
                    }
                    else
                    {
                        flag = false;
                    }
                }
            }
            if (flag)
            {
                try
                {
                    System.IO.Directory.Delete(AddInManager.addInInstallTemp, false);
                }
                catch (System.Exception)
                {
                }
            }
        }