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)
{
}
}
}