本文整理汇总了C#中CodeLanguage类的典型用法代码示例。如果您正苦于以下问题:C# CodeLanguage类的具体用法?C# CodeLanguage怎么用?C# CodeLanguage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CodeLanguage类属于命名空间,在下文中一共展示了CodeLanguage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Event
public Event(Controller controller, BaseConstruct parentObject, CodeLanguage language, int nodeIndex)
: base(controller)
{
ParentObject = parentObject;
Language = language;
Index = nodeIndex;
}
示例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()
};
}
}
示例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();
}
示例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;
}
示例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: ...
}
}
}
}
}
}
示例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;
}
示例7: PropertyAccessor
public PropertyAccessor(Controller controller, BaseConstruct parentObject, AccessorTypes accessorType, string text, CodeLanguage language)
: base(controller)
{
ParentObject = parentObject;
AccessorType = accessorType;
Text = text;
Language = language;
}
示例8: Parameter
public Parameter(Controller controller, BaseConstruct parentObject, string name, string dataType, CodeLanguage language)
: this(controller)
{
ParentObject = parentObject;
Name = name;
DataType = dataType;
Language = language;
}
示例9: VisualizeMutatedCode
public async Task<string> VisualizeMutatedCode(CodeLanguage language, MutationResult mutationResult)
{
var result = Visualize(language, mutationResult.MethodMutated, mutationResult.MutatedModules);
// _mutantsCache.Release(mutationResult);
return result;
}
示例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;
}
示例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;
}
示例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;
}
示例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
};
}
示例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));
}
示例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;
}