当前位置: 首页>>代码示例>>C#>>正文


C# SupportedLanguage类代码示例

本文整理汇总了C#中SupportedLanguage的典型用法代码示例。如果您正苦于以下问题:C# SupportedLanguage类的具体用法?C# SupportedLanguage怎么用?C# SupportedLanguage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SupportedLanguage类属于命名空间,在下文中一共展示了SupportedLanguage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToLabel

 public static string ToLabel(SupportedLanguage supportedLanguage)
 {
     switch (supportedLanguage) {
         case SupportedLanguage.EnUS:
             return "LANGUAGE_US_ENGLISH";
         case SupportedLanguage.PtBR:
             return "LANGUAGE_BR_PORTUGUESE";
         case SupportedLanguage.EnGB:
             return "LANGUAGE_GB_ENGLISH";
         case SupportedLanguage.GeDE:
             return "LANGUAGE_DE_GERMAN";
         case SupportedLanguage.EsUS:
             return "LANGUAGE_US_SPANISH";
         case SupportedLanguage.EsLA:
             return "LANGUAGE_LA_SPANISH";
         case SupportedLanguage.FrFR:
             return "LANGUAGE_FR_FRENCH";
         case SupportedLanguage.ItIT:
             return "LANGUAGE_IT_ITALIAN";
         case SupportedLanguage.JaJP:
             return "LANGUAGE_JP_JAPANESE";
         case SupportedLanguage.ZhCN:
             return "LANGUAGE_CN_CHINESE";
     }
     return "NotSpecified";
 }
开发者ID:paulopine,项目名称:SharpSenses,代码行数:26,代码来源:SupportedLanguageMapper.cs

示例2: NRefactoryInsightWindowHandler

		public NRefactoryInsightWindowHandler(SupportedLanguage language)
		{
			this.language = language;
			if (language == SupportedLanguage.CSharp) {
				eofToken = CSTokens.EOF;
				commaToken = CSTokens.Comma;
				openParensToken = CSTokens.OpenParenthesis;
				closeParensToken = CSTokens.CloseParenthesis;
				openBracketToken = CSTokens.OpenSquareBracket;
				closeBracketToken = CSTokens.CloseSquareBracket;
				openBracesToken = CSTokens.OpenCurlyBrace;
				closeBracesToken = CSTokens.CloseCurlyBrace;
				statementEndToken = CSTokens.Semicolon;

				languageProperties = LanguageProperties.CSharp;
			} else {
				eofToken = VBTokens.EOF;
				commaToken = VBTokens.Comma;
				openParensToken = VBTokens.OpenParenthesis;
				closeParensToken = VBTokens.CloseParenthesis;
				openBracketToken = -1;
				closeBracketToken = -1;
				openBracesToken = VBTokens.OpenCurlyBrace;
				closeBracesToken = VBTokens.CloseCurlyBrace;
				statementEndToken = VBTokens.EOL;

				languageProperties = LanguageProperties.VBNet;
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:29,代码来源:NRefactoryInsightWindowHandler.cs

示例3: EnableRecognition

 public void EnableRecognition(SupportedLanguage language)
 {
     _language = language;
     _session = PXCMSession.CreateInstance();
     var audioSource = FindAudioSource();
     _session.CreateImpl(out _speechRecognition);
     for (int i = 0; ; i++) {
         PXCMSpeechRecognition.ProfileInfo profile;
         if (_speechRecognition.QueryProfile(i, out profile) != RealSenseCamera.NoError) {
             break;
         }
         var languageLabel = profile.language.ToString();
         SupportedLanguage sdkLanguage = SupportedLanguageMapper.FromString(languageLabel);
         if (sdkLanguage != SupportedLanguage.NotSpecified) {
             _recognitionProfiles.Add(sdkLanguage, profile);
         }
     }
     if (language == SupportedLanguage.NotSpecified) {
         language = _recognitionProfiles.Keys.First();
     }
     if (!_recognitionProfiles.ContainsKey(language)) {
         throw new LanguageNotSupportedException(language);
     }
     _speechRecognition.SetProfile(_recognitionProfiles[language]);
     _speechRecognition.SetDictation();
     _speechRecognition.StartRec(audioSource, _speechRecognitionHandler);
 }
开发者ID:paulopine,项目名称:SharpSenses,代码行数:27,代码来源:SpeechRecognition.cs

示例4: WatchInputBox

		public WatchInputBox(string text, string caption) : base()
		{
			InitializeComponent();
			
			// UI
			text = StringParser.Parse(text);
			this.Title = StringParser.Parse(caption);
			this.ConsolePanel.Content = console;

			if (ProjectService.CurrentProject == null)
				language = GetLanguageFromActiveViewContent();
			else
				language = GetLanguage(ProjectService.CurrentProject.Language);
			
			resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language.ToString()));
			
			switch (language) {
				case SupportedLanguage.CSharp:
					console.SetHighlighting("C#");
					break;
				case SupportedLanguage.VBNet:
					console.SetHighlighting("VBNET");
					break;
			}
			
			// get process
			this.Process = ((WindowsDebugger)DebuggerService.CurrentDebugger).DebuggedProcess;
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:28,代码来源:WatchInputBox.xaml.cs

示例5: NRefactoryCodeCompletionBinding

		protected NRefactoryCodeCompletionBinding(SupportedLanguage language)
		{
			this.language = language;
			if (language == SupportedLanguage.CSharp) {
				eofToken = CSTokens.EOF;
				commaToken = CSTokens.Comma;
				openParensToken = CSTokens.OpenParenthesis;
				closeParensToken = CSTokens.CloseParenthesis;
				openBracketToken = CSTokens.OpenSquareBracket;
				closeBracketToken = CSTokens.CloseSquareBracket;
				openBracesToken = CSTokens.OpenCurlyBrace;
				closeBracesToken = CSTokens.CloseCurlyBrace;
				
				languageProperties = LanguageProperties.CSharp;
			} else {
				eofToken = VBTokens.EOF;
				commaToken = VBTokens.Comma;
				openParensToken = VBTokens.OpenParenthesis;
				closeParensToken = VBTokens.CloseParenthesis;
				openBracketToken = -1;
				closeBracketToken = -1;
				openBracesToken = VBTokens.OpenCurlyBrace;
				closeBracesToken = VBTokens.CloseCurlyBrace;
				
				languageProperties = LanguageProperties.VBNet;
			}
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:27,代码来源:NRefactoryCodeCompletionBinding.cs

示例6: GetJsFileFromCodeSnippet

        public JsFile GetJsFileFromCodeSnippet(string codeSnippet, SupportedLanguage language)
        {
            var file = new JsFile();

            var snippetParser = new SnippetParser(language);

            var jsFile = new JsFile
            {
                FullPath = string.Empty
            };

            var parsedNode = snippetParser.Parse(codeSnippet);

            if (parsedNode.Children.Count > 0)
            {
                var visitor = new AstVisitor
                {
                    Model = jsFile
                };

                parsedNode.AcceptVisitor(visitor, null);

                file = visitor.Model;
                return file;
            }

            return null;
        }
开发者ID:chinaniit,项目名称:KnockoutGenerator,代码行数:28,代码来源:CodeGenerator.cs

示例7: GetJsFileFromCodeFile

        public JsFile GetJsFileFromCodeFile(string path, SupportedLanguage language)
        {
            TextReader textReader = File.OpenText(path);

            var file = new JsFile();

            using (var parser = ParserFactory.CreateParser(language, textReader))
            {
                var jsFile = new JsFile
                {
                    FullPath = path
                };

                parser.Parse();

                if (parser.Errors.Count <= 0)
                {
                    var visitor = new AstVisitor
                    {
                        Model = jsFile
                    };

                    parser.CompilationUnit.AcceptVisitor(visitor, null);

                    file = visitor.Model;
                    return file;
                }
            }

            return null;
        }
开发者ID:chinaniit,项目名称:KnockoutGenerator,代码行数:31,代码来源:CodeGenerator.cs

示例8: NRefactoryASTConvertVisitor

		public NRefactoryASTConvertVisitor(IProjectContent projectContent, SupportedLanguage language)
		{
			if (language == SupportedLanguage.VBNet)
				cu = new VBNetCompilationUnit(projectContent);
			else
				cu = new DefaultCompilationUnit(projectContent);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:NRefactoryASTConvertVisitor.cs

示例9: LoadOutputName

 internal static string LoadOutputName(XmlDocument doc, SupportedLanguage language)
 {
     var manager = CreateNamespaceManager(doc);
     string result = null;
     var assemblyNameElement = doc.SelectSingleNode(
         "msbuild:Project/msbuild:PropertyGroup/msbuild:AssemblyName", manager) as XmlElement;
     if (assemblyNameElement != null)
     {
         var fileName = assemblyNameElement.InnerText;
         var extension = ".jar";
         if (language != SupportedLanguage.Java)
         {
             extension = ".exe";
             var outputTypeElement = doc.SelectSingleNode(
                 "msbuild:Project/msbuild:PropertyGroup/msbuild:OutputType", manager) as XmlElement;
             if (outputTypeElement != null)
             {
                 var outputType = outputTypeElement.InnerText;
                 if (outputType == "Library")
                 {
                     extension = ".dll";
                 }
             }
         }
         result = fileName + extension;
     }
     return result;
 }
开发者ID:olivierdagenais,项目名称:softwareninjas,代码行数:28,代码来源:ProjectLoader.cs

示例10: Parse

		INode Parse(SupportedLanguage sourceLanguage, string sourceCode, out string error)
		{
			project = new DefaultProjectContent();
			project.ReferencedContents.AddRange(ReferencedContents);
			if (sourceLanguage == SupportedLanguage.VBNet) {
				project.Language = LanguageProperties.VBNet;
				project.DefaultImports = new DefaultUsing(project);
				project.DefaultImports.Usings.AddRange(DefaultImportsToAdd);
			} else {
				project.Language = LanguageProperties.CSharp;
			}
			SnippetParser parser = new SnippetParser(sourceLanguage);
			INode result = parser.Parse(sourceCode);
			error = parser.Errors.ErrorOutput;
			specials = parser.Specials;
			if (parser.Errors.Count != 0)
				return null;
			
			wasExpression = parser.SnippetType == SnippetType.Expression;
			if (wasExpression) {
				// Special case 'Expression': expressions may be replaced with other statements in the AST by the ConvertVisitor,
				// but we need to return a 'stable' node so that the correct transformed AST is returned.
				// Thus, we wrap any expressions into a statement block.
				result = MakeBlockFromExpression((Expression)result);
			}
			
			// now create a dummy compilation unit around the snippet result
			switch (parser.SnippetType) {
				case SnippetType.CompilationUnit:
					compilationUnit = (CompilationUnit)result;
					break;
				case SnippetType.Expression:
				case SnippetType.Statements:
					compilationUnit = MakeCompilationUnitFromTypeMembers(
						MakeMethodFromBlock(
							(BlockStatement)result
						));
					break;
				case SnippetType.TypeMembers:
					compilationUnit = MakeCompilationUnitFromTypeMembers(result.Children);
					break;
				default:
					throw new NotSupportedException("Unknown snippet type: " + parser.SnippetType);
			}
			
			// convert NRefactory CU in DOM CU
			NRefactoryASTConvertVisitor visitor = new NRefactoryASTConvertVisitor(project);
			visitor.VisitCompilationUnit(compilationUnit, null);
			visitor.Cu.FileName = sourceLanguage == SupportedLanguage.CSharp ? "a.cs" : "a.vb";
			
			// and register the compilation unit in the DOM
			foreach (IClass c in visitor.Cu.Classes) {
				project.AddClassToNamespaceList(c);
			}
			parseInfo = new ParseInformation();
			parseInfo.SetCompilationUnit(visitor.Cu);
			
			return result;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:59,代码来源:CodeSnippetConverter.cs

示例11: ChangeLanguage

        public static bool ChangeLanguage(SupportedLanguage language, params Form[] forms)
        {
            CultureInfo currentCulture;

            if (language == SupportedLanguage.Automatic)
            {
                currentCulture = CultureInfo.InstalledUICulture;
            }
            else
            {
                string cultureName;

                switch (language)
                {
                    default:
                    case SupportedLanguage.English:
                        cultureName = "en-US";
                        break;
                    case SupportedLanguage.German:
                        cultureName = "de-DE";
                        break;
                    case SupportedLanguage.French:
                        cultureName = "fr-FR";
                        break;
                    case SupportedLanguage.Hungarian:
                        cultureName = "hu-HU";
                        break;
                    case SupportedLanguage.Korean:
                        cultureName = "ko-KR";
                        break;
                    case SupportedLanguage.SimplifiedChinese:
                        cultureName = "zh-CN";
                        break;
                    case SupportedLanguage.Turkish:
                        cultureName = "tr-TR";
                        break;
                }

                currentCulture = CultureInfo.GetCultureInfo(cultureName);
            }

            if (!currentCulture.Equals(Thread.CurrentThread.CurrentUICulture))
            {
                Helpers.SetDefaultUICulture(currentCulture);
                DebugHelper.WriteLine("Language changed to: " + currentCulture.DisplayName);

                foreach (Form form in forms)
                {
                    ComponentResourceManager resources = new ComponentResourceManager(form.GetType());
                    ApplyResourceToControl(form, resources, currentCulture);
                    resources.ApplyResources(form, "$this", currentCulture);
                }

                return true;
            }

            return false;
        }
开发者ID:snakems,项目名称:ShareX,代码行数:58,代码来源:LanguageHelper.cs

示例12: ast

        public static IParser ast(this string csharpCodeOrFile,  SupportedLanguage language)
        {
            var codeToParse = (csharpCodeOrFile.fileExists()) ? csharpCodeOrFile.fileContents() : csharpCodeOrFile;

            var parser = ParserFactory.CreateParser(language, new StringReader(codeToParse));

            parser.Parse();
            return parser;
        }
开发者ID:SiGhTfOrbACQ,项目名称:O2.Platform.Projects,代码行数:9,代码来源:Parser_ExtensionMethods.cs

示例13: GetExtension

 private string GetExtension(SupportedLanguage lang)
 {
     if (lang == SupportedLanguage.CSharp)
         return "cs";
     else if (lang == SupportedLanguage.Java)
         return "java";
     else
         throw new NotSupportedException();
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:9,代码来源:TypeDictionary.cs

示例14: Project

 /// <summary>
 /// Initializes a new instance of <see cref="Project"/>, which is rooted at <paramref name="folder"/>
 /// and is called <paramref name="projectName"/>.
 /// </summary>
 /// 
 /// <param name="projectName">
 /// The name of the project.
 /// </param>
 /// 
 /// <param name="folder">
 /// The path to the project.  This folder should contain <c><paramref name="projectName"/>.csproj</c>.
 /// </param>
 /// 
 /// <param name="language">
 /// The programming language used by the source code inside the project.
 /// </param>
 /// 
 /// <param name="references">
 /// The files representing re-usable code libraries referenced by the project.
 /// </param>
 /// 
 /// <param name="outputName">
 /// The name of the file (assembly or JAR) that will be generated by the project.
 /// </param>
 public Project(string projectName, string folder, SupportedLanguage language, IList<FileInfo> references,
     string outputName)
 {
     _name = projectName;
     _folder = folder;
     _language = language;
     _references = references;
     _outputName = outputName;
 }
开发者ID:olivierdagenais,项目名称:softwareninjas,代码行数:33,代码来源:Project.cs

示例15: LookupTableVisitor

		public LookupTableVisitor(SupportedLanguage language)
		{
			this.language = language;
			if (language == SupportedLanguage.VBNet) {
				variables = new Dictionary<string, List<LocalLookupVariable>>(StringComparer.InvariantCultureIgnoreCase);
			} else {
				variables = new Dictionary<string, List<LocalLookupVariable>>(StringComparer.InvariantCulture);
			}
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:9,代码来源:LookupTableVisitor.cs


注:本文中的SupportedLanguage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。