public AdvancedSteamImportDialog()
        {
            SteamApps = new List <SteamLaunchable>();
            //ListItems = new List<SteamLaunchableListViewitem>();
            context = SteamContext.GetInstance();
            InitializeComponent();
            this.Icon = ((Icon)(new ComponentResourceManager(typeof(Resources)).GetObject("steam")));
            lvGames.SmallImageList = new ImageList();

            SetPlatforms(PluginHelper.DataManager.GetAllPlatforms());
        }
 public bool GetIsValidForGame(IGame selectedGame)
 {
     if (SteamToolsContext.IsSteamGame(selectedGame))
     {
         UInt64?GameIDNumber = SteamToolsContext.GetSteamGameID(selectedGame);
         if (GameIDNumber.HasValue)
         {
             SteamContext context       = SteamContext.GetInstance();
             bool?        l_IsInstalled = SteamToolsContext.IsInstalled(GameIDNumber.Value, selectedGame);
             if (l_IsInstalled.HasValue && !l_IsInstalled.Value)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        private void InstallWithSteamDialog(UInt64 GameIDNumber)
        {
            SteamToolsContext.InstallGame(GameIDNumber);
            try
            {
                Process steam = SteamContext.GetInstance().GetSteamProcess();
                steam.Refresh();
                string InstallWindowTitle = steam.MainWindowTitle;
                IntPtr InstallWindow      = steam.MainWindowHandle;

                // try to get the install window
                int Timeout = 0;
                while (!InstallStrings.Any(name => InstallWindowTitle.StartsWith(name + @" - ")) &&
                       !InstallStringsEnd.Any(name => InstallWindowTitle.EndsWith(@" - " + name)))
                {
                    if (Timeout > 10 * 5)
                    {
                        break;
                    }
                    Thread.Sleep(100);
                    Timeout++;

                    steam.Refresh();
                    InstallWindowTitle = steam.MainWindowTitle;
                    InstallWindow      = steam.MainWindowHandle;
                }

                // if we found the install window
                if (InstallStrings.Any(name => InstallWindowTitle.StartsWith(name + @" - ")) ||
                    InstallStringsEnd.Any(name => InstallWindowTitle.EndsWith(@" - " + name)))
                {
                    while (IsWindow(InstallWindow))
                    {
                        Thread.Sleep(100);
                    }

                    SetForegroundWindow(Process.GetCurrentProcess().MainWindowHandle);
                }
            }
            catch { }
        }
Exemplo n.º 4
0
        internal static void Init()
        {
            SteamToolsOptions.LoadConfig();
            try
            {
                LaunchBoxPremiumLicenceFound = File.Exists(@"License.xml");
            }
            catch { }
            lock (contextLock)
            {
                if (context == null)
                {
                    context = SteamContext.GetInstance();

                    SteamSentinalToken  = new CancellationTokenSource();
                    SteamSentinalThread = new Thread(new ThreadStart(CheckSteam));
                    SteamSentinalThread.Start();

                    SteamUpdateSentinalToken  = new CancellationTokenSource();
                    SteamUpdateSentinalThread = new Thread(new ThreadStart(CheckSteamGames));
                    SteamUpdateSentinalThread.Start();
                }
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            int port = 0;

            if (args.Length > 0)
            {
                int.TryParse(args[0], out port);
            }

            if (port <= 0)
            {
                MessageBox.Show("Please supply a port paramater that is within the valid range.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string namedPipeCustom = string.Empty;
            //if (args.Length > 1)
            //{
            //    namedPipeCustom = args[1].Trim();
            //}

            //if(port == 0)
            {
                MenuItem mExit = new MenuItem("Exit", new EventHandler(Exit));
                MenuItem mPort = new MenuItem($"Port: {port}");
                mPort.Enabled = false;
                ContextMenu Menu = new ContextMenu(new MenuItem[] { mExit, mPort });

                Tray = new NotifyIcon()
                {
                    Icon        = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location),
                    Visible     = true,
                    Text        = "Carbyne Steam Interop Server",
                    ContextMenu = Menu
                };
            }

            SteamContext context = SteamContext.GetInstance();

            context.Init();


            //OnEventRaisedSocketHandler = new WebSocketHandler();
            FunctionHttpHandler = new HttpHandler(context);

            server = new HttpServer(port);

            server.AddHttpRequestHandler(
                "/",
                FunctionHttpHandler
                );

            //server.AddWebSocketRequestHandler(
            //    "/OnEventRaised/",
            //    OnEventRaisedSocketHandler
            //);

            server.Start();

            Application.Run();

            /*while (!poison)
             * {
             *  Thread.Sleep(1000);
             * }*/

            server.Stop();
            if (context != null)
            {
                context.Shutdown();
            }

            if (Tray != null)
            {
                Tray.Dispose();
            }
        }