private static void SetFeatureData(PlatformFeature feature, Object value) { lock (_features) { if (FindFeatureData(feature) == null) { _features.Add(feature, value); } } }
internal static Object GetFeatureData(PlatformFeature feature) { Object value = FindFeatureData(feature); if (value != null) { return(value); } switch (feature) { case PlatformFeature.SWC: value = Thunk.SWCThunk.IsSWCSupported(); break; default: DBG.Assert(false, "Unknown feature"); return(null); } SetFeatureData(feature, value); return(value); }
internal static bool Supports(PlatformFeature feature) { return((bool)GetFeatureData(feature)); }
private static Object FindFeatureData(PlatformFeature feature) { return(_features[feature]); }
public static PlatformFeature SetImageAndFileFeaturesSupport(Settings settings, PlatformFeature existingFeatures, IConnectionManager connectionManager) { const PlatformFeature feature = PlatformFeature.Image; var entityProperties = new MetadataPropertiesExpression { AllProperties = false }; entityProperties.PropertyNames.AddRange("LogicalName", "Attributes"); var entityFilter = new MetadataFilterExpression(LogicalOperator.And); entityFilter.Conditions.Add(new MetadataConditionExpression("LogicalName", MetadataConditionOperator.Equals, "account")); var attributeProperties = new MetadataPropertiesExpression { AllProperties = false }; attributeProperties.PropertyNames.AddRange("MaxWidth", "MaxHeight", "MaxSizeInKB"); var attributeFilter = new MetadataFilterExpression(LogicalOperator.And); attributeFilter.Conditions.Add(new MetadataConditionExpression("LogicalName", MetadataConditionOperator.Equals, "name")); var entityQueryExpression = new EntityQueryExpression { Properties = entityProperties, Criteria = entityFilter, AttributeQuery = new AttributeQueryExpression { Properties = attributeProperties, Criteria = attributeFilter } }; try { var retrieveMetadataChangesRequest = new RetrieveMetadataChangesRequest { Query = entityQueryExpression }; var dummy = (RetrieveMetadataChangesResponse)connectionManager.Get().Execute(retrieveMetadataChangesRequest); return(existingFeatures | feature); } catch (FaultException <OrganizationServiceFault> ex) { if (ex.Detail.ErrorCode == unchecked ((int)0x80044183)) { return(existingFeatures & ~feature); } else { throw; } } }