コード例 #1
0
ファイル: Steam.cs プロジェクト: creazyboyone/DSTEd-C
 public Steam()
 {
     this.software = new SteamAppsManager();
     this.account  = new Account(this);
     this.workshop = new Workshop();
     path          = software.InstallDir;
 }
コード例 #2
0
 static bool RetrieveMVInstallDir()
 {
     try
     {
         SteamAppsManager sam  = new SteamAppsManager();
         SteamApp         sapp = sam.SteamApps.FindAppByID(Vars.STEAM_MV_APPID, false);
         if (sapp != null)
         {
             PMFileSystem.MV_Installation_Directory = sapp.InstallDir;
         }
         else
         {
             return(GetStandAloneInstallFolder());
         }
         if (string.IsNullOrWhiteSpace(PMFileSystem.MV_Installation_Directory))
         {
             return(GetStandAloneInstallFolder());
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         Logger.CreateIssueLogForLowLevelException(ex, MethodBase.GetCurrentMethod().ToLogFormatFullName());
         return(GetStandAloneInstallFolder());
     }
 }
コード例 #3
0
 void LoadSAMAPI() //Called once only when the form is first loaded.
 {
     try
     {
         SAM = new SteamAppsManager(); //Load our steam app manager. The library should be able to automatically find our steam directory.
     }
     catch (Exception ex)
     {
         NullReferenceException nullRefException = ex as NullReferenceException;  //The library will throw a null reference exception when it cannot find installation directory.
         if (nullRefException != null)
         {
             MessageBox.Show("Steam installation folder was not found or is invalid! Please provide the path to the Steam installation folder.", "Steam App Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
             DialogResult dResult = folderBrowse.ShowDialog(); //Show the dialog which will allow the user to browse the steam installation directory manually.
             if (dResult == DialogResult.Cancel)               //If the user aborts the operation...
             {
                 OnLoadFailed();
                 return;
             }
             TryLoadManual(folderBrowse.SelectedPath); //If the user selects a directory...
         }
         else
         {
             throw ex; //For other errors, throw it back and show it to the user.
         }
     }
 }
コード例 #4
0
        private void frmDemo_Load(object sender, EventArgs e)
        {
            string steamdir = SteamAppsManager.GetSteamDirectory(); //Set the initial directory of the openFileDialog control by calling the GetSteamDirectory static method from the SteamAppsMan class. It'll return empty if Steam Directory doesn't exist.

            if (!string.IsNullOrWhiteSpace(steamdir))
            {
                steamdir += "\\steamapps";
            }
            openFileDialog.InitialDirectory = steamdir;
        }
        public static void DropSteamId()
        {
            var sam         = new SteamAppsManager();
            var processPath = Process.GetCurrentProcess().MainModule.FileName;

            foreach (var app in sam.SteamApps)
            {
                if (processPath.Contains(app.InstallDir))
                {
                    Program.Logger.WriteLine($"[SteamHook] Found Steam Library Entry with Id {app.AppID}, containing executable.", Program.Logger.ColorGreenLight);
                    SteamAppId.Write(app.AppID);
                    return;
                }
            }

            Program.Logger.WriteLine("[SteamHook] Not found Application in any Steam library. Oof.", Program.Logger.ColorRedLight);
        }
コード例 #6
0
        public static string FindNeosDir(SteamAppsManager sam)
        {
            SteamApp NeosApp = null;

            foreach (SteamApp app in sam.SteamApps)
            {
                if (app.AppID == 740250)
                {
                    NeosApp = app;
                }
            }
            if (NeosApp == null)
            {
                throw new Exception("Neos was not found! Is it installed?");
            }
            return(NeosApp.InstallDir);
        }
コード例 #7
0
        void TryLoadManual(string Path)
        {
            bool loadOK = false; //This variable will tell the loop if the steam library was loaded successfully.

            while (!loadOK)      //Loop until we have successfully loaded the library or when the user aborts the operation.
            {
                if (string.IsNullOrWhiteSpace(Path) || !Directory.Exists(Path))
                {
                    Path = OnInvalidPathSelected(); //Call the method which will show the user the browse dialog.
                    continue;                       //Iterate again so that the check path is valid statement will be called again.
                }
                try
                {
                    SAM    = new SteamAppsManager(Path); //Try to load the steam library again but this time with the path that was provided.
                    loadOK = true;                       //If load was successful, there should be no errors thus this piece of code should be reached which will exit the loop.
                }
                catch
                {
                    Path = OnInvalidPathSelected(); //Just try again if the given path is not the steam library installation location.
                    continue;
                }
            }
        }
コード例 #8
0
    private void DropSteamAppId(Logger logger)
    {
        try
        {
            var manager = new SteamAppsManager();
            foreach (var app in manager.SteamApps)
            {
                if (!_applicationFolder.Contains(app.InstallDir))
                {
                    continue;
                }

                logger.SteamWriteLineAsync($"Found Steam Library Entry with Id {app.AppID}. Dropping {SteamAppId.FileName}.", logger.ColorSuccess);
                SteamAppId.WriteToDirectory(_applicationFolder, app.AppID);
                return;
            }

            logger.SteamWriteLineAsync($"Application not found in any Steam library. Recommend dropping a {SteamAppId.FileName} yourself.", logger.ColorError);
        }
        catch (Exception e)
        {
            logger.SteamWriteLineAsync($"Failed to scan through Steam games and locate current game. Error: {e.Message}, {e.StackTrace}", logger.ColorError);
        }
    }
コード例 #9
0
 public ListBoxItem(string name, SteamApp associatedApp, SteamAppsManager steamAppsMan)
 {
     Name          = name;
     AssociatedApp = associatedApp;
     sam           = steamAppsMan;
 }