public bool Do(ref string error) { var repository = Config.ModelSystemRepository; if ( !Project.ValidateProjectName( this.Name ) ) { return false; } if ( repository.ModelSystems.Any( (ms) => ms.Name.Equals( this.Name, StringComparison.InvariantCultureIgnoreCase ) ) ) { error = "There already exists a model system with the name '" + this.Name + "'!"; return false; } this.GeneratedModelSystem = new ModelSystem( Config, this.Name ); this.GeneratedModelSystem.Description = Description; if ( this.Strucuture != null ) { this.GeneratedModelSystem.ModelSystemStructure = this.Strucuture.Clone(); SetupLinkedParameters( ref error ); } if ( !GeneratedModelSystem.Save( ref error ) ) { this.GeneratedModelSystem = null; return false; } repository.Add( this.GeneratedModelSystem ); return true; }
public bool Do(ref string error) { var repository = Config.ModelSystemRepository; if (!Project.ValidateProjectName(this.Name)) { return(false); } if (repository.ModelSystems.Any((ms) => ms.Name.Equals(this.Name, StringComparison.InvariantCultureIgnoreCase))) { error = "There already exists a model system with the name '" + this.Name + "'!"; return(false); } this.GeneratedModelSystem = new ModelSystem(Config, this.Name); this.GeneratedModelSystem.Description = Description; if (this.Strucuture != null) { this.GeneratedModelSystem.ModelSystemStructure = this.Strucuture.Clone(); SetupLinkedParameters(ref error); } if (!GeneratedModelSystem.Save(ref error)) { this.GeneratedModelSystem = null; return(false); } repository.Add(this.GeneratedModelSystem); return(true); }
public bool Do(ref string error) { if ( this.Replace ) { var modelSystems = this.Configuration.ModelSystemRepository.ModelSystems; for ( int i = 0; i < modelSystems.Count; i++ ) { if ( modelSystems[i].Name.Equals( this.Name, StringComparison.InvariantCultureIgnoreCase ) ) { this.Configuration.ModelSystemRepository.Remove( modelSystems[i] ); break; } } } try { File.Copy( this.Location, Path.Combine( this.Configuration.ModelSystemDirectory, this.Name + ".xml" ), true ); } catch ( IOException ) { } ModelSystem ms = new ModelSystem( this.Configuration, this.Name ); this.Configuration.ModelSystemRepository.Add( ms ); this.ModelSystem = ms; return ms.Save( ref error ); }
public bool Do(ref string error) { if (this.Replace) { var modelSystems = this.Configuration.ModelSystemRepository.ModelSystems; for (int i = 0; i < modelSystems.Count; i++) { if (modelSystems[i].Name.Equals(this.Name, StringComparison.InvariantCultureIgnoreCase)) { this.Configuration.ModelSystemRepository.Remove(modelSystems[i]); break; } } } try { File.Copy(this.Location, Path.Combine(this.Configuration.ModelSystemDirectory, this.Name + ".xml"), true); } catch (IOException) { } ModelSystem ms = new ModelSystem(this.Configuration, this.Name); this.Configuration.ModelSystemRepository.Add(ms); this.ModelSystem = ms; return(ms.Save(ref error)); }