public Event(Controller controller, BaseConstruct parentObject, CodeLanguage language, int nodeIndex) : base(controller) { ParentObject = parentObject; Language = language; Index = nodeIndex; }
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; }
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() }; } }
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(); }
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: ... } } } } } }
public Parameter(Controller controller, BaseConstruct parentObject, string name, string dataType, CodeLanguage language) : this(controller) { ParentObject = parentObject; Name = name; DataType = dataType; Language = language; }
public PropertyAccessor(Controller controller, BaseConstruct parentObject, AccessorTypes accessorType, string text, CodeLanguage language) : base(controller) { ParentObject = parentObject; AccessorType = accessorType; Text = text; Language = language; }
public async Task<string> VisualizeMutatedCode(CodeLanguage language, MutationResult mutationResult) { var result = Visualize(language, mutationResult.MethodMutated, mutationResult.MutatedModules); // _mutantsCache.Release(mutationResult); return result; }
/// <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; }
/// <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; }
/// <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; }
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; }
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; }
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 }; }
protected SmartCodeProject(string name, string location, CodeLanguage language) : base(null) { ThrowUtil.ThrowIfNull(language); Name = name; _projectPath = location; _language = language; _ASTManager = language.CreateASTManager(this); }
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)); }
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; }
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; }
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; }
internal SmartCodeProjectAHK(string name, string location, CodeLanguage language) : base(name, location, language) { _language = language as CodeLanguageAHKv1; //UpdateStdLib(); _language.Settings.SettingsChanged += (s, e) => { //UpdateStdLib(); }; }
/// <summary>Check code with given CodeLanguage.</summary> /// <example> /// <code lang="CS" description="The following example gets some code and check it with given code language"> /// string code = "double Calc(double x) /// { /// double gain = 1.5; /// return x*gain; /// } /// " /// String resultString; /// /// CodeExpressionChecker.CheckCode(CodeLanguage.CSharp, code, ref resultString); /// </code> /// </example> public static void CheckCode(CodeLanguage language, String sourceCode, ref String errorString) { switch(language) { case CodeLanguage.CSharp: CheckCode(new CSharpCodeProvider(), sourceCode, ref errorString); break; case CodeLanguage.VBNET: CheckCode(new VBCodeProvider(), sourceCode, ref errorString); break; } }
public async Task<string> VisualizeOriginalCode(CodeLanguage language, Mutant mutant) { var whiteCode = Visualize(language, mutant.MutationTarget.MethodRaw, _originalCodebase.Modules.Single(m => m.Module.Name == mutant.MutationTarget.ProcessingContext.ModuleName)); if (mutant._mutationTargets.Count != 0 && mutant.MutationTarget.MethodRaw != mutant._mutationTargets[0].MethodRaw) { whiteCode += Visualize(language, mutant._mutationTargets[0].MethodRaw, _originalCodebase.Modules.Single(m => m.Module.Name == mutant._mutationTargets[0].ProcessingContext.ModuleName)); } return whiteCode; }
protected Property(Controller controller, BaseConstruct parentObject, string name, DotNet.DataType dataType, List<string> modifiers, PropertyAccessor getAccessor, PropertyAccessor setAccessor, CodeLanguage language, int nodeIndex) : base(controller) { ParentObject = parentObject; Name = name; DataType = dataType; Modifiers = modifiers; GetAccessor = getAccessor; SetAccessor = setAccessor; Language = language; Index = nodeIndex; }
private void AddTagger(RadDocument document) { CodeLanguage vbCodeLanguage = new CodeLanguage("VB"); RegexTagger vbRegexTagger = MainWindow.GetVbTagger(); document.CodeFormatter.RegisterCodeLanguage(vbCodeLanguage, vbRegexTagger); StyleDefinition vbKeywordStyle = new StyleDefinition("vbKeywordStyle", StyleType.Character); vbKeywordStyle.SpanProperties.ForeColor = Colors.Orange; document.CodeFormatter.RegisterClassificationType(ClassificationTypes.Keyword, vbCodeLanguage, vbKeywordStyle); }
public Inline ToInline(CodeLanguage lang) { switch (lang) { case CodeLanguage.Xml: return new XmlParser().ToInline(this); case CodeLanguage.Json: return new JsonParser().ToInline(this); case CodeLanguage.Plain: return new BaseParser().ToInline(this); default: throw new NotImplementedException(string.Format("Conversion from {0} language is not supported.", lang)); } }
public Indexer(Controller controller, BaseConstruct parentObject, DataType dataType, IEnumerable<Parameter> parameters, PropertyAccessor getAccessor, PropertyAccessor setAccessor, CodeLanguage language, int nodeIndex) : base(controller) { ParentObject = parentObject; DataType = dataType; Parameters.Clear(); if (parameters != null) Parameters.AddRange(parameters); GetAccessor = getAccessor; SetAccessor = setAccessor; Language = language; Index = nodeIndex; Name = "this"; }
/// <summary> /// Generates thes following entities for the service. /// 1. An XXXEntities.cs file that contains the SyncScope attributed collection name and all the individual Entities that make that scope. /// 2. An .SVC file for the sync service. /// 3. The .svc.[Language] code behind file for the above .svc file generated. /// </summary> /// <param name="filePrefix"></param> /// <param name="nameSpace"></param> /// <param name="desc"></param> /// <param name="dirInfo"></param> /// <param name="option"></param> /// <param name="colsMappingInfo"></param> /// <param name="serviceUri"></param> public override void GenerateEntities(string filePrefix, string nameSpace, DbSyncScopeDescription desc, Dictionary<string, Dictionary<string, string>> colsMappingInfo, System.IO.DirectoryInfo dirInfo, CodeLanguage option, string serviceUri) { CodeCompileUnit cc = GenerateEntitiesCompileUnit(filePrefix, nameSpace, desc, colsMappingInfo); CodeDomUtility.SaveCompileUnitToFile(cc, option, CodeDomUtility.GenerateFileName(desc.ScopeName, dirInfo, filePrefix, "Entities", option)); cc = GenerateSyncServiceCompileUnit(filePrefix, nameSpace, desc); // Generate the codebehing file for .svc file string codeBehindFilename = CodeDomUtility.GenerateFileName(desc.ScopeName, dirInfo, filePrefix, "SyncService.svc", option); CodeDomUtility.SaveCompileUnitToFile(cc, option, codeBehindFilename); // Generate the actual .SVC file. CodeDomUtility.SaveSVCFile(nameSpace, cc.Namespaces[0].Types[0].Name, codeBehindFilename, CodeDomUtility.GenerateFileName(desc.ScopeName, dirInfo, filePrefix, "SyncService", CodeLanguage.SVC), option); }
/// <summary> /// Creates a new instance of GeneratedCode class. /// </summary> /// <param name="codeNamespace">The <see cref="codeNamespace"/> containing the code to be wrapped.</param> /// <param name="codeLanguage">The language the code was generated for.</param> /// <param name="configuration">The configuration associated with the generated code.</param> /// <remarks> /// This class can only be initialized by CodeFactory. /// Therefore this constructor is marked as internal. /// </remarks> internal ExtendedCodeDomTree(CodeNamespace codeNamespace, CodeLanguage codeLanguage, Configuration configuration) { this.codeNamespace = codeNamespace; CodeLanguauge = codeLanguage; Configuration = configuration; ServiceContracts = new FilteredTypes(codeNamespace); ServiceTypes = new FilteredTypes(codeNamespace); ClientTypes = new FilteredTypes(codeNamespace); DataContracts = new FilteredTypes(codeNamespace); MessageContracts = new FilteredTypes(codeNamespace); UnfilteredTypes = new FilteredTypes(codeNamespace); TextFiles = new List<TextFile>(); ParseAndFilterCodeNamespace(); }
public List<CodeLexem> Parse(CodeLanguage lang) { switch (lang) { case CodeLanguage.Plain: return new BaseParser().Parse(Text); case CodeLanguage.Xml: return new XmlParser().Parse(Text); case CodeLanguage.Json: return new JsonParser().Parse(Text); default: throw new NotImplementedException(string.Format("Parser for {0} language is not implemented.", lang)); } }
public CodeGenerationHelper(Hashtable propertyBag) { _propertyBag = propertyBag; _model = (Model)propertyBag["Generic.Model"]; if (string.IsNullOrEmpty(_model.Namespace)) _namespace = propertyBag["Generic.Namespace"].ToString(); else _namespace = _model.Namespace; _dte = DTEHelper.GetDTE(_propertyBag["Generic.ProcessID"].ToString()); _propertyBag.Add("Generic.DTE", _dte); _modelFileName = (string)_propertyBag["Generic.ModelFileFullName"]; _modelFilePath = Path.GetDirectoryName(_modelFileName); _projectItem = _dte.Solution.FindProjectItem(_modelFileName); _language = DTEHelper.GetProjectLanguage(_projectItem.ContainingProject); switch (_language) { case CodeLanguage.CSharp: _provider = new CSharpCodeProvider(); _propertyBag.Add("Generic.Language", CodeLanguage.CSharp); break; case CodeLanguage.VB: _provider = new VBCodeProvider(); _propertyBag.Add("Generic.Language", CodeLanguage.VB); // use VB default namespace if it was set VSProject project = (VSProject)_projectItem.ContainingProject.Object; Property DefaultNamespaceProperty = project.Project.Properties.Item("DefaultNamespace"); _defaultNamespace = (string)DefaultNamespaceProperty.Value; break; default: throw new ArgumentException( "Unsupported project type. ActiveWriter currently supports C# and Visual Basic.NET projects."); } _output = new OutputWindowHelper(_dte); }
public CodeBlockPresenter(CodeLanguage language) { CodeLanguage = language; }
public static void StepInfo(string msg, CodeLanguage formatType) { var formattedMessage = MarkupHelper.CreateCodeBlock(msg, formatType); CurrentTest.Info(formattedMessage); }
protected CodeLanguageProvider(CodeLanguage language) { Language = language; settingsFileName = string.Format("FastSharp.{0}.settings", Language); }
public VBParameter(BaseBaseConstruct parentObject, CodeLanguage language) : base(parentObject, language) { }
public VBPropertyAccessor(VBController controller, VBBaseConstruct parentObject, AccessorTypes accessorType, string text, CodeLanguage language) : base(controller, parentObject, accessorType, text, language) { }
public void SetProvider(CodeLanguage language) { ActiveLanguageProvider = GetLanguageProvider(language); }
public VBParameter(BaseController controller, BaseBaseConstruct parentObject, string name, string dataType, CodeLanguage language) : base(controller, parentObject, name, dataType, language) { }
/// <summary> /// Initializes a new instance of the FunctionEvalutor class on the specified code, /// code language and list of variables. /// </summary> /// <param name="code">Code</param> /// <param name="variables">List of variables</param> /// <param name="language">Code language</param> public FunctionEvalutor(string code, string[] variables, CodeLanguage language) { _code = code; _variables = variables; _language = language; }
public static string ToNullableType(this string type, bool isNullable = false, CodeLanguage language = CodeLanguage.CSharp) { bool isValueType = type.IsValueType(); type = type.ToType(language); if (!isValueType || !isNullable) { return(type); } return(language == CodeLanguage.VisualBasic ? string.Format("Nullable(Of {0})", type) : type + "?"); }
public Parameter(BaseConstruct parentObject, CodeLanguage language) : this(parentObject.Controller) { ParentObject = parentObject; Language = language; }
public VBStruct(VBController controller, VBBaseConstruct parentObject, string name, List <string> modifiers, CodeLanguage language, int nodeIndex) : base(controller, parentObject, name, modifiers, language, nodeIndex) { }
public void GetHeaderLengthLanguageWithWrongTags(CodeLanguage language, string docStart) { var headerLength = FileHeaderHelper.GetHeaderLength(language, docStart); Assert.IsTrue(headerLength == 0); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); ClientScriptManager scripts = Page.ClientScript; CodeLanguage language = Language; String name = Name; if (!scripts.IsClientScriptIncludeRegistered("core")) { scripts.RegisterClientScriptInclude("core", Page.ResolveClientUrl(ScriptPath + "Scripts/shCore.js")); } switch (language) { case CodeLanguage.csharp: if (!scripts.IsClientScriptIncludeRegistered("csharp")) { scripts.RegisterClientScriptInclude("csharp", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushCSharp.js")); } break; case CodeLanguage.delphi: if (!scripts.IsClientScriptIncludeRegistered("delphi")) { scripts.RegisterClientScriptInclude("delphi", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushDelphi.js")); } break; case CodeLanguage.javascript: if (!scripts.IsClientScriptIncludeRegistered("javascript")) { scripts.RegisterClientScriptInclude("javascript", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushJScript.js")); } break; case CodeLanguage.php: if (!scripts.IsClientScriptIncludeRegistered("php")) { scripts.RegisterClientScriptInclude("php", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushPhp.js")); } break; case CodeLanguage.python: if (!scripts.IsClientScriptIncludeRegistered("python")) { scripts.RegisterClientScriptInclude("python", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushPython.js")); } break; case CodeLanguage.sql: if (!scripts.IsClientScriptIncludeRegistered("sql")) { scripts.RegisterClientScriptInclude("sql", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushSql.js")); } break; case CodeLanguage.vbnet: if (!scripts.IsClientScriptIncludeRegistered("vb")) { scripts.RegisterClientScriptInclude("vb", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushVb.js")); } break; case CodeLanguage.xml: if (!scripts.IsClientScriptIncludeRegistered("xml")) { scripts.RegisterClientScriptInclude("xml", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushXml.js")); } break; case CodeLanguage.css: if (!scripts.IsClientScriptIncludeRegistered("css")) { scripts.RegisterClientScriptInclude("css", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushCss.js")); } break; case CodeLanguage.ruby: if (!scripts.IsClientScriptIncludeRegistered("ruby")) { scripts.RegisterClientScriptInclude("ruby", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushRuby.js")); } break; default: if (!scripts.IsClientScriptIncludeRegistered("unknown")) { scripts.RegisterClientScriptInclude("unknown", Page.ResolveClientUrl(ScriptPath + "Scripts/shBrushUnknown.js")); } break; } String script = String.Format( "<script language=\"javascript\">dp.SyntaxHighlighter.HighlightAll('{0}');</script>", name); if (!scripts.IsStartupScriptRegistered(typeof(SyntaxHighlighter), "init" + name)) { scripts.RegisterStartupScript(typeof(SyntaxHighlighter), "init" + name, script); } }
// If a user wants to modify the chunk generation process they do it via the DecorateChunkGenerator method // which is why this is internal. internal RazorChunkGenerator CreateChunkGenerator(string className, string rootNamespace, string sourceFileName) { return(DecorateChunkGenerator( CodeLanguage.CreateChunkGenerator(className, rootNamespace, sourceFileName, host: this))); }
public CodeLanguageProvider GetLanguageProvider(CodeLanguage language) { return(languageProviders.SingleOrDefault(x => x.Language == language)); }
public static string ToNullableType(this Type type, bool isNullable = false, CodeLanguage language = CodeLanguage.CSharp) { return(ToNullableType(type.FullName, isNullable, language)); }
public static bool IsKeyword(this string text, CodeLanguage language = CodeLanguage.CSharp) { return(language == CodeLanguage.VisualBasic ? _visualBasicKeywords.Contains(text) : _csharpKeywords.Contains(text)); }
public ICodeMap EnsuredGetCodeMap(CodeLanguage codeLanguage) { throw new Exception("The method or operation is not implemented."); }
public VBConstant(BaseController controller, BaseBaseConstruct parentObject, CodeLanguage language, int nodeIndex) : base(controller, parentObject, language, nodeIndex) { }
public static string ToType(this Type type, CodeLanguage language = CodeLanguage.CSharp) { return(ToType(type.FullName, language)); }
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)); }
public VBIndexer(VBController controller, VBBaseConstruct parentObject, VBDataType dataType, IEnumerable <BaseParameter> parameters, PropertyAccessor getAccessor, PropertyAccessor setAccessor, CodeLanguage language, int nodeIndex) : base(controller, parentObject, dataType, parameters, getAccessor, setAccessor, language, nodeIndex) { }
public VBInterfaceProperty(VBController controller, VBBaseConstruct parentObject, string name, DataType dataType, InterfaceAccessor getAccessor, InterfaceAccessor setAccessor, bool hasNewKeyword, CodeLanguage language, int nodeIndex) : base(controller, parentObject, name, dataType, getAccessor, setAccessor, hasNewKeyword, language, nodeIndex) { }
/// <summary> /// This function initializes the code generator object. It initializes the /// code generators namespace and the class objects also. /// </summary> /// <param name="Language">Input Language as string </param> /// <param name="FilePath">Path of the file to which code has to written </param> /// <param name="ClassName">Name of the WMI class </param> /// <param name="lang" > Language in which code is to be generated </param> static bool InitializeCodeGenerator(string Language, ref string FilePath, string ClassName, out CodeLanguage lang) { bool bRet = true; lang = CodeLanguage.CSharp; string suffix = ".CS"; ///Defaulted to CS switch (Language.ToUpper()) { case "VB": suffix = ".VB"; lang = CodeLanguage.VB; break; case "JS": suffix = ".JS"; lang = CodeLanguage.JScript; break; case "": case "CS": lang = CodeLanguage.CSharp; break; default: bRet = false; return(false); } // if filepath is empty then create if (bRet == true && FilePath == string.Empty) { string FileName = string.Empty; if (ClassName.IndexOf('_') > 0) { FileName = ClassName.Substring(0, ClassName.IndexOf('_')); //Now trim the class name without the first '_' FileName = ClassName.Substring(ClassName.IndexOf('_') + 1); } else { FileName = ClassName; } FilePath = FileName + suffix; } return(bRet); }
public InterfaceAccessor(Controller controller, BaseConstruct parentObject, AccessorTypes accessorType, CodeLanguage language) : base(controller) { ParentObject = parentObject; AccessorType = accessorType; Language = language; }
public VBInterfaceAccessor(VBController controller, VBBaseConstruct parentObject, AccessorTypes accessorType, CodeLanguage language) : base(controller, parentObject, accessorType, language) { }
void OnDataChanged(object oldValue, object newValue) { GetCodeTextFunc = () => ReadCode(newValue.GetType()); CodeLanguage = CodeLanguage.CS; }
protected Property(Controller controller, BaseConstruct parentObject, string name, DotNet.DataType dataType, List <string> modifiers, PropertyAccessor getAccessor, PropertyAccessor setAccessor, CodeLanguage language, int nodeIndex) : base(controller) { ParentObject = parentObject; Name = name; DataType = dataType; Modifiers = modifiers; GetAccessor = getAccessor; SetAccessor = setAccessor; Language = language; Index = nodeIndex; }