internal void WriteTo( BinaryWriter writer, AssetNameCollection assetNames, ushort minimumVersionThatHasInternalName, ushort minimumVersionThatHasEnabledFlag, Action derivedWriteTo = null) { WriteAssetTo(writer, () => { writer.Write((uint)(object)ContentType); if (Version >= minimumVersionThatHasInternalName) { InternalName.WriteTo(writer, assetNames); } writer.Write((uint)Arguments.Length); foreach (var argument in Arguments) { argument.WriteTo(writer); } if (Version >= minimumVersionThatHasEnabledFlag) { writer.WriteBooleanUInt32(Enabled); } derivedWriteTo?.Invoke(); }); }
public void ParseTest(string raw, bool valid, string expectedNamespace, string expectedName) { InternalName internalName; try { internalName = InternalName.Parse(raw); } catch { internalName = null; } if (!valid) { Assert.IsNull(internalName); } else if (internalName == null) { Assert.Fail("Valid name, but failed to parse"); } else { Assert.AreEqual(expectedNamespace, internalName.Namespace); Assert.AreEqual(expectedName, internalName.Name); Assert.AreEqual(raw, internalName.ToString()); } }
private string GetFieldXml(bool required, string additionalProperties, string fieldContent) { var format = !string.IsNullOrEmpty(Format) ? " Format=\"" + Format + "\"" : string.Empty; var showField = !string.IsNullOrEmpty(ShowField) ? " ShowField=\"" + ShowField + "\"" : string.Empty; var openTermSet = OpenTermSet ? " CreateValuesInEditForm=\"TRUE\" Open=\"TRUE\"" : string.Empty; var fieldXml = new StringBuilder(); fieldXml.AppendFormat( "<Field ID=\"{0}\" Name=\"{1}\" DisplayName=\"{2}\" Type=\"{3}\" Hidden=\"{4}\" " + "Group=\"{5}\" Description=\"{6}\" Required=\"{7}\" " + "ShowInNewForm=\"{8}\" ShowInEditForm=\"{9}\" ShowInDisplayForm=\"{10}\"" + "{11}{12}{13} {14}>", ID.ToString("B"), InternalName.Trim(), DisplayName.Trim(), Type, Hidden, Group, Description, required.ToString().ToUpper(), ShowInNewForm.ToString().ToUpper(), ShowInEditForm.ToString().ToUpper(), ShowInDisplayForm.ToString().ToUpper(), format, showField, openTermSet, additionalProperties); if (!string.IsNullOrEmpty(Default)) { fieldXml.AppendFormat("<Default>{0}</Default>", Default); } if (!string.IsNullOrEmpty(fieldContent)) { fieldXml.Append(fieldContent); } fieldXml.Append("</Field>"); return(fieldXml.ToString()); }
/// <summary> /// Map the information sent back by Campaign into a format which can be saved as a file to disk. /// </summary> /// <param name="requestHandler">Request handler, which can be used if further information from Campaign is required for the mapping.</param> /// <param name="rawQueryResponse">Raw response from Campaign.</param> /// <returns>Class containing file content and metadata</returns> public override Template ParseQueryResponse(IRequestHandler requestHandler, string rawQueryResponse) { var doc = new XmlDocument(); doc.LoadXml(rawQueryResponse); var metadata = new TemplateMetadata { Schema = InternalName.Parse(Schema), Name = new InternalName(doc.DocumentElement.Attributes["namespace"].InnerText, doc.DocumentElement.Attributes["name"].InnerText), Label = doc.DocumentElement.Attributes["label"].InnerText, }; doc.DocumentElement.RemoveAllAttributesExcept(AttributesToKeep); doc.DocumentElement.RemoveChild("createdBy"); doc.DocumentElement.RemoveChild("modifiedBy"); var rawCode = doc.OuterXml; return(new Template { Code = rawCode, Metadata = metadata, FileExtension = FileTypes.Xml, }); }
/// <summary> /// Map the information sent back by Campaign into a format which can be saved as a file to disk. /// </summary> /// <param name="requestHandler">Request handler, which can be used if further information from Campaign is required for the mapping.</param> /// <param name="rawQueryResponse">Raw response from Campaign.</param> /// <returns>Class containing file content and metadata</returns> public override Template ParseQueryResponse(IRequestHandler requestHandler, string rawQueryResponse) { var doc = new XmlDocument(); doc.LoadXml(rawQueryResponse); var metadata = new TemplateMetadata { Schema = InternalName.Parse(Schema), Name = new InternalName(doc.DocumentElement.Attributes["namespace"].InnerText, doc.DocumentElement.Attributes["name"].InnerText), }; var labelNode = doc.DocumentElement.Attributes["label"]; if (labelNode != null) { metadata.Label = labelNode.InnerText; } var codeNode = doc.DocumentElement.SelectSingleNode("data"); var rawCode = codeNode == null ? string.Empty : codeNode.InnerText; return(new Template { Code = rawCode, Metadata = metadata, FileExtension = FileTypes.JavaScript, }); }
/// <summary> /// Map the information sent back by Campaign into a format which can be saved as a file to disk. /// </summary> /// <param name="requestHandler">Request handler, which can be used if further information from Campaign is required for the mapping.</param> /// <param name="rawQueryResponse">Raw response from Campaign.</param> /// <returns>Class containing file content and metadata</returns> public override Template ParseQueryResponse(IRequestHandler requestHandler, string rawQueryResponse) { var doc = new XmlDocument(); doc.LoadXml(rawQueryResponse); var metadata = new TemplateMetadata { Schema = InternalName.Parse(Schema), Name = new InternalName(null, doc.DocumentElement.Attributes["internalName"].InnerText), Label = doc.DocumentElement.Attributes["label"].InnerText, }; var folderInternalName = doc.DocumentElement.SelectSingleNode("folder").Attributes["name"].InnerText; metadata.AdditionalProperties.Add(AdditionalData_Folder, folderInternalName); doc.DocumentElement.RemoveAllAttributesExcept(AttributesToKeep); doc.DocumentElement.RemoveChild("createdBy"); doc.DocumentElement.RemoveChild("modifiedBy"); // Substitute delivery internal name for id in each delivery activity. var deliveryActions = doc.DocumentElement.SelectNodes("activities/delivery"); if (deliveryActions != null) { foreach (XmlElement deliveryAction in deliveryActions) { var deliveryIdAttr = deliveryAction.Attributes["scenario-id"]; if (deliveryIdAttr == null) { continue; } int deliveryId; if (!int.TryParse(deliveryIdAttr.Value, out deliveryId)) { continue; } var deliveryInternalName = GetDeliveryInternalName(requestHandler, deliveryId); if (deliveryInternalName == null) { continue; } deliveryAction.Attributes.Remove(deliveryIdAttr); deliveryAction.AppendAttribute("scenario-internalName", deliveryInternalName); } } var rawCode = doc.OuterXml; return(new Template { Code = rawCode, Metadata = metadata, FileExtension = FileTypes.Xml, }); }
public bool Equals(SongBase other) { return((FileSystemFriendlyName.Equals(other.FileSystemFriendlyName)) && (InternalName.Equals(other.InternalName)) && (Identifier.Equals(other.Identifier)) && (Artist.Equals(other.Artist)) && (TrackName.Equals(other.TrackName))); }
/// <summary> /// Parse metadata taken from a file into a form which can be sent to Campaign. /// </summary> /// <param name="input">String representation of metadata</param> /// <returns>Metadata</returns> public TemplateMetadata Parse(string input) { if (input == null) { throw new ArgumentNullException("input"); } var result = new TemplateMetadata(); foreach (var metadatum in input.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries)) { var metadatumMatch = Regex.Match(metadatum, @"^\s*(?<name>[a-z0-9_]+)\s*:\s*(?<value>.*?)\s*$", RegexOptions.IgnoreCase); if (!metadatumMatch.Success) { continue; } var propertyName = metadatumMatch.Groups["name"].Value; var propertyValue = metadatumMatch.Groups["value"].Value; switch (propertyName.ToLower()) { case "schema": { InternalName value; if (InternalName.TryParse(propertyValue, out value)) { result.Schema = value; } } break; case "name": { InternalName value; if (InternalName.TryParse(propertyValue, out value)) { result.Name = value; } } break; case "label": { result.Label = propertyValue; } break; default: result.AdditionalProperties.Add(propertyName, propertyValue); break; } } return(result); }
public override int GetHashCode() { unchecked { var hash = 17; hash = hash * 37 + InternalName.GetHashCode(); hash = hash * 37 + MemberInfoComparer.Default.GetHashCode(Member); return(hash); } }
public override int GetHashCode() { return (Position.GetHashCode() ^ ActorSNO.GetHashCode() ^ InternalName.GetHashCode() ^ WorldId.GetHashCode() ^ Quality.GetHashCode() ^ Level.GetHashCode()); }
/// <summary> /// Map the information sent back by Campaign into a format which can be saved as a file to disk. /// </summary> /// <param name="requestHandler">Request handler, which can be used if further information from Campaign is required for the mapping.</param> /// <param name="rawQueryResponse">Raw response from Campaign.</param> /// <returns>Class containing file content and metadata</returns> public override Template ParseQueryResponse(IRequestHandler requestHandler, string rawQueryResponse) { var doc = new XmlDocument(); doc.LoadXml(rawQueryResponse); var metadata = new TemplateMetadata { Schema = InternalName.Parse(IncludeView.EntitySchema), Name = new InternalName(null, doc.DocumentElement.Attributes["name"].InnerText), Label = doc.DocumentElement.Attributes["label"].InnerText, }; var folderInternalName = doc.DocumentElement.SelectSingleNode("folder").Attributes["name"].InnerText; metadata.AdditionalProperties.Add(AdditionalData_Folder, folderInternalName); var visibleAttribute = doc.DocumentElement.Attributes["visible"]; if (visibleAttribute != null) { metadata.AdditionalProperties.Add(AdditionalData_Visible, (visibleAttribute.InnerText == "1").ToString()); } var textCodeNode = doc.DocumentElement.SelectSingleNode("source/text"); var rawTextCode = textCodeNode == null ? string.Empty : textCodeNode.InnerText; var htmlCodeNode = doc.DocumentElement.SelectSingleNode("source/html"); var rawHtmlCode = htmlCodeNode == null ? string.Empty : htmlCodeNode.InnerText; var dependOnFormat = false; var dependOnFormatAttribute = doc.DocumentElement.SelectSingleNode("source/@dependOnFormat"); if (dependOnFormatAttribute != null) { dependOnFormat = dependOnFormatAttribute.InnerText == "true"; } var rawCode = dependOnFormat ? string.Concat(rawTextCode, Environment.NewLine, Environment.NewLine, FormatSeparator, Environment.NewLine, Environment.NewLine, rawHtmlCode) : rawTextCode; return(new Template { Code = rawCode, Metadata = metadata, FileExtension = FileTypes.Jssp, }); }
public override int GetHashCode() { unchecked { var hashCode = ContentId.GetHashCode(); hashCode = (hashCode * 397) ^ (IconUrl?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ Id.GetHashCode(); hashCode = (hashCode * 397) ^ (InternalName?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (SupportedGameModes?.GetHashCode() ?? 0); return(hashCode); } }
/// <summary> /// Map the information sent back by Campaign into a format which can be saved as a file to disk. /// </summary> /// <param name="requestHandler">Request handler, which can be used if further information from Campaign is required for the mapping.</param> /// <param name="rawQueryResponse">Raw response from Campaign.</param> /// <returns>Class containing file content and metadata</returns> public override Template ParseQueryResponse(IRequestHandler requestHandler, string rawQueryResponse) { var doc = new XmlDocument(); doc.LoadXml(rawQueryResponse); var metadata = new TemplateMetadata { Schema = InternalName.Parse(Schema), Name = new InternalName(null, doc.DocumentElement.Attributes["name"].InnerText), }; var option = new Option { DataType = (DataType)int.Parse(doc.DocumentElement.Attributes["dataType"].InnerText), StringValue = doc.DocumentElement.Attributes["stringValue"].InnerText, MemoValue = doc.DocumentElement.SelectSingleNode("memoValue").InnerText, }; long longValue; if (long.TryParse(doc.DocumentElement.Attributes["longValue"].InnerText, out longValue)) { option.LongValue = longValue; } double doubleValue; if (double.TryParse(doc.DocumentElement.Attributes["doubleValue"].InnerText, out doubleValue)) { option.DoubleValue = doubleValue; } DateTime timeStampValue; if (DateTime.TryParse(doc.DocumentElement.Attributes["timeStampValue"].InnerText, out timeStampValue)) { option.TimeStampValue = timeStampValue; } metadata.AdditionalProperties.Add(AdditionalData_DataType, option.DataType.ToString()); return(new Template { Code = Convert.ToString(option.GetValue()), Metadata = metadata, FileExtension = FileTypes.Jssp, }); }
public override int GetHashCode() { int hash = 1; if (InternalName.Length != 0) { hash ^= InternalName.GetHashCode(); } if (MessageFormat.Length != 0) { hash ^= MessageFormat.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Trigger a build of the schema from the srcSchema /// </summary> /// <param name="requestHandler">Request handler</param> /// <param name="schemaName">Name of the schema to build</param> /// <returns>Response</returns> public Response BuildSchema(IRequestHandler requestHandler, InternalName schemaName) { const string serviceName = "BuildSchemaFromId"; var serviceNs = string.Concat("urn:", ServiceNamespace); // Create common elements of SOAP request. var serviceElement = CreateServiceRequest(serviceName, serviceNs); var requestDoc = serviceElement.OwnerDocument; // Build request for this service. serviceElement.AppendChildWithValue("urn:schemaId", serviceNs, schemaName.ToString()); // Execute request and get response from server. var response = requestHandler.ExecuteRequest(new ServiceName(ServiceNamespace, serviceName), requestDoc); Log.Debug($"Response to {serviceName} received: {response.Status}"); return(response); }
internal Frame(GaleObject galeObject, int frameIndex) { this.galeObject = galeObject; this.frameIndex = frameIndex; InternalName = gg.GetFrameName(galeObject.Handle, frameIndex); Name = InternalName .Replace("%framenumber%", (frameIndex + 1).ToString()) .Replace("%framenumber_zero%", (frameIndex + 1).ToString(galeObject._ZeroDigitFormat)) .Replace("%frameindex%", frameIndex.ToString()) .Replace("%frameindex_zero%", frameIndex.ToString(galeObject._ZeroDigitFormat)); TransparentColor = gg.GetFrameTransparentColor(galeObject.Handle, this.frameIndex); DisposalType = gg.GetFrameDisposalType(galeObject.Handle, this.frameIndex); Delay = gg.GetFrameDelay(galeObject.Handle, this.frameIndex); LayerCount = gg.GetLayerCount(galeObject.Handle, frameIndex); }
public override int GetHashCode() { return(InternalName != null ? InternalName.GetHashCode() : 0); }
public __TextBoxBase() { #region InternalContainer this.InternalContainer = new IHTMLDiv(); this.InternalContainer.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute; this.InternalContainer.name = "__TextBox"; this.InternalContainer.style.left = "0px"; this.InternalContainer.style.top = "0px"; // do we create any new havoc? this.InternalContainer.style.zIndex = 0; #endregion #region InternalTextField_ShadowContainer this.InternalTextField_ShadowContainer = new IHTMLDiv(); this.InternalTextField_ShadowContainer.style.position = IStyle.PositionEnum.absolute; this.InternalTextField_ShadowContainer.style.overflow = IStyle.OverflowEnum.hidden; this.InternalTextField_ShadowContainer.style.SetSize(0, 0); this.InternalTextField_Shadow = new IHTMLSpan(); this.InternalTextField_Shadow.AttachTo(this.InternalTextField_ShadowContainer); this.InternalTextField_Shadow.style.whiteSpace = IStyle.WhiteSpaceEnum.pre; this.InternalTextField_Shadow.style.display = IStyle.DisplayEnum.inline_block; this.InternalTextField_Shadow.style.position = IStyle.PositionEnum.absolute; #endregion #region InternalTextField this.InternalTextField = new IHTMLInput(ScriptCoreLib.Shared.HTMLInputTypeEnum.text) { }.AttachTo(this.InternalContainer); // boxstyle. will it break layout? this.InternalTextField.style.padding = "0.4em"; //Need to test/document this.InternalNameChanged += delegate { this.InternalTextField.name = InternalName; if (InternalName.ToUpper().Contains(("email").ToUpper())) { this.InternalTextField.type = Shared.HTMLInputTypeEnum.email; } if (InternalName.ToUpper().Contains(("phone").ToUpper())) { this.InternalTextField.type = Shared.HTMLInputTypeEnum.tel; } }; this.InternalSetDefaultFont(); this.InternalTextField.style.position = IStyle.PositionEnum.absolute; this.InternalTextField.style.margin = "0"; this.InternalTextField.style.paddingTop = "0"; this.InternalTextField.style.paddingBottom = "0"; // what about inheritance chain? // X:\jsc.svn\examples\javascript\forms\Test\CSSLastTextBox\CSSLastTextBox\Application.cs IStyleSheet.all[typeof(TextBox)][IHTMLElement.HTMLElementEnum.input].style.border = "1px solid gray"; #endregion // what about padding? // X:\jsc.svn\examples\javascript\forms\Test\TestTextBoxPadding\TestTextBoxPadding\Application.cs // http://stackoverflow.com/questions/628500/can-i-stop-100-width-text-boxes-from-extending-beyond-their-containers/628912#628912 //box-sizing: border-box; (this.InternalTextField.style as dynamic).boxSizing = "border-box"; //this.InternalTextField.style.boxSizing = "border-box"; this.InternalTextField.style.width = "100%"; this.InternalTextField.style.height = "100%"; //this.ClientSizeChanged += // delegate // { // this.InternalTextField.style.width = this.ClientSize.Width + "px"; // this.InternalTextField.style.height = this.ClientSize.Height + "px"; // }; #region InternalRaiseTextChanged Action InternalAutoSizeUpdate = delegate { if (this.InternalTextField_Shadow == null) { return; } //InternalAutoSizeToText(this.InternalTextField.value); }; this.InternalTextField.onchange += delegate { InternalAutoSizeUpdate(); this.InternalRaiseTextChanged(); }; this.InternalTextField.onkeyup += delegate { InternalAutoSizeUpdate(); this.InternalRaiseTextChanged(); }; #endregion this.Size = new global::System.Drawing.Size(100, 20); }
InternalStat GetIntStat(InternalName name) { return(m_internalStats[(int)name]); }
///<summary> ///Updates SNO Cache Values ///</summary> public virtual bool UpdateData(DiaObject thisObj, int raguid) { bool failureDuringUpdate = false; if (InternalName == null) { try { InternalName = thisObj.Name; } catch { Logger.Write(LogLevel.Cache, "Failure to get internal name on object, SNO {0}", SNOID); return(false); } } if (!Actortype.HasValue) { #region ActorType try { Actortype = thisObj.ActorType; } catch { Logger.Write(LogLevel.Cache, "Failure to get actorType for object, SNO: {0}", SNOID); return(false); } #endregion } //Ignored actor types.. if (BlacklistCache.IgnoredActorTypes.Contains(Actortype.Value)) //||!LootBehaviorEnabled&&this.Actortype.Value==ActorType.Item) { BlacklistCache.IgnoreThisObject(this, raguid); return(false); } if (!targetType.HasValue) { #region EvaluateTargetType try { //Evaluate Target Type.. // See if it's an avoidance first from the SNO if (IsAvoidance || IsObstacle) { targetType = TargetType.None; if (IsAvoidance) { if (IsProjectileAvoidance) { Obstacletype = ObstacleType.MovingAvoidance; } else { Obstacletype = ObstacleType.StaticAvoidance; } AvoidanceType AT = AvoidanceCache.FindAvoidanceUsingSNOID(SNOID); //Check if avoidance is enabled or if the avoidance type is set to 0 if (!Bot.Settings.Avoidance.AttemptAvoidanceMovements || AT != AvoidanceType.None && AvoidanceCache.IgnoringAvoidanceType(AT)) { BlacklistCache.AddObjectToBlacklist(raguid, BlacklistType.Temporary); return(false); } // Avoidance isn't disabled, so set this object type to avoidance targetType = TargetType.Avoidance; } else { Obstacletype = ObstacleType.ServerObject; } } else { // Calculate the object type of this object if (Actortype.Value == ActorType.Monster || CacheIDLookup.hashActorSNOForceTargetUnit.Contains(SNOID)) { targetType = TargetType.Unit; Obstacletype = ObstacleType.Monster; if (CacheIDLookup.hashActorSNOForceTargetUnit.Contains(SNOID)) { //Fill in monster data? Actortype = ActorType.Monster; } } else if (Actortype.Value == ActorType.Item || CacheIDLookup.hashForceSNOToItemList.Contains(SNOID)) { string testname = InternalName.ToLower(); //Check if this item is gold/globe.. if (testname.StartsWith("gold")) { targetType = TargetType.Gold; } else if (testname.StartsWith("healthglobe")) { targetType = TargetType.Globe; } else if (testname.StartsWith("console_powerglobe")) { targetType = TargetType.PowerGlobe; } else { targetType = TargetType.Item; } //Gold/Globe? } else if (Actortype.Value == ActorType.Gizmo) { GizmoType thisGizmoType; try { thisGizmoType = thisObj.ActorInfo.GizmoType; } catch { Logger.Write(LogLevel.Cache, "Failure to get actor Gizmo Type!"); return(false); } if (thisGizmoType == GizmoType.DestroyableObject || thisGizmoType == GizmoType.BreakableChest) { targetType = TargetType.Destructible; } else if (thisGizmoType == GizmoType.PowerUp || thisGizmoType == GizmoType.HealingWell || thisGizmoType == GizmoType.PoolOfReflection) { targetType = TargetType.Shrine; } else if (thisGizmoType == GizmoType.Chest) { targetType = TargetType.Container; } else if (thisGizmoType == GizmoType.BreakableDoor) { targetType = TargetType.Barricade; } else if (thisGizmoType == GizmoType.Door) { targetType = TargetType.Door; } else if (thisGizmoType == GizmoType.Waypoint || thisGizmoType == GizmoType.Portal || thisGizmoType == GizmoType.DungeonPortal || thisGizmoType == GizmoType.BossPortal) { //Special Interactive Object -- Add to special cache! targetType = TargetType.ServerInteractable; } else if (thisGizmoType == GizmoType.Switch) { targetType = TargetType.CursedShrine; } else { //All other gizmos should be ignored! BlacklistCache.IgnoreThisObject(this, raguid); return(false); } if (targetType.HasValue) { if (targetType.Value == TargetType.Destructible || targetType.Value == TargetType.Barricade || targetType.Value == TargetType.Door) { Obstacletype = ObstacleType.Destructable; } else if (targetType.Value == TargetType.Shrine || IsChestContainer) { Obstacletype = ObstacleType.ServerObject; } } if (!Gizmotype.HasValue) { Gizmotype = thisGizmoType; } } else if (CacheIDLookup.hashSNOInteractWhitelist.Contains(SNOID)) { targetType = TargetType.Interactable; } else if (Actortype.Value == ActorType.ServerProp) { string TestString = InternalName.ToLower(); //Server props with Base in name are the destructibles "remains" which is considered an obstacle! if (TestString.Contains("base") || TestString.Contains("fence")) { //Add this to the obstacle navigation cache if (!IsObstacle) { CacheIDLookup.hashSNONavigationObstacles.Add(SNOID); } Obstacletype = ObstacleType.ServerObject; //Use unknown since we lookup SNO ID for server prop related objects. targetType = TargetType.None; } else if (TestString.StartsWith("monsteraffix_")) { AvoidanceType T = AvoidanceCache.FindAvoidanceUsingName(TestString); if (T == AvoidanceType.Wall) { //Add this to the obstacle navigation cache if (!IsObstacle) { CacheIDLookup.hashSNONavigationObstacles.Add(SNOID); } Obstacletype = ObstacleType.ServerObject; //Use unknown since we lookup SNO ID for server prop related objects. targetType = TargetType.None; } //else if (Bot.AvoidancesHealth.ContainsKey(T)) //{ // Logger.DBLog.InfoFormat("Found Avoidance not recongized by SNO! Name {0} SNO {1}", TestString, this.SNOID); // CacheIDLookup.hashAvoidanceSNOList.Add(this.SNOID); // this.targetType=TargetType.Avoidance; //} else { //Blacklist all other monster affixes BlacklistCache.IgnoreThisObject(this, raguid); return(false); } } else { BlacklistCache.IgnoreThisObject(this, raguid); return(false); } } else { //Misc?? Ignore it! BlacklistCache.IgnoreThisObject(this, raguid); return(false); } } } catch { Logger.Write(LogLevel.Cache, "Failure to get actorType for object, SNO: {0}", SNOID); return(false); } #endregion } if (!Obstacletype.HasValue) { Obstacletype = ObstacleType.None; } if (ObjectCache.CheckTargetTypeFlag(targetType.Value, TargetType.Unit)) { SNORecordMonster monsterInfo; try { monsterInfo = thisObj.CommonData.MonsterInfo; } catch { Logger.Write(LogLevel.Cache, "Safely Handled MonsterInfo Exception for Object {0}", InternalName); return(false); } if (!Monstertype.HasValue || ShouldRefreshMonsterType) { #region MonsterType try { Monstertype = monsterInfo.MonsterType; } catch { Logger.Write(LogLevel.Cache, "Failure to get MonsterType for SNO: {0}", SNOID); failureDuringUpdate = true; } #endregion } if (!Monstersize.HasValue) { #region MonsterSize try { Monstersize = monsterInfo.MonsterSize; } catch { Logger.Write(LogLevel.Cache, "Failure to get MonsterSize for SNO: {0}", SNOID); failureDuringUpdate = true; } #endregion } } if (Actortype.HasValue && targetType.HasValue && (Actortype.Value != ActorType.Item && targetType.Value != TargetType.Avoidance && targetType.Value != TargetType.ServerInteractable)) { //Validate sphere info Sphere sphereInfo = thisObj.CollisionSphere; if (!CollisionRadius.HasValue) { #region CollisionRadius try { CollisionRadius = sphereInfo.Radius; } catch { Logger.Write(LogLevel.Cache, "Failure to get CollisionRadius for SNO: {0}", SNOID); failureDuringUpdate = true; } #endregion if (CacheIDLookup.dictFixedCollisionRadius.ContainsKey(SNOID)) { //Override The Default Collision Sphere Value CollisionRadius = CacheIDLookup.dictFixedCollisionRadius[SNOID]; } } if (!ActorSphereRadius.HasValue) { #region ActorSphereRadius try { ActorSphereRadius = thisObj.ActorInfo.Sphere.Radius; } catch { Logger.Write(LogLevel.Cache, "Safely handled getting attribute Sphere radius for gizmo {0}", InternalName); failureDuringUpdate = true; } #endregion } #region GizmoProperties if (ObjectCache.CheckTargetTypeFlag(targetType.Value, TargetType.Destructible | TargetType.Interactable)) { //No Loot if (!DropsNoLoot.HasValue) { #region DropsNoLoot try { DropsNoLoot = thisObj.CommonData.GetAttribute <float>(ActorAttributeType.DropsNoLoot) <= 0; } catch { Logger.Write(LogLevel.Cache, "Safely handled reading DropsNoLoot for gizmo {0}", InternalName); failureDuringUpdate = true; } #endregion } //No XP if (!GrantsNoXP.HasValue) { #region GrantsNoXP try { GrantsNoXP = thisObj.CommonData.GetAttribute <float>(ActorAttributeType.GrantsNoXP) <= 0; } catch { Logger.Write(LogLevel.Cache, "Safely handled reading GrantsNoXp for gizmo {0}", InternalName); failureDuringUpdate = true; } #endregion } //Barricade flag if (!IsBarricade.HasValue) { #region Barricade try { IsBarricade = ((DiaGizmo)thisObj).IsBarricade; } catch { Logger.Write(LogLevel.Cache, "Safely handled getting attribute IsBarricade for gizmo {0}", InternalName); failureDuringUpdate = true; } #endregion } } #endregion } return(!failureDuringUpdate); }
public string GetImageIcon() { switch (Type) { case ItemType.Unknown: break; case ItemType.Axe: if (OneHanded) { return("axe.png"); } return("axe_2h.png"); case ItemType.Sword: if (OneHanded) { return("sword.png"); } return("sword_2h.png"); case ItemType.Mace: if (OneHanded) { return("mace.png"); } return("mace_2h.png"); case ItemType.Dagger: return("dagger.png"); case ItemType.Flail: if (OneHanded) { return("flail.png"); } return("flail_2h.png"); case ItemType.Bow: return("bow.png"); case ItemType.Crossbow: return("crossbow.png"); case ItemType.Staff: return("staff.png"); case ItemType.Spear: return("spear.png"); case ItemType.Shield: return("shield.png"); case ItemType.CrusaderShield: return("crusadershield.png"); case ItemType.Gloves: return("gloves.png"); case ItemType.Boots: return("boots.png"); case ItemType.Chest: return("chestarmor.png"); case ItemType.Ring: return("ring.png"); case ItemType.Amulet: return("amulet.png"); case ItemType.Quiver: return("quiver.png"); case ItemType.Shoulder: return("shoulders.png"); case ItemType.Legs: return("pants.png"); case ItemType.FistWeapon: return("fistweapon.png"); case ItemType.Mojo: return("mojo.png"); case ItemType.CeremonialDagger: return("ceremonialdagger.png"); case ItemType.WizardHat: return("helm.png"); case ItemType.Helm: return("helm.png"); case ItemType.Belt: return("belt.png"); case ItemType.Bracer: return("bracers.png"); case ItemType.Orb: return("orb.png"); case ItemType.MightyWeapon: if (OneHanded) { return("mightyweapon.png"); } return("mightyweapon_2h.png"); case ItemType.MightyBelt: return("belt.png"); case ItemType.Polearm: return("polearm.png"); case ItemType.Cloak: return("chestarmor.png"); case ItemType.Wand: return("wand.png"); case ItemType.SpiritStone: return("helm.png"); case ItemType.Daibo: return("combatstaff.png"); case ItemType.HandCrossbow: return("handxbow.png"); case ItemType.VoodooMask: return("helm.png"); case ItemType.Potion: return("healthpotionconsole.png"); case ItemType.Gem: if (InternalName.StartsWith("Ruby")) { return("ruby.png"); } if (InternalName.StartsWith("Topaz")) { return("topaz.png"); } if (InternalName.StartsWith("Diamond")) { return("diamond.png"); } if (InternalName.StartsWith("Amethyst")) { return("amethyst.png"); } if (InternalName.StartsWith("Emerald")) { return("emerald.png"); } break; case ItemType.CraftingReagent: if (SNO == 361984) { return("crafting_assortedparts.png"); } if (SNO == 361985) { return("crafting_magic.png"); } if (SNO == 361986) { return("crafting_rare.png"); } break; case ItemType.CraftingPage: case ItemType.CraftingPlan: case ItemType.FollowerSpecial: case ItemType.HoradricCache: case ItemType.KeystoneFragment: return("demonorgan.png"); } return("demonorgan.png"); }
public override int GetHashCode() { return(InternalName.GetHashCode()); }
private void GenerateScreen(Project project, Entity entity) { if (EntityTemplate == EntityTemplate.Reference) { var screenFound = project.Screens.Where(s => s.EntityId == Id).Any(); if (screenFound) { return; } if (Properties == null || !Properties.Any() || !Properties.Any(p => p.PropertyType == PropertyType.PrimaryKey)) { var properties = new List <Property> { new Property() { Id = entity.Id, Title = "Id", InternalName = "Id", PropertyType = PropertyType.PrimaryKey } }; if (Properties != null) { properties.AddRange(Properties); } Properties = properties; } var editScreenId = Properties.SingleOrDefault(p => p.PropertyType == PropertyType.PrimaryKey).Id; // Just grabing a reproduceable id var screens = new List <Screen>(project.Screens) { new Screen() { Id = Id, // TODO: The id should be reproduceable I don't like this EntityId = Id, Title = Title.Pluralize(), ScreenType = ScreenType.Search, Path = InternalNamePlural, Template = ScreenTemplate.Reference, ScreenSections = new ScreenSection[] { new ScreenSection { Id = Id, Title = Title.Pluralize(), EntityId = Id, InternalName = InternalName.Pluralize(), ScreenSectionType = ScreenSectionType.Search, NavigateToScreenId = editScreenId, } } }, new Screen() { Id = editScreenId, EntityId = Id, Title = Title, ScreenType = ScreenType.Form, Path = InternalName, ScreenSections = new ScreenSection[] { new ScreenSection { Id = editScreenId, Title = Title, EntityId = Id, InternalName = InternalName, ScreenSectionType = ScreenSectionType.Form } } } }; project.Screens = screens; } }
/// <summary> /// Upload a set of images defined by the settings. /// </summary> /// <param name="requestHandler">Request handler</param> /// <param name="settings">Upload settings</param> public void DoImageUpload(IRequestHandler requestHandler, UploadSettings settings) { var imageData = settings.FilePaths.SelectMany(i => _imageDataProvider.GetData(i)).ToArray(); var totalCount = imageData.Length; var processedCount = 0; var successCount = 0; foreach (var imageItem in imageData) { processedCount++; var mimeType = ImageHelper.GetMimeType(Path.GetExtension(imageItem.FilePath)); if (mimeType == null) { Log.Warn($"Unsupported file type: {imageItem.FilePath}"); continue; } var fileInfo = new FileInfo(imageItem.FilePath); if (!fileInfo.Exists) { Log.Warn($"File does not exist: {imageItem.FilePath}"); continue; } InternalName internalName; if (!InternalName.TryParse(imageItem.InternalName, out internalName)) { Log.Warn($"Failed to parse internal name: {imageItem.InternalName}"); continue; } string md5Hash; using (var md5 = MD5.Create()) using (var stream = File.OpenRead(imageItem.FilePath)) { md5Hash = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower(); } int width, height; using (var bitmap = new Bitmap(imageItem.FilePath)) { width = bitmap.Width; height = bitmap.Height; } var fileContent = Convert.ToBase64String(File.ReadAllBytes(imageItem.FilePath)); var file = new ImageResource { FolderName = imageItem.FolderName, FileRes = new FileResource { Name = internalName, Label = imageItem.Label, Alt = imageItem.Alt, Width = width, Height = height, }, FileName = fileInfo.Name, MimeType = mimeType, Md5 = md5Hash, FileContent = fileContent, }; var response = _imageWriteService.WriteImage(requestHandler, file); if (!response.Success) { Log.Warn($"Upload of {imageItem.InternalName} failed: {response.Message}"); } else { successCount++; } } Log.Info($"{successCount} images uploaded."); }
public override bool Equals(object obj) { var part = obj as GameParticipant; return(part != null && InternalName.Equals(part.InternalName)); }
public string MapNameWithDimensions() { return($"{InternalName.Trim()} ({MapWidth}x{MapHeight})"); }