本文整理汇总了C#中ITextBuffer.GetFilenameExtension方法的典型用法代码示例。如果您正苦于以下问题:C# ITextBuffer.GetFilenameExtension方法的具体用法?C# ITextBuffer.GetFilenameExtension怎么用?C# ITextBuffer.GetFilenameExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITextBuffer
的用法示例。
在下文中一共展示了ITextBuffer.GetFilenameExtension方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetConfiguration
//=====================================================================
/// <summary>
/// Get the configuration settings for the specified buffer
/// </summary>
/// <param name="buffer">The buffer for which to get the configuration settings</param>
/// <returns>The spell checker configuration settings for the buffer or null if one is not provided or
/// is disabled for the given buffer.</returns>
public SpellCheckerConfiguration GetConfiguration(ITextBuffer buffer)
{
SpellCheckerConfiguration config = null;
bool isDisabled = false;
// If not given a buffer or already checked for and found to be disabled, don't go any further
if(buffer != null && !buffer.Properties.TryGetProperty(SpellCheckerDisabledKey, out isDisabled) &&
!buffer.Properties.TryGetProperty(typeof(SpellCheckerConfiguration), out config))
{
// Generate the configuration settings unique to the file
config = this.GenerateConfiguration(buffer);
if(!config.SpellCheckAsYouType || config.IsExcludedByExtension(buffer.GetFilenameExtension()))
{
// Mark it as disabled so that we don't have to check again
buffer.Properties[SpellCheckerDisabledKey] = true;
config = null;
}
else
buffer.Properties[typeof(SpellCheckerConfiguration)] = config;
}
return config;
}