Пример #1
0
        /*
         * private Dictionary<Type, List<Type>> ResultTypeDependencies()
         * {
         * //Build up dictionary of new GSA schema types and keywords - to be used to construct dependencies based on these new types
         * var layerSchemaDict = layerKeywordTypes[Initialiser.AppResources.Settings.TargetLayer];
         * var layerSchemaTypes = layerSchemaDict.Keys;
         * var layerKw = layerSchemaDict.Values.Select(v => v.GetStringValue()).ToList();
         *
         * var resultTypeDependencies = new Dictionary<Type, List<Type>>();
         * var oldSchemaResultTypes = oldSchemaTypes.Where(t => ((string)t.GetAttribute<GSAObject>("Stream")).Contains("result")).ToList();
         * foreach (var t in oldSchemaResultTypes)
         * {
         *  if (!resultTypeDependencies.ContainsKey(t))
         *  {
         *    resultTypeDependencies.Add(t, new List<Type>());
         *  }
         *
         *  var attVal = t.GetAttribute<GSAObject>("ReadPrerequisite");
         *  var prereqs = (attVal != null) ? ((Type[])attVal).ToList() : new List<Type>();
         *
         *  //the prereqs list is a list of the old schema types
         *  foreach (var tPrereq in prereqs)
         *  {
         *    //Remove version for comparison with keyword enum
         *    var kwPrereq = ((string)tPrereq.GetAttribute<GSAObject>("GSAKeyword")).Split('.').First();
         *
         *    if (layerKw.Any(lkw => lkw.Equals(kwPrereq, StringComparison.InvariantCultureIgnoreCase)))
         *    {
         *      resultTypeDependencies[t].Add(tPrereq);
         *    }
         *  }
         * }
         * return resultTypeDependencies;
         * }
         */

        private Dictionary <GSATargetLayer, bool> TypeLayers(Type t)
        {
            return(new Dictionary <GSATargetLayer, bool>
            {
                { GSATargetLayer.Design, GsaRecord.IsDesignLayer(t) },
                { GSATargetLayer.Analysis, GsaRecord.IsAnalysisLayer(t) }
            });
        }
Пример #2
0
 private bool MatchesLayer(Type t, GSATargetLayer layer)
 {
     return((layer == GSATargetLayer.Design && GsaRecord.IsDesignLayer(t)) ||
            (layer == GSATargetLayer.Analysis && GsaRecord.IsAnalysisLayer(t)));
 }