Exemplo n.º 1
0
        public void DetectVersionType()
        {
            string appidContents;
            string infContents;
            string version;

            goreType      = GoreType.Unknown;
            status        = StatusType.Error;
            statusMessage = Constants.ErrorUnknownMessage;
            VersionNumber = Constants.ErrorUnknownVersion;

            if (!ValidGamePath(l4d2Path))
            {
                status        = StatusType.Error;
                statusMessage = Constants.ErrorBadPathMessage;
            }
            else
            {
                appidContents = ReadFile(string.Format("{0}\\{1}", l4d2Path, Constants.steamAppFile));
                infContents   = ReadFile(string.Format("{0}\\{1}", l4d2Path, Constants.steamInfFile));

                version = infContents.GetL4D2Version();
                if (version != string.Empty)
                {
                    VersionNumber = version;

                    /// Check to see if it is a normal version.
                    if (appidContents.AppIdContains(Constants.normalAppId) && infContents.InfContains(Constants.normalAppId))
                    {
                        goreType = GoreType.Normal;
                        status   = StatusType.None;
                    }


                    /// Check to see if gore has been turned on version.
                    if (appidContents.AppIdContains(Constants.dedicatedAppId) && infContents.InfContains(Constants.dedicatedAppId))
                    {
                        goreType = GoreType.Gore;
                        status   = StatusType.None;
                    }

                    /// Check to see if there is a missmatch.
                    if ((appidContents.AppIdContains(Constants.dedicatedAppId) && infContents.InfContains(Constants.normalAppId)) ||
                        (appidContents.AppIdContains(Constants.normalAppId) && infContents.InfContains(Constants.dedicatedAppId)))
                    {
                        status        = StatusType.Warning;
                        statusMessage = Constants.WarningConflictMessage;
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Needs cleaning up
        /// </summary>
        /// <param name="type"></param>
        public void SwitchVersion(GoreType type)
        {
            int    desiredAppId;
            string infContent;

            desiredAppId = type == GoreType.Gore ? Constants.dedicatedAppId : Constants.normalAppId;

            if (ValidGamePath(l4d2Path))
            {
                // Write the app id to the steam app file.
                WriteFile(string.Format("{0}\\{1}", l4d2Path, Constants.steamAppFile), desiredAppId.ToString());

                // Read in inf contents and pull out the appId line.
                infContent = ReadFile(string.Format("{0}\\{1}", l4d2Path, Constants.steamInfFile));
                infContent = infContent.UpdateInfAppId(desiredAppId);
                WriteFile(string.Format("{0}\\{1}", l4d2Path, Constants.steamInfFile), infContent);
            }
        }
Exemplo n.º 3
0
 private void SwitchVersion(GoreType type)
 {
     engine.SwitchVersion(type);
     UpdateVersionStatus();
 }