protected internal bool LoadConfiguration() { if (ConfigurationFile.Exists) { _Configuration = ContractDefinition.LoadFromFile(ConfigurationFile.FullName); } else { MessageBox.Show(String.Format("Please create the configuration file on following location or add the template again and modify the file (location: {0})", ConfigurationFile)); } //if (_Configuration == null) //{ // ContractGenerationConfigurationWindow mainWindow = new ContractGenerationConfigurationWindow(WorkingDirectory); // var result = mainWindow.ShowDialog(); // if (result.HasValue && result.Value) // _Configuration = mainWindow.Settings; //} return(_Configuration != null); }
static void Main(string[] args) { //StreamWriter y = null; try { var x = ContractDefinition.LoadFromFile(@"XMLFile1.xml"); string subfolder = "Contract\\Interfaces\\"; if (!Directory.Exists(subfolder)) { Directory.CreateDirectory(subfolder); } foreach (var item in x.ContractServiceInterfaces) { File.WriteAllText(subfolder + item.Name + ".cs", item.GenerateCode()); } foreach (var item in x.ContractServiceInterfaces) { File.WriteAllText(subfolder + item.Name + "Agent.cs", ((ContractAgentInterfaceDefinition)item).GenerateCode()); } subfolder = "Contract\\Agent\\"; if (!Directory.Exists(subfolder)) { Directory.CreateDirectory(subfolder); } foreach (var item in x.ContractServiceInterfaces) { File.WriteAllText(subfolder + item.Name.Substring(1) + "Agent.cs", ((ContractAgentClassDefinition)item).GenerateCode()); } File.WriteAllText(subfolder + x.Name + "ProviderFactory.cs", ContractAgentFactoryClassDefinition.GetAgentFactory(x.ContractServiceInterfaces, x.Name).GenerateCode()); subfolder = "Service\\"; if (!Directory.Exists(subfolder)) { Directory.CreateDirectory(subfolder); } foreach (var item in x.ContractServiceInterfaces) { File.WriteAllText(subfolder + item.Name.Substring(1) + ".cs", ((ContractServiceClassDefinition)item).GenerateCode()); } foreach (var item in x.ContractServiceInterfaces) { File.WriteAllText(subfolder + item.Name.Substring(1) + ".svc", ((ContractServiceHostDefinition)item).GenerateCode()); } subfolder = "Contract\\Domain\\"; if (!Directory.Exists(subfolder)) { Directory.CreateDirectory(subfolder); } foreach (var item in x.DomainObjectClasses) { File.WriteAllText(subfolder + item.Name + ".cs", ((DomainObjectClassDefinition)item).GenerateCode()); } } finally { //y.Close(); } }
private void Reset_Button_Click(object sender, RoutedEventArgs e) { Settings = ContractDefinition.LoadFromFile(ConfigurationFile.FullName); }