/// <summary>
        /// Initialize all stuffs required for the connection and settings
        /// </summary>
        private void Initialize()
        {
            Pk2Reader pk2Reader = null;

            try
            {
                // Load pk2 reader
                pk2Reader = new Pk2Reader(LauncherSettings.PATH_PK2_MEDIA, LauncherSettings.CLIENT_BLOWFISH_KEY);

                // Load settings
                m_Config = new ConfigViewModel();
                m_Config.Load(pk2Reader);

                // Extract essential stuffs for the process
                if (pk2Reader.TryGetDivisionInfo(out m_DivisionInfo) &&
                    pk2Reader.TryGetGateport(out m_Gateport) &&
                    pk2Reader.TryGetVersion(out m_Version) &&
                    pk2Reader.TryGetLocale(out m_Locale))
                {
                    IsLoaded = true;
                    // Force string to be updated
                    Version = m_Version;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
            finally
            {
                pk2Reader?.Close();
            }
        }
예제 #2
0
        /// <summary>
        /// Try to loads all required everything to create the connection to server
        /// </summary>
        private void LoadPk2()
        {
            Pk2Reader pk2Reader = null;

            try
            {
                // Load pk2 reader
                pk2Reader = new Pk2Reader(LauncherSettings.PATH_PK2_MEDIA, LauncherSettings.CLIENT_BLOWFISH_KEY);

                // Try to load Type.txt
                m_Config.LoadTypeFile(pk2Reader);

                // Extract essential stuffs for the process
                if (pk2Reader.TryGetDivisionInfo(out m_DivisionInfo) &&
                    pk2Reader.TryGetGateport(out m_Gateport) &&
                    pk2Reader.TryGetVersion(out m_Version) &&
                    pk2Reader.TryGetLocale(out m_Locale))
                {
                    IsLoaded = true;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
            finally
            {
                pk2Reader?.Close();
            }
        }