public ManualTransmission() { IniFile ini = new IniFile(path); animdict = ini.Read("animdict", "MTSupport"); anim = ini.Read("anim", "MTSupport"); Tick += OnTick; mtlib = Dll.GetModuleHandle(@"Gears.asi"); if (mtlib == IntPtr.Zero) { Logger.Write(logpath, "Process not found!"); } else { Logger.Write(logpath, "Process present!"); } IsActive = CheckAddr <FnBool>(mtlib, "MT_IsActive"); AddIgnoreVehicle = CheckAddr <SetInt>(mtlib, "MT_AddIgnoreVehicle"); NeutralGear = CheckAddr <FnBool>(mtlib, "MT_NeutralGear"); ShiftMode = CheckAddr <GetInt>(mtlib, "MT_GetShiftMode"); if (IsActive == null || AddIgnoreVehicle == null || NeutralGear == null) { mtPresent = false; Logger.Write(logpath, "MTSupport disabled!"); } else { mtPresent = true; Logger.Write(logpath, "MTSupport initialized!"); } }
public TDInt(object obj, PropertyInfo info) : base() { MemberInfo get = info.GetGetMethod(); _get = Delegate.CreateDelegate(typeof(TDInt.GetInt), obj, info.GetGetMethod()) as TDInt.GetInt; _set = Delegate.CreateDelegate(typeof(TDInt.SetInt), obj, info.GetSetMethod()) as TDInt.SetInt; }
//Note the degree of internal coupling void ReportProgress(int value) { ISynchronizeInvoke synchronizer = m_ProgressBar; if (synchronizer.InvokeRequired == false) { SetProgress(value); return; } SetInt del = new SetInt(SetProgress); try { synchronizer.Invoke(del, new object[] { value }); } catch {} }
public void SetValue(int progress) { if (InvokeRequired) { SetInt setInt = delegate(int value) { base.Value = value; }; try { Invoke(setInt, new object[] { progress }); } catch {} } else { base.Value = progress; } }
/// <summary> /// Progresbar Table /// </summary> /// <param name="val"></param> void ReportProgressTable(int val) { ISynchronizeInvoke synchronizer = progressBar2; if (synchronizer.InvokeRequired == false) { SetProgressTable(val); return; } SetInt delProg = new SetInt(SetProgressTable); try { synchronizer.Invoke(delProg, new object[] { val }); } catch { } }
public TDInt(GetInt get, SetInt set) : base() { _get = get; _set = set; }
public static void Start() { var setInt = new SetInt(); }