本文整理汇总了C#中Project.GetIdentifier方法的典型用法代码示例。如果您正苦于以下问题:C# Project.GetIdentifier方法的具体用法?C# Project.GetIdentifier怎么用?C# Project.GetIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project.GetIdentifier方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
public static ProjectSettings Get(Project project)
{
if (!project.IsSupported())
return null;
string key = project.GetIdentifier();
return settings.ValueOrNull(key);
}
示例2: Create
public static ProjectSettings Create(Project project)
{
if (!project.IsSupported())
return null;
string key = project.GetIdentifier();
if (!settings.ContainsKey(key))
{
string fullPath = project.GetSettingsFilePath();
ProjectSettings projectSettings = ProjectSettings.Load(fullPath);
settings.Add(key, projectSettings);
}
return settings[key];
}
示例3: UpdateCache
private static void UpdateCache(Project project)
{
if (!project.IsSupported())
return;
// check if the settings file exists
string filePath = project.GetSettingsFilePath();
try
{
if (File.Exists(filePath))
{
string projectId = project.GetIdentifier();
ProjectSettings projectSettings = ProjectSettings.Load(filePath);
settings.Remove(projectId);
settings.Add(projectId, projectSettings);
Logger.Log(" -> Settings file loaded for project '{0}'", project.Name);
}
else
{
Logger.Debug(" -> Project '{0}': No settings file exists for publishing", project.Name);
}
}
catch (XmlSerializationException ex)
{
Logger.Log(Logger.Divider);
Logger.Log(ex, "Error in publish settings file '{0}'", Path.Combine(SettingsStore.SettingsFolder, SettingsStore.SettingsFileName));
Logger.Log(Logger.Divider);
MessageBox.Show(
"The publish settings file contains errors, please correct the errors manually and save the file." +
Environment.NewLine + Environment.NewLine +
"See the output window for more information.",
"Invalid Settings File",
MessageBoxButton.OK,
MessageBoxImage.Error);
}
catch (Exception ex)
{
Logger.Debug(ex, "Error in publish settings file '{0}'", Path.Combine(SettingsStore.SettingsFolder, SettingsStore.SettingsFileName));
}
}