/// <summary>
        /// Try to load the Type file from the Pk2
        /// </summary>
        /// <param name="Pk2Reader">Pk2 used to search</param>
        /// <returns>Return success</returns>
        private bool LoadTypeFile(Pk2Reader Pk2Reader)
        {
            var temp = Pk2Reader.GetFileText("Type.txt");

            // Check if file has been found
            if (temp != null)
            {
                // Analyze the file and extract language
                var match = Regex.Match(temp, "Language[ ]{0,1}=[ ]{0,1}[\"]{0,1}([a-zA-Z]*)[\"]{0,1}");
                if (match.Success)
                {
                    // Try to find the index selected
                    for (int i = 0; i < LauncherSettings.CLIENT_LANGUAGE_SUPPORTED.Length; i++)
                    {
                        if (LauncherSettings.CLIENT_LANGUAGE_SUPPORTED[i] == match.Groups[1].Value)
                        {
                            m_TypeFile             = temp;
                            SupportedLanguageIndex = i;
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
示例#2
0
        /// <summary>
        /// Try to load the Type file from the Pk2
        /// </summary>
        /// <param name="Pk2Reader">Pk2 used to search</param>
        /// <returns>Return success</returns>
        public bool LoadTypeFile(Pk2Reader Pk2Reader)
        {
            var temp = Pk2Reader.GetFileText("Type.txt");

            // Check if file has been found
            if (temp != null)
            {
                // Analyze the file and extract language
                var match = Regex.Match(temp, "Language[ ]{0,1}=[ ]{0,1}[\"]{0,1}([a-zA-Z]*)[\"]{0,1}");
                if (match.Success)
                {
                    m_TypeFile = temp;
                    m_Language = match.Groups[1].Value;
                    return(true);
                }
            }
            return(false);
        }
示例#3
0
        /// <summary>
        /// Try to get the port available to connect to the server
        /// </summary>
        /// <returns>Return success</returns>
        public static bool TryGetGateport(this Pk2Reader Pk2Reader, out ushort Gateport)
        {
            try
            {
                // Localize the file and prepare to read it
                string data = Pk2Reader.GetFileText("Gateport.txt");

                // The file contains the port only
                Gateport = ushort.Parse(data.Trim());

                // Success
                return(true);
            }
            catch
            {
                Gateport = ushort.MinValue;
                return(false);
            }
        }