Академический Документы
Профессиональный Документы
Культура Документы
using System.Collections.Generic;
using System.Xml;
using System.Xml.Schema;
using System.Diagnostics;
using System.IO;
using Microsoft.Deployment.WindowsInstaller;
namespace VirusBlokAda.CC.RemoteOperations.MsiInfo
{
public static class Vba32VersionInfo
{
private static Dictionary<String, String> dict = new Dictionary<String,
String>();
static Vba32VersionInfo()
{
try
{
XmlReaderSettings settings = new XmlReaderSettings();
XmlSchema schema = new XmlSchema();
schema.SourceUri =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Settings\Vba32Versions.xsd");
settings.Schemas.Add(schema);
settings.ValidationType = ValidationType.Schema;
XmlReader reader =
XmlReader.Create(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
@"Settings\Vba32Versions.xml"), settings);
XmlDocument document = new XmlDocument();
document.Load(reader);
ValidationEventHandler eventHandler = new
ValidationEventHandler(ValidationEventHandler);
document.Validate(eventHandler);
XmlNodeList nodes = document.GetElementsByTagName("version");
foreach (XmlNode next in nodes)
{
String version = next.InnerText;
String guid = next.Attributes["guid"].Value;
dict.Add(version, guid);
}
}
catch (Exception ex)
{
Debug.WriteLine("Error loading or parsing Vba32Versions.xml " +
ex.Message);
}
}
public static String GetGuid(String version)
{
String guid;
return dict.TryGetValue(version, out guid) ? guid : "unknown";
}
#region Versions
#endregion
switch (product)
{
case "KANOE":
x64 = "KANOEx64.msi";
x86 = "KANOEx86.msi";
sqlAddLocal =
"VSIS,AGENT,VPP,VIC,VND,VDD,VAS,VMT,VFC,VGI,VKW,VQN";
break;
default:
x64 = "Vba32Antivirusx64.msi";
x86 = "Vba32Antivirusx86.msi";
sqlAddLocal = "VSIS,AGENT,VPP,VQN,VKW,VAS,VMT,VDD,VGI,VMF";
break;
}
switch (product)
{
case "KANOE":
if (isServer) mst = n == x64 ? "s64.mst" : "s86.mst";
else mst = n == x64 ? "c64.mst" : "c86.mst";
break;
default:
if (isServer) mst = n == x64 ? "cfs.mst" : "cfe.mst";
else mst = n == x64 ? "cfss.mst" : "cfse.mst";
break;
}
if (!isServer)
database.Execute("INSERT INTO `Property`
(`Property`.`Property`, `Property`.`Value`) VALUES ('GENERATE_CLEAR_LIST', '1')");
if (product == "KC_SAZ")
database.Execute("INSERT INTO `Property`
(`Property`.`Property`, `Property`.`Value`) VALUES ('VDD_HIDE_COMPONENTS', '1')");
database.GenerateTransform(origDatabase, transform);
database.CreateTransformSummaryInfo(origDatabase, transform,
TransformErrors.None, TransformValidations.None);
}
File.Delete(temp);
}
}
}
}