示例#1
0
// ----------------------------------------------

		private void deleteSpecifiedAddons()
		{
			string URL = AutoAddonURL.Text;
			DebugLine(_RETRXMLDATA);
			string UpdateQueryResponse = "";
			string value2 = valu2.Text;
			if (sendPwSecurely.Checked)
			{
				value2 = MD5SUM(new UTF8Encoding(true).GetBytes(valu2.Text));
			}
			if (arg1check.Checked && arg2check.Checked)
			{
				UpdateQueryResponse = RetrData(URL, null, null, "OPERATION", "GETDELETEADDONS", arrg1.Text, valu1.Text, arrg2.Text, value2, -1, null, null);
			}
			else
			{
				UpdateQueryResponse = RetrData(URL, null, null, "OPERATION", "GETDELETEADDONS", null, null, null, null, -1, null, null);
			}
			DebugLine(_XMLPARS);
			if (UpdateQueryResponse == string.Empty) return;
			ArrayList addonsToCheck = new ArrayList();
			try
			{
				XmlDocument doc = new XmlDocument();
				/////////////////////////////////////
				///	Begin Reading the XML data ///
				/////////////////////////////////////
				doc.InnerXml = UpdateQueryResponse;
				XmlElement root = doc.DocumentElement;
				XmlNodeList lstXMLData = root.GetElementsByTagName("addon");
				/////////////////////////////////////
				/// Finished Reading the XML data ///
				/////////////////////////////////////
				foreach (XmlNode Node in lstXMLData)
				{
					Hashtable addon = new Hashtable();
					string name = Node.Attributes.GetNamedItem("dirname").Value.ToString();
					addonsToCheck.Add(name);
				}
			}
			catch (Exception ex)
			{
				DebugLine("deleteSpecifiedAddons: " + ex.Message);
			}
			string addonPath = GetInstallPath() + "\\Interface\\AddOns";
			try
			{
				DirectoryInfo addonDirInfo = new DirectoryInfo(addonPath);
				DirectoryInfo[] installedAddons = addonDirInfo.GetDirectories();
				foreach (DirectoryInfo installedAddonDir in installedAddons)
				{
					foreach (string addon in addonsToCheck)
					{
						//MessageBox.Show(installedAddonDir.Name.ToLower());
						if (installedAddonDir.Name.ToLower() == addon.ToLower())
						{
							Directory.Delete(installedAddonDir.FullName, true);
						}
					}
				}
			}
			catch (Exception ex)
			{
				DebugLine("deleteSpecifiedAddons: " + ex.Message);
			}
		}