public static Model loadModel(string toLoad) { ModelKey temp = models.FirstOrDefault(new ModelKey(toLoad).Equals); if (temp != null) return temp.model; temp = new ModelKey(toLoad, ContentLoader.getModel(@"Models\"+toLoad)); models.Add(temp); return temp.model; }
private set => SetValue(ModelKey, value);
public TValue this[ModelKey key] => _dictionary[key];
/// <summary> /// Accepts the specified item. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> bool IReferenceVisitor.Accept(ReferenceItem item) { if (item.Element is DataLayer) { if (item.Source is DataLayer) { RelationShip relation; relation.Source = ((DataLayer)item.Source).Component.Model; relation.Target = ((DataLayer)item.Element).Component.Model; ; relation.Type = RelationShip.RelationType.Composants; relation.Scope = item.Scope; relation.TargetAsString = String.Empty; if (!RelationExists(relation)) { _relations.Add(relation); } // On n'empile pas le modèle sur le contexte car une couche modèle ne peut avoir que des références sur d'autres modèles // et on a pas besoin de contexte pour calculer la relation } } if (item.Element is CandleModel) { CandleModel model = item.Element as CandleModel; if (model == null) { return(false); } if (_context.Count > 0) { RelationShip relation; relation.Source = _context.Peek(); relation.Target = model; relation.Type = RelationShip.RelationType.Composants; relation.Scope = item.Scope; relation.TargetAsString = String.Empty; if (!RelationExists(relation)) { _relations.Add(relation); } } else { //modele initial RelationShip rel; rel.Type = RelationShip.RelationType.Framework; rel.Source = model; rel.Target = null; rel.TargetAsString = model.DotNetFrameworkVersion.ToString(); rel.Scope = item.Scope; _relations.Add(rel); } // Si dèja vu, on arrete ModelKey key = new ModelKey(model.Id, model.Version); if (_models.Exists(delegate(ModelKey k) { return(key.GetHashCode() == k.GetHashCode()); })) { return(false); } _models.Add(key); // Liste des modèles dèja traités _context.Push(model); } return(true); }
public bool TryGetValue(ModelKey key, out TValue value) => _dictionary.TryGetValue(key, out value);
public bool ContainsKey(ModelKey key) => _dictionary.ContainsKey(key);
/// <summary> /// <see cref="object.GetHashCode"/> /// </summary> public override int GetHashCode() { return(ModelKey.GetHashCode()); }
public StadReference(ModelKey key) { Key = key; }
private Model ModelFromHtml(int brandId, HtmlNode li, Dictionary <string, Model> modelToSeriesModel) { HtmlNode input = li.CssSelect("input").SingleOrDefault(); HtmlNode label = li.CssSelect("label").SingleOrDefault(); if (input == null || label == null) { return(null); } string modelName = label.InnerText.Trim(); var modelDto = new ModelDto { BrandId = brandId, Name = modelName }; if (existingModels.Contains(modelDto)) { return(null); } if (!existingModels.Add(modelDto)) { return(null); } string modelKeyName = input.GetAttributeValue("value"); Model model = new Model { BrandId = brandId, Name = modelName, }; string dataGroup = input.GetAttributeValue("data-group"); if (!string.IsNullOrEmpty(dataGroup)) { string[] subModels = dataGroup.Split(','); foreach (string subModel in subModels) { modelToSeriesModel.Add(subModel, model); } } if (modelToSeriesModel.ContainsKey(modelKeyName)) { Model seriesModel = modelToSeriesModel[modelKeyName]; model.ParentModel = seriesModel; seriesModel.SubModels.Add(model); } ModelKey modelKey = new ModelKey { Key = modelKeyName, Model = model, SourceId = (int)SourceEnum.CarsBg }; model.ModelKeys.Add(modelKey); return(model); }