public static string GetSteamAppPath(TaskLoggingHelper taskLoggingHelper, uint appId)
    {
        try {
            if (!SteamClient.IsValid)
            {
                SteamClient.Init(appId);
            }
        }
        catch (Exception ex) {
            taskLoggingHelper.LogWarning(ex.ToString());
#if DEBUG
            Debugger.Launch();
#endif
        }

        string path = null;
        try {
            path = SteamApps.AppInstallDir(appId);
        }
        catch (Exception ex) {
            taskLoggingHelper.LogError(ex.ToString());
#if DEBUG
            Debugger.Launch();
#endif
        }

        return(path);
    }
        protected override void Initialize()
        {
            base.Initialize();

            Exiting += SteamworksIntegration_Exiting;

            try
            {
                SteamClient.Init(480);

                Functions.IsSteamRunning = true;

                SteamFriends.OnGameOverlayActivated += Functions.SteamFriends_OnGameOverlayActivated;
                SteamUserStats.OnUserStatsReceived  += SteamUserStats_OnUserStatsReceived;
                SteamUserStats.RequestCurrentStats();

                SteamUtils.OverlayNotificationPosition = NotificationPosition.TopRight;
                // Uncomment the next line to adjust the OverlayNotificationPosition.
                //SteamUtils.SetOverlayNotificationInset(400, 0);

                _CurrentLanguage = SteamApps.GameLanguage;
                _UserLevel       = SteamUser.SteamLevel;
                _UserID          = SteamClient.SteamId;
                _InstallDir      = SteamApps.AppInstallDir();

                _Scores      = Functions.FindLeaderboard("Quickest Win", 9).Result;
                _UserAvatar  = Functions.GetUserImage(_UserID, GraphicsDevice).Result;
                _PlayerCount = Functions.GetPlayerCount().Result;

                //The following lines can be helpful to know more about the user of your application
                //
                // Check if the user basically owns this app
                _OwnsApp = SteamApps.IsSubscribed;

                // Check if the user owns this app through Family Sharing
                _OwnsAppThroughFamilySharing = SteamApps.IsSubscribedFromFamilySharing;

                // Check if the user owns this app because of a Free Weekend
                _OwnsAppThroughFreeWeekend = SteamApps.IsSubscribedFromFreeWeekend;

                // The ownder SteamID of this app. It will be different from the users ID who started this application, when he just borrowed
                // this app through Family Sharing
                _OwnerID = SteamApps.AppOwner;

                // More information about the original app owner, which could be a Steam Friend (Family Sharing)
                try
                {
                    _OwnerFriend = SteamFriends.GetFriends().Where(x => x.Id == _OwnerID).First();
                }
                catch { }
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e.ToString());
            }

            Functions.LoadContent(Content);
        }
Esempio n. 3
0
 public async Task AppTest()
 {
     Print($"SteamApps.AppOwner: {SteamApps.AppOwner}");
     Print($"SteamApps.AvailablLanguages: {string.Join( ", ", SteamApps.AvailableLanguages )}");
     Print($"SteamApps.BuildId: {SteamApps.BuildId}");
     Print($"SteamApps.CommandLine: {SteamApps.CommandLine}");
     Print($"SteamApps.CurrentBetaName: {SteamApps.CurrentBetaName}");
     Print($"SteamApps.GameLanguage: {SteamApps.GameLanguage}");
     Print($"SteamApps.IsCybercafe: {SteamApps.IsCybercafe}");
     Print($"SteamApps.IsLowVoilence: {SteamApps.IsLowVoilence}");
     Print($"SteamApps.IsSubscribed: {SteamApps.IsSubscribed}");
     Print($"SteamApps.IsSubscribedFromFamilySharing: {SteamApps.IsSubscribedFromFamilySharing}");
     Print($"SteamApps.IsSubscribedFromFreeWeekend: {SteamApps.IsSubscribedFromFreeWeekend}");
     Print($"SteamApps.IsVACBanned: {SteamApps.IsVACBanned}");
     Print($"SteamApps.PurchaseTime: {SteamApps.PurchaseTime()}");
     Print($"SteamApps.AppInstallDir: {SteamApps.AppInstallDir()}");
     Print($"SteamApps.InstalledDepots: {string.Join( ", ", SteamApps.InstalledDepots() )}");
 }
Esempio n. 4
0
        public static void Main(string[] args)
        {
            if (IsDebugRelease)
            {
                MessageBox.Show("Code messed up somewhere, report this to the devs, PROGRAM RUN IN DEBUG");
            }

            MainWindow.SetupSettings();
            if (!ProcessHelpers.IsVC2019x64Installed() && !Storage.Settings.ShownVCScreen)
            {
                MessageBox.Show(
                    "You do not have Visual C installed! Continue to install it.\nTHIS WILL NOT BE SHOWN AGAIN!\nDO NOT REPORT THE APP NOT RUNNING IF YOU DIDNT INSTALL THIS");
                Process.Start("https://aka.ms/vs/16/release/VC_redist.x64.exe");
                Storage.Settings.ShownVCScreen = true;
                throw new("Need Visual C Installed!");
            }

            var mtr = new List <Mod>();

            foreach (var a in (ModManifest.Instance * typeof(Mod)))
            {
                if (!File.Exists((ModManifest.Instance ^ a.Name).CanonicalLocation))
                {
                    mtr.Add(a);
                }
            }

            foreach (var remove in mtr)
            {
                ModManifest.Instance -= remove;
            }

            try {
                SteamClient.Init(960090);
                Storage.InstallDir = SteamApps.AppInstallDir();
                MelonHandler.EnsureMelonInstalled();
                FileAssociations.EnsureAssociationsSet();
            }
            catch (Exception e) {
                MessageBox.Show("ERROR 0x3ef93 PLEASE REPORT IN THE DISCORD" + Environment.NewLine + "Please include this message in your support ticket: " + e.Message);
                Environment.Exit(1);
            }

            _ = Directory.CreateDirectory(Storage.InstallDir + @"\Mods\Inferno");
            _ = Directory.CreateDirectory(Storage.InstallDir + @"\Mods\Inferno\Disabled");
            _ = Directory.CreateDirectory(Storage.InstallDir + @"\Mods");
            _ = Directory.CreateDirectory(Storage.InstallDir + @"\Mods\Disabled");
            _ = Directory.CreateDirectory(Environment.ExpandEnvironmentVariables("%AppData%\\InfernoOmnia\\"));
            if (args.Length != 0)
            {
                foreach (var file in args)
                {
                    if (!file.Contains(@"\Mods\Inferno"))
                    {
                        if (File.Exists(Storage.InstallDir + @"\Mods\Inferno\" + Path.GetFileName(file)))
                        {
                            File.Delete(Storage.InstallDir + @"\Mods\Inferno\" + Path.GetFileName(file));
                        }
                        File.Move(file, Storage.InstallDir + @"\Mods\Inferno\" + Path.GetFileName(file));
                    }
                }
            }

            if (Directory.GetFiles(Storage.InstallDir + @"\Mods\Inferno")
                .Combine(Directory.GetFiles(Storage.InstallDir + @"\Mods\Inferno\Disabled")).Length > 0)
            {
                var flag = false;
                foreach (var file in Directory.GetFiles(Storage.InstallDir + @"\Mods", "*.dll")
                         .Combine(Directory.GetFiles(Storage.InstallDir + @"\Mods\Inferno\Disabled")))
                {
                    MelonHandler.GetMelonAttrib(file, out var att);
                    if (att != null)
                    {
                        flag |= att.Name.Equals("Inferno API Injector");
                    }
                }

                if (!flag)
                {
                    File.Create(Storage.InstallDir + @"\Mods\Inferno API Injector.dll")
                    .Write(Resources.Inferno_API_Injector, 0, Resources.Inferno_API_Injector.Length);
                }
            }

            var app = new App {
                ShutdownMode = ShutdownMode.OnMainWindowClose
            };

            app.InitializeComponent();
            app.Run();
        }