// public void Build( // dBuild notifyBack_in, // Type[] typeofClaSSe_in // ) { // #region Checking... // Type[] _interfaces = typeofClaSSe_in.GetInterfaces(); // bool _found = false; // for (int i = 0; i < _interfaces.Length; i++) { // if (_interfaces[i] == typeof(iClaSSe_metadata)) { // _found = true; // break; // } // } // if (!_found) // throw new Exception( // string.Format( // "{0}.{1}.Build(): - invalid type supplied!", // this.GetType().Namespace, // this.GetType().Name // ) // ); // #endregion // build( // notifyBack_in, // (iClaSSe_metadata)Activator.CreateInstance(typeofClaSSe_in), // true // ); // } public void Build( dBuild notifyBack_in, MetadataInterface metadata_in ) { build( notifyBack_in, // false, metadata_in ); }
// public void Build( // dBuild notifyBack_in, // Type[] typeofClaSSe_in // ) { // #region Checking... // Type[] _interfaces = typeofClaSSe_in.GetInterfaces(); // bool _found = false; // for (int i = 0; i < _interfaces.Length; i++) { // if (_interfaces[i] == typeof(iClaSSe_metadata)) { // _found = true; // break; // } // } // if (!_found) // throw new Exception( // string.Format( // "{0}.{1}.Build(): - invalid type supplied!", // this.GetType().Namespace, // this.GetType().Name // ) // ); // #endregion // build( // notifyBack_in, // (iClaSSe_metadata)Activator.CreateInstance(typeofClaSSe_in), // true // ); // } public void Build( dBuild notifyBack_in, iClaSSe_metadata metadata_in ) { build( notifyBack_in, // false, metadata_in ); }
// public void Build( // dBuild notifyBack_in, // Type[] typeofClaSSe_in // ) { // #region Checking... // Type[] _interfaces = typeofClaSSe_in.GetInterfaces(); // bool _found = false; // for (int i = 0; i < _interfaces.Length; i++) { // if (_interfaces[i] == typeof(iClaSSe_metadata)) { // _found = true; // break; // } // } // if (!_found) // throw new Exception( // string.Format( // "{0}.{1}.Build(): - invalid type supplied!", // this.GetType().Namespace, // this.GetType().Name // ) // ); // #endregion // build( // notifyBack_in, // (iClaSSe_metadata)Activator.CreateInstance(typeofClaSSe_in), // true // ); // } public void Build( dBuild notifyBack_in, MetadataInterface metadata_in, params string[] templateTypes_in ) { build( notifyBack_in, // false, metadata_in, templateTypes_in ); }
private void build( dBuild notifyBack_in, // bool loadMetadata_in, MetadataInterface metadata_in, params string[] templateTypes_in ) { notifyback_ = notifyBack_in; //notifyback_("- common items", true); if (xmltemplatesfileuri_.IsFile) { xmltemplatesdir_ = Path.GetDirectoryName( xmltemplatesfileuri_.LocalPath ); } else { xmltemplatesdir_ = xmltemplatesfileuri_.ToString().Substring( 0, xmltemplatesfileuri_.ToString().LastIndexOf("/") ); } #region dbconnectionstrings_[0..n].Connection_createInstance(); for (int d = 0; d < dbconnectionstrings_.Count; d++) { dbconnectionstrings_[d].Connection_createInstance(); } #endregion //metadata_ = new cDBMetadata(xmlmetadatafile_, xmlmetadataroot_); metadata_ = metadata_in; // if (loadMetadata_in) { //// ToDos: now! index must be sinchronized, not very convenient :( // for (int m = 0; m < metadatas_.Length; m++) { // metadatas_[m].LoadState_fromFile( // //xmlmetadatafile_, // metafiles_[m].Path, // //xmlmetadataroot_ // metafiles_[m].Root // ); // } // } templates_ = (xmltemplatesfileuri_.IsFile) ? XS__templates.Load_fromFile(xmltemplatesfileuri_.LocalPath)[0] : XS__templates.Load_fromURI(xmltemplatesfileuri_)[0] ; bool _finished; ArrayList _finishedTemplates = new ArrayList(templates_.TemplateCollection.Count); do { _finished = true; for (template_ = 0; template_ < templates_.TemplateCollection.Count; template_++) { #region if (_finishedPreviously = ...) continue; bool _finishedPreviously = false; for (int f = 0; f < _finishedTemplates.Count; f++) { if ( templates_.TemplateCollection[template_].ID == (string)_finishedTemplates[f] ) { _finishedPreviously = true; break; } } if (_finishedPreviously) continue; #endregion #region if (!utils.StringArrayContains(templateTypes_in, templates_.TemplateCollection[template_].TemplateType)) continue; if ( (templateTypes_in != null) && (templateTypes_in.Length > 0) && (templates_.TemplateCollection[template_].TemplateType != "") && !utils.StringArrayContains( templateTypes_in, templates_.TemplateCollection[template_].TemplateType ) ) { notifyback_( string.Format( "#{0}/{1} - {2} ", _finishedTemplates.Count + 1, templates_.TemplateCollection.Count, templates_.TemplateCollection[template_].ID ), false ); _finishedTemplates.Add(templates_.TemplateCollection[template_].ID); _finished = false; notifyback_("... skipping!", true); continue; } #endregion #region if ((_finishedDependencies = ...) == templates_[template_].Dependencies.Count) { _finishedTemplates.Add(templates_[template_].ID); _finished = false; } #region int _finishedDependencies = ...; int _finishedDependencies = 0; for (int d = 0; d < templates_.TemplateCollection[template_].Dependencies.DependencyCollection.Count; d++) { for (int f = 0; f < _finishedTemplates.Count; f++) { if ( templates_.TemplateCollection[template_].Dependencies.DependencyCollection[d].TemplateID == (string)_finishedTemplates[f] ) { _finishedDependencies++; break; } } } #endregion if (_finishedDependencies == templates_.TemplateCollection[template_].Dependencies.DependencyCollection.Count) { #region RUNNING: templates_[template_] ... notifyback_( string.Format( "#{0}/{1} - {2} ", _finishedTemplates.Count + 1, templates_.TemplateCollection.Count, templates_.TemplateCollection[template_].ID ), false ); bool _valuehasbeenfound_out = false; metadata_.IterateThrough_fromRoot( templates_.TemplateCollection[template_].IterationType, new utils.IterationFoundDelegate(notifyme), ref _valuehasbeenfound_out ); #endregion // adding template to finished list of templates _finishedTemplates.Add(templates_.TemplateCollection[template_].ID); _finished = false; notifyback_((_valuehasbeenfound_out ? "... DONE!" : "NOT doing!"), true); } #endregion } } while (!_finished); #region if (templates_.Count != _finishedTemplates.Count) throw new Exception("unsolved dependencies"); if (templates_.TemplateCollection.Count != _finishedTemplates.Count) { string _error = "list of Templates with unsolved dependencies:\n"; for (int t = 0; t < templates_.TemplateCollection.Count; t++) { _finished = false; for (int f = 0; f < _finishedTemplates.Count; f++) { if ((string)_finishedTemplates[f] == templates_.TemplateCollection[template_].ID) { _finished = true; break; } } if (!_finished) { _error += string.Format( "\t{0}\n", templates_.TemplateCollection[template_].ID ); } } throw new Exception(_error); } #endregion #region dbconnectionstrings_[0..n].Connection_clearInstance(); for (int d = 0; d < dbconnectionstrings_.Count; d++) { dbconnectionstrings_[d].Connection_clearInstance(); } #endregion }
private void build( dBuild notifyBack_in, // bool loadMetadata_in, MetadataInterface metadata_in ) { notifyback_ = notifyBack_in; //notifyback_("- common items", true); if (xmltemplatesfileuri_.IsFile) { xmltemplatesdir_ = Path.GetDirectoryName( xmltemplatesfileuri_.LocalPath ); } else { xmltemplatesdir_ = xmltemplatesfileuri_.ToString().Substring( 0, xmltemplatesfileuri_.ToString().LastIndexOf("/") ); } #region dbconnectionstrings_[0..n].Connection_createInstance(); for (int d = 0; d < dbconnectionstrings_.Count; d++) { dbconnectionstrings_[d].Connection_createInstance(); } #endregion //metadata_ = new cDBMetadata(xmlmetadatafile_, xmlmetadataroot_); metadata_ = metadata_in; // if (loadMetadata_in) { //// ToDos: now! index must be sinchronized, not very convenient :( // for (int m = 0; m < metadatas_.Length; m++) { // metadatas_[m].LoadState_fromFile( // //xmlmetadatafile_, // metafiles_[m].Path, // //xmlmetadataroot_ // metafiles_[m].Root // ); // } // } templates_ = (xmltemplatesfileuri_.IsFile) ? XS__templates.Load_fromFile(xmltemplatesfileuri_.LocalPath)[0] : XS__templates.Load_fromURI(xmltemplatesfileuri_)[0] ; bool _finished; ArrayList _finishedTemplates = new ArrayList(templates_.TemplateCollection.Count); do { _finished = true; for (template_ = 0; template_ < templates_.TemplateCollection.Count; template_++) { #region if (_finishedPreviously = ...) continue; bool _finishedPreviously = false; for (int f = 0; f < _finishedTemplates.Count; f++) { if ( templates_.TemplateCollection[template_].ID == (string)_finishedTemplates[f] ) { _finishedPreviously = true; break; } } if (_finishedPreviously) { continue; } #endregion #region if ((_finishedDependencies = ...) == templates_[template_].Dependencies.Count) { _finishedTemplates.Add(templates_[template_].ID); _finished = false; } #region int _finishedDependencies = ...; int _finishedDependencies = 0; for (int d = 0; d < templates_.TemplateCollection[template_].Dependencies.DependencyCollection.Count; d++) { for (int f = 0; f < _finishedTemplates.Count; f++) { if ( templates_.TemplateCollection[template_].Dependencies.DependencyCollection[d].TemplateID == (string)_finishedTemplates[f] ) { _finishedDependencies++; break; } } } #endregion if (_finishedDependencies == templates_.TemplateCollection[template_].Dependencies.DependencyCollection.Count) { #region RUNNING: templates_[template_] ... notifyback_( string.Format( "#{0}/{1} - {2} ", _finishedTemplates.Count + 1, templates_.TemplateCollection.Count, templates_.TemplateCollection[template_].ID ), false ); bool _valuehasbeenfound_out = false; metadata_.IterateThrough_fromRoot( templates_.TemplateCollection[template_].IterationType, new utils.IterationFoundDelegate(notifyme), ref _valuehasbeenfound_out ); #endregion // adding template to finished list of templates _finishedTemplates.Add(templates_.TemplateCollection[template_].ID); _finished = false; notifyback_((_valuehasbeenfound_out ? "... DONE!" : "nothing"), true); } #endregion } } while (!_finished); #region if (templates_.Count != _finishedTemplates.Count) throw new Exception("unsolved dependencies"); if (templates_.TemplateCollection.Count != _finishedTemplates.Count) { string _error = "list of Templates with unsolved dependencies:\n"; for (int t = 0; t < templates_.TemplateCollection.Count; t++) { _finished = false; for (int f = 0; f < _finishedTemplates.Count; f++) { if ((string)_finishedTemplates[f] == templates_.TemplateCollection[template_].ID) { _finished = true; break; } } if (!_finished) { _error += string.Format( "\t{0}\n", templates_.TemplateCollection[template_].ID ); } } throw new Exception(_error); } #endregion #region dbconnectionstrings_[0..n].Connection_clearInstance(); for (int d = 0; d < dbconnectionstrings_.Count; d++) { dbconnectionstrings_[d].Connection_clearInstance(); } #endregion }