Пример #1
0
        /// <summary>
        /// Calculates the engine version and type based on the network protocol and build numbers. CalculateGameVersion sould be called before this becaues of issues with HLTV demos and beta Steam demos.
        /// </summary>
        private void CalculateEngineVersionAndType()
        {
            engineVersion = EngineVersions.Unknown;
            engineType    = Engines.HalfLife;

            if (networkProtocol == 43)
            {
                if (buildNumber >= 1712)
                {
                    engineVersion = EngineVersions.HalfLife1107;
                }
                else if (buildNumber >= 1600)
                {
                    engineVersion = EngineVersions.HalfLife1106;
                }
                else if (buildNumber >= 1460)
                {
                    engineVersion = EngineVersions.HalfLife1104;
                }
            }
            else if (networkProtocol == 45)
            {
                if (Perspective == Perspectives.Hltv)
                {
                    engineVersion = EngineVersions.HalfLife1108or1109;
                }
                else if (buildNumber >= 2006)
                {
                    engineVersion = EngineVersions.HalfLife1109;
                }
                else
                {
                    engineVersion = EngineVersions.HalfLife1108;
                }
            }
            else if (networkProtocol == 46)
            {
                if (IsBetaSteam())
                {
                    engineVersion = EngineVersions.HalfLife1111;
                    engineType    = Engines.HalfLifeSteam;
                }
                else if (Perspective == Perspectives.Hltv)
                {
                    engineVersion = EngineVersions.HalfLife1110or1111;
                }
                else
                {
                    engineVersion = EngineVersions.HalfLife1110;
                }
            }
            else if (networkProtocol >= 47)
            {
                engineVersion = EngineVersions.HalfLife1111;
                engineType    = Engines.HalfLifeSteam;
            }
        }
Пример #2
0
        /// <summary>
        /// Calculates the engine version and type based on the network protocol and build numbers. CalculateGameVersion sould be called before this becaues of issues with HLTV demos and beta Steam demos.
        /// </summary>
        private void CalculateEngineVersionAndType()
        {
            engineVersion = EngineVersions.Unknown;
            engineType = Engines.HalfLife;

            if (networkProtocol == 43)
            {
                if (buildNumber >= 1712)
                {
                    engineVersion = EngineVersions.HalfLife1107;
                }
                else if (buildNumber >= 1600)
                {
                    engineVersion = EngineVersions.HalfLife1106;
                }
                else if (buildNumber >= 1460)
                {
                    engineVersion = EngineVersions.HalfLife1104;
                }
            }
            else if (networkProtocol == 45)
            {
                if (Perspective == Perspectives.Hltv)
                {
                    engineVersion = EngineVersions.HalfLife1108or1109;
                }
                else if (buildNumber >= 2006)
                {
                    engineVersion = EngineVersions.HalfLife1109;
                }
                else
                {
                    engineVersion = EngineVersions.HalfLife1108;
                }
            }
            else if (networkProtocol == 46)
            {
                if (IsBetaSteam())
                {
                    engineVersion = EngineVersions.HalfLife1111;
                    engineType = Engines.HalfLifeSteam;
                }
                else if (Perspective == Perspectives.Hltv)
                {
                    engineVersion = EngineVersions.HalfLife1110or1111;
                }
                else
                {
                    engineVersion = EngineVersions.HalfLife1110;
                }
            }
            else if (networkProtocol >= 47)
            {
                engineVersion = EngineVersions.HalfLife1111;
                engineType = Engines.HalfLifeSteam;
            }
        }
Пример #3
0
        /// <summary>
        /// @UE3 Parse each individual row of meta data
        /// </summary>
        /// <param name="match"></param>
        /// <returns></returns>
        private string ParseMetadataRow(Match match, TransformationData data, bool full = true)
        {
            var metaValue        = match.Groups["MetadataValue"].Value;
            var metaDataCategory = match.Groups["MetadataKey"].Value;

            if (metaDataCategory.Contains(' '))
            {
                data.ErrorList.Add(
                    Markdown.GenerateError(
                        Language.Message("MetadataNamesMustNotContainSpaces", metaDataCategory),
                        MessageClass.Warning,
                        metaDataCategory,
                        data.ErrorList.Count,
                        data));
            }

            var metaDataCategoryLowerCase = metaDataCategory.ToLower();

            // If value is blank change to paragraph for table creation classification form
            if (!String.IsNullOrWhiteSpace(match.Groups["MetadataValue"].Value))
            {
                if (metaDataCategoryLowerCase == "title")
                {
                    DocumentTitle = metaValue;
                }

                if (metaDataCategoryLowerCase == "seo-title")
                {
                    SEOTitle = metaValue;
                }

                if (metaDataCategoryLowerCase == "crumbs")
                {
                    CrumbsLinks.Add(metaValue);
                }

                if (metaDataCategoryLowerCase == "related" && full)
                {
                    RelatedLinks.Add(data.Markdown.ProcessRelated(metaValue, data));
                }

                if (metaDataCategoryLowerCase == "prereq" && full)
                {
                    PrereqLinks.Add(data.Markdown.ProcessPrereqs(metaValue, data));
                }

                if (metaDataCategoryLowerCase == "version")
                {
                    EngineVersions.Add(Hash.FromAnonymousObject(new { version = metaValue, label = metaValue.Replace('.', '_') }));
                }

                if (metaDataCategoryLowerCase == "skilllevel")
                {
                    SkillLevels.Add(metaValue);
                }

                if (metaDataCategoryLowerCase == "tags")
                {
                    Tags.Add(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaValue));
                }
            }

            // Add meta data to the list, we require some specific meta data keys to be unique others can be duplicates
            if (metaDataCategoryLowerCase.Equals("title") || metaDataCategoryLowerCase.Equals("seo-title") ||
                metaDataCategoryLowerCase.Equals("description") || metaDataCategoryLowerCase.Equals("seo-description") ||
                metaDataCategoryLowerCase.Equals("template") || metaDataCategoryLowerCase.Equals("forcepublishfiles"))
            {
                if (MetadataMap.ContainsKey(metaDataCategoryLowerCase))
                {
                    data.ErrorList.Add(
                        new ErrorDetail(
                            Language.Message("DuplicateMetadataDetected", metaDataCategory),
                            MessageClass.Info,
                            "",
                            "",
                            0,
                            0));
                }
                else
                {
                    var valueList = new List <string>();
                    valueList.Add(match.Groups["MetadataValue"].Value);
                    MetadataMap.Add(metaDataCategoryLowerCase, valueList);
                }
            }
            else
            {
                if (MetadataMap.ContainsKey(metaDataCategoryLowerCase))
                {
                    MetadataMap[metaDataCategoryLowerCase].Add(match.Groups["MetadataValue"].Value);
                }
                else
                {
                    var valueList = new List <string>();
                    valueList.Add(match.Groups["MetadataValue"].Value);
                    MetadataMap.Add(metaDataCategoryLowerCase, valueList);
                }
            }

            // Return empty string, we are removing the meta data from the document
            return("");
        }