示例#1
0
        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!");
            }
        }
示例#2
0
        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;
        }
示例#3
0
        //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
            {}
        }
示例#4
0
 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;
     }
 }
示例#5
0
 /// <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
     {
     }
 }
示例#6
0
 public TDInt(GetInt get, SetInt set)
     : base()
 {
     _get = get;
     _set = set;
 }
示例#7
0
 public static void Start()
 {
     var setInt = new SetInt();
 }