本文整理汇总了C#中ILanguage类的典型用法代码示例。如果您正苦于以下问题:C# ILanguage类的具体用法?C# ILanguage怎么用?C# ILanguage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ILanguage类属于命名空间,在下文中一共展示了ILanguage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RaceGen
public RaceGen(List<IMythology> mythologies, ILanguage commonTongue)
{
CommonTongue = commonTongue;
Mythologies = mythologies;
Random = new Random(Guid.NewGuid().GetHashCode());
Names = new NameGen();
}
开发者ID:AsheDev,项目名称:WorldGenerator,代码行数:7,代码来源:RaceGen.cs
示例2: BaseLanguageWriter
public BaseLanguageWriter(ILanguage language, IFormatter formatter, IExceptionFormatter exceptionFormatter, bool writeExceptionsAsComments)
{
this.Language = language;
this.formatter = formatter;
this.exceptionFormatter = exceptionFormatter;
this.WriteExceptionsAsComments = writeExceptionsAsComments;
}
开发者ID:saravanaram,项目名称:JustDecompileEngine,代码行数:7,代码来源:BaseLanguageWriter.cs
示例3: RunInternal
protected BlockStatement RunInternal(MethodBody body, BlockStatement block, ILanguage language)
{
try
{
if (body.Instructions.Count != 0 || body.Method.IsJustDecompileGenerated)
{
foreach (IDecompilationStep step in steps)
{
if (language != null && language.IsStopped)
{
break;
}
block = step.Process(Context, block);
}
}
}
finally
{
if (Context.MethodContext.IsMethodBodyChanged)
{
body.Method.RefreshBody();
}
}
return block;
}
开发者ID:is00hcw,项目名称:JustDecompileEngine,代码行数:27,代码来源:DecompilationPipeline.cs
示例4: AddDictionaryItem
public void AddDictionaryItem(string resourceName, string defaultValue, ILanguage language)
{
var arr = resourceName.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
if (arr.Length == 0)
return;
if (arr.Length == 1)
{
SetDictionaryValue(resourceName, defaultValue, language);
return;
}
var parentName = string.Join(".", arr.Take(arr.Length - 1));
if (!_localizationService.DictionaryItemExists(parentName))
{
AddDictionaryItem(parentName, "", language);
}
var parentDic = _localizationService.GetDictionaryItemByKey(parentName);
var dicItem = new DictionaryItem(resourceName);
dicItem.ParentId = parentDic.Key;
dicItem.Translations = new List<IDictionaryTranslation>
{
new DictionaryTranslation(language, defaultValue)
};
_localizationService.Save(dicItem);
}
开发者ID:bgadiel,项目名称:tt,代码行数:27,代码来源:IDictionaryService.cs
示例5: TestWinRTProjectBuilder
public TestWinRTProjectBuilder(string assemblyPath, AssemblyDefinition assembly,
Dictionary<ModuleDefinition, Mono.Collections.Generic.Collection<TypeDefinition>> userDefinedTypes,
Dictionary<ModuleDefinition, Mono.Collections.Generic.Collection<Resource>> resources,
string targetPath, ILanguage language, IDecompilationPreferences preferences, VisualStudioVersion visualStudioVersion, ProjectGenerationSettings projectGenerationSettings = null)
: base(assemblyPath, assembly, userDefinedTypes, resources, targetPath, language, preferences, NoCacheAssemblyInfoService.Instance, visualStudioVersion, projectGenerationSettings)
{
}
开发者ID:Feng2012,项目名称:JustDecompileEngine,代码行数:7,代码来源:TestWinRTProjectBuilder.cs
示例6: Process
/// <summary>
/// 处理过程方法
/// </summary>
/// <param name="code">输入的代码</param>
/// <param name="lang">指定的语言</param>
/// <returns>返回高亮的代码片段</returns>
public static List<CodePiece> Process(string code, ILanguage lang)
{
var regexes = lang.Regexes.Keys.ToArray();
var matches = new Match[regexes.Length];
int index = 0;
var codePieces = new List<CodePiece>();
while (index < code.Length)
{
int i = 0;
for (; i < matches.Length; i++)
{
// 是否需要匹配
if (matches[i] != null && matches[i].Index >= index)
continue;
matches[i] = regexes[i].Match(code, index);
}
// 取最前的匹配
i = GetFirstMatch(matches);
if (i == -1)
break;
// 添加到代码片段
codePieces.Add(
new CodePiece(lang.Regexes[regexes[i]], matches[i])
);
// 更新Index,继续迭代
index = matches[i].Index + matches[i].Length;
}
return codePieces;
}
开发者ID:wcavell,项目名称:ubb-highlight-code-editor,代码行数:41,代码来源:Highlighter.cs
示例7: ImportItem
public virtual Projects.Items.Item ImportItem(IProject project, Data.Items.Item item, ILanguage language, [ItemNotNull] IEnumerable<string> excludedFields)
{
var itemBuilder = new ItemBuilder(Factory)
{
DatabaseName = item.Database.Name,
Guid = item.ID.ToString(),
ItemName = item.Name,
TemplateIdOrPath = item.Template.InnerItem.Paths.Path,
ItemIdOrPath = item.Paths.Path
};
var versions = item.Versions.GetVersions(true);
var sharedFields = item.Fields.Where(f => f.Shared && !excludedFields.Contains(f.Name, StringComparer.OrdinalIgnoreCase) && !f.ContainsStandardValue && !string.IsNullOrEmpty(f.Value)).ToList();
var unversionedFields = versions.SelectMany(i => i.Fields.Where(f => !f.Shared && f.Unversioned && !excludedFields.Contains(f.Name, StringComparer.OrdinalIgnoreCase) && !f.ContainsStandardValue && !string.IsNullOrEmpty(f.Value))).ToList();
var versionedFields = versions.SelectMany(i => i.Fields.Where(f => !f.Shared && !f.Unversioned && !excludedFields.Contains(f.Name, StringComparer.OrdinalIgnoreCase) && !f.ContainsStandardValue && !string.IsNullOrEmpty(f.Value))).ToList();
// shared fields
foreach (var field in sharedFields.OrderBy(f => f.Name))
{
var value = ImportFieldValue(field, item, language);
var fieldBuilder = new FieldBuilder(Factory)
{
FieldName = field.Name,
Value = value
};
itemBuilder.Fields.Add(fieldBuilder);
}
// unversioned fields
foreach (var field in unversionedFields.OrderBy(f => f.Name))
{
var value = ImportFieldValue(field, item, language);
var fieldBuilder = new FieldBuilder(Factory)
{
FieldName = field.Name,
Value = value,
Language = field.Language.Name
};
itemBuilder.Fields.Add(fieldBuilder);
}
// versioned fields
foreach (var field in versionedFields.OrderBy(f => f.Name))
{
var value = ImportFieldValue(field, item, language);
var fieldBuilder = new FieldBuilder(Factory)
{
FieldName = field.Name,
Value = value,
Language = field.Language.Name,
Version = field.Item.Version.Number
};
itemBuilder.Fields.Add(fieldBuilder);
}
return itemBuilder.Build(project, TextNode.Empty);
}
开发者ID:pveller,项目名称:Sitecore.Pathfinder,代码行数:60,代码来源:ItemImporterService.cs
示例8: FormatAndColorize
protected virtual string FormatAndColorize(string value, ILanguage language = null)
{
var output = new StringBuilder();
string[] sz = value.Split(new[] { "\n" }, StringSplitOptions.None);
List<string> ls = new List<string>();
foreach (string s in sz)
{
if (!s.StartsWith(CodeBlockMarker))
ls.Add(s);
}
//foreach (var line in value.Split(new[] { "\n" }, StringSplitOptions.None).Where(s => !s.StartsWith(CodeBlockMarker)))
foreach (var line in ls)
{
if(language == null)
output.Append(new string(' ', 4));
if(line == "\n")
output.AppendLine();
else
output.AppendLine(line);
}
ls.Clear();
ls = null;
return language != null
? _syntaxHighlighter.Colorize(output.ToString().Trim(), language)
: output.ToString();
}
开发者ID:ststeiger,项目名称:MarkdownReaderAndWriter,代码行数:33,代码来源:Tranformers.cs
示例9: AddCustomTranslations
public void AddCustomTranslations(ILanguage sourceLanguage, ILanguage destLanguage, IDictionary<string,string>customTranslations)
{
if (sourceLanguage == null) { throw new ArgumentNullException("soureLanguage"); }
if (destLanguage == null) { throw new ArgumentNullException("destLanguage"); }
if (customTranslations == null) { throw new ArgumentNullException("customTranslations"); }
// TODO: This could be done Async
IList<BingTranslatorService.Translation> translationList = new List<BingTranslatorService.Translation>();
foreach (string key in customTranslations.Keys) {
if (!string.IsNullOrWhiteSpace(key)) {
BingTranslatorService.Translation translation = new BingTranslatorService.Translation();
translation.OriginalText = key;
translation.TranslatedText = customTranslations[key];
// make it less than 5 because that is the max value for machine translations
translation.Rating = this.CustomTranslationRating;
translation.RatingSpecified = true;
translation.Sequence = 0;
translation.SequenceSpecified = true;
translationList.Add(translation);
}
}
// TODO: We should batch these into 100 because according to http://msdn.microsoft.com/en-us/library/ff512409.aspx that is the limit
using (BingTranslatorService.SoapService client = new BingTranslatorService.SoapService()) {
client.AddTranslationArray(this.ApiKey, translationList.ToArray(), sourceLanguage.Language, destLanguage.Language, this.TranslateOptions);
}
}
开发者ID:sayedihashimi,项目名称:locan,代码行数:29,代码来源:BingLocanTranslator.cs
示例10: DecompileMethod
private string DecompileMethod(MethodDefinition definition, ILanguage language)
{
var str = new StringWriter();
var writer = language.GetWriter(new PlainTextFormatter(str));
writer.Write (definition);
return str.ToString ();
}
开发者ID:pusp,项目名称:o2platform,代码行数:7,代码来源:DecompilationTestFixture.cs
示例11: Load
public void Load(ILanguage language)
{
Guard.ArgNotNull(language, "language");
if (string.IsNullOrEmpty(language.Id))
throw new ArgumentException("The language identifier must not be null or empty.", "language");
lock (loadLock)
{
loadedLanguages[language.Id] = language;
}
/*
loadLock.EnterWriteLock();
try
{
loadedLanguages[language.Id] = language;
}
finally
{
loadLock.ExitWriteLock();
}
*/
}
开发者ID:ststeiger,项目名称:MarkdownReaderAndWriter,代码行数:25,代码来源:LanguageRepository.cs
示例12: DefaultFilePathsAnalyzer
public DefaultFilePathsAnalyzer(Dictionary<ModuleDefinition, Mono.Collections.Generic.Collection<TypeDefinition>> userDefinedTypes,
Dictionary<ModuleDefinition, Mono.Collections.Generic.Collection<Resource>> resources, ILanguage language)
{
this.userDefinedTypes = userDefinedTypes;
this.resources = resources;
this.sourceExtension = language.VSCodeFileExtension;
}
开发者ID:juancarlosbaezpozos,项目名称:JustDecompileEngine,代码行数:7,代码来源:DefaultFilePathsAnalyzer.cs
示例13: WinRTSolutionWriter
internal WinRTSolutionWriter(AssemblyDefinition assembly, TargetPlatform targetPlatform, string targetDir, string solutionFileName,
Dictionary<ModuleDefinition, string> modulesProjectsRelativePaths, Dictionary<ModuleDefinition, Guid> modulesProjectsGuids,
VisualStudioVersion visualStudioVersion, ILanguage language, IEnumerable<string> platforms)
: base(assembly, targetPlatform, targetDir, solutionFileName, modulesProjectsRelativePaths, modulesProjectsGuids, visualStudioVersion, language)
{
this.platforms = platforms;
}
开发者ID:juancarlosbaezpozos,项目名称:JustDecompileEngine,代码行数:7,代码来源:WinRTSolutionWriter.cs
示例14: SolutionWriter
internal SolutionWriter(AssemblyDefinition assembly, TargetPlatform targetPlatform, string targetDir, string solutionFileName,
Dictionary<ModuleDefinition, string> modulesProjectsRelativePaths, Dictionary<ModuleDefinition, Guid> modulesProjectsGuids,
VisualStudioVersion visualStudioVersion, ILanguage language)
{
this.assembly = assembly;
this.targetPlatform = targetPlatform;
this.targetDir = targetDir;
this.solutionFileName = solutionFileName;
this.modulesProjectsRelativePaths = modulesProjectsRelativePaths;
this.modulesProjectsGuids = modulesProjectsGuids;
if (language is ICSharp)
{
this.languageGuid = new Guid(WinRTProjectBuilder.CSharpGUID);
}
else if (language is IVisualBasic)
{
this.languageGuid = new Guid(WinRTProjectBuilder.VisualBasicGUID);
}
else
{
throw new NotSupportedException();
}
this.visualStudioVersion = visualStudioVersion;
}
开发者ID:Feng2012,项目名称:JustDecompileEngine,代码行数:25,代码来源:SolutionWriter.cs
示例15: ChangeLanguage
/// <summary>
/// Changes the language.
/// </summary>
/// <param name="Language">The language.</param>
public void ChangeLanguage(ILanguage Language)
{
foreach (var item in Language.GetTranslationDictionary())
{
var itemKey = item.Key;
var itemValue = item.Value;
var menuItem = Variables.Menu.Item(itemKey);
try
{
if (menuItem != null)
{
menuItem.DisplayName = itemValue;
}
else
{
LogHelper.AddToLog(new LogItem("Language_Module", "Could Not Translate: "+ itemKey + " with " + itemValue, LogSeverity.Warning));
}
}
catch (Exception e)
{
LogHelper.AddToLog(new LogItem("Language_Module", e, LogSeverity.Warning));
}
}
}
开发者ID:luizssn,项目名称:LeagueSharp,代码行数:29,代码来源:LanguageAdaptor.cs
示例16: ToolTipContentCreatorContext
public ToolTipContentCreatorContext(IImageManager imageManager, IDotNetImageManager dotNetImageManager, ILanguage language, ICodeToolTipSettings codeToolTipSettings)
{
this.imageManager = imageManager;
this.dotNetImageManager = dotNetImageManager;
this.language = language;
this.codeToolTipSettings = codeToolTipSettings;
}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:7,代码来源:ToolTipContentCreatorContext.cs
示例17: Translation
public Translation(ILanguage sourceLang, ILanguage destLanguage, string stringToTranslate,string translatedString)
{
this.SourceLanguage = sourceLang;
this.DestLanguage = destLanguage;
this.StringToTranslate = stringToTranslate;
this.TrnaslatedString = translatedString;
}
开发者ID:sayedihashimi,项目名称:locan,代码行数:7,代码来源:Translation.cs
示例18: GetWriterContext
public override WriterContext GetWriterContext(IMemberDefinition member, ILanguage language)
{
TypeDefinition type = Utilities.GetDeclaringTypeOrSelf(member);
Dictionary<FieldDefinition, PropertyDefinition> fieldToPropertyMap = type.GetFieldToPropertyMap(language);
IEnumerable<FieldDefinition> propertyFields = fieldToPropertyMap.Keys;
HashSet<PropertyDefinition> autoImplementedProperties = new HashSet<PropertyDefinition>(fieldToPropertyMap.Values);
HashSet<EventDefinition> autoImplementedEvents = GetAutoImplementedEvents(type);
TypeSpecificContext typeContext = new TypeSpecificContext(type) { AutoImplementedProperties = autoImplementedProperties, AutoImplementedEvents = autoImplementedEvents };
TypeDefinition declaringType = Utilities.GetDeclaringTypeOrSelf(member);
Dictionary<string, string> renamedNamespacesMap = new Dictionary<string, string>();
MemberRenamingData memberReanmingData = GetMemberRenamingData(declaringType.Module, language);
ModuleSpecificContext moduleContext =
new ModuleSpecificContext(declaringType.Module, new List<string>(), new Dictionary<string, List<string>>(), new Dictionary<string, HashSet<string>>(),
renamedNamespacesMap, memberReanmingData.RenamedMembers, memberReanmingData.RenamedMembersMap);
return new WriterContext(
new AssemblySpecificContext(),
moduleContext,
typeContext,
new Dictionary<string, MethodSpecificContext>(),
GetDecompiledStatements(member, language, propertyFields));
}
开发者ID:juancarlosbaezpozos,项目名称:JustDecompileEngine,代码行数:27,代码来源:TypeDeclarationsWriterContextService.cs
示例19: CanShow
public static bool CanShow(IMemberRef member, ILanguage language) {
var property = member as PropertyDef;
if (property == null)
return false;
return !language.ShowMember(property.GetMethod ?? property.SetMethod)
|| PropertyOverridesNode.CanShow(property);
}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:8,代码来源:PropertyNode.cs
示例20: WinRTProjectBuilder
public WinRTProjectBuilder(string assemblyPath, string targetPath, ILanguage language,
IDecompilationPreferences preferences, IFileGenerationNotifier notifier,
IAssemblyInfoService assemblyInfoService, VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2010,
ProjectGenerationSettings projectGenerationSettings = null)
: base(assemblyPath, targetPath, language, null, preferences, notifier, assemblyInfoService, visualStudioVersion, projectGenerationSettings)
{
Initialize();
}
开发者ID:saravanaram,项目名称:JustDecompileEngine,代码行数:8,代码来源:WinRTProjectBuilder.cs
注:本文中的ILanguage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论