本文整理汇总了C#中Project.IsSupported方法的典型用法代码示例。如果您正苦于以下问题:C# Project.IsSupported方法的具体用法?C# Project.IsSupported怎么用?C# Project.IsSupported使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project.IsSupported方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: AddProjectToCache
private void AddProjectToCache(Project project)
{
if (!project.IsSupported())
{
return;
}
ProjectName oldProjectName;
_projectCache.TryGetProjectNameByShortName(project.Name, out oldProjectName);
ProjectName newProjectName = _projectCache.AddProject(project);
if (String.IsNullOrEmpty(DefaultProjectName) ||
newProjectName.ShortName.Equals(DefaultProjectName, StringComparison.OrdinalIgnoreCase))
{
DefaultProjectName = oldProjectName != null ?
oldProjectName.CustomUniqueName :
newProjectName.ShortName;
}
}
示例4: OnProjectAdded
private void OnProjectAdded(Project project)
{
if (project.IsSupported() && !project.IsParentProjectExplicitlyUnsupported())
{
EnsureProjectCache();
AddProjectToCache(project);
if (ProjectAdded != null)
{
ProjectAdded(this, new ProjectEventArgs(project));
}
}
}
示例5: OnProjectRenamed
private void OnProjectRenamed(Project project, string oldName)
{
if (!String.IsNullOrEmpty(oldName))
{
EnsureProjectCache();
if (project.IsSupported())
{
RemoveProjectFromCache(oldName);
AddProjectToCache(project);
}
else if (project.IsSolutionFolder())
{
// In the case where a solution directory was changed, project FullNames are unchanged.
// We only need to invalidate the projects under the current tree so as to sync the CustomUniqueNames.
foreach (var item in project.GetSupportedChildProjects())
{
RemoveProjectFromCache(item.FullName);
AddProjectToCache(item);
}
}
}
}
示例6: 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));
}
}
示例7: OnProjectAdded
private void OnProjectAdded(Project project)
{
if (project.IsSupported()) {
EnsureProjectCache();
AddProjectToCache(project);
}
}