public static string CreateCode( Type proxyType, ICodeGenerator generator, XmlRpcProxyCodeGenOptions options) { if (options == null) { throw new ArgumentNullException( "options", "The options parameter cannot be null"); } CodeCompileUnit ccu = CreateCodeCompileUnit(proxyType, options); var cgo = new CodeGeneratorOptions(); cgo.BlankLinesBetweenMembers = true; cgo.BracingStyle = "C"; using (var sw = new StringWriter(CultureInfo.InvariantCulture)) { generator.GenerateCodeFromCompileUnit(ccu, sw, cgo); return(sw.ToString()); } }
public static CodeCompileUnit CreateCodeCompileUnit( Type proxyType, XmlRpcProxyCodeGenOptions options) { if (options == null) { throw new ArgumentNullException( "options", "The options parameter cannot be null"); } // create unique names string baseName = proxyType.Name; // string leading "I" if (baseName.StartsWith("I", StringComparison.Ordinal)) { baseName = baseName.Remove(0, 1); } string assemblyName = options.Namespace.Length > 0 ? options.Namespace : string.Format( CultureInfo.InvariantCulture, "{0}{1}", baseName, DEFAULT_SUFFIX); string typeName = options.TypeName.Length > 0 ? options.TypeName : assemblyName; var implicitAsync = options.ImplicitAsync; var flattenInterfaces = options.FlattenInterfaces; return(BuildCompileUnit( proxyType, assemblyName, typeName, implicitAsync, flattenInterfaces)); }
public static string CreateCode( Type proxyType, ICodeGenerator generator, XmlRpcProxyCodeGenOptions options) { if (options == null) { throw new ArgumentNullException( "options", "The options parameter cannot be null"); } CodeCompileUnit ccu = CreateCodeCompileUnit(proxyType, options); var cgo = new CodeGeneratorOptions(); cgo.BlankLinesBetweenMembers = true; cgo.BracingStyle = "C"; using (var sw = new StringWriter(CultureInfo.InvariantCulture)) { generator.GenerateCodeFromCompileUnit(ccu, sw, cgo); return sw.ToString(); } }
public static CodeCompileUnit CreateCodeCompileUnit( Type proxyType, XmlRpcProxyCodeGenOptions options) { if (options == null) { throw new ArgumentNullException( "options", "The options parameter cannot be null"); } // create unique names string baseName = proxyType.Name; // string leading "I" if (baseName.StartsWith("I", StringComparison.Ordinal)) baseName = baseName.Remove(0, 1); string assemblyName = options.Namespace.Length > 0 ? options.Namespace : string.Format( CultureInfo.InvariantCulture, "{0}{1}", baseName, DEFAULT_SUFFIX); string typeName = options.TypeName.Length > 0 ? options.TypeName : assemblyName; var implicitAsync = options.ImplicitAsync; var flattenInterfaces = options.FlattenInterfaces; return BuildCompileUnit( proxyType, assemblyName, typeName, implicitAsync, flattenInterfaces); }