本文整理汇总了C#中System.Collections.Dictionary.LoadFromXmlFile方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.LoadFromXmlFile方法的具体用法?C# Dictionary.LoadFromXmlFile怎么用?C# Dictionary.LoadFromXmlFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Dictionary
的用法示例。
在下文中一共展示了Dictionary.LoadFromXmlFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParameterReplacements
internal static Dictionary<int, List<ParameterReplaceAction>> GetParameterReplacements(FriendlyUrlSettings settings, int portalId, ref List<string> messages)
{
string replaceActionKey = "replaceActions:" + portalId.ToString();
var replaceActions = (Dictionary<int, List<ParameterReplaceAction>>)DataCache.GetCache(replaceActionKey);
if (messages == null)
{
messages = new List<string>();
}
if (replaceActions == null)
{
replaceActions = new Dictionary<int, List<ParameterReplaceAction>>();
try
{
bool portalSpecific;
string fileName = FindFriendlyUrlParmsConfigFilePath(portalId, out portalSpecific);
if (!string.IsNullOrEmpty(fileName))
{
replaceActions.LoadFromXmlFile(fileName, portalId, portalSpecific, ref messages);
}
CacheDependency cacheDependency = null;
if (replaceActions.Count > 0)
{
//only set filename dependency if file exists
cacheDependency = new CacheDependency(fileName);
}
DateTime expiration = DateTime.MaxValue;
DataCache.SetCache(replaceActionKey, replaceActions, new DNNCacheDependency(cacheDependency), expiration, settings.CacheTime);
}
catch (Exception ex)
{
Services.Exceptions.Exceptions.LogException(ex);
messages.Add("Exception: " + ex.Message + "\n" + ex.StackTrace);
}
}
return replaceActions;
}
示例2: GetParameterRewrites
internal static Dictionary<int, SharedList<ParameterRewriteAction>> GetParameterRewrites(int portalId, ref List<string> messages, Guid parentTraceId)
{
string rewriteActionKey = string.Format(RewriteActionsKey, portalId.ToString());
if (messages == null)
{
messages = new List<string>();
}
var rewriteActions = (Dictionary<int, SharedList<ParameterRewriteAction>>)DataCache.GetCache(rewriteActionKey);
if (rewriteActions == null)
{
try
{
rewriteActions = new Dictionary<int, SharedList<ParameterRewriteAction>>();
bool portalSpecific;
//807 : new change to look for portal rule files in portal specific locations
string filename = FindFriendlyUrlParmsConfigFilePath(portalId, out portalSpecific);
if (!string.IsNullOrEmpty(filename))
{
rewriteActions.LoadFromXmlFile(filename, portalId, portalSpecific, ref messages);
}
CacheDependency fileDependency = null;
if (File.Exists(filename))
{
fileDependency = new CacheDependency(filename);
}
DataCache.SetCache(rewriteActionKey, rewriteActions, new DNNCacheDependency(fileDependency));
}
catch (Exception ex)
{
Services.Exceptions.Exceptions.LogException(ex);
messages.Add("Exception: " + ex.Message + "\n" + ex.StackTrace);
}
}
return rewriteActions;
}
示例3: GetParameterRedirects
internal static Dictionary<int, List<ParameterRedirectAction>> GetParameterRedirects(FriendlyUrlSettings settings, int portalId, ref List<string> messages)
{
string redirectActionKey = string.Format(RedirectActionsKey, portalId); //cached one portal at a time
if (messages == null)
{
messages = new List<string>();
}
var redirectActions = (Dictionary<int, List<ParameterRedirectAction>>)DataCache.GetCache(redirectActionKey);
if (redirectActions == null)
{
try
{
redirectActions = new Dictionary<int, List<ParameterRedirectAction>>();
//807 : look for portal specific files
bool portalSpecific;
string fileName = FindFriendlyUrlParmsConfigFilePath(portalId, out portalSpecific);
if (fileName != "")
{
redirectActions.LoadFromXmlFile(fileName, portalId, portalSpecific, ref messages);
}
CacheDependency fileDependency = null;
if (File.Exists(fileName))
{
fileDependency = new CacheDependency(fileName);
}
if (settings != null)
{
DateTime absoluteExpiration = DateTime.Now.Add(settings.CacheTime);
DataCache.SetCache(redirectActionKey, redirectActions, new DNNCacheDependency(fileDependency), absoluteExpiration, Cache.NoSlidingExpiration);
}
else
{
DataCache.SetCache(redirectActionKey, redirectActions, new DNNCacheDependency(fileDependency));
}
}
catch (Exception ex)
{
//log the exception
Services.Exceptions.Exceptions.LogException(ex);
messages.Add("Exception: " + ex.Message + "\n" + ex.StackTrace);
}
}
return redirectActions;
}