/// <summary> /// Tries to get the value. /// </summary> /// <param name="object">The @object.</param> /// <param name="key">The key.</param> /// <param name="value">The value.</param> /// <returns>True if it is found, false otherwise.</returns> private bool TryGetValue(TClass @object, int key, out object?value) { if (!GetProperties.ContainsKey(key)) { value = null; return(false); } value = GetProperties[key](@object); return(true); }
private OperationResponse ItemOperationGetProperties(Item item, GetProperties operation) { if (item.Disposed) { return(operation.GetOperationResponse((int)ReturnCode.ItemNotFound, "ItemNotFound")); } if (item.Properties != null) { if (operation.PropertiesRevision.HasValue == false || operation.PropertiesRevision.Value != item.PropertiesRevision) { var properties = new ItemProperties { ItemId = item.Id, PropertiesRevision = item.PropertiesRevision, PropertiesSet = new Hashtable(item.Properties) }; var eventData = new EventData((byte)EventCode.ItemProperties, properties); this.Peer.SendEvent(eventData, new SendParameters { ChannelId = Settings.ItemEventChannel }); } } // no response sent operation.OnComplete(); return(null); }
protected override void GenerateAccessToCustomProperties() { SetProperties.Add("freezepercentage", SetFreezePercentage); SetProperties.Add("freezetime", SetFreezeTime); GetProperties.Add("freezepercentage", GetFreezePercentage); GetProperties.Add("freezetime", GetFreezeTime); }
private OperationResponse ItemOperationGetProperties(Item item, GetProperties operation, MmoActor actor) { if (item.Disposed) { return(operation.GetOperationResponse((int)ReturnCode.ItemNotFound, "ItemNotFound")); } if (item.properties != null) { //if (operation.PropertiesRevision.HasValue == false || operation.PropertiesRevision.Value != item.PropertiesRevision) //{ ItemProperties properties = null; properties = new ItemProperties { ItemId = item.Id, ItemType = item.Type, PropertiesRevision = item.properties.propertiesRevision, PropertiesSet = item.properties.raw }; var eventData = new EventData((byte)EventCode.ItemProperties, properties); actor.Peer.SendEvent(eventData, new SendParameters { ChannelId = Settings.ItemEventChannel, Unreliable = true }); //} } // no response sent operation.OnComplete(); return(null); }
protected virtual List <string> GetAnymonousPropertySet() { var list = new List <string>(); foreach (var property in GetProperties.Where(x => x.Property.DataType.Datatype != Datatype.ChildCollection)) { if (property.Property.DataType.Datatype == Datatype.Child || property.Property.DataType.Datatype == Datatype.ReadonlyChild) { if (property.Property.Required) { list.Add($"anymonous.{property.Property.Name}Id = {property.Property.Name}.Id;"); } else { list.Add($"anymonous.{property.Property.Name}Id = {property.Property.Name}?.Id;"); } } else { list.Add($"anymonous.{property.Property.Name} = {property.Property.Name};"); } } return(list); }
protected override void GenerateAccessToCustomProperties() { SetProperties.Add("moneytime", SetMoneyTime); SetProperties.Add("moneyamount", SetMoneyAmount); GetProperties.Add("moneytime", GetMoneyTime); GetProperties.Add("moneyamount", GetMoneyAmount); GetProperties.Add("moneypersecond", GetMoneyPerSecond); }
protected override void GenerateAccessToCustomProperties() { SetProperties.Add("healthtime", SetHealthTime); SetProperties.Add("healthamount", SetHealthAmount); GetProperties.Add("healthtime", GetHealthTime); GetProperties.Add("healthamount", GetHealthAmount); GetProperties.Add("healthpersecond", GetHealthPerSecond); }
protected override void GenerateAccessToCustomProperties() { SetProperties.Add("poisontime", SetPoisonTime); SetProperties.Add("poisonamount", SetPoisonAmount); SetProperties.Add("poisoncountertime", SetDotCounterTime); GetProperties.Add("poisontime", GetPoisonTime); GetProperties.Add("poisonamount", GetPoisonAmount); GetProperties.Add("poisoncountertime", GetDotCounterTime); GetProperties.Add("damageoverall", GetDamageOverall); }
private static async Task <string> GetAzureStorageUriAsync(ConfigurationFile config, HttpClient client) { string subscriptionId = config.SubscriptionId; string resourceGroupName = config.ResourceGroup; string accountName = config.StorageAccount; HttpResponseMessage result = await client.GetAsync($"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2018-07-01"); string content = await result.Content.ReadAsStringAsync(); GetProperties properties = JsonConvert.DeserializeObject <GetProperties>(content); return(properties?.properties?.primaryEndpoints?.web); }
public override IEnumerable <FileBuilder.OutputFile> Build() { OutputPaneManager.WriteToOutputPane($"Build {Entity.Name} for {Location.FileLocation.GetProjectLocation}"); var file = FileManager.StartNewClassFile(Entity.Name, Location.FileLocation.Project, Location.FileLocation.Folder); file.ClassAttributes.Add("[Serializable]"); file.IsAbstract = Entity.IsAbstract; file.BaseClass = Location.GetBaseClass; file.Namespaces.AddRange(Location.Namespaces.Select(x => x.Value).Concat(MainInfoManager.GetBasicNamespaces)); file.Namespaces.Add(MainInfoManager.GetEnumNamespace); file.Properties.AddRange(GetProperties.Select(x => x.GetProperty)); file.Methods.Add(GenerateMethods()); file.OwnNamespace = Location.FileLocation.GetNamespace; return(new List <FileBuilder.OutputFile> { file }); }
/// <summary> /// Tries to get the value. /// </summary> /// <param name="object">The object.</param> /// <param name="propertyName">Name of the property.</param> /// <param name="value">The value.</param> /// <returns>True if it is a property, false otherwise.</returns> public bool TryGetValue(Dynamo @object, string propertyName, out object?value) { if (@object is null) { value = null; return(false); } var Key = propertyName.GetHashCode(StringComparison.OrdinalIgnoreCase); if (!GetProperties.ContainsKey(Key)) { value = null; return(false); } value = GetProperties[Key]((@object as TClass) !); return(true); }
public void UpdateProxyTemplate() { var properties = GetProperties.ToDictionary(x => x.LinkedProperty, y => y.Value ?? ""); properties.Add(PropertyTabViewModel.SetProperty, Set.Name); properties.Add(PropertyTabViewModel.NameProperty, Name); properties.Add(PropertyTabViewModel.SizeNameProperty, SizeProperty.Name); properties.Add(PropertyTabViewModel.SizeHeightProperty, SizeProperty.Height.ToString()); properties.Add(PropertyTabViewModel.SizeWidthProperty, SizeProperty.Width.ToString()); var proxymapping = properties.ToDictionary(x => x.Key.Name, y => y.Value); TemplateModel activeTemplate = (TemplateModel)ViewModelLocator.ProxyTabViewModel.Templates.DefaultItem; foreach (TemplateModel template in ViewModelLocator.ProxyTabViewModel.Templates) { if (template._def.Matches.All(x => proxymapping.ContainsKey(x.Name) && proxymapping[x.Name] == x.Value)) { activeTemplate = template; break; } } BaseImage = activeTemplate.Asset.SafePath; BitmapImage image = new BitmapImage(new Uri(BaseImage)); BaseWidth = image.PixelWidth; BaseHeight = image.PixelHeight; ActiveOverlayLayers = new ObservableCollection <OverlayBlockDefinitionItemModel>( activeTemplate._def .GetOverLayBlocks(proxymapping).Where(x => x.SpecialBlock == null) .Select(x => (OverlayBlockDefinitionItemModel)ViewModelLocator.ProxyTabViewModel.OverlayBlocks.First(y => ((OverlayBlockDefinitionItemModel)y).Name == x.Block)) ); ActiveTextLayers = new ObservableCollection <ProxyTextBlockItemModel>( activeTemplate._def .GetTextBlocks(proxymapping) .Select(x => new ProxyTextBlockItemModel(x) { Card = this, LinkedProperty = properties.First(y => y.Key.Name == x.NestedProperties.First().Name).Key } )); }
/// <summary> /// Setups the values. /// </summary> /// <returns>This.</returns> public void SetupValues() { if (GetProperties.Count > 0 || SetProperties.Count > 0) { return; } foreach (var Property in TypeCacheFor <TClass> .Properties.Where(x => x.GetIndexParameters().Length == 0)) { var Key = Property.Name.GetHashCode(StringComparison.OrdinalIgnoreCase); if (Property.CanRead) { GetProperties.Add(Key, Property.PropertyGetter <TClass>().Compile()); } if (Property.CanWrite) { SetProperties.Add(Key, (Property.PropertySetter <TClass, object>()?.Compile()) !); } } }
public PropertyContainer() { foreach (PropertyInfo propertyInfo in typeof(T).GetProperties()) { if (Attribute.IsDefined(propertyInfo, typeof(InversePropertyAttribute)) != true) { var property = new Property(propertyInfo); getter.Add(property.Name, propertyInfo.GetValueGetter <T>()); setter.Add(property.Name, propertyInfo.GetValueSetter <T>()); if (property.IsKey) { GetProperties.Insert(0, property); } else { GetProperties.Add(property); } } } properties = GetProperties.ToDictionary(p => p.Name); }
/// <summary> /// Handles operation GetProperties: Sends event ItemProperties to the client. /// </summary> public OperationResponse OperationGetProperties(PeerBase peer, OperationRequest request, SendParameters sendParameters) { var operation = new GetProperties(peer.Protocol, request); if (!operation.IsValid) { return(new OperationResponse(request.OperationCode) { ReturnCode = (int)ReturnCode.InvalidOperationParameter, DebugMessage = operation.GetErrorMessage() }); } operation.OnStart(); Item item; bool actorItem = this.TryGetItem(operation.ItemId, out item); if (actorItem == false) { if (this.World.ItemCache.TryGetItem(operation.ItemId, out item) == false) { return(operation.GetOperationResponse((int)ReturnCode.ItemNotFound, "ItemNotFound")); } } if (actorItem) { // we are already in the item thread, invoke directly return(this.ItemOperationGetProperties(item, operation)); } else { // second parameter (peer) allows us to send an error event to the client (in case of an error) item.Fiber.Enqueue(() => this.ExecItemOperation(() => this.ItemOperationGetProperties(item, operation), sendParameters)); // operation is continued later return(null); } }
public void UpdateProxyTemplate() { var tempCard = GetTempCard(); var properties = tempCard.GetProxyMappings(); ProxyTemplateItemModel activeTemplate = ViewModelLocator.ProxyTabViewModel.Templates.First(x => x._def.defaultTemplate == true); foreach (var template in ViewModelLocator.ProxyTabViewModel.Templates) { bool isValidTemplate = true; foreach (var match in template._def.Matches) { if (!properties.ContainsKey(match.Name) || properties[match.Name] != match.Value) { isValidTemplate = false; break; } } if (isValidTemplate == true) { activeTemplate = template; break; } } BaseImage = Path.Combine(activeTemplate._def.rootPath, activeTemplate._def.src); BitmapImage image = new BitmapImage(new Uri(BaseImage)); BaseWidth = image.PixelWidth; BaseHeight = image.PixelHeight; ActiveOverlayLayers = new ObservableCollection <ProxyOverlayItemModel>(activeTemplate._def.GetOverLayBlocks(properties).Select(x => ViewModelLocator.ProxyTabViewModel.OverlayBlocks.First(y => y.Name == x.Block))); ActiveTextLayers = new ObservableCollection <ProxyTextBlockItemModel>(activeTemplate._def.GetTextBlocks(properties).Select(x => new ProxyTextBlockItemModel(x) { Property = GetProperties.First(y => y.Name == x.NestedProperties.First().Name) })); RaisePropertyChanged(""); }
public static extern bool CallPropDialog (IntPtr hwnd, GetProperties dwType, string szObject, string szPage);
protected override void GenerateAccessToCustomProperties() { SetProperties.Add("percentage", SetPercentage); GetProperties.Add("percentage", GetPercentage); }
protected override void GenerateAccessToCustomProperties() { SetProperties.Add("shotcostmultiplier", SetShotCostMultiplier); GetProperties.Add("shotcostmultiplier", GetShotCostMultiplier); GetProperties.Add("costpershot", GetCostPerShot); }
Debug(logger, message, GetProperties(properties));