public override byte[] GetContent(Assembly assembly) { var result = new Dictionary<string, string>(); var resourceManager = new ResourceManager(baseName, assembly); using (var resourceSet = resourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true)) { foreach (DictionaryEntry entry in resourceSet) { var key = entry.Key.ToString(); result.Add(key, resourceManager.GetString(key)); } } var json = result.ToJson(); return Encoding.UTF8.GetBytes(json); }
/// <summary> /// Retrieves feature collection JSON for a feature layer. /// </summary> /// <remarks> /// The JSON returned by this function can be used to instantiate a feature collection layer /// via FeatureLayer.FromJson. Note that this method DOES NOT serialize features as this /// capability is not needed at this time. /// </remarks> public static string GenerateFeatureCollectionJson(this FeatureLayer layer, bool humanReadable = false) { if (layer.LayerInfo == null) { return null; } else { Dictionary<string, object> dictionary = new Dictionary<string, object>(); dictionary.Add("layerDefinition", layer.GetLayerInfoDictionary()); string json = dictionary.ToJson(); return json; } }