private async Task <IActionResult> ManageEditing(long id, BaseProperty baseProperty) { if (id != baseProperty.Id || baseProperty.GameId != (Guid)GameId() || baseProperty.PresetId == null || !PresetExists((long)baseProperty.PresetId)) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(baseProperty); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BasePropertyExists(baseProperty.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Details", "Presets", new { id = baseProperty.PresetId })); } return(View(baseProperty)); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void AppendStringValue(CommandLineBuilder builder, BaseProperty property, string subtype, string value) { string switchName = property.SwitchPrefix; if (string.IsNullOrEmpty(property.SwitchPrefix)) { switchName = m_parsedBuildRule.SwitchPrefix; } switchName += property.Switch + property.Separator; if (subtype == "file" || subtype == "folder") { if (!string.IsNullOrWhiteSpace(switchName)) { builder.AppendSwitchIfNotNull(switchName, value); } else { builder.AppendTextUnquoted(" " + PathUtils.QuoteIfNeeded(value)); } } else if (!string.IsNullOrEmpty(property.Switch)) { builder.AppendSwitchUnquotedIfNotNull(switchName, value); } else if (!string.IsNullOrEmpty(value)) { builder.AppendTextUnquoted(" " + value); } }
private void GenerateArgumentString(CommandLineBuilder builder, BaseProperty property, string value) { // could cache this SubType test off in property wrapper or somewhere if performance were an issue StringProperty casted = (StringProperty)property; AppendStringValue(builder, property, casted.Subtype, value); }
/// <summary> /// This can be used to write a time zone to a PDI data stream /// </summary> /// <param name="tw">A <see cref="System.IO.TextWriter"/> derived class to which the time zone is /// written.</param> /// <param name="sb">A <see cref="System.Text.StringBuilder"/> used by the properties as a temporary /// buffer. This can be null if the TextWriter is a <see cref="System.IO.StringWriter"/>.</param> /// <remarks>This is called by <see cref="CalendarObject.ToString"/> as well as owning objects when they /// convert themselves to a string or write themselves to a PDI data stream.</remarks> /// <exception cref="ArgumentException">This is thrown if the TimeZoneId's Value property is null</exception> public override void WriteToStream(TextWriter tw, StringBuilder sb) { PropagateVersion(); tw.Write("BEGIN:VTIMEZONE\r\n"); // The TZID property is required. if (this.TimeZoneId.Value == null) { throw new ArgumentException(LR.GetString("ExTZIDCannotBeNull")); } BaseProperty.WriteToStream(timeZoneId, sb, tw); BaseProperty.WriteToStream(timeZoneUrl, sb, tw); BaseProperty.WriteToStream(lastMod, sb, tw); if (rules != null && rules.Count != 0) { foreach (ObservanceRule r in rules) { r.WriteToStream(tw, sb); } } if (customProps != null && customProps.Count != 0) { foreach (CustomProperty c in customProps) { BaseProperty.WriteToStream(c, sb, tw); } } tw.Write("END:VTIMEZONE\r\n"); }
private void InitProperty(CharacterPropertyEnum id, int val) { if (val != 0) { BaseProperty.SetInt(id, val); } }
/// <summary> /// Returns the value of the metadata item identified by <paramref name="metadataName"/>. /// </summary> /// <param name="property">The property to examine.</param> /// <param name="metadataName">The name of the metadata item to return.</param> /// <returns> /// The value of the corresponding metadata item, or <see langword="null"/> if it is not /// found. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="property"/> is <see langword="null"/>. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="property"/> is <see langword="null"/> or empty. /// </exception> public static string?GetMetadataValueOrNull(this BaseProperty property, string metadataName) { Requires.NotNull(property, nameof(property)); Requires.NotNullOrEmpty(metadataName, nameof(metadataName)); return(property.Metadata.FirstOrDefault(nvp => nvp.Name == metadataName)?.Value); }
/// <summary> /// This can be used to write a free/busy object to a PDI data stream /// </summary> /// <param name="tw">A <see cref="System.IO.TextWriter"/> derived class to which the free/busy object is /// written.</param> /// <param name="sb">A <see cref="System.Text.StringBuilder"/> used by the properties as a temporary /// buffer. This can be null if the TextWriter is a <see cref="System.IO.StringWriter"/>.</param> /// <remarks>This is called by <see cref="CalendarObject.ToString"/> as well as owning objects when they /// convert themselves to a string or write themselves to a PDI data stream.</remarks> public override void WriteToStream(TextWriter tw, StringBuilder sb) { // DTSTAMP is always updated and written to reflect when the object was saved to the stream this.TimeStamp.DateTimeValue = DateTime.Now; PropagateVersion(); tw.Write("BEGIN:VFREEBUSY\r\n"); // This is a required property for iCalendar 2.0. BaseProperty.WriteToStream(this.UniqueId, sb, tw); BaseProperty.WriteToStream(organizer, sb, tw); if (attendees != null && attendees.Count != 0) { foreach (AttendeeProperty a in attendees) { BaseProperty.WriteToStream(a, sb, tw); } } BaseProperty.WriteToStream(contact, sb, tw); BaseProperty.WriteToStream(startDate, sb, tw); BaseProperty.WriteToStream(endDate, sb, tw); BaseProperty.WriteToStream(duration, sb, tw); BaseProperty.WriteToStream(comment, sb, tw); BaseProperty.WriteToStream(url, sb, tw); BaseProperty.WriteToStream(timeStamp, sb, tw); if (reqstats != null && reqstats.Count != 0) { foreach (RequestStatusProperty r in reqstats) { BaseProperty.WriteToStream(r, sb, tw); } } if (freebusy != null && freebusy.Count != 0) { // If there are any, they are sorted in ascending order first freebusy.Sort(true); foreach (FreeBusyProperty fb in freebusy) { BaseProperty.WriteToStream(fb, sb, tw); } } if (customProps != null && customProps.Count != 0) { foreach (CustomProperty c in customProps) { BaseProperty.WriteToStream(c, sb, tw); } } tw.Write("END:VFREEBUSY\r\n"); }
public ActionResult DeleteConfirmed(int id) { BaseProperty baseProperty = db.BaseProperties.Find(id); db.BaseProperties.Remove(baseProperty); db.SaveChanges(); return(RedirectToAction("Index")); }
private bool ParseParameterGroupOrParameter(BaseProperty baseProperty, LinkedList <Property> propertyList, Property property) { if (!this.ParseParameter(baseProperty, propertyList, property)) { return(false); } return(true); }
static KeyValuePair <PropertyType, BaseProperty> ReadProperty(BinaryReader reader) { var key = (PropertyType)reader.ReadUInt32(); BaseProperty property = new BaseProperty(); property.Unpack(reader); return(new KeyValuePair <PropertyType, BaseProperty>(key, property)); }
public T AddProperty <T>(PropertyType type) where T : PropertyValue, new() { BaseProperty bp = new BaseProperty(); bp.Type = type; bp.Value = new T(); Properties.Add(type, bp); return((T)bp.Value); }
public static string?GetDebugPropertyNameOrNull(BaseProperty property) { if (property.ContainingRule.PageTemplate == CommandNameBasedDebuggerPageTemplate) { return(ConvertRealPageAndPropertyToDebugProperty(property.ContainingRule.Name, property.Name)); } return(null); }
private void GenerateArgumentEnum(CommandLineBuilder builder, BaseProperty property, string value) { var result = ((EnumProperty)property).AdmissibleValues.Find(x => (x.Name == value)); if (result != null) { builder.AppendSwitchUnquotedIfNotNull(m_parsedBuildRule.SwitchPrefix, result.Switch); } }
public bool Add(INotify notify, BaseProperty property) { if (false != this.notifierDictionary.ContainsKey(property.id)) { return(false); } this.notifierDictionary.Add(property.id, notify); return(true); }
/// <summary> /// Default string formatter for properties controllers. /// </summary> /// <param name="obj">Object to convert.</param> /// <returns>Value of the property as string.</returns> public static string PropertyControllerStringFormatter(BaseProperty obj) { // Validation: if (obj == null) { throw new InvalidOperationException("Can not parse a null value"); } return(obj.CommandString); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void AppendIntValue(CommandLineBuilder builder, BaseProperty property, string value) { value = value.Trim(); string switchName = m_parsedBuildRule.SwitchPrefix + property.Switch; switchName += property.Separator; builder.AppendSwitchUnquotedIfNotNull(switchName, value); }
private void GenerateArgumentBool(CommandLineBuilder builder, BaseProperty property, string value) { if (value == "true") { builder.AppendSwitchUnquotedIfNotNull(m_parsedBuildRule.SwitchPrefix, property.Switch); } else if (value == "false" && ((BoolProperty)property).ReverseSwitch != null) { builder.AppendSwitchUnquotedIfNotNull(m_parsedBuildRule.SwitchPrefix, ((BoolProperty)property).ReverseSwitch); } }
private (string, UpdateResult, long) LinkProperty(BaseProperty property) { var result = Measure(() => _elasticClient.LinkProductsByProperty(property), out var time); _context.CalculatePercent(); if (result.IsError) { _context.AddMessage($"id {property.Id} updated {result.Pretty}", result.IsError); } return(property.Id, result, time); }
public UObject(IoPackageReader reader, string type, bool structFallback = false) { Dict = new Dictionary <string, object>(); var header = new FUnversionedHeader(reader); if (header.HasValues) { using var it = new FIterator(header); if (header.HasNonZeroValues) { FUnversionedType unversionedType = reader.GetOrCreateSchema(type); var num = 1; do { var(val, isNonZero) = it.Current; if (unversionedType.Properties.TryGetValue(val, out var props)) { var propertyTag = new FPropertyTag(props); if (isNonZero) { var key = Dict.ContainsKey(props.Name) ? $"{props.Name}_NK{num++:00}" : props.Name; var obj = BaseProperty.ReadAsObject(reader, propertyTag, propertyTag.Type, ReadType.NORMAL); Dict[key] = obj; } else { var key = Dict.ContainsKey(props.Name) ? $"{props.Name}_NK{num++:00}" : props.Name; var obj = BaseProperty.ReadAsZeroObject(reader, propertyTag, propertyTag.Type); Dict[key] = obj; } } else { Dict[val.ToString()] = null; } } while (it.MoveNext()); } else { #if DEBUG FConsole.AppendText(string.Concat("\n", type ?? "Unknown", ": ", reader.Summary.Name.String), "#CA6C6C", true); do { FConsole.AppendText($"Val: {it.Current.Val} (IsNonZero: {it.Current.IsNonZero})", FColors.Yellow, true); }while (it.MoveNext()); #endif } } if (!structFallback && reader.ReadInt32() != 0 /* && reader.Position + 16 <= maxSize*/) { reader.Position += FGuid.SIZE; } }
public ActionResult Edit([Bind(Include = "Id,PropertyTypeId,Select,Label")] BaseProperty baseProperty) { if (ModelState.IsValid) { db.Entry(baseProperty).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PropertyTypeId = new SelectList(db.PropertyTypes, "Id", "Label", baseProperty.PropertyTypeId); return(View(baseProperty)); }
public T GetProperty <T>() where T : class { BaseProperty returnVal = null; if (Schematic.Behaviours.TryGetValue(typeof(T), out returnVal)) { return(returnVal as T); } return(null); }
/// <summary> /// Базовый метод для добавления в коллекцию контроля свойств /// </summary> /// <param name="controlProperty">Базовый элемент контроля свойств</param> /// <returns></returns> public bool AddProperty(BaseProperty baseProperty) { foreach (PropertyControl property in _properties) { if (ReferenceEquals(property.Property, baseProperty)) return false; } //Проверим нахождение добавляемого свойства в списке PropertyControl propertyControl = new PropertyControl(); //Создали свойство propertyControl.Set(baseProperty); //передали базовый объект _properties.Add(propertyControl); //Добавим в список return true; }
public void Add(BaseProperty baseProperty) { if (_memberCheckService.CheckIfRealPerson((Member)baseProperty)) { members.Add((Member)baseProperty); Console.WriteLine("Member added : " + baseProperty.Name); } else { Console.WriteLine("Not a added member"); } }
public ActionResult Create([Bind(Include = "Id,PropertyTypeId,Select,Label")] BaseProperty baseProperty) { if (ModelState.IsValid) { db.BaseProperties.Add(baseProperty); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PropertyTypeId = new SelectList(db.PropertyTypes, "Id", "Label", baseProperty.PropertyTypeId); return(View(baseProperty)); }
public void OnTriggerEnter(Collider _c) { if ((transform.parent.tag == "blue" && _c.tag == "red") || (transform.parent.tag == "red" && _c.tag == "blue")) { BaseProperty _p = _c.gameObject.GetComponent <BaseProperty>(); if (_p != null && !_p.hasDead && !enemies.ContainsKey(_c.gameObject)) { enemies.Add(_c.gameObject, _p); print(_c.gameObject.name); } } }
private void GenerateArgumentStringList(CommandLineBuilder builder, BaseProperty property, string value) { string[] arguments = value.Split(';'); foreach (string argument in arguments) { if (argument.Length > 0) { StringListProperty casted = (StringListProperty)property; AppendStringValue(builder, property, casted.Subtype, argument); } } }
public bool Find <T>(List <T> list, string name, out BaseProperty prop) where T : BaseProperty { foreach (var p in list) { if (p.Name == name) { prop = p; return(true); } } prop = null; return(false); }
// GET: BaseProperties/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BaseProperty baseProperty = db.BaseProperties.Find(id); if (baseProperty == null) { return(HttpNotFound()); } return(View(baseProperty)); }
private async Task <IActionResult> ManageCreation(BaseProperty baseProperty) { if (ModelState.IsValid && PresetExists((long)baseProperty.PresetId)) { baseProperty.GameId = (Guid)GameId(); _context.Add(baseProperty); await _context.SaveChangesAsync(); baseProperty.SortValue = baseProperty.Id; await _context.SaveChangesAsync(); return(RedirectToAction("Details", "Presets", new { id = baseProperty.PresetId })); } return(View(baseProperty)); }
// GET: BaseProperties/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BaseProperty baseProperty = db.BaseProperties.Find(id); if (baseProperty == null) { return(HttpNotFound()); } ViewBag.PropertyTypeId = new SelectList(db.PropertyTypes, "Id", "Label", baseProperty.PropertyTypeId); return(View(baseProperty)); }
public VBProperty(BaseProperty propToCopyFrom) : base(propToCopyFrom) { }