• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CodeLanguage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Event

 public Event(Controller controller, BaseConstruct parentObject, CodeLanguage language, int nodeIndex)
     : base(controller)
 {
     ParentObject = parentObject;
     Language = language;
     Index = nodeIndex;
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:7,代码来源:Event.cs


示例2: CreateDifferenceListing

 public async Task<CodeWithDifference> CreateDifferenceListing(CodeLanguage language, Mutant mutant, MutationResult mutationResult)
 {
     _log.Debug("CreateDifferenceListing in object: " + ToString() + GetHashCode());
     try
     {
         
         var whiteCode = await VisualizeOriginalCode(language, mutant);
         var mutatedCode = await VisualizeMutatedCode(language, mutationResult);
         CodePair pair = new CodePair
         {
             OriginalCode = whiteCode,
             MutatedCode = mutatedCode
         };
         return _differenceCreator.GetDiff(language, pair.OriginalCode, pair.MutatedCode);
     }
     catch (Exception e)
     {
         _log.Error(e);
         return new CodeWithDifference
         {
             Code = "Exception occurred while decompiling: " + e,
             LineChanges = Enumerable.Empty<LineChange>().ToList()
         };
     }
 }
开发者ID:buchu73,项目名称:visualmutator,代码行数:25,代码来源:CodeVisualizer.cs


示例3: Read

 internal override void Read(NetIncomingMessage Message)
 {
     base.Read(Message);
     Language = (CodeLanguage)Enum.Parse(typeof(CodeLanguage), Message.ReadString());
     Location = (CodeLocation)Enum.Parse(typeof(CodeLocation), Message.ReadString());
     Source = Message.ReadString();
 }
开发者ID:CloneDeath,项目名称:FantasyScape,代码行数:7,代码来源:CodeFile.cs


示例4: CompileAndRun

        public static CompilerResults CompileAndRun(String source, CodeLanguage language = CodeLanguage.CSharp)
        {
            // Select the code provider based on the input file extension.
            var provider = language == CodeLanguage.CSharp ?
                CodeDomProvider.CreateProvider("CSharp") : CodeDomProvider.CreateProvider("VisualBasic");

            var cp = new CompilerParameters
            {
                GenerateExecutable = true,
                GenerateInMemory = true,
                TreatWarningsAsErrors = false
            };

            cp.ReferencedAssemblies.AddRange(refAssemblies);

            // Invoke compilation of the source code.
            CompilerResults cr = provider.CompileAssemblyFromSource(cp, source);
            CopyAssembly();

            if (cr.Errors.Count < 1)
            {
                var entry = cr.CompiledAssembly.GetTypes().Select(t => t.GetMethod("Main", BindingFlags.Static | BindingFlags.NonPublic))
                    .Single(m => m != null);

                entry.Invoke(null, new object[]{ null });
            }

            return cr;
        }
开发者ID:cooodd,项目名称:Research,代码行数:29,代码来源:Compiler.cs


示例5: Generate

        public void Generate()
        {
            _model = (Model) _propertyBag["Generic.Model"];
            
            if (_model.GenerateMonoRailProject && !String.IsNullOrEmpty(_model.MonoRailProjectName) && !String.IsNullOrEmpty(_model.MonoRailProjectPath))
            {
                _dte = (DTE)_propertyBag["Generic.DTE"];
                if (_dte == null)
                {
                    throw new NullReferenceException("Could not get a reference to active DTE object.");
                }
                else
                {
                    _language = (CodeLanguage)_propertyBag["Generic.Language"];

                    Project project = null;
                    project = GetProject(_dte, _model.MonoRailProjectName);

                    if (project == null)
                    {
                        project =
                            CreateProject(_dte, _model.MonoRailProjectPath + Path.DirectorySeparatorChar + _model.MonoRailProjectName,
                                          _model.MonoRailProjectName);
                    }

                    CodeCompileUnit compileUnit = (CodeCompileUnit)_propertyBag["CodeGeneration.CodeCompileUnit"];
                    
                    // We will handle the first namespace by default.
                    if (compileUnit.Namespaces.Count > 0)
                    {
                        CodeNamespace ns = compileUnit.Namespaces[0];
                        List<CodeTypeDeclaration> classes = null;
                        if (ns.Types.Count > 0)
                        {
                            classes = new List<CodeTypeDeclaration>();
                            foreach (CodeTypeDeclaration type in ns.Types)
                            {
                                if (type.IsClass)
                                {
                                    foreach (CodeAttributeDeclaration attribute in type.CustomAttributes)
                                    {
                                        if (attribute.Name == "ActiveRecord")
                                        {
                                            classes.Add(type);
                                            break;
                                        }
                                    }
                                }
                            }

                            if (classes.Count > 0)
                            {
                                // TODO: ...
                            }
                        }
                    }
                }
            }
        }
开发者ID:mgagne-atman,项目名称:Projects,代码行数:59,代码来源:MonoRailGenerator.cs


示例6: Implicit3DParameters

		/// <summary>
		/// Initializes a new instance of the <strong>Implicit3DParameters</strong> class on
		/// the specified code, code language, left-top corner point, right-bottom corner point and
		/// grid factor.
		/// </summary>
		/// <param name="codeExpression">Code</param>
		/// <param name="codeLanguage">Code language</param>
		/// <param name="point3DA">Left-top corner point</param>
		/// <param name="point3DB">Right-bottom corner point</param>
		/// <param name="gridFactor">
		/// This parameter specify graphics details. Increasing of this parameter give more
		/// detailed graphic but decrease speed of evaluation.
		/// </param>
		public Implicit3DParameters(string codeExpression, CodeLanguage codeLanguage, Point3D point3DA, Point3D point3DB, int gridFactor)
		{
			_code = codeExpression;
			_codeLanguage = codeLanguage;
			_point3DA = point3DA;
			_point3DB = point3DB;
			_gridFactor = gridFactor;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:21,代码来源:Implicit3DParameters.cs


示例7: PropertyAccessor

 public PropertyAccessor(Controller controller, BaseConstruct parentObject, AccessorTypes accessorType, string text, CodeLanguage language)
     : base(controller)
 {
     ParentObject = parentObject;
     AccessorType = accessorType;
     Text = text;
     Language = language;
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:8,代码来源:PropertyAccessor.cs


示例8: Parameter

 public Parameter(Controller controller, BaseConstruct parentObject, string name, string dataType, CodeLanguage language)
     : this(controller)
 {
     ParentObject = parentObject;
     Name = name;
     DataType = dataType;
     Language = language;
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:8,代码来源:Parameter.cs


示例9: VisualizeMutatedCode

        public async Task<string> VisualizeMutatedCode(CodeLanguage language, MutationResult mutationResult)
        {
            

            var result = Visualize(language, mutationResult.MethodMutated, mutationResult.MutatedModules);
          //  _mutantsCache.Release(mutationResult);
            return result;
        }
开发者ID:buchu73,项目名称:visualmutator,代码行数:8,代码来源:CodeVisualizer.cs


示例10: Explicit3DParameters

		/// <summary>
		/// Initializes a new instance of the Explicit2DParameters class on the specified
		/// code, code language, left-top corner point, right-bottom corner point and area
		/// size.
		/// </summary>
		/// <param name="codeExpression">code</param>
		/// <param name="codeLanguage">Code language.</param>
		/// <param name="pointA">Left-top corner point</param>
		/// <param name="pointB">Right-bottom corner point</param>
		/// <param name="size">Area size.</param>
		public Explicit3DParameters(string codeExpression, CodeLanguage codeLanguage, Point2D pointA, Point2D pointB, Size size)
		{
			_code = codeExpression;
			_codeLanguage = codeLanguage;
			_pointA = pointA;
			_pointB = pointB;
			_areaSize = size;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:18,代码来源:Explicit3DParameters.cs


示例11: Implicit2DParameters

		/// <summary>
		/// Initializes a new instance of the <strong>Implicit2DParameters</strong> class on
		/// the specified code, code language, left-top corner point, right-bottom corner point,
		/// grid factor and area size.
		/// </summary>
		/// <param name="codeExpression">code</param>
		/// <param name="codeLanguage">Code language</param>
		/// <param name="pointA">Left-top corner point</param>
		/// <param name="pointB">Right-bottom corner point</param>
		/// <param name="gridFactor">
		/// This parameter specify graphics details. Increasing of this parameter give more
		/// detailed graphic but decrease speed of evaluation.
		/// </param>
		/// <param name="areaSize">Area size.</param>
		public Implicit2DParameters(string codeExpression, CodeLanguage codeLanguage, Point2D pointA, Point2D pointB, int gridFactor, Size areaSize)
		{
			_code = codeExpression;
			_codeLanguage = codeLanguage;
			_pointA = pointA;
			_pointB = pointB;
			_gridFactor = gridFactor;
			_areaSize = areaSize;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:23,代码来源:Implicit2DParameters.cs


示例12: Namespace

 public Namespace(Controller controller, BaseConstruct parentObject, string name, CodeRoot parentCodeRoot, CodeLanguage language, int nodeIndex)
     : this(controller)
 {
     ParentObject = parentObject;
     Name = name;
     ParentCodeRoot = parentCodeRoot;
     Language = language;
     Index = nodeIndex;
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:9,代码来源:Namespace.cs


示例13: GetDiff

 public CodeWithDifference GetDiff(CodeLanguage language, string input1, string input2)
 {
     var diff = new StringBuilder();
     var lineChanges = CreateDiff(language, input1, input2, diff);
     return new CodeWithDifference
     {
         Code = diff.ToString(),
         LineChanges = lineChanges
     };
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:10,代码来源:CodeDifferenceCreator.cs


示例14: GenerateEntities

        public override void GenerateEntities(string filePrefix, string nameSpace, Data.DbSyncScopeDescription desc, Dictionary<string, Dictionary<string, string>> colsMappingInfo, System.IO.DirectoryInfo dirInfo, CodeLanguage option, string serviceUri)
        {
            // First generate the custom Context file
            CodeCompileUnit compileUnit = GenerateContextFile(filePrefix, nameSpace, desc, serviceUri);
            CodeDomUtility.SaveCompileUnitToFile(compileUnit, option, CodeDomUtility.GenerateFileName(desc.ScopeName, dirInfo, filePrefix, "OfflineContext", option));

            // Then generate the file containing the actual entities
            compileUnit = GenerateEntitiesFile(nameSpace, desc, colsMappingInfo);
            CodeDomUtility.SaveCompileUnitToFile(compileUnit, option, CodeDomUtility.GenerateFileName(desc.ScopeName, dirInfo, filePrefix, "Entities", option));
        }
开发者ID:erpframework,项目名称:SyncWinRT,代码行数:10,代码来源:SQLiteClientEntityGenerator.cs


示例15: Interface

 public Interface(Controller controller, string name, List<string> modifiers, string interfaceBase, CodeLanguage language, BaseConstruct parentObject, int nodeIndex)
     : base(controller)
 {
     Name = name;
     InterfaceBase = interfaceBase;
     Language = language;
     Modifiers = modifiers;
     ParentObject = parentObject;
     Index = nodeIndex;
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:10,代码来源:Interface.cs


示例16: Enumeration

 public Enumeration(Controller controller, string name, List<string> modifiers, string enumBase, BaseConstruct parentObject, CodeLanguage language, int nodeIndex)
     : base(controller)
 {
     Name = name;
     EnumBase = enumBase;
     Modifiers = modifiers;
     ParentObject = parentObject;
     Language = language;
     Index = nodeIndex;
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:10,代码来源:Enumeration.cs


示例17: SmartCodeProject

        protected SmartCodeProject(string name, string location, CodeLanguage language)
            : base(null)
        {
            ThrowUtil.ThrowIfNull(language);

            Name = name;
            _projectPath = location;
            _language = language;
            _ASTManager = language.CreateASTManager(this);
        }
开发者ID:RaptorOne,项目名称:SmartDevelop,代码行数:10,代码来源:SmartCodeProject.cs


示例18: CreateDiff

        private List<LineChange> CreateDiff(CodeLanguage language, string input1, string input2, StringBuilder diff)
        {
            IEqualityComparer<string> eq = FunctionalExt.ValuedSwitch<CodeLanguage, IEqualityComparer<string>>(language)
                .Case(CodeLanguage.CSharp, () => new CSharpCodeLineEqualityComparer())
                .Case(CodeLanguage.IL, () => new ILCodeLineEqualityComparer())
                .GetResult();
            var differ = new AlignedDiff<string>(
                NormalizeAndSplitCode(input1),
                NormalizeAndSplitCode(input2),
                eq,
                new StringSimilarityComparer(),
                new StringAlignmentFilter());

            int line1 = 0, line2 = 0;

            var list = new List<LineChange>();
            foreach (var change in differ.Generate())
            {
                int startIndex = 0;
                switch (change.Change)
                {
                    case ChangeType.Same:
                        diff.AppendFormat("{0,4} {1,4} ", ++line1, ++line2);
                        diff.AppendFormat("  ");
                        diff.AppendLine(change.Element1);
                        break;
                    case ChangeType.Added:
                        startIndex = diff.Length;
                        diff.AppendFormat("     {1,4}  +  ", line1, ++line2);

                        diff.AppendLine(change.Element2);
                        list.Add(NewLineChange(LineChangeType.Add, diff, startIndex, diff.Length));
                        break;
                    case ChangeType.Deleted:
                        startIndex = diff.Length;
                        diff.AppendFormat("{0,4}       -  ", ++line1, line2);
                        diff.AppendLine(change.Element1);
                        list.Add(NewLineChange(LineChangeType.Remove, diff, startIndex, diff.Length));
                        break;
                    case ChangeType.Changed:
                        startIndex = diff.Length;
                        diff.AppendFormat("{0,4}      ", ++line1, line2);
                        diff.AppendFormat("(-) ");
                        diff.AppendLine(change.Element1);
                        list.Add(NewLineChange(LineChangeType.Remove, diff, startIndex, diff.Length));
                        startIndex = diff.Length;
                        diff.AppendFormat("     {1,4} ", line1, ++line2);
                        diff.AppendFormat("(+) ");
                        diff.AppendLine(change.Element2);
                        list.Add(NewLineChange(LineChangeType.Add, diff, startIndex, diff.Length));
                        break;
                }
            }
            return list;
        }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:55,代码来源:CodeDifferenceCreator.cs


示例19: VisualizeMutatedCode

        public async Task<string> VisualizeMutatedCode(CodeLanguage language, MutationResult mutationResult)
        {
            var result = Visualize(language, mutationResult.MethodMutated, mutationResult.MutatedModules);//oryginalnie była tylko ta linijka i return

            if (mutationResult.AdditionalMethodsMutated != null && mutationResult.MethodMutated!=mutationResult.AdditionalMethodsMutated[0])
            {
                result += Visualize(language, mutationResult.AdditionalMethodsMutated[0], mutationResult.MutatedModules);
            }
            //  _mutantsCache.Release(mutationResult);*/
            return result;
        }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:11,代码来源:CodeVisualizer.cs


示例20: SmartCodeProjectAHK

        internal SmartCodeProjectAHK(string name, string location, CodeLanguage language)
            : base(name, location, language)
        {
            _language = language as CodeLanguageAHKv1;

                //UpdateStdLib();

                _language.Settings.SettingsChanged += (s, e) => {
                        //UpdateStdLib();
                    };
        }
开发者ID:RaptorOne,项目名称:SmartDevelop,代码行数:11,代码来源:SmartCodeProjectAHK.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CodeLocation类代码示例发布时间:2022-05-24
下一篇:
C# CodeGenerator类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap