private void TellMeAbout(InfoHelper helper) { ClearInfoTree(); switch (helper.Type) { case InfoHelperType.InfoDictionary: case InfoHelperType.ProcessInfoDictionary: TellMeAboutTitle = helper.Title; break; case InfoHelperType.DriverObject: TellMeAboutTitle = helper.Title; PopulateInfoTree("_DRIVER_OBJECT"); break; case InfoHelperType.ProcessObject: TellMeAboutTitle = helper.Title; PopulateInfoTree("_EPROCESS"); break; case InfoHelperType.HandleTable: TellMeAboutTitle = helper.Title; PopulateInfoTree("_HANDLE_TABLE"); break; default: TellMeAboutTitle = ""; break; } }
/// <summary> /// Check, if mouse is hovered over a feature at a given screen position /// </summary> /// <param name="screenPosition">Screen position to check for widgets and features</param> /// <param name="scale">Scale of scrren. Normally is 1, but could be greater.</param> /// <param name="symbolCache">Cache for symbols to determin size</param> public void InvokeHover(Point screenPosition, float scale, ISymbolCache symbolCache) { if (Hover == null) { return; } if (HoverLayers.Count == 0) { return; } var mapInfo = InfoHelper.GetMapInfo(Viewport, screenPosition, scale, HoverLayers, symbolCache); if (mapInfo?.Feature != _previousHoverEventArgs?.MapInfo.Feature) // only notify when the feature changes { var mapInfoEventArgs = new MapInfoEventArgs { MapInfo = mapInfo, NumTaps = 0, Handled = false }; _previousHoverEventArgs = mapInfoEventArgs; Hover?.Invoke(this, mapInfoEventArgs); } }
public void NewSelection(InfoHelper helper) { switch (helper.Type) { case InfoHelperType.DriverObject: helper.BufferSize = _driverObjectSize; UpdateInfoViewer(helper); break; case InfoHelperType.InfoDictionary: UpdateInfoViewer(helper); break; case InfoHelperType.ProcessInfoDictionary: UpdateInfoViewer(helper); break; case InfoHelperType.HandleTable: helper.BufferSize = _handleTableSize; UpdateInfoViewer(helper); break; case InfoHelperType.ProcessObject: helper.BufferSize = _eprocessSize; UpdateInfoViewer(helper); break; default: break; } TellMeAbout(helper); }
private void IsFailed() { InfoHelper.DisplayMissionResult( false, _userInfo.Score, _userInfo.Turn, _userInfo.Gold ); }
private void AddToProcessInfoDictionary(string key, InfoHelper helper) { if (helper == null) { return; } lock (AccessLock) { InfoHelper testValue; int suffix = 1; bool trying = true; string alternativeKey = key; while (trying) { trying = ProcessInfoDictionary.TryGetValue(alternativeKey, out testValue); if (trying) { alternativeKey = key + (suffix++).ToString(); } } Dictionary <string, InfoHelper> _tempInfo = new Dictionary <string, InfoHelper>(); foreach (var item in ProcessInfoDictionary) { _tempInfo.Add(item.Key, item.Value); } _tempInfo.Add(alternativeKey, helper); ProcessInfoDictionary = _tempInfo; } }
public void GetMethodInfo_ActionInstance_Invalid() { Expression <Action <InfoHelperClass> > exp = i => new InfoHelperClass(); MethodInfo info = InfoHelper.GetMethodInfo(exp); Assert.IsNull(info); }
public void GetMethodInfo_Func_Int() { MethodInfo info = InfoHelper.GetMethodInfo(() => InfoHelperClass.StaticIntMethod()); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "StaticIntMethod"); }
public void IgnoringDisabledLayers() { // arrange var map = new Map(); map.Viewport.Resolution = 1; map.Viewport.Width = 10; map.Viewport.Height = 10; map.Viewport.Center = new Point(5, 5); var disabledLayer = new MemoryLayer { Name = "TestLayer", DataSource = new MemoryProvider(CreatePolygon(1, 3)), Enabled = false }; map.Layers.Add(disabledLayer); map.InfoLayers.Add(disabledLayer); var screenPositionHit = map.Viewport.WorldToScreen(2, 2); var scale = 1; // act var argsHit = InfoHelper.GetInfoEventArgs(map.Viewport, screenPositionHit, scale, map.InfoLayers, null); // assert; Assert.IsTrue(argsHit.Feature == null); Assert.IsTrue(argsHit.Layer == null); Assert.IsTrue(argsHit.WorldPosition.Equals(new Point(2, 2))); }
private void IsSucceeded() { InfoHelper.DisplayMissionResult( true, _userInfo.Score, _userInfo.Turn, _userInfo.Gold ); }
public void GetConstructorInfo_NoArgs() { ConstructorInfo info = InfoHelper.GetConstructorInfo(() => new InfoHelperClass()); Assert.IsNotNull(info); Assert.AreEqual(info.GetParameters().Length, 0); }
public void GetMethodInfo_FuncInstance_InvalidThrowIfNotFoundThrows() { Expression <Func <InfoHelperClass, object> > exp = i => new InfoHelperClass(); MethodInfo info = InfoHelper.GetMethodInfo(exp, true); Assert.Fail("Didn't throw"); }
public void GetPropertyInfo_Instance_String() { PropertyInfo info = InfoHelper.GetPropertyInfo <InfoHelperClass>(i => i.StringProperty); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "StringProperty"); }
public void GetMethodInfo_ActionInstance_NoArgs() { MethodInfo info = InfoHelper.GetMethodInfo <InfoHelperClass>(i => i.VoidMethod()); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "VoidMethod"); }
public bool InvokeInfo(Point screenPosition, Point startScreenPosition, float scale, ISymbolCache symbolCache, Action <IWidget, Point> widgetCallback, int numTaps) { var allWidgets = Layers.Select(l => l.Attribution).Where(a => a != null).Concat(Widgets).ToList(); // First check if a Widget is clicked. In the current design they are always on top of the map. var widget = WidgetTouch.GetWidget(screenPosition, startScreenPosition, scale, allWidgets); if (widget != null) { // TODO how should widgetCallback have a handled type thing? // Widgets should be iterated through rather than getting a single widget, // based on Z index and then called until handled = true; Ordered By highest Z widgetCallback(widget, new Point(screenPosition.X / scale, screenPosition.Y / scale)); return(true); } if (Info == null) { return(false); } var eventArgs = InfoHelper.GetInfoEventArgs(Viewport, screenPosition, scale, InfoLayers, symbolCache, numTaps); if (eventArgs != null) { // TODO Info items should be iterated through rather than getting a single item, // based on Z index and then called until handled = true; Ordered By highest Z Info?.Invoke(this, eventArgs); return(eventArgs.Handled); } return(false); }
public void GetMethodInfo_FuncInstance_Int() { MethodInfo info = InfoHelper.GetMethodInfo <InfoHelperClass>(i => i.IntMethod()); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "IntMethod"); }
public void GetMethodInfo_FuncInstance_Invalid() { Expression <Func <InfoHelperClass, object> > exp = i => new InfoHelperClass(); MethodInfo info = InfoHelper.GetMethodInfo(exp); Assert.IsNull(info); }
/// <summary> /// Initializes the category. /// </summary> /// <param name="prefab">The prefab.</param> private bool InitializeCategory(PrefabInfo prefab) { string category = null; try { ItemClass.SubService subService = prefab.GetSubService(); if (subService != ItemClass.SubService.None && subService != ItemClass.SubService.Unused2) { category = subService.ToString(); if (category.Length < 6 || category.Substring(0, 6).ToLowerInvariant() != "unused") { this.RawCategory = "SubService:" + category; this.Category = InfoHelper.CleanCategory(category); return(true); } } } catch { } try { ItemClass.Service service = prefab.GetService(); if (service != ItemClass.Service.None && service != ItemClass.Service.Unused2) { category = service.ToString(); if (category.Length < 6 || category.Substring(0, 6).ToLowerInvariant() != "unused") { this.RawCategory = "Service:" + category; this.Category = InfoHelper.CleanCategory(category); return(true); } } } catch { } try { category = prefab.category; if (!String.IsNullOrEmpty(category)) { this.RawCategory = "Category:" + prefab.category; this.Category = InfoHelper.CleanCategory(prefab.category); return(true); } } catch { } this.RawCategory = null; this.Category = "Unknown"; return(true); }
public void GetMethodInfo_Action_OutArgs() { int a = 0, b; MethodInfo info = InfoHelper.GetMethodInfo(() => InfoHelperClass.StaticOutMethod(ref a, out b)); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "StaticOutMethod"); }
public void GetParameterInfo_Instance_VoidFirstArg() { ParameterInfo info = InfoHelper.GetParameterInfo <InfoHelperClass, string>((i, p) => i.VoidArgsMethod(p, default(int))); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "sarg"); Assert.AreEqual(info.ParameterType, typeof(string)); }
public void GetParameterInfo_Static_FirstArg() { ParameterInfo info = InfoHelper.GetParameterInfo <string>(p => InfoHelperClass.StaticStringArgsMethod(p, default(int))); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "sarg"); Assert.AreEqual(info.ParameterType, typeof(string)); }
public void GetParameterInfo_Static_SecondArg() { ParameterInfo info = InfoHelper.GetParameterInfo <int>(p => InfoHelperClass.StaticStringArgsMethod(default(string), p)); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "iarg"); Assert.AreEqual(info.ParameterType, typeof(int)); }
public void GetMethodInfo_Action_Args() { MethodInfo info = InfoHelper.GetMethodInfo( () => InfoHelperClass.StaticVoidArgsMethod(default(string), default(int))); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "StaticVoidArgsMethod"); }
public void GetParameterInfo_Static_Out() { ParameterInfo info = InfoHelper.GetParameterInfo <int>(p => InfoHelperClass.StaticOutMethod(ref InfoHelper <int> .RefOrOut, out InfoHelper <int> .Parameter)); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "b"); Assert.AreEqual(info.ParameterType, typeof(int).MakeByRefType()); }
public void GetMethodInfo_ActionInstance_Args() { MethodInfo info = InfoHelper.GetMethodInfo <InfoHelperClass>( i => i.VoidArgsMethod(default(string), default(int))); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "VoidArgsMethod"); }
public void GetConstructorInfo_Args() { ConstructorInfo info = InfoHelper.GetConstructorInfo(() => new InfoHelperClass(default(string), default(int))); Assert.IsNotNull(info); Assert.AreEqual(info.GetParameters().Length, 2); }
public void GetMethodInfo_ActionInstance_OutArgs() { int a = 0, b; MethodInfo info = InfoHelper.GetMethodInfo <InfoHelperClass>(i => i.OutMethod(ref a, out b)); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "OutMethod"); }
public void GetMethodInfo_ActionInstance_OutArgsHelper() { MethodInfo info = InfoHelper.GetMethodInfo <InfoHelperClass>( i => i.OutMethod(ref InfoHelper <int> .RefOrOut, out InfoHelper <int> .RefOrOut)); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "OutMethod"); }
public void GetParameterInfo_Instance_VoidSecondArg() { ParameterInfo info = InfoHelper.GetParameterInfo <InfoHelperClass, int>((i, p) => i.VoidArgsMethod(default(string), p)); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "iarg"); Assert.AreEqual(info.ParameterType, typeof(int)); }
public void GetMethodInfo_Action_OutArgsHelper() { MethodInfo info = InfoHelper.GetMethodInfo( () => InfoHelperClass.StaticOutMethod(ref InfoHelper <int> .RefOrOut, out InfoHelper <int> .RefOrOut)); Assert.IsNotNull(info); Assert.AreEqual(info.Name, "StaticOutMethod"); }
private bool FeelExhausted() { var needRecover = _userInfo.Lives == 1 ? true : false; InfoHelper.DisplayNeedRecovering(needRecover); return(needRecover); }