public static int Main(string[] args) { var configFile = args.FirstOrDefault(); if (configFile == null) { ShowWarning("No config file specified. Using '" + DefaultConfigPath + "' as default"); configFile = DefaultConfigPath; } if (!File.Exists(configFile)) { ShowWarning("Invalid config file specified. Using '" + DefaultConfigPath + "' as default"); configFile = DefaultConfigPath; } if (!File.Exists(configFile)) { ShowError("Config file could not be loaded."); return(-1); } var config = GenerateConfig.LoadFromFile(configFile); IList <SchemaDefinition> schemaDefinitions = new List <SchemaDefinition>(); var index = 1; foreach (var schema in config.Schemas) { var path = schema.SourcePath + "." + config.baseExtension; if (config.basePath != null) { path = Path.Combine(config.basePath, path); } if (!File.Exists(path)) { ShowError(string.Format("Invalid schema path on position {0}: The given schema file '{1}' could not be found!", index, path)); return(-1); } SchemaDictionary.Add(Path.GetFullPath(path), schema.TargetNamespace); schemaDefinitions.Add(new SchemaDefinition(path, schema.TargetNamespace, schema.TargetXmlNamespace)); index++; } ProcessSchemas(schemaDefinitions, config.includeDataContractAttributes); return(0); }
/// <summary> /// Deserializes xml markup from file into an GenerateConfig object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output GenerateConfig object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out GenerateConfig obj, out System.Exception exception) { exception = null; obj = default(GenerateConfig); try { obj = LoadFromFile(fileName); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
/// <summary> /// Deserializes workflow markup into an GenerateConfig object /// </summary> /// <param name="xml">string workflow markup to deserialize</param> /// <param name="obj">Output GenerateConfig object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out GenerateConfig obj, out System.Exception exception) { exception = null; obj = default(GenerateConfig); try { obj = Deserialize(xml); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
public static bool LoadFromFile(string fileName, out GenerateConfig obj) { System.Exception exception = null; return(LoadFromFile(fileName, out obj, out exception)); }
public static bool Deserialize(string xml, out GenerateConfig obj) { System.Exception exception = null; return(Deserialize(xml, out obj, out exception)); }