public Result GetLatestReadingForMeter(string meterNumber) { if (ObjectID != 0) { // Check if authenticationtoken must renewed if (Authentication.Expires < DateTime.UtcNow.AddMinutes(2)) { Authentication.RenewAuthentication(); } RestRequest request = new RestRequest("systems/{SystemID}/meters/readings/latest", Method.GET); request.AddUrlSegment("SystemID", ObjectID.ToString()); IRestResponse <Collection <Meter> > response = RestClient.Execute <Collection <Meter> >(request); if (response.StatusCode == System.Net.HttpStatusCode.OK) { // Select meter and exclude Pulse Meter meter = response.Data.FirstOrDefault(f => f.SerialNumber == meterNumber && f.UsageType.ToUpper() != "P"); if (meter != null) { MeterDetails = meter; LatestReadings = meter.Readings; return(Result.Success); } } } return(Result.Failed("Gegevens voor het gebouw zijn nog niet opgehaald.")); }
void Instance_GameInitialization(object sender, GameInitEventArgs e) { PlayerInfo pi = ClientPlayerInfo.Player; PositionData[] aPd = e.gameInitInfo; foreach (PositionData pd in aPd) { //TODO: get info //_currPlayer = _sim.Players[pd.PlayerId]; Player p = _sim.Players[pd.PlayerId]; ObjectID mcvID = new ObjectID(p.Id, p.GenerateObjectID()); InfoLog.WriteInfo(mcvID.ToString() + " for MVC", EPrefix.GObj); UnitMCV mcv = new UnitMCV(mcvID, GlobalSettings.Wrapper.MCVs[0], new Position(pd.X, _sim.Map.Height - pd.Y - 1), _sim.Map, this._sim); p.AddUnit(mcv); _sim.ClearFogOfWar(mcv); // vjust for fun ;p ObjectID tankID = new ObjectID(p.Id, p.GenerateObjectID()); UnitTank u = new UnitTank(tankID, GlobalSettings.Wrapper.Tanks[0], new Position((short)((pd.X + 1) % _sim.Map.Width), _sim.Map.Height - pd.Y - 1), this._sim.Map, this._sim); InfoLog.WriteInfo(tankID.ToString() + " for tank: " + u.TypeID, EPrefix.GObj); p.AddUnit(u); _sim.ClearFogOfWar(u); // ^ //this.sim.Map.Units[u.Position.X, u.Position.Y].AddLast(u); } this._sim.StartSimulation(); this._sim.DoTurn(1); }
private void CreateUnit(short playerId, short type, Position pos) { InfoLog.WriteInfo("CreateUnit", EPrefix.Test); Player p = players[playerId]; Unit u = null; ObjectID id = new ObjectID(playerId, p.GenerateObjectID()); InfoLog.WriteInfo(id.ToString() + " dla jednostki: " + type, EPrefix.Test); if (GlobalSettings.Wrapper.harvestersMap.ContainsKey(type)) { u = new UnitHarvester(id, GlobalSettings.Wrapper.harvestersMap[type], pos, this._map, this, GlobalSettings.Wrapper.harvestersMap[type].__Speed); ((UnitHarvester)u).SpiceUnload += new SpiceUnloadDelegate(SpiceUnload); } else if (GlobalSettings.Wrapper.mcvsMap.ContainsKey(type)) { u = new UnitMCV(id, GlobalSettings.Wrapper.mcvsMap[type], pos, this._map, this); } else if (GlobalSettings.Wrapper.tanksMap.ContainsKey(type)) { u = new UnitTank(id, GlobalSettings.Wrapper.tanksMap[type], pos, this._map, this); } else if (GlobalSettings.Wrapper.troopersMap.ContainsKey(type)) { u = new UnitTrooper(id, GlobalSettings.Wrapper.troopersMap[type], pos, this._map, this); } p.AddUnit(u); ClearFogOfWar(u); OnUnitCompleted(u); }
public override string ToString() { StringBuilder bld = new StringBuilder(); bld.Append(ObjectType + " (" + ObjectID.ToString() + "):\n"); foreach (DictionaryEntry entry in m_propValues) { bld.Append("\t" + entry.Key + " : " + entry.Value.ToString() + "\n"); } return(bld.ToString()); }
public void EqualsForObjectID() { var endPointID2 = RelationEndPointID.Create(ObjectID.Parse(_objectID.ToString()), _propertyName); var endPointID3 = RelationEndPointID.Create(DomainObjectIDs.Order3, _propertyName); Assert.That(_endPointID.Equals(endPointID2), Is.True); Assert.That(endPointID2.Equals(_endPointID), Is.True); Assert.That(_endPointID.Equals(endPointID3), Is.False); Assert.That(endPointID3.Equals(_endPointID), Is.False); Assert.That(endPointID2.Equals(endPointID3), Is.False); Assert.That(endPointID3.Equals(endPointID2), Is.False); }
/// <summary> /// Returns parameters according to the upload mode. /// </summary> private string GetModeParameters() { string[] args; if (MediaLibraryID > 0) { // MediaLibrary mode args = new[] { "MediaLibraryID", MediaLibraryID.ToString(), "MediaFolderPath", MediaFolderPath, "MediaFileID", MediaFileID.ToString(), "IsMediaThumbnail", IsMediaThumbnail.ToString(), "MediaFileName", MediaFileName }; return("MediaLibraryArgs=" + GetArgumentsString(args, UploaderHelper.MEDIA_LIBRARY_ARGS_HASHING_PURPOSE)); } if (ObjectID > 0) { // MetaFile mode args = new[] { "MetaFileID", MetaFileID.ToString(), "ObjectID", ObjectID.ToString(), "SiteID", SiteID.ToString(), "ObjectType", ObjectType, "Category", Category }; return("MetaFileArgs=" + GetArgumentsString(args, UploaderHelper.META_FILE_ARGS_HASHING_PURPOSE)); } if ((DocumentID > 0) || (FormGUID != Guid.Empty)) { // Attachment mode args = new[] { "DocumentID", DocumentID.ToString(), "DocumentParentNodeID", DocumentParentNodeID.ToString(), "NodeClassName", NodeClassName, "AttachmentGUIDColumnName", AttachmentGUIDColumnName, "AttachmentGUID", AttachmentGUID.ToString(), "AttachmentGroupGUID", AttachmentGroupGUID.ToString(), "FormGUID", FormGUID.ToString(), "IsFieldAttachment", mIsFiledAttachment.ToString(), "FullRefresh", FullRefresh.ToString() }; return("AttachmentArgs=" + GetArgumentsString(args, UploaderHelper.ATTACHEMENT_ARGS_HASHING_PURPOSE)); } return(String.Empty); }
private Building AddBuilding(short playerID, int creatorID, short buildingType, Position pos) { Player p = players[playerID]; int objid = p.GenerateObjectID(); ObjectID id = new ObjectID(playerID, objid); InfoLog.WriteInfo(id.ToString() + " adding building: " + buildingType, EPrefix.BMan); InfoLog.WriteInfo("Adding building id: (" + playerID + "," + id + ")", EPrefix.BMan); BuildingData bd = GlobalSettings.Wrapper.buildingsMap[buildingType]; Building b = new Building(id, bd, this._map, pos, this); p.AddBuilding(b); ClearFogOfWar(b); return(b); }
public override void _Ready() { base._Ready(); _params = ID2Params[ObjectID.ToString()]; _sprite = GetNode <AnimatedSprite>("FollowCreature/AnimatedSprite"); _right_checker = GetNode <Area2D>("FollowCreature/RightChecker"); _left_checker = GetNode <Area2D>("FollowCreature/LeftChecker"); GetNode <Area2D>("FollowCreature/Area2D").Connect("body_entered", this, "_on_Area2D_body_entered"); GetNode <Area2D>("FollowCreature/Area2D").Connect("body_exited", this, "_on_Area2D_body_exited"); _sprite.Animation = _params.name; OrganicEnemy = _params.organic_enemy; }
//public static ObjectID genObjectId(string name) //{ // if (name == null || name.Length == 0) // { // return new ObjectID(); // } // uint hashValue = GetHashValueCase(name); // ObjectID objId = new ObjectID(hashValue, hashValue); // return objId; //} public static uint GetHashValueCase(ObjectID name) { if (name.IsNull()) { return(0); } uint hashValue = 0; string strName = name.ToString(); for (int i = 0; i < strName.Length; i++) { hashValue = hashValue * 5 + strName[i]; } return(hashValue); }
public void DeleteObject() { if (Component != null) { if (Component.Keep != null) { Component.Keep.Banners.Remove(ObjectID.ToString()); } Component.Delete(); } Component = null; DBPosition = null; base.Delete(); CurrentRegion = null; }
private void GetSystemFromApi() { if (!string.IsNullOrWhiteSpace(Authentication.AccessToken)) { // Check if authenticationtoken must renewed if (Authentication.Expires < DateTime.UtcNow.AddMinutes(2)) { Authentication.RenewAuthentication(); } RestRequest request = new RestRequest("systems/{SystemID}", Method.GET); request.AddUrlSegment("SystemID", ObjectID.ToString()); request.AddHeader("Authorization", "bearer " + Authentication.AccessToken); IRestResponse <Models.Object> systemResponse = RestClient.Execute <Models.Object>(request); if (systemResponse.StatusCode == System.Net.HttpStatusCode.OK) { ObjectDetails = systemResponse.Data; } else { ObjectDetails = null; } } }
/// <summary> /// Returns parameters according to the upload mode. /// </summary> private string GetModeParameters() { string[] args = null; if (MediaLibraryID > 0) { // MediaLibrary mode args = new string[] { "MediaLibraryID", MediaLibraryID.ToString(), "MediaFolderPath", HttpUtility.UrlEncode(MediaFolderPath), "MediaFileID", MediaFileID.ToString(), "IsMediaThumbnail", IsMediaThumbnail.ToString(), "MediaFileName", HttpUtility.UrlEncode(MediaFileName) }; return("MediaLibraryArgs=" + GetArgumentsString(args)); } else { if ((NodeID > 0) && (SourceType == MediaSourceEnum.Content)) { // CMS.File mode args = new string[] { "NodeID", NodeID.ToString(), "DocumentCulture", DocumentCulture, "IncludeExtension", IncludeExtension.ToString(), "NodeGroupID", NodeGroupID.ToString() }; return("FileArgs=" + GetArgumentsString(args)); } else { if (ObjectID > 0) { // MetaFile mode args = new string[] { "MetaFileID", MetaFileID.ToString(), "ObjectID", ObjectID.ToString(), "SiteID", SiteID.ToString(), "ObjectType", ObjectType, "Category", Category }; return("MetaFileArgs=" + GetArgumentsString(args)); } else { if (PostForumID > 0) { // Forum attachment args = new string[] { "PostForumID", PostForumID.ToString(), "PostID", PostID.ToString() }; return("ForumArgs=" + GetArgumentsString(args)); } else { if ((DocumentID > 0) || (FormGUID != Guid.Empty)) { // Attachment mode args = new string[] { "DocumentID", DocumentID.ToString(), "DocumentParentNodeID", DocumentParentNodeID.ToString(), "NodeClassName", NodeClassName, "AttachmentGUIDColumnName", AttachmentGUIDColumnName, "AttachmentGUID", AttachmentGUID.ToString(), "AttachmentGroupGUID", AttachmentGroupGUID.ToString(), "FormGUID", FormGUID.ToString(), "IsFieldAttachment", mIsFiledAttachment.ToString() }; return("AttachmentArgs=" + GetArgumentsString(args)); } } } } } return(String.Empty); }
public override string ToString() { return(ObjectType + "[" + ObjectID.ToString() + "]"); }
public void SerializeGuidValue() { var id = new ObjectID("Order", new Guid("{5D09030C-25C2-4735-B514-46333BD28AC8}")); Assert.That(id.ToString(), Is.EqualTo("Order|5d09030c-25c2-4735-b514-46333bd28ac8|System.Guid")); }
public override string ToString() { return(CutObject?.ToString() ?? (ObjectID.ToString() + ": " + Name.ToString())); }
private string GetObjectIDString(ObjectID id) { return(id != null?id.ToString() : "<null>"); }
public override string ToString() { return(base.ToString() + " GMDeployMCV: mcvID: " + mcvID.ToString()); }
public override int GetHashCode() { // Simplistic approach. If this object is going to be really used as a hash key, the method can be optimized. return((ObjectType.ToString() + ObjectID.ToString() + PropertyName).GetHashCode()); }
public override string ToString() { return("AnimID=" + AnimID.ToString() + "/seq=" + SequenceNum.ToString() + "/objID=" + ObjectID.ToString()); }
protected override void onMessageCreate(CreateUnitMessage cum) { InfoLog.WriteInfo("MessageCreate", EPrefix.Test); int cost = 0; Player p = players[cum.IdPlayer]; BoardObjectClass boc = cum.UnitKind; Unit u = null; ObjectID id = new ObjectID(cum.IdPlayer, p.GenerateObjectID()); InfoLog.WriteInfo(id.ToString() + " unit created: " + cum.Type, EPrefix.GObj); if (boc == BoardObjectClass.UnitTank) { if (players[cum.IdPlayer].Credits < (cost = GlobalSettings.Wrapper.tanksMap[cum.UnitType].Cost)) { return; } u = new UnitTank(id, GlobalSettings.Wrapper.tanksMap[cum.UnitType], cum.Position, this._map, this); players[cum.IdPlayer].Credits -= GlobalSettings.Wrapper.tanksMap[cum.UnitType].Cost; } else if (boc == BoardObjectClass.UnitTrooper) { if (players[cum.IdPlayer].Credits < (cost = GlobalSettings.Wrapper.troopersMap[cum.UnitType].Cost)) { return; } u = new UnitTrooper(id, GlobalSettings.Wrapper.troopersMap[cum.UnitType], cum.Position, this._map, this); players[cum.IdPlayer].Credits -= GlobalSettings.Wrapper.troopersMap[cum.UnitType].Cost; } else if (boc == BoardObjectClass.UnitHarvester) { if (players[cum.IdPlayer].Credits < (cost = GlobalSettings.Wrapper.harvestersMap[cum.UnitType].Cost)) { return; } u = new UnitHarvester(id, GlobalSettings.Wrapper.harvestersMap[cum.UnitType], cum.Position, this._map, this, GlobalSettings.Wrapper.harvestersMap[cum.UnitType].__Speed); ((UnitHarvester)u).SpiceUnload += new SpiceUnloadDelegate(SpiceUnload); players[cum.IdPlayer].Credits -= GlobalSettings.Wrapper.harvestersMap[cum.UnitType].Cost; } else if (boc == BoardObjectClass.UnitMCV) { if (players[cum.IdPlayer].Credits < (cost = GlobalSettings.Wrapper.mcvsMap[cum.UnitType].Cost)) { return; } u = new UnitMCV(id, GlobalSettings.Wrapper.mcvsMap[cum.UnitType], cum.Position, this._map, this); players[cum.IdPlayer].Credits -= GlobalSettings.Wrapper.mcvsMap[cum.UnitType].Cost; } else if (boc == BoardObjectClass.UnitSandworm) { u = new UnitSandworm(id, GlobalSettings.Wrapper.sandwormsMap[cum.UnitType], cum.Position, this._map, this, GlobalSettings.Wrapper.sandwormsMap[cum.UnitType].__Speed); Sandworms[id.ObjectId] = (UnitSandworm)u; return; //} else if (boc == BoardObjectClass.UnitTank) { // u = new UnitTank(id, GlobalSettings.Wrapper.tanksMap[cum.UnitType], cum.Position, this._map, this); //} else if (boc == BoardObjectClass.UnitTrooper) { // u = new UnitTrooper(id, GlobalSettings.Wrapper.troopersMap[cum.UnitType], cum.Position, this._map, this); } OnCreditsUpdate(cum.IdPlayer, cost); p.AddUnit(u); ClearFogOfWar(u); OnUnitCompleted(u); }
/// <summary> /// Gibt eine URL zurück, welche das Video auf einen UPnP Gerät abspielen lässt. /// Returns a URL that plays the video on a UPnP device. /// </summary> /// <returns></returns> public string GetUPnPUriString() { var dvbApi = DVBViewerServerApi.GetCurrentInstance(); return($"http://{dvbApi.Hostname}:8090/upnp/video/{ObjectID.ToString("D5")}{FileExtension}?d={Duration}"); }
public override string ToString() { //return TaskName; return(TaskID.ToString() + "_" + ObjectID.ToString()); }
public override string ToString() { return(String.Format("{0}/{1}", _objectID != null ? _objectID.ToString() : "null", Definition.PropertyName)); }
private string GetStringOrNull(ObjectID objectID) { return(objectID == null ? null : objectID.ToString()); }