/// <summary> /// Processes the bounce. /// </summary> /// <param name="email">The email.</param> /// <param name="bounceType">Type of the bounce.</param> /// <param name="message">The message.</param> /// <param name="bouncedDateTime">The bounced date time.</param> public static void ProcessBounce(string email, BounceType bounceType, string message, DateTime bouncedDateTime) { // currently only processing hard bounces if (bounceType != BounceType.HardBounce) { return; } string bounceMessage = message.IsNotNullOrWhiteSpace() ? $" ({message})" : ""; // get people who have those emails PersonService personService = new PersonService(new RockContext()); var peopleWithEmail = personService.GetByEmail(email).Select(p => p.Id).ToList(); foreach (int personId in peopleWithEmail) { RockContext rockContext = new RockContext(); personService = new PersonService(rockContext); Person person = personService.Get(personId); if (person.IsEmailActive == true) { person.IsEmailActive = false; } person.EmailNote = $"Email experienced a {bounceType.Humanize()} on {bouncedDateTime.ToShortDateString()}{bounceMessage}."; rockContext.SaveChanges(); } }
private SignalBounce <TKey> CreateBouncedMessage(BounceType type, AmazonSesMail mail , string recipientEmail, string detailsXml) { SignalBounce <TKey> bouncedMessage = new SignalBounce <TKey>() { ReceiverAddress = recipientEmail, BounceType = type, BounceReceiveDateUtc = DateTime.UtcNow, BounceDetailsXML = detailsXml, MessageBody = null, MessageSubject = null, SendDateUtc = null //DeliveryType, ReceiverSubscriberID, BouncedMessageID //are set by NdrHandler }; DateTime timestamp; if (DateTime.TryParse(mail.Timestamp, out timestamp)) { bouncedMessage.SendDateUtc = timestamp; } return(bouncedMessage); }
private static string GetEmailNote(BounceType bounceType, string message, DateTime bouncedDateTime) { var messages = new Dictionary <string, string> { { "550", "The user's mailbox was unavailable or could not be found." }, { "551", "The intended mailbox does not exist on this recipient server." }, { "552", "This message is larger than the current system limit or the recipient's mailbox is full." }, { "553", "The message was refused because the mailbox name is either malformed or does not exist." }, { "554", "Email refused." }, }; var emailNote = message; foreach (string key in messages.Keys) { if (message.StartsWith(key)) { emailNote = messages[key]; break; } } emailNote = $"Email experienced a {bounceType.Humanize()} on {bouncedDateTime.ToShortDateString()}. {emailNote}"; return(emailNote.SubstringSafe(0, 250)); }
public void HandleCollision(bool sameType) { BounceType temp = bounceDir; if (sameType) { bounceDir = (BounceType)(((int)bounceDir + collisionDepth) % 3); next = GetPlatformAfterMovement(); } HandleCollision(); bounceDir = temp; }
public (Ray, bool, double) Bounce(HitInfo info, double u, double v, BounceType bounceType, Random rand) { var n = info.Ray; var material = info.material; (var n1, var n2) = (1.0, material.Index); if (info.inside) { (n1, n2) = (n2, n1); } double p; if (material.Reflectivity >= 0) { p = material.Reflectivity; } else { p = n.Reflectance(this, n1, n2); } //bool reflect = false; if (bounceType == BounceType.BounceTypeAny) { reflect = rand.NextDouble() < p; } else if (bounceType == BounceType.BounceTypeDiffuse) { reflect = false; } else if (bounceType == BounceType.BounceTypeSpecular) { reflect = true; } if (reflect) { var reflected = n.Reflect(this); return(reflected.ConeBounce(material.Gloss, u, v, rand), true, p); } else if (material.Transparent) { var refracted = n.Refract(this, n1, n2); refracted.Origin = refracted.Origin.Add(refracted.Direction.MulScalar(1e-4)); return(refracted.ConeBounce(material.Gloss, u, v, rand), true, 1 - p); } else { return(n.WeightedBounce(u, v, rand), false, 1 - p); } }
public static void Bounce(BounceType Type, int Count) { if (IsRegistered) { using (var parameters = new Parameters()) { APICall(parameters .AddInt((int)Function.Bounce) .AddInt((int)Id) .AddInt((int)Type) .AddInt((int)Count)); } } }
public (Ray, bool, double) Bounce(HitInfo info, double u, double v, BounceType bounceType, Random rand) { var n = info.Ray; var material = info.material; var n1 = 1.0; var n2 = material.Index; if (info.inside) { Interlocked.Exchange(ref n1, n2); } double p = material.Reflectivity >= 0 ? material.Reflectivity : n.Reflectance(this, n1, n2); switch (bounceType) { case BounceType.BounceTypeAny: reflect = ThreadSafeRandom.NextDouble() < p; break; case BounceType.BounceTypeDiffuse: reflect = false; break; case BounceType.BounceTypeSpecular: reflect = true; break; } if (reflect) { var reflected = n.Reflect(this); return(reflected.ConeBounce(material.Gloss, u, v, rand), true, p); } else if (material.Transparent) { var refracted = n.Refract(this, n1, n2); refracted.Origin = refracted.Origin.Add(refracted.Direction.MulScalar(1e-4)); return(refracted.ConeBounce(material.Gloss, u, v, rand), true, 1 - p); } else { return(n.WeightedBounce(u, v, rand), false, 1 - p); } }
private List <SignalBounce <TKey> > CreateBounceList(AmazonSesNotification sesNotification) { List <SignalBounce <TKey> > bouncedMessages = new List <SignalBounce <TKey> >(); if (sesNotification.AmazonSesMessageType == AmazonSesMessageType.Unknown) { _logger.LogError("Unknown AWS message type received."); return(bouncedMessages); } //parse NDR else if (sesNotification.AmazonSesMessageType == AmazonSesMessageType.Bounce) { foreach (AmazonSesBouncedRecipient recipient in sesNotification.Bounce.BouncedRecipients) { BounceType bounceType = sesNotification.Bounce.AmazonBounceType == AmazonBounceType.Permanent ? BounceType.HardBounce : BounceType.SoftBounce; string detailsXml = XmlBounceDetails.DetailsToXml(sesNotification.AmazonSesMessageType , sesNotification.Bounce.AmazonBounceType, sesNotification.Bounce.AmazonBounceSubType); SignalBounce <TKey> bouncedMessage = CreateBouncedMessage(bounceType , sesNotification.Mail, recipient.EmailAddress, detailsXml); bouncedMessages.Add(bouncedMessage); } } //parse complaint else if (sesNotification.AmazonSesMessageType == AmazonSesMessageType.Complaint) { foreach (AmazonSesComplaintRecipient recipient in sesNotification.Complaint.ComplainedRecipients) { string detailsXml = XmlBounceDetails.DetailsToXml(sesNotification.AmazonSesMessageType , complaintFeedbackType: sesNotification.Complaint.AmazonComplaintFeedbackType); SignalBounce <TKey> bouncedMessage = CreateBouncedMessage(BounceType.HardBounce , sesNotification.Mail, recipient.EmailAddress, detailsXml); bouncedMessages.Add(bouncedMessage); } } return(bouncedMessages); }
/// <summary> /// Processes the bounce. /// </summary> /// <param name="email">The email.</param> /// <param name="bounceType">Type of the bounce.</param> /// <param name="message">The message.</param> /// <param name="bouncedDateTime">The bounced date time.</param> public static void ProcessBounce(string email, BounceType bounceType, string message, DateTime bouncedDateTime) { // currently only processing hard bounces if (bounceType == BounceType.HardBounce) { // get people who have those emails RockContext rockContext = new RockContext(); PersonService personService = new PersonService(rockContext); var peopleWithEmail = personService.GetByEmail(email); foreach (var person in peopleWithEmail) { person.IsEmailActive = false; person.EmailNote = String.Format("Email experienced a {0} on {1} ({2}).", bounceType.Humanize(), bouncedDateTime.ToShortDateString(), message); } rockContext.SaveChanges(); } }
/// <summary> /// Processes the bounce. /// </summary> /// <param name="email">The email.</param> /// <param name="bounceType">Type of the bounce.</param> /// <param name="message">The message.</param> /// <param name="bouncedDateTime">The bounced date time.</param> public static void ProcessBounce(string email, BounceType bounceType, string message, DateTime bouncedDateTime) { // currently only processing hard bounces if (bounceType == BounceType.HardBounce) { string bounceMessage = message.IsNotNullOrWhitespace() ? $" ({message})" : ""; // get people who have those emails RockContext rockContext = new RockContext(); PersonService personService = new PersonService(rockContext); var peopleWithEmail = personService.GetByEmail(email); foreach (var person in peopleWithEmail) { person.IsEmailActive = false; person.EmailNote = $"Email experienced a {bounceType.Humanize()} on {bouncedDateTime.ToShortDateString()}{bounceMessage}."; } rockContext.SaveChanges(); } }
//////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// #region events public void OnBallBounced(GameObject bounce) { BounceType bounceType = BounceType.Wall; Brick brick = bounce.GetComponent <Brick>(); if (brick != null) { bounceType = BounceType.Brick; brick.OnBallBounced(); _consecutiveBounces = 0; } else { if (bounce == Paddle.gameObject) { bounceType = BounceType.Paddle; } ++_consecutiveBounces; } SoundController.PlayBallBouncedSound(bounceType, null); }
/// <summary> /// Processes the bounce. /// </summary> /// <param name="email">The email.</param> /// <param name="bounceType">Type of the bounce.</param> /// <param name="message">The message.</param> /// <param name="bouncedDateTime">The bounced date time.</param> public static void ProcessBounce( string email, BounceType bounceType, string message, DateTime bouncedDateTime ) { // currently only processing hard bounces if ( bounceType == BounceType.HardBounce ) { // get people who have those emails RockContext rockContext = new RockContext(); PersonService personService = new PersonService( rockContext ); var peopleWithEmail = personService.GetByEmail( email ); foreach ( var person in peopleWithEmail ) { person.IsEmailActive = false; person.EmailNote = String.Format( "Email experienced a {0} on {1} ({2}).", bounceType.Humanize(), bouncedDateTime.ToShortDateString(), message ); } rockContext.SaveChanges(); } }
Colour sample(Scene scene, Ray ray, bool emission, int samples, int depth, Random rand) { if (depth > MaxBounces) { return(Colour.Black); } var hit = scene.Intersect(ray); if (!hit.Ok()) { return(sampleEnvironment(scene, ray)); } var info = hit.Info(ray); var material = info.material; var result = Colour.Black; if (material.Emittance > 0) { if (DirectLighting && !emission) { return(Colour.Black); } result = result.Add(material.Color.MulScalar(material.Emittance * samples)); } var n = (int)Math.Sqrt(samples); BounceType ma, mb; if (SpecularMode == SpecularMode.SpecularModeAll || depth == 0 && SpecularMode == SpecularMode.SpecularModeFirst) { ma = BounceType.BounceTypeDiffuse; mb = BounceType.BounceTypeSpecular; } else { ma = BounceType.BounceTypeAny; mb = BounceType.BounceTypeAny; } for (int u = 0; u < n; u++) { for (int v = 0; v < n; v++) { for (BounceType mode = ma; mode <= mb; mode++) { var fu = (u + ThreadSafeRandom.NextDouble()) / n; var fv = (v + ThreadSafeRandom.NextDouble()) / n; (var newRay, var reflected, var p) = ray.Bounce(info, fu, fv, mode, rand); if (mode == BounceType.BounceTypeAny) { p = 1; } if (p > 0 && reflected) { // specular var indirect = sample(scene, newRay, reflected, 1, depth + 1, rand); var tinted = indirect.Mix(material.Color.Mul(indirect), material.Tint); result = result.Add(tinted.MulScalar(p)); } if (p > 0 && !reflected) { // diffuse var indirect = sample(scene, newRay, reflected, 1, depth + 1, rand); var direct = Colour.Black; if (DirectLighting) { direct = sampleLights(scene, info.Ray, rand); } result = result.Add(material.Color.Mul(direct.Add(indirect)).MulScalar(p)); } } } } return(result.DivScalar(n * n)); }
public static void Bounce(BounceType Type, int Count) { if (IsRegistered) { using (var parameters = new Parameters()) { APICall(parameters .AddInt((int)Function.Bounce) .AddInt((int)Id) .AddInt((int)Type) .AddInt((int)Count)); } } }
public ActorProperties(ActorProperties other) { Accuracy = other.Accuracy; Activation = other.Activation; ActiveSound = other.ActiveSound.Copy(); Alpha = other.Alpha; AmmoBackpackAmount = other.AmmoBackpackAmount; AmmoBackpackMaxAmount = other.AmmoBackpackMaxAmount; AmmoDropAmount = other.AmmoDropAmount; ArmorMaxAbsorb = other.ArmorMaxAbsorb; ArmorMaxBonus = other.ArmorMaxBonus; ArmorMaxBonusMax = other.ArmorMaxBonusMax; ArmorMaxSaveAmount = other.ArmorMaxSaveAmount; ArmorMaxFullAbsorb = other.ArmorMaxFullAbsorb; ArmorSaveAmount = other.ArmorSaveAmount; ArmorSavePercent = other.ArmorSavePercent; Args = new SpecialArgs(other.Args); AttackSound = other.AttackSound.Copy(); BloodColor = other.BloodColor; BloodType = new List <UpperString>(other.BloodType); BounceCount = other.BounceCount; BounceFactor = other.BounceFactor; BounceSound = other.BounceSound.Copy(); BounceType = other.BounceType; BurnHeight = other.BurnHeight; CameraHeight = other.CameraHeight; ConversationID = other.ConversationID; CrushPainSound = other.CrushPainSound.Copy(); Damage = other.Damage; DamageFactor = new DamageFactor(other.DamageFactor); DamageType = other.DamageType.Copy(); DeathHeight = other.DeathHeight; DeathSound = other.DeathSound.Copy(); DeathType = other.DeathType.Copy(); Decal = other.Decal.Copy(); DefThreshold = other.DefThreshold; DesignatedTeam = other.DesignatedTeam; DistanceCheck = other.DistanceCheck.Copy(); DropItem = other.DropItem.Select(val => new DropItem(val)).ToList(); ExplosionDamage = other.ExplosionDamage; ExplosionRadius = other.ExplosionRadius; FakeInventoryRespawns = other.FakeInventoryRespawns; FastSpeed = other.FastSpeed; FloatBobPhase = other.FloatBobPhase; FloatBobStrength = other.FloatBobStrength; FloatSpeed = other.FloatSpeed; Friction = other.Friction; FriendlySeeBlocks = other.FriendlySeeBlocks; Game = new List <UpperString>(Game); GibHealth = other.GibHealth; Gravity = other.Gravity; Health = other.Health; HealthLowMessage = new HealthLowMessage(other.HealthLowMessage); HealthPickupAutoUse = other.HealthPickupAutoUse; Height = other.Height; HitObituary = other.HitObituary.Copy(); HowlSound = other.HowlSound.Copy(); InventoryAltHUDIcon = other.InventoryAltHUDIcon.Copy(); InventoryAmount = other.InventoryAmount; InventoryDefMaxAmount = other.InventoryDefMaxAmount; InventoryForbiddenTo = new List <UpperString>(other.InventoryForbiddenTo); InventoryGiveQuest = other.InventoryGiveQuest; InventoryIcon = other.InventoryIcon.Copy(); InventoryInterHubAmount = other.InventoryInterHubAmount; InventoryMaxAmount = other.InventoryMaxAmount; InventoryPickupFlash = other.InventoryPickupFlash.Copy(); InventoryPickupMessage = other.InventoryPickupMessage.Copy(); InventoryPickupSound = other.InventoryPickupSound.Copy(); InventoryRespawnTics = other.InventoryRespawnTics; InventoryRestrictedTo = new List <UpperString>(other.InventoryRestrictedTo); InventoryUseSound = other.InventoryUseSound.Copy(); Mass = other.Mass; MaxStepHeight = other.MaxStepHeight; MaxDropOffHeight = other.MaxDropOffHeight; MaxTargetRange = other.MaxTargetRange; MeleeDamage = other.MeleeDamage; MeleeRange = other.MeleeRange; MeleeSound = other.MeleeSound.Copy(); MeleeThreshold = other.MeleeThreshold; MinMissileChance = other.MinMissileChance; MissileHeight = other.MissileHeight; MissileType = other.MissileType.Copy(); MorphProjectileDuration = other.MorphProjectileDuration; MorphProjectileMonsterClass = other.MorphProjectileMonsterClass.Copy(); MorphProjectileMorphFlash = other.MorphProjectileMorphFlash.Copy(); MorphProjectileMorphStyle = other.MorphProjectileMorphStyle; MorphProjectilePlayerClass = other.MorphProjectilePlayerClass.Copy(); MorphProjectileUnMorphFlash = other.MorphProjectileUnMorphFlash.Copy(); Obituary = other.Obituary.Copy(); PainChance = new PainChance(other.PainChance); PainSound = other.PainSound.Copy(); PainThreshold = other.PainThreshold; PainType = other.PainType.Copy(); PlayerAirCapacity = other.PlayerAirCapacity; PlayerAttackZOffset = other.PlayerAttackZOffset; PlayerColorRange = other.PlayerColorRange; PlayerCrouchSprite = other.PlayerCrouchSprite.Copy(); PlayerDamageScreenColor = new DamageScreenColor(other.PlayerDamageScreenColor); PlayerDisplayName = other.PlayerDisplayName.Copy(); PlayerFace = other.PlayerFace.Copy(); PlayerFallingScreamSpeed = other.PlayerFallingScreamSpeed; PlayerFlechetteType = other.PlayerFlechetteType.Copy(); PlayerForwardMove = other.PlayerForwardMove; PlayerGruntSpeed = other.PlayerGruntSpeed; PlayerHealRadiusType = other.PlayerHealRadiusType.Copy(); PlayerHexenArmor = other.PlayerHexenArmor; PlayerJumpZ = other.PlayerJumpZ; PlayerMaxHealth = other.PlayerMaxHealth; PlayerMorphWeapon = other.PlayerMorphWeapon.Copy(); PlayerMugShotMaxHealth = other.PlayerMugShotMaxHealth; PlayerPortrait = other.PlayerPortrait.Copy(); PlayerRunHealth = other.PlayerRunHealth; PlayerScoreIcon = other.PlayerScoreIcon.Copy(); PlayerSideMove = other.PlayerSideMove; PlayerSoundClass = other.PlayerSoundClass.Copy(); PlayerSpawnClass = other.PlayerSpawnClass.Copy(); PlayerStartItem = new Dictionary <UpperString, int>(other.PlayerStartItem); PlayerTeleportFreezeTime = other.PlayerTeleportFreezeTime; PlayerUseRange = other.PlayerUseRange; PlayerWeaponSlot = CopyWeaponSlot(other.PlayerWeaponSlot); PlayerViewBob = other.PlayerViewBob; PlayerViewHeight = other.PlayerViewHeight; PoisonDamage = other.PoisonDamage; PoisonDamageType = other.PoisonDamageType.Copy(); PowerupColor = other.PowerupColor; PowerupColormap = other.PowerupColormap; PowerupDuration = other.PowerupDuration; PowerupMode = other.PowerupMode; PowerupStrength = other.PowerupStrength; PowerupType = other.PowerupType.Copy(); PowerSpeedNoTrail = other.PowerSpeedNoTrail; ProjectileKickBack = other.ProjectileKickBack; ProjectilePassHeight = other.ProjectilePassHeight; PushFactor = other.PushFactor; PuzzleItemNumber = other.PuzzleItemNumber; PuzzleItemFailMessage = other.PuzzleItemFailMessage.Copy(); Radius = other.Radius; RadiusDamageFactor = other.RadiusDamageFactor; ReactionTime = other.ReactionTime; RenderRadius = other.RenderRadius; RenderStyle = other.RenderStyle; RipLevelMax = other.RipLevelMax; RipLevelMin = other.RipLevelMin; RipperLevel = other.RipperLevel; Scale = other.Scale; SeeSound = other.SeeSound.Copy(); SelfDamageFactor = other.SelfDamageFactor; SpawnID = other.SpawnID; SpawnInfo = other.SpawnInfo.Map(si => new SpawnInfo(si)); Species = other.Species.Copy(); Speed = other.Speed; SpriteAngle = other.SpriteAngle; SpriteRotation = other.SpriteRotation; Stamina = other.Stamina; StealthAlpha = other.StealthAlpha; StencilColor = other.StencilColor; Tag = other.Tag.Copy(); DecorateTranslation = new DecorateTranslation(DecorateTranslation); Threshold = other.Threshold; TeleFogDestType = other.TeleFogDestType; TeleFogSourceType = other.TeleFogSourceType; VisibleAngles = other.VisibleAngles; VisiblePitch = other.VisiblePitch; VisibleToPlayerClass = new List <UpperString>(other.VisibleToPlayerClass); VisibleToTeam = other.VisibleToTeam; VSpeed = other.VSpeed; WallBounceFactor = other.WallBounceFactor; WallBounceSound = other.WallBounceSound.Copy(); WeaponAmmoGive = other.WeaponAmmoGive; WeaponAmmoGive1 = other.WeaponAmmoGive1; WeaponAmmoGive2 = other.WeaponAmmoGive2; WeaponAmmoType = other.WeaponAmmoType.Copy(); WeaponAmmoType1 = other.WeaponAmmoType1.Copy(); WeaponAmmoType2 = other.WeaponAmmoType2.Copy(); WeaponAmmoUse = other.WeaponAmmoUse; WeaponAmmoUse1 = other.WeaponAmmoUse1; WeaponAmmoUse2 = other.WeaponAmmoUse2; WeaponBobRangeX = other.WeaponBobRangeX; WeaponBobRangeY = other.WeaponBobRangeY; WeaponBobSpeed = other.WeaponBobSpeed; WeaponBobStyle = other.WeaponBobStyle; WeaponDefaultKickBack = other.WeaponDefaultKickBack; WeaponKickBack = other.WeaponKickBack; WeaponLookScale = other.WeaponLookScale; WeaponMinSelectionAmmo1 = other.WeaponMinSelectionAmmo1; WeaponMinSelectionAmmo2 = other.WeaponMinSelectionAmmo2; WeaponReadySound = other.WeaponReadySound.Copy(); WeaponSelectionOrder = other.WeaponSelectionOrder; WeaponSisterWeapon = other.WeaponSisterWeapon.Copy(); WeaponSlotNumber = other.WeaponSlotNumber; WeaponSlotPriority = other.WeaponSlotPriority; WeaponUpSound = other.WeaponUpSound.Copy(); WeaponYAdjust = other.WeaponYAdjust; WeaponPieceNumber = other.WeaponPieceNumber; WeaponPieceWeapon = other.WeaponPieceWeapon.Copy(); WeaveIndexXY = other.WeaveIndexXY; WeaveIndexZ = other.WeaveIndexZ; WoundHealth = other.WoundHealth; XScale = other.XScale; YScale = other.YScale; }