本文整理汇总了C#中SIM.Instances.Instance.GetWebConfig方法的典型用法代码示例。如果您正苦于以下问题:C# Instance.GetWebConfig方法的具体用法?C# Instance.GetWebConfig怎么用?C# Instance.GetWebConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIM.Instances.Instance
的用法示例。
在下文中一共展示了Instance.GetWebConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessActions
private static void ProcessActions(Instance instance, SqlConnectionStringBuilder connectionString,
IPipelineController controller, Product module, Dictionary<string, string> variables,
XmlElement actionsElement)
{
// made replacement
actionsElement.InnerXml = variables.Aggregate(actionsElement.InnerXml,
(result, variable) => result.Replace(variable.Key, variable.Value)).Replace("{InstanceName}", instance.Name);
var actions = actionsElement.ChildNodes.OfType<XmlElement>();
var webRootPath = instance.WebRootPath;
List<string> ignoreCommands = new List<string>();
foreach (XmlElement action in actions.Where(a => a.Name.EqualsIgnoreCase("patch")))
{
var commandText = action.GetAttribute("command").EmptyToNull().IsNotNull("The command attribute of <patch /> element must exist and must not be empty");
var actionText = action.GetAttribute("action");
if (actionText == "delete")
{
ignoreCommands.Add(commandText);
}
}
// give extract more priority
if (actions.Any(xml => xml.Name.EqualsIgnoreCase("extract")) && !ignoreCommands.Contains("extract"))
{
FileSystem.FileSystem.Local.Zip.UnpackZip(module.PackagePath, instance.WebRootPath);
}
foreach (XmlElement action in actions)
{
var children = action.ChildNodes.OfType<XmlElement>();
string actionName = action.Name;
if (ignoreCommands.Contains(actionName))
{
continue;
}
switch (actionName)
{
case "extract":
{
// give extract more priority
// FileSystem.Instance.UnpackZip(module.PackagePath, instance.GetRootPath(webRootPath));
break;
}
case "config":
{
string configPath = action.GetAttribute("path");
try
{
XmlDocumentEx config = !string.IsNullOrEmpty(configPath)
? XmlDocumentEx.LoadFile(Path.Combine(webRootPath, configPath))
: instance.GetWebConfig(webRootPath);
PerformConfigChanges(instance, children, module, config, variables);
}
catch (XmlDocumentEx.FileIsMissingException ex)
{
Log.Warn(
"The path attribute is specified (path: {0}) but the file doesn't exist".FormatWith(configPath),
typeof(ConfigurationActions), ex);
}
break;
}
case "databases":
{
AddDatabase(instance, children, module, connectionString, controller);
break;
}
case "editfile":
{
EditFile(action.GetAttribute("path"), children, instance, variables);
break;
}
case "setRestrictingPlaceholders":
{
InstanceHelper.StartInstance(instance);
SetRestrictingPlaceholders(action.GetAttribute("names"), GetWebServiceUrl(instance));
break;
}
case "custom":
{
var typeName = action.GetAttribute("type").EmptyToNull().IsNotNull("The type attribute is missing in the <custom> install action");
var obj = (IPackageInstallActions)ReflectionUtil.CreateObject(typeName);
obj.Execute(instance, module);
break;
}
case "sql":
{
var db = action.GetAttribute("database");
var file = action.GetAttribute("file").Replace("$(data)", instance.DataFolderPath).Replace("$(website)", instance.WebRootPath);
if (!string.IsNullOrEmpty(file))
{
Assert.IsTrue(File.Exists(file), string.Format("The {0} file does not exist", file));
}
//.........这里部分代码省略.........
示例2: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
if (!this.Showconfig && !this.WebConfigResult)
{
RunConfigApp("Sitecore.ConfigBuilder.Tool.exe", mainWindow, instance != null ? Path.Combine(instance.WebRootPath, "web.config") : null);
return;
}
var path = instance.GetWebConfig().FilePath;
if (this.Showconfig)
{
path = Path.Combine(Path.GetDirectoryName(path), "showconfig.xml");
}
else if (this.WebConfigResult)
{
path += ".result.xml";
}
else
{
Assert.IsTrue(false, "Impossible");
}
if (this.Normalize)
{
path += ".normalized.xml";
}
if (this.Showconfig)
{
instance.GetShowconfig(this.Normalize).Save(path);
}
else if (this.WebConfigResult)
{
instance.GetWebResultConfig(this.Normalize).Save(path);
}
else
{
Assert.IsTrue(false, "Impossible");
}
WindowHelper.OpenFile(path);
}