Exemplo n.º 1
0
        public static bool loadShortcuts(NexHudEngineMode _mode, bool _useClassic)
        {
            string _path = Environment.CurrentDirectory + autoPath;

            if (_mode == NexHudEngineMode.WindowDebug)
            {
                _path = Environment.CurrentDirectory + debugPath;
            }
            else if (_mode == NexHudEngineMode.WindowOverlay && _useClassic)
            {
                _path = Environment.CurrentDirectory + classicPath;
            }


            if (File.Exists(_path))
            {
                try
                {
                    ShortcutEntry[] _array;
                    string          _json = File.ReadAllText(_path);
                    _array = JsonConvert.DeserializeObject <ShortcutEntry[]>(_json);
                    for (int i = 0; i < _array.Length; i++)
                    {
                        if (!_array[i].compile())
                        {
                            throw new Exception(string.Format("ERROR: shortcut {0} is invalid", _array[i].id));
                        }
                        else
                        {
                            if (m_entrys.ContainsKey(_array[i].id))
                            {
                                m_entrys[_array[i].id] = _array[i];
                            }
                            else
                            {
                                m_entrys.Add(_array[i].id, _array[i]);
                            }
                        }
                    }

                    return(true);
                }
                catch (Exception ex)
                {
                    NexHudEngine.Log("ERROR while reading Shortcuts.json");
                    NexHudEngine.Log(ex.Message);
                    //Console.WriteLine("Type any key to exist...");
                    // Console.ReadKey();
                    return(false);
                }
            }
            else
            {
                NexHudEngine.Log("ERROR: {0} is missing !", _path);
                Console.WriteLine("Type any key to exist...");
                Console.ReadKey();
                return(false);
            }
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            m_mutex = new Mutex(true, AppName, out bool createdNew);

            if (!createdNew)
            {
                Console.WriteLine(AppName + " is already running! Exiting the application.");
                Console.ReadKey();
                return;
            }

            InitLogs();
            NexHudSettings.load();

            NexHudEngine.Log("NexHud Version: " + Version);

            NexHudEngineMode _requestedMode = NexHudSettings.GetInstance().nexHudMode;

            foreach (string a in args)
            {
                if (a == ArgAuto)
                {
                    _requestedMode = NexHudEngineMode.Auto;
                }
                else if (a == ArgDebug)
                {
                    _requestedMode = NexHudEngineMode.WindowDebug;
                }
                else if (a == ArgVr)
                {
                    _requestedMode = NexHudEngineMode.Vr;
                }
                else if (a == ArgClassic)
                {
                    _requestedMode = NexHudEngineMode.WindowOverlay;
                }
            }
            NexHudEngine.Log("Engine mode Requested: " + _requestedMode);
            //performTests();
            InitEliteApi();

            InitEngine(_requestedMode);
            NexHudEngine.Log("Engine mode: " + _requestedMode);

            LoadConfigs();


            if (NexHudEngine.engineMode == NexHudEngineMode.Vr)
            {
                InitVrConsole();
            }

            new NxMenu();

            try
            {
                NexHudEngine.Run(); // Runs update/draw calls for all active overlays. And yes, it's blocking.
            }
            catch (Exception ex)
            {
                NexHudEngine.Log(NxLog.Type.Fatal, ex.Message);
                NexHudEngine.Log(NxLog.Type.Fatal, ex.Source);
                NexHudEngine.Log(NxLog.Type.Fatal, ex.StackTrace);
            }
        }
Exemplo n.º 3
0
 private static void InitEngine(NexHudEngineMode _mode)
 {
     NexHudEngine.Log("Engine Initilization...");
     NexHudEngine.Init(_mode);
     NexHudEngine.FPS = 30;
 }