private void OnMetadataUpdate(string key, IMetadataProperty newData) { if (activeSlot.IsNullOrEmpty()) { return; } var item = activeSlot.Item; if (item.IsTool) { var tool = (InventoryItemTool)item; // when current durability changes if (key.Equals(InventoryItemTool.DURABILITY_MDK)) { // try to read durability from metadata toolCurrentDurabilityText.text = newData is MetadataProperty <int> durabilityMeta ? durabilityMeta.ValueStr : valueNotFoundString; } } else if (item.IsWeapon) { var weapon = (InventoryItemWeapon)item; // when clipp ammo count changes if (key.Equals(InventoryItemWeapon.AMMO_CURRENT_CLIP_MDK)) { weaponCurrentClipText.text = newData is MetadataProperty <int> clipMeta ? clipMeta.ValueStr : valueNotFoundString; } } }
public PropertyValueInfo OnGetProjectConfigurationPropertyValue(JToken arg) { try { var message = arg.ToObject <ProjectConfigurationPropertyParams> (); var project = FindProject(message.ProjectFileName); var configuration = project.GetConfiguration(IdeApp.Workspace.ActiveConfiguration) as ProjectConfiguration; if (configuration == null) { return(new PropertyValueInfo()); } IMetadataProperty property = configuration.Properties.GetProperty(message.PropertyName); if (property != null) { return(new PropertyValueInfo { PropertyValue = GetPropertyValue(property) }); } return(new PropertyValueInfo()); } catch (Exception ex) { LoggingService.LogError("OnGetProjectConfigurationPropertyValue error", ex); throw; } }
public PropertyValueInfo OnGetProjectPropertyValue(JToken arg) { try { var message = arg.ToObject <ProjectPropertyParams> (); var project = FindProject(message.ProjectFileName); string propertyName = MapPropertyName(message.PropertyName); IMetadataProperty property = project.ProjectProperties.GetProperty(propertyName); if (property != null) { return(new PropertyValueInfo { PropertyValue = property.Value }); } IMSBuildPropertyEvaluated evaluatedProperty = project .MSBuildProject? .EvaluatedProperties? .GetProperty(propertyName); if (evaluatedProperty != null) { return(new PropertyValueInfo { PropertyValue = evaluatedProperty.Value }); } return(new PropertyValueInfo()); } catch (Exception ex) { LoggingService.LogError("OnGetProjectPropertyValue error", ex); throw; } }
static string GetPropertyValue(IMetadataProperty property) { if (IsPathProperty(property.Name)) { return(GetPathValue(property.Value)); } return(property.Value); }
private static MetadataPropertyAccessor BuildPropertyAccessor(IMetadataProperty metadataProperty, YamlMappingNode map) { if (metadataProperty.GetAccessType() != FieldAccessType.PUBLIC_METHOD) { return(null); } string getter = null; foreach (var(key, value) in map) { if (key.ToString().Equals(KEY_GETTER)) { getter = value.ToString(); } } return(getter == null ? null : new MetadataPropertyAccessor(getter)); }