public override void Copy(IMap mapObject) { ICodeMap codeMap = (ICodeMap)mapObject; codeMap.Code = this.Code; codeMap.CodeLanguage = this.CodeLanguage; }
public override void DeepCopy(IMap mapObject) { ICodeMap codeMap = (ICodeMap)mapObject; Copy(codeMap); DoDeepCopy(codeMap); }
private string InsertCodeMap(string code, IClassMap classMap, ICodeMap codeMap) { string declaration = GetClassDeclaration(classMap, codeMap); int pos = code.IndexOf(declaration); if (pos > 0) { InsertCode(pos, codeMap, ref code); } return(code); }
private string GetNamespaceDeclaration(IDomainMap domainMap, ICodeMap codeMap) { if (codeMap.CodeLanguage == CodeLanguage.CSharp) { return("namespace " + domainMap.RootNamespace + " {"); } if (codeMap.CodeLanguage == CodeLanguage.VB) { return("Namespace " + domainMap.RootNamespace); } throw new IAmOpenSourcePleaseImplementMeException(""); }
private string GetClassDeclaration(IClassMap classMap, ICodeMap codeMap) { if (codeMap.CodeLanguage == CodeLanguage.CSharp) { return("public class " + classMap.GetName()); } if (codeMap.CodeLanguage == CodeLanguage.VB) { return("Public Class " + classMap.GetName()); } throw new IAmOpenSourcePleaseImplementMeException(""); }
private string GetNamespaceEndDeclaration(ICodeMap codeMap) { if (codeMap.CodeLanguage == CodeLanguage.CSharp) { return("}"); } if (codeMap.CodeLanguage == CodeLanguage.VB) { return("End Namespace"); } throw new IAmOpenSourcePleaseImplementMeException(""); }
private string GetDomainCodeMap(IDomainMap domainMap, ICodeMap codeMap) { if (codeMap.Code.Length > 0) { if (domainMap.RootNamespace.Length > 0) { string declaration = GetNamespaceDeclaration(domainMap, codeMap); string endDeclaration = GetNamespaceEndDeclaration(codeMap); return(AddCode(declaration, endDeclaration, codeMap)); } } return(""); }
private static void InsertCode(int pos, ICodeMap codeMap, ref string code) { //int pos2 = code.Substring(pos).IndexOf("{"); int pos2 = code.Substring(pos).IndexOf("\r\n"); if (pos2 > 0) { //int breakAt = pos + pos2 + 3; int breakAt = pos + pos2; string codeLeft = code.Substring(0, breakAt); string codeRight = code.Substring(breakAt); string codeMiddle = Environment.NewLine + Environment.NewLine + codeMap.Code; code = codeLeft + codeMiddle + codeRight; } }
public override bool Compare(IMap compareTo) { if (compareTo == null) { return(false); } ICodeMap codeMap = (ICodeMap)compareTo; if (!(codeMap.Code == this.Code)) { return(false); } if (!(codeMap.CodeLanguage == this.CodeLanguage)) { return(false); } return(true); }
private string GetClassDeclaration(IClassMap classMap, ICodeMap codeMap) { if (codeMap.CodeLanguage == CodeLanguage.CSharp) return "public class " + classMap.GetName(); if (codeMap.CodeLanguage == CodeLanguage.VB) return "Public Class " + classMap.GetName(); throw new IAmOpenSourcePleaseImplementMeException(""); }
public virtual void Visit(ICodeMap codeMap) { VerifyCodeMap(codeMap); }
public virtual void VerifyCodeMap(ICodeMap codeMap) { ; }
public static IApplicationBuilder UseErrorHandling(this IApplicationBuilder app, ICodeMap codeMap) => app.UseErrorHandling(codeMap.MapErrorCode);
private string GetNamespaceEndDeclaration(ICodeMap codeMap) { if (codeMap.CodeLanguage == CodeLanguage.CSharp) return "}" ; if (codeMap.CodeLanguage == CodeLanguage.VB) return "End Namespace"; throw new IAmOpenSourcePleaseImplementMeException(""); }
protected virtual string SerializeCodeMap(ICodeMap codeMap) { StringBuilder xml = new StringBuilder(); xml.Append(" <code language=\"" + codeMap.CodeLanguage.ToString() + "\"><![CDATA[" + codeMap.Code + "]]></code>\r\n"); // do not localize return xml.ToString(); }
protected virtual void DoDeepCopy(ICodeMap codeMap) { }
private string GetDomainCodeMap(IDomainMap domainMap, ICodeMap codeMap) { if (codeMap.Code.Length > 0) { if (domainMap.RootNamespace.Length > 0) { string declaration = GetNamespaceDeclaration(domainMap, codeMap); string endDeclaration = GetNamespaceEndDeclaration(codeMap); return AddCode(declaration, endDeclaration, codeMap); } } return ""; }
private string InsertCodeMap(string code, IClassMap classMap, ICodeMap codeMap) { string declaration = GetClassDeclaration(classMap, codeMap); int pos = code.IndexOf(declaration); if (pos > 0) { InsertCode(pos, codeMap, ref code); } return code; }
private static string AddCode(string declaration, string endDeclaration, ICodeMap codeMap) { return(declaration + Environment.NewLine + codeMap.Code + Environment.NewLine + endDeclaration + Environment.NewLine); }
private string GetNamespaceDeclaration(IDomainMap domainMap, ICodeMap codeMap) { if (codeMap.CodeLanguage == CodeLanguage.CSharp) return "namespace " + domainMap.RootNamespace + " {"; if (codeMap.CodeLanguage == CodeLanguage.VB) return "Namespace " + domainMap.RootNamespace; throw new IAmOpenSourcePleaseImplementMeException(""); }
public void Visit(ICodeMap codeMap) { ; }
private static string AddCode(string declaration, string endDeclaration, ICodeMap codeMap) { return declaration + Environment.NewLine + codeMap.Code + Environment.NewLine + endDeclaration + Environment.NewLine; }