Exemplo n.º 1
0
        private static void setUserSettings(SQLiteManager mngrs)
        {
            DataTable userData = mngrs.getListItems("USER_DATA");

            CURRENT_ENB_OPTION    = userData.Rows[0][0].ToString();
            CURRENT_SHADER_OPTION = userData.Rows[0][1].ToString();
        }
Exemplo n.º 2
0
        public static DataTable getENBPresets()
        {
            SQLiteManager mngr = new SQLiteManager();
            DataTable     enb  = mngr.getListItems("ENB");

            mngr.ConnectionClose();
            return(enb);
        }
Exemplo n.º 3
0
        private static void setUserGlobals(SQLiteManager mngrs)
        {
            DataTable globals = mngrs.getListItems("GLOBALS");

            GAME_TITLE        = globals.Rows[0][0].ToString();
            USER_GAME_VERSION = float.Parse(globals.Rows[0][2].ToString(), CultureInfo.InvariantCulture.NumberFormat);
            USER_BD_VERSION   = Convert.ToInt32(globals.Rows[0][3]);
            REGISTRY_HIVE     = globals.Rows[0][1].ToString();
            LOAD_ORDER_FILE   = globals.Rows[0][2].ToString();
            PLUGINS_TXT_PATH  = getpath("plugins_txt");
        }
Exemplo n.º 4
0
        private static void setPathsAndFilesForCheck(SQLiteManager mngrs)
        {
            PATHS          = new Dictionary <string, string>();
            FILES_TO_CHECK = new List <string>();
            DataTable data = new DataTable();

            data = mngrs.getListItems("FILES");
            foreach (DataRow dtRow in data.Rows)
            {
                bool   fileNeedForCheck = false;
                string path             = "";

                if (Convert.ToBoolean(dtRow[3].ToString()))
                {
                    fileNeedForCheck = true;
                }

                if ((dtRow[1].ToString().Equals("gameroot")))
                {
                    path = GAME_ROOT + dtRow[2];
                }
                else
                {
                    if ((dtRow[1].ToString().Equals("userdocs")))
                    {
                        path = USER_DOCS + dtRow[2];
                    }
                    else
                    {
                        if ((dtRow[1].ToString().Equals("appdata")))
                        {
                            path = APPDATA_LOCAL_DIR + dtRow[2];
                        }
                        else
                        {
                            if ((dtRow[1].ToString().Equals("link")))
                            {
                                path = dtRow[2].ToString();
                            }
                            else
                            {
                            }
                        }
                    }
                }
                PATHS.Add(dtRow[0].ToString(), path);

                if (fileNeedForCheck)
                {
                    FILES_TO_CHECK.Add(path);
                }
            }
        }
Exemplo n.º 5
0
        private static void setUserInstalledUpdates(SQLiteManager mngrs)
        {
            DataTable updateslist = mngrs.getListItems("WINDOW_UPDATES");

            USER_UPDATES_INSTALLED = new List <int>();
            foreach (DataRow dr in updateslist.Rows)
            {
                if (Convert.ToBoolean(dr[5]))
                {
                    USER_UPDATES_INSTALLED.Add(Convert.ToInt32(dr[0]));
                }
            }
        }
Exemplo n.º 6
0
        public static void initUserBDGame()
        {
            // CTRL_PANEL_DIR = @"J:\Games\TES 5 Skyrim - ESSE 0.6\Control Panel\";
            //  CTRL_PANEL_DIR = @"D:\TES_DEV\!!!!!!!!!!!!!!!!!!MASS\Control Panel\"; // bumagi
            //  CTRL_PANEL_DIR = @"D:\OblivionPR\Control Panel\"; //корневая директория панели управления - временно
            //   CTRL_PANEL_DIR = AppDomain.CurrentDomain.BaseDirectory;
            CTRL_PANEL_DIR = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\";



            RES_DIR          = CTRL_PANEL_DIR + @"Resources\"; //корневая директория ресурсов панели
            ENB_DIR          = CTRL_PANEL_DIR + @"ENB\";       //корневая директория ENB-пресетов
            SHADER_DIR       = CTRL_PANEL_DIR + @"SHADER\";    //корневая директория вариантов шейдеров
            GAME_ROOT        = Path.GetFullPath(Path.Combine(CTRL_PANEL_DIR, @"..\"));
            DATA_DIR         = GAME_ROOT + @"Data\";
            ESP_SETTINGS_DIR = RES_DIR + @"esp settings\"; //корневая директория esp файлов для настроеек

            USER_DOCS         = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\";
            APPDATA_LOCAL_DIR = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\";
            INIT.CURRENT_SHIFTED_PLUGIN_IN_LO = "";
            LOG_FILE = CTRL_PANEL_DIR + "cp_log.txt";

            GAME_TYPE.init();

            SQLiteManager userBDSQLManager = new SQLiteManager();

            setPathsAndFilesForCheck(userBDSQLManager);
            setUserGlobals(userBDSQLManager);
            setUserSettings(userBDSQLManager);
            setUserInstalledUpdates(userBDSQLManager);
            int stylesAmount = userBDSQLManager.getListItems("STYLES").Rows.Count;

            userBDSQLManager.ConnectionClose();

            Random rnd = new Random();

            try
            {
                STYLE.init(rnd.Next(1, stylesAmount + 1));
                DEFAULT_VISUAL_STYLE = false;
            }
            catch
            {
                DEFAULT_VISUAL_STYLE = true;
                Logger.addLine(false, "Не удалось загрузить стили оформления. Будет использован стиль по умолчанию");
            }
        }
Exemplo n.º 7
0
        public static void getnewBD()
        {
            if (File.Exists(TEMP_DB_SQLITE_FILE))
            {
                FileManager.remove(TEMP_DB_SQLITE_FILE);
            }


            try
            {
                new WebClient().DownloadFile(GAME_TYPE.UPDATE_DB_DOWNLOAD_LINK, TEMP_DB_SQLITE_FILE);
            }
            catch
            {
                throw new NoInternetConnectionException();
            }
            if (File.Exists(TEMP_DB_SQLITE_FILE))
            {
                SQLiteManager newBD = new SQLiteManager(TEMP_DB_CONNECTION_STRING);
                DataTable     dt    = newBD.getListItems("GLOBALS");
                ACTUAL_DB_VERSION   = Convert.ToInt32(dt.Rows[0][3].ToString());
                ACTUAL_GAME_VERSION = float.Parse(dt.Rows[0][2].ToString(), CultureInfo.InvariantCulture.NumberFormat);
                newBD.ConnectionClose();
                if (INIT.USER_GAME_VERSION != ACTUAL_GAME_VERSION)
                {
                    throw new gameBuildInvalidVersionForUpdateException(ACTUAL_GAME_VERSION, INIT.USER_GAME_VERSION);
                }
                else
                {
                    if (INIT.USER_BD_VERSION < ACTUAL_DB_VERSION)
                    {
                        switchDBForUpdate();
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else
            {
                return;
            }
        }
Exemplo n.º 8
0
        public static void ResetSettings()
        {
            try
            {
                MessageBox.Show("настройки будут сброшены");
                Logger.addLine(true, "Начат сброс настроек" + " : " + DateTime.Now.ToString());
                registryFix(INIT.REGISTRY_HIVE, INIT.GAME_ROOT);


                string table = "RESET";

                List <Tuple <string, string> > sourceToTargetList = new List <Tuple <string, string> >();

                List <string> removeTargets = new List <string>();
                List <string> dirsToCreate  = new List <string>();

                SQLiteManager mngr = new SQLiteManager();
                DataTable     data = mngr.getListItems(table);
                foreach (DataRow dtRow in data.Rows)
                {
                    if ((dtRow[0].ToString().Equals("copy")))
                    {
                        string source = INIT.getpath(dtRow[1].ToString());
                        string target = INIT.getpath(dtRow[2].ToString());
                        sourceToTargetList.Add(new Tuple <string, string>(source, target));
                    }
                    else
                    {
                        if ((dtRow[0].ToString().Equals("remove")))
                        {
                            string fileToRemove = INIT.getpath(dtRow[1].ToString());
                            removeTargets.Add(fileToRemove);
                        }
                        else
                        {
                            if ((dtRow[0].ToString().Equals("create_dir")))
                            {
                                string dirToCreate = INIT.getpath(dtRow[1].ToString());
                                dirsToCreate.Add(dirToCreate);
                            }
                        }
                    }
                }
                mngr.ConnectionClose();



                FileManager.remove(removeTargets.ToArray());


                foreach (string dirs in dirsToCreate)
                {
                    FileManager.createDirectory(dirs);
                }

                foreach (Tuple <string, string> pair in sourceToTargetList)
                {
                    FileManager.copyFiles(pair.Item1, pair.Item2);
                }
                MessageBox.Show("Сброс настроек произведен");
                Logger.addLine(true, "Сброс настроек произведен" + " : " + DateTime.Now.ToString());
            }
            catch (Exception)
            {
                Logger.addLine(false, "Сброс настроек произвеcти не удалось!" + " : " + DateTime.Now.ToString());
                Logger.addLine(true, "Завершение приложения: " + DateTime.Now.ToString());
                Environment.Exit(1);
            }
        }