/// <summary> /// Constructs a new <see cref="EventData"/> instance using given event properties /// and additional entity includes. /// </summary> /// <param name="id"> /// The unique identifier of the event (used for duplicate event detection). /// </param> /// <param name="properties"> /// The properties for this event (includes both meta and data properties). /// </param> /// <param name="includes"> /// Additional entity includes to be stored along with this event /// </param> public EventData(EventId id, EventProperties properties, EventIncludes includes) { Requires.NotNull(properties, "properties"); Requires.NotNull(includes, "includes"); Id = id; Includes = includes; Properties = properties; }
public void Log(EventSource eventSource, Exception exception, EventId eventId, EventLogEntryType logEntryType) { if (!EventLog.SourceExists(eventSource.ToString())) { EventLog.CreateEventSource(eventSource.ToString(), "TrainSurfer"); } EventLog log = new EventLog(); log.Source = eventSource.ToString(); log.WriteEntry(FormatException(exception), logEntryType, (int)eventId); }
private void ClearLightingDataOverride() { this.applyLightingOverrideEvent = EventId.Nop; this.overrideLightingDataAssetName = null; }
/// public メソッド ///--------------------------------------------------------------------------- /// 初期化 public bool Init( DemoGame.InputGamePad pad, DemoGame.InputTouch touch, DemoGame.GraphicsDevice gDev ) { useGPad = pad; useTouch = touch; plRotY = 0.0f; camRotX = 0.0f; camRotY = 0.0f; eventId = 0; touchRelease = false; singleTouchFlg = false; singleDTapCnt = 0; backTouchNum = 0; plBehindFlg = false; ChangeCamFlag = false; ChangeCamFlag2 = false; multiTapParam = new cTapParam[2]; singleTapParam.Pos.X = 0; singleTapParam.Pos.Y = 0; singleTouchParam.Pos.X = 0; singleTouchParam.Pos.Y = 0; scrWidth = gDev.DisplayWidth; scrHeight = gDev.DisplayHeight; return true; }
public virtual void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) => _logger.Log(logLevel, eventId, state, exception, formatter);
/// <summary> /// Wrapper for the the google.earth.removeEventListener method /// See: https://developers.google.com/earth/documentation/reference/google_earth_namespace#a4367d554eb492adcafa52925ddbf0c71 /// </summary> /// <param name="feature">The target feature</param> /// <param name="action">The event Id</param> /// <param name="callback">Optional, the same callback as was provided when the event was added</param> /// <param name="useCapture">Optional, use event capture</param> public void RemoveEventListener(object feature, EventId action, bool useCapture = false) { //feature, hash, action, useCapture object[] args = new object[] { feature, feature.GetHashCode(), action.ToString().ToUpperInvariant(), useCapture }; this.InvokeJavaScript(JSFunction.RemoveEventListener, args); }
/// <summary> /// Adds key and value pairs to the cache. If any of the specified keys /// already exists in the cache; it is updated, otherwise a new item is /// added to the cache. /// </summary> /// <param name="keys">keys of the entries.</param> /// <param name="cacheEntry">the cache entries.</param> /// <returns>returns keys that are added or updated successfully and their status.</returns> public sealed override Hashtable Insert(object[] keys, CacheEntry[] cacheEntries, bool notify, OperationContext operationContext) { Hashtable table = new Hashtable(); EventContext eventContext = null; EventId eventId = null; OperationID opId = operationContext.OperatoinID; for (int i = 0; i < keys.Length; i++) { try { operationContext.RemoveValueByField(OperationContextFieldName.EventContext); if (notify) { //generate EventId eventId = new EventId(); eventId.EventUniqueID = opId.OperationId; eventId.OperationCounter = opId.OpCounter; eventId.EventCounter = i; eventContext = new EventContext(); eventContext.Add(EventContextFieldName.EventID, eventId); operationContext.Add(OperationContextFieldName.EventContext, eventContext); } CacheInsResultWithEntry result = Insert(keys[i], cacheEntries[i], notify, null, LockAccessType.IGNORE_LOCK, operationContext); table.Add(keys[i], result); } catch (Exception e) { table[keys[i]] = e; } finally { operationContext.RemoveValueByField(OperationContextFieldName.EventContext); } } if (_context.PerfStatsColl != null) { _context.PerfStatsColl.SetCacheSize(Size); } return table; }
/// <summary> /// Constructs a new <see cref="EventData"/> instance using given event properties. /// </summary> /// <param name="id"> /// The unique identifier of the event (used for duplicate event detection). /// </param> /// <param name="properties"> /// The properties for this event (includes both meta and data properties). /// </param> public EventData(EventId id, EventProperties properties) : this(id, properties, EventIncludes.None) { }
}; // class HookedEvent // Add a handler for a specific event. internal void AddHandler(EventId eventId, Delegate handler) { lock(this) { HookedEvent current = hookedEvents; while(current != null) { if(current.eventId == eventId) { current.handler = Delegate.Combine(current.handler, handler); return; } current = current.next; } hookedEvents = new HookedEvent (eventId, handler, hookedEvents); } }
static TerrainRequestEvent() { theName = "terrain.chunk.request"; theId = new EventId("terrain.chunk.request"); }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) => _output.WriteLine(formatter?.Invoke(state, exception));
public abstract IAutomationEventHandler RegisterEvent(EventId @event, TreeScope treeScope, Action <AutomationElement, EventId> action);
public abstract void RemoveAutomationEventHandler(EventId @event, IAutomationEventHandler eventHandler);
public const string LinePrefix = @" "; // 6 spaces. #region Static public static void PerformLogging(LogLevel logLevel, string categoryName, EventId eventId, string formattedStateAndException) { var initialForegroundColor = Console.ForegroundColor; var initialBackgroundColor = Console.BackgroundColor; switch (logLevel) { case LogLevel.Trace: Console.ForegroundColor = ConsoleColor.DarkGray; break; case LogLevel.Debug: Console.ForegroundColor = ConsoleColor.DarkGreen; break; case LogLevel.Information: Console.ForegroundColor = ConsoleColor.White; break; case LogLevel.Warning: Console.ForegroundColor = ConsoleColor.Yellow; break; case LogLevel.Error: Console.ForegroundColor = ConsoleColor.Red; break; case LogLevel.Critical: Console.ForegroundColor = ConsoleColor.White; Console.BackgroundColor = ConsoleColor.Red; break; default: Console.ForegroundColor = ConsoleColor.White; break; } switch (logLevel) { case LogLevel.Trace: Console.Write(@"trace "); break; case LogLevel.Debug: Console.Write(@"debug "); break; case LogLevel.Information: Console.Write(@"info "); break; case LogLevel.Warning: Console.WriteLine(@"WARNING"); Console.Write(SimpleConsoleLogger.LinePrefix); break; case LogLevel.Error: Console.WriteLine(@"* ERROR * "); Console.Write(SimpleConsoleLogger.LinePrefix); break; case LogLevel.Critical: Console.WriteLine(@"*** CRITICAL *** "); Console.BackgroundColor = initialBackgroundColor; Console.Write(SimpleConsoleLogger.LinePrefix); break; default: Console.Write(SimpleConsoleLogger.LinePrefix); // 6 spaces. break; } Console.ForegroundColor = initialForegroundColor; Console.BackgroundColor = initialBackgroundColor; Console.WriteLine(categoryName); Utilities.WriteLines(Console.Out, formattedStateAndException, SimpleConsoleLogger.LinePrefix); }
/// private メソッド ///--------------------------------------------------------------------------- /// プレイヤーの移動チェック private void checkPadPlMove() { plRotY = 0.0f; eventId |= EventId.Move; /// 8方向の入力チェック if( (useGPad.Scan & DemoGame.InputGamePadState.Up) != 0 && (useGPad.Scan & DemoGame.InputGamePadState.Left) != 0 ){ plRotY = 45.0f; } else if( (useGPad.Scan & DemoGame.InputGamePadState.Down) != 0 && (useGPad.Scan & DemoGame.InputGamePadState.Left) != 0 ){ plRotY = 135.0f; } else if( (useGPad.Scan & DemoGame.InputGamePadState.Down) != 0 && (useGPad.Scan & DemoGame.InputGamePadState.Right) != 0 ){ plRotY = 225.0f; } else if( (useGPad.Scan & DemoGame.InputGamePadState.Up) != 0 && (useGPad.Scan & DemoGame.InputGamePadState.Right) != 0 ){ plRotY = 315.0f; } else if( (useGPad.Scan & DemoGame.InputGamePadState.Up) != 0 ){ plRotY = 0.0f; } else if( (useGPad.Scan & DemoGame.InputGamePadState.Left) != 0 ){ plRotY = 90.0f; } else if( (useGPad.Scan & DemoGame.InputGamePadState.Down) != 0 ){ plRotY = 180.0f; } else if( (useGPad.Scan & DemoGame.InputGamePadState.Right) != 0 ){ plRotY = 270.0f; } /// アナログパッド入力 else if( useGPad.AnalogLeftX != 0.0f || useGPad.AnalogLeftY != 0.0f ){ plRotY = (float)( Math.Atan2( useGPad.AnalogLeftX, useGPad.AnalogLeftY ) / (3.141593f / 180.0) ); plRotY += 180.0f; if( plRotY >= 360.0f ){ plRotY -= 360.0f; } } else{ eventId &= ~EventId.Move; } }
private void checkPadPause() { if( (useGPad.Trig & DemoGame.InputGamePadState.Start) != 0 ){ eventId |= EventId.Pause; }else{ eventId &= ~EventId.Pause; } }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception?exception, Func <TState, Exception?, string> formatter) { _logSinkProvider.Log(_categoryName, logLevel, eventId, state, exception, formatter); }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { Console.WriteLine(""); Console.WriteLine(formatter(state, exception)); Console.WriteLine(""); }
internal RecordedEvent(EventId id, EventProperties properties, IEnumerable<Include> includes, Partition partition, int version) { Id = id; Version = version; Properties = properties; EventOperations = Prepare(partition).ToArray(); IncludedOperations = Prepare(includes, partition).ToArray(); }
public void Log <TState>( LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter ) { if (!IsEnabled(logLevel)) { return; } if (formatter == null) { throw new ArgumentNullException(nameof(formatter)); } var message = formatter(state, exception); if (exception != null) { message += Environment.NewLine + exception; } if (string.IsNullOrEmpty(message)) { return; } contextAccessor = services.GetService <IHttpContextAccessor>(); var logItem = new LogItem(); logItem.EventId = eventId.Id; logItem.Message = message; logItem.IpAddress = GetIpAddress(); logItem.Culture = CultureInfo.CurrentCulture.Name; logItem.Url = GetRequestUrl(); // lets not log the log viewer if (logItem.Url.StartsWith("/SystemLog")) { return; } if (logItem.Url.StartsWith("/systemlog")) { return; } logItem.ShortUrl = GetShortUrl(logItem.Url); logItem.Thread = System.Threading.Thread.CurrentThread.Name; logItem.Logger = logger; logItem.LogLevel = logLevel.ToString(); try { logItem.StateJson = JsonConvert.SerializeObject( state, Formatting.None, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Include } ); } catch (Exception) { // don't throw exceptions from logger //bool foo = true; // just a line to set a breakpoint so I can see the error when debugging } // an exception is expected here if the db has not yet been populated // or if the db is not accessible // we cannot allow logging to raise exceptions // so we must swallow any exception here // would be good if we could only swallow specific exceptions try { logRepo.AddLogItem(logItem); } catch (Exception) { //bool foo = true; // just a line to set a breakpoint so I can see the error when debugging } }
private void checkPadLR() { if(ctrlResMgr.eatingBoss == false){ if( (useGPad.Scan & DemoGame.InputGamePadState.L) != 0 || (useGPad.Scan & DemoGame.InputGamePadState.R) != 0 ){ eventId |= EventId.buttonPress; if(ChangeCamFlag == false) { ctrlResMgr.CtrlCam.SetCamMode(CtrlCamera.ModeId.NormalToCloseLook); ChangeCamFlag = true; } }else{ eventId &= ~EventId.buttonPress; if(ChangeCamFlag == true) { ctrlResMgr.CtrlCam.SetCamMode(CtrlCamera.ModeId.CloseLookToNormal); ChangeCamFlag = false; } } } }
/// <summary> /// 设置事件 Id /// </summary> /// <param name="eventId"></param> public StringLoggingPart SetEventId(EventId eventId) { EventId = eventId; return(this); }
// Get the handler for a specific event. internal Delegate GetHandler(EventId eventId) { lock(this) { HookedEvent current = hookedEvents; while(current != null) { if(current.eventId == eventId) { return current.handler; } current = current.next; } return null; } }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) => _underlying.Log(logLevel, eventId, state, exception, formatter);
/// <summary> /// Wrapper for the the google.earth.removeEventListener method /// See: https://developers.google.com/earth/documentation/reference/google_earth_namespace#a4367d554eb492adcafa52925ddbf0c71 /// </summary> /// <param name="feature">The target feature</param> /// <param name="action">The event Id</param> /// <param name="useCapture">Optional, use event capture</param> public void RemoveEventListener(object feature, EventId action, bool useCapture = false) { if (feature == null) { throw new ArgumentNullException("feature"); } // feature, hash, action, useCapture this.InvokeJavaScript(JSFunction.RemoveEventListener, feature, feature.GetHashCode(), action, useCapture); }
internal void SetErrorTestResult(EventId eventId, LocalizedString strMessage) { this.SetResult(false, -1.0); this.Error = strMessage; this.DetailEvents.Add(new MonitoringEvent("MSExchange Monitoring ExchangeSearch", (int)eventId, EventTypeEnumeration.Error, strMessage, this.Database)); }
/// <summary> /// 注册事件 /// </summary> /// <param name="eventId">Event identifier.</param> protected void RegisterEvent(EventId eventId) { // 注册到eventsystem中 EventSystem2.Instance.RegisterEvent(eventId, this, mConfigData.mName, UISystem2.Instance.OnEventHandler); mRegisteredEvents.Add (eventId); }
public static async Task LogEvent <T>(AtomicLogger log, EventId id, T e, DateTime?time = null) where T : struct { var payloadData = GetEventBytes(time ?? DateTime.UtcNow, id, e); await log.WriteDataAsync(payloadData, CancellationToken.None); }
// ILogger public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) => _logger.Log(logLevel, eventId, state, exception, (s, e) => _logPrefix + formatter(s, e));
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { if (!IsEnabled(logLevel)) { return; } int frameOffset = 4; #if DEBUG frameOffset = 5; #endif StackFrame frame = new StackFrame(frameOffset); MethodBase method = frame.GetMethod(); string timestamp = DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss.fff"); lock (this) { if (JsonOutput) { JObject output = new JObject() { ["level"] = logLevel.ToString(), ["message"] = string.Format("{0} [{1,11}] ({2}.{3}) {4}", timestamp, logLevel, method.DeclaringType.FullName, method.Name, formatter(state, exception)), ["timestamp"] = timestamp }; if (exception != null) { output["exception"] = exception.ToString(); } Console.WriteLine(output.ToString(Formatting.None)); } else { var color = Console.ForegroundColor; switch (logLevel) { case LogLevel.Trace: Console.ForegroundColor = ConsoleColor.DarkCyan; break; case LogLevel.Debug: Console.ForegroundColor = ConsoleColor.DarkGreen; break; case LogLevel.Information: Console.ForegroundColor = ConsoleColor.White; break; case LogLevel.Warning: Console.ForegroundColor = ConsoleColor.Yellow; break; case LogLevel.Error: Console.ForegroundColor = ConsoleColor.Red; break; case LogLevel.Critical: Console.ForegroundColor = ConsoleColor.Magenta; break; default: break; } Console.WriteLine("{0} [{1,11}] ({2}.{3}) {4}", timestamp, logLevel, method.DeclaringType.FullName, method.Name, formatter(state, exception)); if (exception != null) { Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine(exception.ToString()); } Console.ForegroundColor = color; } } }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { Log(DateTimeOffset.Now, logLevel, eventId, state, exception, formatter); }
public void OperationInformation(CloudResourceOperationDto currentResourceOperation, string suffix, EventId eventId = default(EventId)) { _logger.LogInformation(eventId, CurrentOperationLogMessage(currentResourceOperation, suffix)); }
public EatResponse OnEvent(EventId id, object cookie) { if (id == this.applyLightingOverrideEvent) { this.UnregisterOverrideEvent(this.applyLightingOverrideEvent); this.applyLightingOverrideEvent = EventId.Nop; this.LoadPlanetLightingData(this.overrideLightingDataAssetName); return(EatResponse.NotEaten); } if (id == this.removeLightingOverrideEvent) { this.UnregisterOverrideEvent(this.removeLightingOverrideEvent); this.removeLightingOverrideEvent = EventId.Nop; this.RemoveLightingDataOverride(); return(EatResponse.NotEaten); } if (id != EventId.WorldOutTransitionComplete) { if (id == EventId.GameStateChanged) { GameStateMachine gameStateMachine = Service.Get <GameStateMachine>(); IState currentState = gameStateMachine.CurrentState; uint timeStamp = DateUtils.GetNowSeconds(); if (currentState is BattlePlaybackState) { BattleEntry currentBattleEntry = Service.Get <BattlePlaybackController>().CurrentBattleEntry; BattleRecord currentBattleRecord = Service.Get <BattlePlaybackController>().CurrentBattleRecord; if (currentBattleEntry != null && currentBattleRecord != null) { uint num = (uint)(currentBattleRecord.BattleLength - currentBattleRecord.BattleAttributes.TimeLeft); timeStamp = currentBattleEntry.EndBattleServerTime - num; } else { timeStamp = (uint)UnityEngine.Random.Range(0, 86400000); } this.CalculateInitialPlanetLightingData(timeStamp); } else if (currentState is HomeState) { this.UnlockAndRestoreTimeOfDay(); } else if (this.IsTimePausedInDayPhase()) { this.SetTimeOfDayColorToTheDayPhase(); } this.RefreshPlanetData(timeStamp); } } else { this.ClearLightingDataOverride(); CurrentBattle currentBattle = Service.Get <BattleController>().GetCurrentBattle(); if (currentBattle != null && !currentBattle.IsPvP() && !currentBattle.IsDefense()) { this.pauseTimeOfDayUpdate = true; this.SetTimeOfDayColorToTheDayPhase(); } } return(EatResponse.NotEaten); }
public void OperationWarning(CloudResourceOperationDto currentResourceOperation, string suffix, Exception exeption = null, EventId eventId = default(EventId)) { _logger.LogWarning(eventId, exeption, CurrentOperationLogMessage(currentResourceOperation, suffix)); }
public override void OnUIEventHandler(EventId eventId, params object[] args) { if (eventId == EventId.OnMatchInit) { matchId = (string)args[0]; roomId = (string)args[1]; IList <NetMessage.UserData> userList = (IList <NetMessage.UserData>)args[2]; IList <int> userIndexList = (IList <int>)args[3]; timeCount = (int)args[4]; playerNum = (int)args[5]; int nPlayerCount = 0; for (int i = 0; i < userList.Count; ++i) { PlayerData pd = new PlayerData(); pd.Init(userList[i]); if (pd.userId > 0) { nPlayerCount++; } else { // AI //pd.name = AIManager.GetAIName(pd.userId); //pd.icon = AIManager.GetAIIcon(pd.userId); } int index = userIndexList[i]; nowUserDatas[index] = pd; SetModelPage(); SetPage(); CheckAllEntered(); Flurry.Instance.FlurryPVPBattleMatchEvent("0", matchId, "0", nPlayerCount.ToString(), ""); } } else if (eventId == EventId.OnMatchUpdate) { IList <NetMessage.UserData> userAddList = (IList <NetMessage.UserData>)args[0]; IList <int> userIndexAddList = (IList <int>)args[1]; IList <int> userIndexDeleteList = (IList <int>)args[2]; for (int i = 0; i < userIndexDeleteList.Count; ++i) { int index = userIndexDeleteList[i]; nowUserDatas[index] = null; } // add for (int i = 0; i < userAddList.Count; ++i) { PlayerData pd = new PlayerData(); pd.Init(userAddList[i]); if (pd.userId <= 0) { // AI //pd.name = AIManager.GetAIName(pd.userId); //pd.icon = AIManager.GetAIIcon(pd.userId); } int index = userIndexAddList[i]; nowUserDatas[index] = pd; } SetPage(); CheckAllEntered(); } else if (eventId == EventId.OnMatchQuit) { // quit , 谁触发的quit,谁收到quit, NetMessage.ErrCode code = (NetMessage.ErrCode)args[0]; if (code == NetMessage.ErrCode.EC_NotMaster) { Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.GetValue(905), 1.0f); } else if (code != NetMessage.ErrCode.EC_Ok) { Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.Format(901, code), 1.0f); } else if (code == NetMessage.ErrCode.EC_Ok) { BattleSystem.Instance.battleData.root.SetActive(false); BattleSystem.Instance.Reset(); UISystem.Get().HideAllWindow(); UISystem.Get().ShowWindow("StartWindow"); } } }
private static extern void SHChangeNotify(EventId wEventId, uFlags uFlags, IntPtr dwItem1, IntPtr dwItem2);
/// <summary> /// Constructs a new <see cref="EventData"/> instance which doesn't have any additional properties /// but includes a set of additional entity includes. /// </summary> /// <param name="id"> /// The unique identifier of the event (used for duplicate event detection). /// </param> /// <param name="includes"> /// Additional entity includes to be stored along with this event /// </param> public EventData(EventId id, EventIncludes includes) : this(id, EventProperties.None, includes) { }
public static extern int SHChangeNotify( EventId eventId, ChangeNotifyFlags flags, IntPtr item1, IntPtr item2 );
/// <summary> /// Returns a warning-as-error exception wrapping the given message for this event. /// </summary> /// <param name="message"> The message to wrap. </param> protected virtual Exception WarningAsError(string message) => new InvalidOperationException( CoreStrings.WarningAsErrorTemplate(EventId.ToString(), message, EventIdCode));
/// 破棄 public void Term() { eventId = 0; useGPad = null; useTouch = null; multiTapParam = null; }
public EatResponse OnEvent(EventId id, object cookie) { if (id <= EventId.ButtonClicked) { if (id <= EventId.EntityKilled) { if (id <= EventId.BuildingSelected) { if (id != EventId.BuildingPurchaseSuccess) { if (id != EventId.BuildingSelected) { return(EatResponse.NotEaten); } Entity entity = (Entity)cookie; BuildingComponent buildingComponent = entity.Get <BuildingComponent>(); if (buildingComponent == null) { return(EatResponse.NotEaten); } BuildingTypeVO buildingType = buildingComponent.BuildingType; if (buildingType.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { Entity entity2 = (Entity)cookie; BuildingComponent buildingComponent2 = entity2.Get <BuildingComponent>(); if (buildingComponent2 == null) { return(EatResponse.NotEaten); } BuildingTypeVO buildingType2 = buildingComponent2.BuildingType; if (buildingType2.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else { if (id == EventId.DroidPurchaseAnimationComplete) { goto IL_3D4; } if (id != EventId.EntityKilled) { return(EatResponse.NotEaten); } Entity entity3 = (Entity)cookie; string text = ""; string text2 = this.prepareArgs[1]; if (text2 == "troopKilled") { TroopComponent troopComponent = entity3.Get <TroopComponent>(); if (troopComponent == null) { return(EatResponse.NotEaten); } text = troopComponent.TroopType.Uid; } else if (text2 == "buildingKilled") { BuildingComponent buildingComponent3 = entity3.Get <BuildingComponent>(); if (buildingComponent3 == null) { return(EatResponse.NotEaten); } BuildingTypeVO buildingType3 = buildingComponent3.BuildingType; text = buildingType3.Uid; } if (text.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id <= EventId.TroopDonationTrackRewardReceived) { if (id != EventId.TroopDeployed) { if (id != EventId.TroopDonationTrackRewardReceived) { return(EatResponse.NotEaten); } goto IL_3D4; } } else if (id != EventId.SpecialAttackDeployed) { if (id != EventId.ButtonClicked) { return(EatResponse.NotEaten); } string text3 = (string)cookie; if (text3.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { SpecialAttack specialAttack = (SpecialAttack)cookie; if (specialAttack.VO.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id <= EventId.InventoryResourceUpdated) { if (id <= EventId.ContractStarted) { if (id != EventId.ContractAdded) { if (id != EventId.ContractStarted) { return(EatResponse.NotEaten); } ContractEventData contractEventData = (ContractEventData)cookie; if (contractEventData.Contract.ProductUid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { ContractEventData contractEventData2 = (ContractEventData)cookie; if (contractEventData2.Contract.ProductUid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id != EventId.ContractCompletedForStoryAction) { if (id != EventId.InventoryResourceUpdated) { return(EatResponse.NotEaten); } string text4 = (string)cookie; if (text4.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { ContractTO contractTO = (ContractTO)cookie; if (contractTO.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id <= EventId.ScreenLoaded) { if (id != EventId.ScreenClosing) { if (id != EventId.ScreenLoaded) { return(EatResponse.NotEaten); } UXFactory uXFactory = cookie as UXFactory; string name = uXFactory.Root.name; if (name.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } else { UXFactory uXFactory2 = cookie as UXFactory; string text5 = (uXFactory2 == null || uXFactory2.Root == null) ? string.Empty : uXFactory2.Root.name; if (text5.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id != EventId.HeroDeployed && id != EventId.ChampionDeployed) { if (id != EventId.EquipmentUnlocked) { return(EatResponse.NotEaten); } goto IL_3D4; } Entity entity4 = (Entity)cookie; TroopComponent troopComponent2 = entity4.Get <TroopComponent>(); ITroopDeployableVO troopType = troopComponent2.TroopType; if (troopType.Uid.Equals(this.eventData[0], 5)) { this.CountEvent(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); IL_3D4: this.CountEvent(); return(EatResponse.NotEaten); }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { efCoreLogAction($"Log Level: {logLevel}, {state}"); }
public HookedEvent(EventId eventId, Delegate handler, HookedEvent next) { this.eventId = eventId; this.handler = handler; this.next = next; }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { }
// Remove a handler from a specific event. internal void RemoveHandler(EventId eventId, Delegate handler) { lock(this) { HookedEvent current = hookedEvents; HookedEvent prev = null; while(current != null) { if(current.eventId == eventId) { current.handler = Delegate.Remove(current.handler, handler); if(current.handler == null) { if(prev != null) { prev.next = current.next; } else { hookedEvents = current.next; } } return; } prev = current; current = current.next; } } }
/// <summary> /// </summary> /// <param name="logLevel"></param> /// <param name="eventId"></param> /// <param name="state"></param> /// <param name="exception"></param> /// <param name="formatter"></param> public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { if (!IsEnabled(logLevel)) { return; } if (formatter == null) { throw new ArgumentNullException(nameof(formatter)); } var message = new JObject(); if (applicationName != null) { message["name"] = applicationName; } if (environment != null) { message["env"] = environment; } if (options.IncludeLogLevel) { message["level"] = (int)logLevel.ToBunyanLogLevel(); } if (options.IncludeCategory) { message["category_name"] = categoryName; } message["pid"] = Environment.ProcessId; message["hostname"] = hostname; if (state is JObject obj) { foreach (var kvp in obj) { message[kvp.Key.ToLower()] = kvp.Value; } } else { message["msg"] = formatter.Invoke(state, exception); } if (options.IncludeNewline) { } message["time"] = DateTime.UtcNow; if (exception != null) { message["err"] = exception.ToString(); } if (eventId.Id != 0) { message["event_id"] = eventId.Id; message["event_name"] = eventId.Name; } message["v"] = 0; string finalText; try { finalText = JsonConvert.SerializeObject(message, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, }); } #pragma warning disable 168 catch (Exception e) #pragma warning restore 168 { return; // suppressing error here is intentional } Amazon.Lambda.Core.LambdaLogger.Log(finalText); }
/// <summary> /// Wrapper for the the google.earth.addEventListener method /// </summary> /// <param name="feature">The target feature</param> /// <param name="action">The event Id</param> /// <param name="callback">Optional, the name of javascript callback function to use, or an anonymous function</param> /// <param name="useCapture">Optionally use event capture</param> /// <example>GEWebBrowser.AddEventListener(object, "click", "someFunction");</example> /// <example>GEWebBrowser.AddEventListener(object, "click", "function(event){alert(event.getType);}");</example> public void AddEventListener(object feature, EventId action, string callback = null, bool useCapture = false) { if (!string.IsNullOrEmpty(callback)) { callback = "_x=" + callback; } object[] args = new object[] { feature, feature.GetHashCode(), action.ToString().ToUpperInvariant(), callback, useCapture }; this.InvokeJavaScript(JSFunction.AddEventListener, args); }
/// <summary> /// Creates a delegate which can be invoked for logging a message. /// </summary> /// <typeparam name="T1">The type of the first parameter passed to the named format string.</typeparam> /// <typeparam name="T2">The type of the second parameter passed to the named format string.</typeparam> /// <typeparam name="T3">The type of the third parameter passed to the named format string.</typeparam> /// <param name="logLevel">The <see cref="LogLevel"/></param> /// <param name="eventId">The event id</param> /// <param name="formatString">The named format string</param> /// <returns>A delegate which when invoked creates a log message.</returns> public static Action <ILogger, LogLevel, T1, T2, T3, Exception> Define <T1, T2, T3>(EventId eventId, string formatString) { var formatter = CreateLogValuesFormatter(formatString, expectedNamedParameterCount: 3); return((logger, logLevel, arg1, arg2, arg3, exception) => { if (logger.IsEnabled(logLevel)) { logger.Log(logLevel, eventId, new LogValues <T1, T2, T3>(formatter, arg1, arg2, arg3), exception, LogValues <T1, T2, T3> .Callback); } }); }
/// <summary> /// Wrapper for the the google.earth.addEventListener method /// </summary> /// <param name="feature">The target feature</param> /// <param name="action">The event Id</param> /// <param name="callback">Optional, the name of JavaScript callback function to use, or an anonymous function</param> /// <param name="useCapture">Optionally use event capture</param> /// <example>GEWebBrowser.AddEventListener(object, "click", "someFunction");</example> /// <example>GEWebBrowser.AddEventListener(object, "click", "function(event){alert(event.getType);}");</example> public void AddEventListener(object feature, EventId action, string callback = null, bool useCapture = false) { this.InvokeJavaScript( JSFunction.AddEventListener, feature, feature.GetHashCode(), action.ToString().ToUpperInvariant(), callback, useCapture); }
void ILogger.Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { var message = formatter(state, exception); TraceEvent(LogLevelToTraceEventType(logLevel), eventId.Id, message); }
/// <summary> /// Adds key and value pairs to the cache. Throws an exception or returns the /// list of keys that failed to add in the cache. /// </summary> /// <param name="keys">keys of the entries.</param> /// <param name="cacheEntries">the cache entries.</param> /// <returns>List of keys that are added or that alredy exists in the cache and their status.</returns> public sealed override Hashtable Add(object[] keys, CacheEntry[] cacheEntries, bool notify, OperationContext operationContext) { Hashtable table = new Hashtable(); EventContext eventContext = null; EventId eventId = null; OperationID opId = operationContext.OperatoinID; for (int i = 0; i < keys.Length; i++) { try { operationContext.RemoveValueByField(OperationContextFieldName.EventContext); if (notify) { //generate EventId eventId = new EventId(); eventId.EventUniqueID = opId.OperationId; eventId.OperationCounter = opId.OpCounter; eventId.EventCounter = i; eventContext = new EventContext(); eventContext.Add(EventContextFieldName.EventID, eventId); operationContext.Add(OperationContextFieldName.EventContext, eventContext); } CacheAddResult result = Add(keys[i], cacheEntries[i], notify, operationContext); table[keys[i]] = result; } catch (Exceptions.StateTransferException se) { table[keys[i]] = se; } catch (Exception inner) { table[keys[i]] = new OperationFailedException(inner.Message, inner); } finally { operationContext.RemoveValueByField(OperationContextFieldName.EventContext); } } if (_context.PerfStatsColl != null) { _context.PerfStatsColl.SetCacheSize(Size); } return table; }
/// <inheritdoc /> public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { GaxPreconditions.CheckNotNull(formatter, nameof(formatter)); if (!IsEnabled(logLevel)) { return; } string message = formatter(state, exception); if (string.IsNullOrEmpty(message)) { return; } var jsonStruct = new Struct(); jsonStruct.Fields.Add("message", Value.ForString(message)); jsonStruct.Fields.Add("log_name", Value.ForString(_logName)); if (eventId.Id != 0 || eventId.Name != null) { var eventStruct = new Struct(); if (eventId.Id != 0) { eventStruct.Fields.Add("id", Value.ForNumber(eventId.Id)); } if (!string.IsNullOrWhiteSpace(eventId.Name)) { eventStruct.Fields.Add("name", Value.ForString(eventId.Name)); } jsonStruct.Fields.Add("event_id", Value.ForStruct(eventStruct)); } // If we have format params and its more than just the original message add them. if (state is IEnumerable <KeyValuePair <string, object> > formatParams && !(formatParams.Count() == 1 && formatParams.Single().Key.Equals("{OriginalFormat}"))) { var paramStruct = new Struct(); foreach (var pair in formatParams) { // Consider adding formatting support for values that are IFormattable. paramStruct.Fields[pair.Key] = Value.ForString(pair.Value?.ToString() ?? ""); } if (paramStruct.Fields.Count > 0) { jsonStruct.Fields.Add("format_parameters", Value.ForStruct(paramStruct)); } } var currentLogScope = GoogleLoggerScope.Current; if (currentLogScope != null) { jsonStruct.Fields.Add("scope", Value.ForString(currentLogScope.ToString())); } // Create a map of format parameters of all the parent scopes, // starting from the most inner scope to the top-level scope. var scopeParamsList = new List <Value>(); while (currentLogScope != null) { // Determine if the state of the scope are format params if (currentLogScope.State is FormattedLogValues scopeFormatParams) { var scopeParams = new Struct(); foreach (var pair in scopeFormatParams) { scopeParams.Fields[pair.Key] = Value.ForString(pair.Value?.ToString() ?? ""); } scopeParamsList.Add(Value.ForStruct(scopeParams)); } currentLogScope = currentLogScope.Parent; } if (scopeParamsList.Count > 0) { jsonStruct.Fields.Add("parent_scopes", Value.ForList(scopeParamsList.ToArray())); } Dictionary <string, string> labels; var labelProviders = GetLabelProviders()?.ToArray(); if (labelProviders?.Length > 0) { // Create a copy of the labels from the options and invoke each provider labels = _loggerOptions.Labels.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); foreach (var provider in labelProviders) { provider.Invoke(labels); } } else { labels = _loggerOptions.Labels; } LogEntry entry = new LogEntry { Resource = _loggerOptions.MonitoredResource, LogName = _fullLogName, Severity = logLevel.ToLogSeverity(), Timestamp = Timestamp.FromDateTime(_clock.GetCurrentDateTimeUtc()), JsonPayload = jsonStruct, Labels = { labels }, Trace = GetTraceName() ?? "", }; _consumer.Receive(new[] { entry }); }
/// <summary> /// Removes key and value pairs from the cache. The keys are specified as parameter. /// Moreover it take a removal reason and a boolean specifying if a notification should /// be raised. /// </summary> /// <param name="keys">keys of the entry.</param> /// <param name="removalReason">reason for the removal.</param> /// <param name="notify">boolean specifying to raise the event.</param> /// <returns>list of removed keys</returns> public override Hashtable Remove(object[] keys, ItemRemoveReason removalReason, bool notify, bool isUserOperation, OperationContext operationContext) { Hashtable table = new Hashtable(); EventContext eventContext = null; EventId eventId = null; OperationID opId = operationContext.OperatoinID; for (int i = 0; i < keys.Length; i++) { try { operationContext.RemoveValueByField(OperationContextFieldName.EventContext); if (notify) { //generate EventId eventId = new EventId(); eventId.EventUniqueID = opId.OperationId; eventId.OperationCounter = opId.OpCounter; eventId.EventCounter = i; eventContext = new EventContext(); eventContext.Add(EventContextFieldName.EventID, eventId); operationContext.Add(OperationContextFieldName.EventContext, eventContext); } CacheEntry e = Remove(keys[i], removalReason, notify, null, LockAccessType.IGNORE_LOCK, operationContext); if (e != null) { table[keys[i]] = e; } } catch (StateTransferException e) { table[keys[i]] = e; } finally { operationContext.RemoveValueByField(OperationContextFieldName.EventContext); } } if (_context.PerfStatsColl != null) { _context.PerfStatsColl.SetCacheSize(Size); } return table; }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { throw new NotImplementedException(); }
/// <summary> /// 取消注册事件 /// </summary> /// <param name="eventId">Event identifier.</param> private void UnRegisterEvent(EventId eventId) { // 从eventsystem中删除注册事件 EventSystem2.Instance.UnRegisterEvent(eventId, this); mRegisteredEvents.Remove (eventId); }
/// フレーム処理 public void Frame() { eventId = 0; camRotX = 0.0f; camRotY = 0.0f; touchRelease = false; //ポーズ判定 checkPadPause(); /// 移動判定 checkPadPlMove(); /// LR判定 checkPadLR(); checkPadcamMode(); /// カメラの回転判定 checkPadCamRot(); motionCamRot(); /// タップ判定 ///------------------------------------------------------- if( backTouchNum == 0 ){ if( useTouch.GetInputNum() > 0 ){ touchRelease = true; } } /// ニュートラル状態 ///------------------------------------------------------- if( useTouch.GetInputNum() == 0 ){ if( singleTouchFlg ){ /// フリックしていたら無効 if( singleFlicFlg ){ singleDTapCnt = 0; } /// 目的地セット else{ eventId |= EventId.DestinationCancel; singleDTapCnt = 30; } singleTouchFlg = false; } } /// シングルタッチ系の判定 ///------------------------------------------------------- else if( useTouch.GetInputNum() == 1 ){ /// タッチした直後のパラメータセット if( useTouch.GetInputState( 0 ) == DemoGame.InputTouchState.Down ){ setSingleTapParam(); } if( useTouch.GetInputState( 0 ) == DemoGame.InputTouchState.Move ){ setSingleTouchParam(); eventId |= EventId.DestinationMove; } /// 攻撃判定 /* if( singleTouchFlg && !singleFlicFlg ){ checkTouchAttack(); } */ if( singleTouchFlg){ // checkSingleTouchCamRot(); } } /// マルチタッチ系の判定 ///------------------------------------------------------- else{ /// マルチタッチした直後のパラメータセット if( backTouchNum != 2 ){ setMultiTouchBackDis(); setMultiTouchBackPos(); singleTouchFlg = false; } /// ズーム判定 // if( !multiZoomModeFlg ){ // checkTouchCamZoom(); // } /// カメラの回転判定 checkTouchCamRot(); singleDTapCnt = 0; } if( singleDTapCnt > 0 ){ singleDTapCnt --; } backTouchNum = useTouch.GetInputNum(); }