本文整理汇总了C#中Loader.LoadAppDistributive方法的典型用法代码示例。如果您正苦于以下问题:C# Loader.LoadAppDistributive方法的具体用法?C# Loader.LoadAppDistributive怎么用?C# Loader.LoadAppDistributive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader.LoadAppDistributive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartInstaller
static void StartInstaller(DataRow row, Hashtable args)
{
string applicationName = Utils.GetDbString(row["ApplicationName"]);
string componentName = Utils.GetDbString(row["ComponentName"]);
string componentCode = Utils.GetDbString(row["ComponentCode"]);
string componentDescription = Utils.GetDbString(row["ComponentDescription"]);
string component = Utils.GetDbString(row["Component"]);
string version = Utils.GetDbString(row["Version"]);
string fileName = row["FullFilePath"].ToString();
string installerPath = Utils.GetDbString(row["InstallerPath"]);
string installerType = Utils.GetDbString(row["InstallerType"]);
try
{
// download installer
var loader = new Loader(fileName);
//
loader.OperationCompleted += new EventHandler<EventArgs>((object sender, EventArgs e) =>
{
Log.WriteInfo("Download completed!");
//
string tmpFolder = FileUtils.GetTempDirectory();
string path = Path.Combine(tmpFolder, installerPath);
//Update();
string method = "Install";
Log.WriteStart(string.Format("Running installer {0}.{1} from {2}", installerType, method, path));
//prepare installer args
args[Global.Parameters.ComponentName] = componentName;
args[Global.Parameters.ApplicationName] = applicationName;
args[Global.Parameters.ComponentCode] = componentCode;
args[Global.Parameters.ComponentDescription] = componentDescription;
args[Global.Parameters.Version] = version;
args[Global.Parameters.InstallerFolder] = tmpFolder;
args[Global.Parameters.InstallerPath] = installerPath;
args[Global.Parameters.InstallerType] = installerType;
args[Global.Parameters.Installer] = Path.GetFileName(fileName);
args[Global.Parameters.BaseDirectory] = FileUtils.GetCurrentDirectory();
args[Global.Parameters.IISVersion] = Global.IISVersion;
args[Global.Parameters.ShellVersion] = AssemblyLoader.GetShellVersion();
args[Global.Parameters.ShellMode] = Global.SilentInstallerShell;
args[Global.Parameters.SetupXml] = String.Empty;
// Run the installer
var res = AssemblyLoader.Execute(path, installerType, method, new object[] { args });
Log.WriteInfo(string.Format("Installer returned {0}", res));
Log.WriteEnd("Installer finished");
// Remove temporary directory
FileUtils.DeleteTempDirectory();
});
loader.OperationFailed += new EventHandler<LoaderEventArgs<Exception>>(loader_OperationFailed);
loader.ProgressChanged += new EventHandler<LoaderEventArgs<int>>(loader_ProgressChanged);
loader.StatusChanged += new EventHandler<LoaderEventArgs<string>>(loader_StatusChanged);
//
loader.LoadAppDistributive();
}
catch (Exception ex)
{
Log.WriteError("Installer error", ex);
//AppContext.AppForm.ShowError(ex);
}
finally
{
//this.componentSettingsXml = null;
//this.componentCode = null;
}
}