Exemplo n.º 1
0
        // ReSharper restore PrivateFieldCanBeConvertedToLocalVariable

        public GamePicker(API.Client client)
        {
            this._Games             = new Dictionary <uint, GameInfo>();
            this._FilteredGames     = new List <GameInfo>();
            this._SelectedGameIndex = -1;
            this._LogosAttempted    = new List <string>();
            this._LogoQueue         = new ConcurrentQueue <GameInfo>();

            var logoPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                        "SAM.Picker.Cache.zip");

            this._CacheArchive = ZipFile.Open(logoPath, ZipArchiveMode.Update);

            this.InitializeComponent();

            var blank = new Bitmap(this._LogoImageList.ImageSize.Width, this._LogoImageList.ImageSize.Height);

            using (var g = Graphics.FromImage(blank))
            {
                g.Clear(Color.DimGray);
            }

            this._LogoImageList.Images.Add("Blank", blank);

            this._SteamClient = client;

            this._AppDataChangedCallback        = client.CreateAndRegisterCallback <API.Callbacks.AppDataChanged>();
            this._AppDataChangedCallback.OnRun += this.OnAppDataChanged;

            this.AddGames();
        }
        // ReSharper restore PrivateFieldCanBeConvertedToLocalVariable

        public GamePicker(API.Client client)
        {
            this._Games          = new Dictionary <uint, GameInfo>();
            this._FilteredGames  = new List <GameInfo>();
            this._LogosAttempted = new List <string>();
            this._LogoQueue      = new ConcurrentQueue <GameInfo>();

            this.InitializeComponent();

            var blank = new Bitmap(this._LogoImageList.ImageSize.Width, this._LogoImageList.ImageSize.Height);

            using (var g = Graphics.FromImage(blank))
            {
                g.Clear(Color.DimGray);
            }

            this._LogoImageList.Images.Add("Blank", blank);

            this._SteamClient = client;

            this._AppDataChangedCallback        = client.CreateAndRegisterCallback <API.Callbacks.AppDataChanged>();
            this._AppDataChangedCallback.OnRun += this.OnAppDataChanged;

            this.AddGames();
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            long appId;

            if (args.Length == 0)
            {
                Process.Start("SAM.Picker.exe");
                return;
            }

            if (long.TryParse(args[0], out appId) == false)
            {
                MessageBox.Show(
                    "Could not parse application ID from commandline argument.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            if (API.Steam.GetInstallPath() == Application.StartupPath)
            {
                MessageBox.Show(
                    "This tool declines to being run from the Steam directory.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            API.Client client;
            try
            {
                client = new API.Client();

                if (client.Initialize(appId) == false)
                {
                    MessageBox.Show(
                        "Steam is not running. Please start Steam then run this tool again.",
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }
            }
            catch (DllNotFoundException)
            {
                MessageBox.Show(
                    "You've caused an exceptional error!",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Manager(appId, client));
        }
Exemplo n.º 4
0
 public static void Main(string[] args)
 {
     Console.WriteLine("Ready");
     API.Client api = API.Client.Instance;
     api.Auth.Credentials = new API.Models.Credentials("ashmicr1", "M7mw34E5sb");
     api.Server.Host      = "http://nypub.microweber.com";
     Console.WriteLine(api.Call("is_logged"));
     Console.ReadKey();
 }
Exemplo n.º 5
0
        private static void Main()
        {
            if (API.Steam.GetInstallPath() == Application.StartupPath)
            {
                MessageBox.Show(
                    ResourcesUI.DLG_STEAM_DIR_ERROR,
                    "Steam Achievement Manager",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            using (var client = new API.Client())
            {
                try
                {
                    client.Initialize(0);
                }
                catch (API.ClientInitializeException e)
                {
                    if (string.IsNullOrEmpty(e.Message) == false)
                    {
                        MessageBox.Show(
                            ResourcesUI.DLG_STEAM_NOT_RUN_ERROR + "\n\n" +
                            "(" + e.Message + ")",
                            "Steam Achievement Manager",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(
                            ResourcesUI.DLG_STEAM_NOT_RUN_ERROR,
                            "Steam Achievement Manager",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    return;
                }
                catch (DllNotFoundException)
                {
                    MessageBox.Show(
                        ResourcesUI.DLG_EXCEPT_ERROR,
                        "Steam Achievement Manager",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new GamePicker(client));
            }
        }
Exemplo n.º 6
0
        private static void Main()
        {
            if (API.Steam.GetInstallPath() == Application.StartupPath)
            {
                MessageBox.Show(
                    "This tool cannot be run from inside the Steam directory.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            using (var client = new API.Client())
            {
                try
                {
                    client.Initialize(0);
                }
                catch (API.ClientInitializeException e)
                {
                    if (string.IsNullOrEmpty(e.Message) == false)
                    {
                        MessageBox.Show(
                            "Steam is not running. Please start Steam then run this tool again.\n\n" +
                            "(" + e.Message + ")",
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(
                            "Steam is not running. Please start Steam then run this tool again.",
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    return;
                }
                catch (DllNotFoundException)
                {
                    MessageBox.Show(
                        "You've caused an exceptional error!",
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new GamePicker(client));
            }
        }
Exemplo n.º 7
0
        public Client(string ip, int port, string publicKey, string privateKey, string targetKey)
        {
            transport = new TSocket(ip, port);
            protocol  = new TBinaryProtocol(transport);
            api       = new API.Client(protocol);
            transport.Open();

            keys            = new Keys();
            keys.PublicKey  = publicKey;
            keys.PrivateKey = privateKey;
            keys.TargetKey  = targetKey;
        }
Exemplo n.º 8
0
        // ReSharper restore PrivateFieldCanBeConvertedToLocalVariable

        //private API.Callback<APITypes.UserStatsStored> UserStatsStoredCallback;

        public Manager(long gameId, API.Client client)
        {
            this.InitializeComponent();

            this._MainTabControl.SelectedTab = this._AchievementsTabPage;
            //this.statisticsList.Enabled = this.checkBox1.Checked;

            this._AchievementImageList.Images.Add("Blank", new Bitmap(64, 64));

            this._StatisticsDataGridView.AutoGenerateColumns = false;

            this._StatisticsDataGridView.Columns.Add("name", "Name");
            this._StatisticsDataGridView.Columns[0].ReadOnly         = true;
            this._StatisticsDataGridView.Columns[0].Width            = 200;
            this._StatisticsDataGridView.Columns[0].DataPropertyName = "DisplayName";

            this._StatisticsDataGridView.Columns.Add("value", "Value");
            this._StatisticsDataGridView.Columns[1].ReadOnly         = this._EnableStatsEditingCheckBox.Checked == false;
            this._StatisticsDataGridView.Columns[1].Width            = 90;
            this._StatisticsDataGridView.Columns[1].DataPropertyName = "Value";

            this._StatisticsDataGridView.Columns.Add("extra", "Extra");
            this._StatisticsDataGridView.Columns[2].ReadOnly         = true;
            this._StatisticsDataGridView.Columns[2].Width            = 200;
            this._StatisticsDataGridView.Columns[2].DataPropertyName = "Extra";

            this._StatisticsDataGridView.DataSource = new BindingSource
            {
                DataSource = this._Statistics,
            };

            this._GameId      = gameId;
            this._SteamClient = client;

            this._IconDownloader.DownloadDataCompleted += this.OnIconDownload;

            string name = this._SteamClient.SteamApps001.GetAppData((uint)this._GameId, "name");

            if (name != null)
            {
                base.Text += " | " + name;
            }
            else
            {
                base.Text += " | " + this._GameId.ToString(CultureInfo.InvariantCulture);
            }

            this._UserStatsReceivedCallback        = client.CreateAndRegisterCallback <API.Callbacks.UserStatsReceived>();
            this._UserStatsReceivedCallback.OnRun += this.OnUserStatsReceived;

            //this.UserStatsStoredCallback = new API.Callback(1102, new API.Callback.CallbackFunction(this.OnUserStatsStored));
            this.RefreshStats();
        }
Exemplo n.º 9
0
        public Client(API.Client client)
        {
            this.client = client;

            PingTimer          = new System.Timers.Timer();
            PingTimer.Elapsed += OnPingEvent;

            PongTimer           = new System.Timers.Timer();
            PongTimer.Elapsed  += OnPongTimeoutEvent;
            PongTimer.AutoReset = false;
            PongTimer.Interval  = 10000;

            SetRandomPingInterval();
        }
Exemplo n.º 10
0
        private static void Main()
        {
            if (API.Steam.GetInstallPath() == Application.StartupPath)
            {
                MessageBox.Show(
                    "This tool declines to being run from the Steam directory.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            API.Client client;
            try
            {
                client = new API.Client();
                if (client.Initialize(0) == false)
                {
                    MessageBox.Show(
                        "Steam is not running. Please start Steam then run this tool again.",
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }
            }
            catch (DllNotFoundException)
            {
                MessageBox.Show(
                    "You've caused an exceptional error!",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            /* Disable server certificate validation.
             * This is for media downloads (application logos).
             * https://media.steamcommunity.com/ has certs issued to (various).e.akamai.net.
             */
            ServicePointManager.ServerCertificateValidationCallback = (s, ce, ch, e) => true;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new GamePicker(client));
        }
        // ReSharper restore PrivateFieldCanBeConvertedToLocalVariable

        public GamePicker(API.Client client)
        {
            this.InitializeComponent();

            this._GameLogoImageList.Images.Add(
                "Blank",
                new Bitmap(this._GameLogoImageList.ImageSize.Width, this._GameLogoImageList.ImageSize.Height));

            this._GameListDownloader.DownloadDataCompleted += this.OnGameListDownload;
            this._LogoDownloader.DownloadDataCompleted     += this.OnLogoDownload;

            this._SteamClient = client;

            this._AppDataChangedCallback        = client.CreateAndRegisterCallback <API.Callbacks.AppDataChanged>();
            this._AppDataChangedCallback.OnRun += this.OnAppDataChanged;

            this.AddGames();
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            Console.WriteLine("Credits API Simple Demo");

            if (args.Length != 4)
            {
                Console.WriteLine("Usage: CreditsCSAPIDemo NodeIpAddress YourPublicKey YourPrivateKey TargetPublicKey");
                return;
            }

            var SourceKeys = new Keys
            {
                PublicKey  = args[1],
                PrivateKey = args[2]
            };

            var TargetKeys = new Keys
            {
                PublicKey = args[3],
            };

            using (var transport = new TSocket(args[0], 9090))
            {
                using (var protocol = new TBinaryProtocol(transport))
                {
                    using (var client = new API.Client(protocol))
                    {
                        transport.Open();

                        var balance = client.WalletBalanceGet(SourceKeys.PublicKeyBytes);
                        Console.WriteLine($"[{SourceKeys.PublicKey}] Balance: {balance.Balance.ToString()}");

                        var clientEx = new ClientEx(client, SourceKeys, TargetKeys);
                        Console.WriteLine("Result of the transaction execution:");
                        Console.WriteLine(clientEx.ExecuteTransaction());
                    }
                }
            }

            Console.WriteLine("Press [Enter] to exit...");
            Console.ReadLine();
        }
Exemplo n.º 13
0
        private static void Main()
        {
            if (API.Steam.GetInstallPath() == Application.StartupPath)
            {
                MessageBox.Show(
                    "This tool declines to being run from the Steam directory.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            API.Client client;
            try
            {
                client = new API.Client();
                if (client.Initialize(0) == false)
                {
                    MessageBox.Show(
                        "Steam is not running. Please start Steam then run this tool again.",
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }
            }
            catch (DllNotFoundException)
            {
                MessageBox.Show(
                    "You've caused an exceptional error!",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new GamePicker(client));
        }
Exemplo n.º 14
0
 public ClientEx(API.Client client, Keys sk, Keys tk)
 {
     sourceKeys  = sk;
     targetKeys  = tk;
     this.client = client;
 }
Exemplo n.º 15
0
        public static void Main(string[] args)
        {
            long appId;

            if (args.Length == 0)
            {
                Process.Start("SAM.Picker.exe");
                return;
            }

            if (long.TryParse(args[0], out appId) == false)
            {
                MessageBox.Show(
                    "Could not parse application ID from command line argument.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            if (API.Steam.GetInstallPath() == Application.StartupPath)
            {
                MessageBox.Show(
                    "This tool declines to being run from the Steam directory.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            using (var client = new API.Client())
            {
                try
                {
                    client.Initialize(appId);
                }
                catch (API.ClientInitializeException e)
                {
                    if (e.Failure == API.ClientInitializeFailure.ConnectToGlobalUser)
                    {
                        MessageBox.Show(
                            "Steam is not running. Please start Steam then run this tool again.\n\n" +
                            "If you have the game through Family Share, the game may be locked due to\n\n" +
                            "the Family Share account actively playing a game.\n\n" +
                            "(" + e.Message + ")",
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    else if (string.IsNullOrEmpty(e.Message) == false)
                    {
                        MessageBox.Show(
                            "Steam is not running. Please start Steam then run this tool again.\n\n" +
                            "(" + e.Message + ")",
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(
                            "Steam is not running. Please start Steam then run this tool again.",
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    return;
                }
                catch (DllNotFoundException)
                {
                    MessageBox.Show(
                        "You've caused an exceptional error!",
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Manager(appId, client));
            }
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            var ipAddress = System.Configuration.ConfigurationManager.AppSettings["IpAddress"];

            var publicKey  = "[Source PubKey]";
            var privateKey = System.Configuration.ConfigurationManager.AppSettings["PrivateKey"];

            var publicKeyBytes  = SimpleBase.Base58.Bitcoin.Decode(publicKey).ToArray();
            var privateKeyBytes = SimpleBase.Base58.Bitcoin.Decode(privateKey).ToArray();

            var targetPublicKey      = "[Target PubKey]";
            var targetPublicKeyBytes = SimpleBase.Base58.Bitcoin.Decode(targetPublicKey).ToArray();

            Task.Run(async() =>
            {
                try
                {
                    using (var transport = new TSocket(ipAddress, 9090))
                    {
                        using (var protocol = new TBinaryProtocol(transport))
                        {
                            using (var client = new API.Client(protocol))
                            {
                                transport.Open();

                                #region GetBalance
                                //Get the balance of our wallet.
                                var balance = client.BalanceGet(publicKeyBytes, 0);
                                Console.WriteLine($"[{publicKey}] Balance: {ConvUtils.FormatAmount(balance.Amount)} CS");
                                #endregion
                                Debugger.Break();

                                #region GetTransactions
                                //Get transactions

                                var transactionGetResult = client.TransactionsGet(publicKeyBytes, 0, 5);
                                #endregion
                                Debugger.Break();

                                #region CreateTransaction
                                //Create a transaction
                                var transaction      = new Transaction();
                                transaction.Id       = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds();
                                transaction.Source   = publicKeyBytes;
                                transaction.Target   = targetPublicKeyBytes;
                                transaction.Amount   = new Amount(5, 0);
                                transaction.Balance  = balance.Amount;
                                transaction.Fee      = new Amount(0, 0);
                                transaction.Currency = 1;

                                //Create the signature of the transaction by writing the values into a memory stream and then writes the contents out into a bytearray.
                                byte[] bytes;
                                using (var memoryStream = new MemoryStream())
                                {
                                    using (BinaryWriter writer = new BinaryWriter(memoryStream))
                                    {
                                        writer.Write(transaction.Id);
                                        writer.Write(transaction.Source);
                                        writer.Write(transaction.Target);
                                        writer.Write(transaction.Amount.Integral);
                                        writer.Write(transaction.Amount.Fraction);
                                        writer.Write(transaction.Fee.Integral);
                                        writer.Write(transaction.Fee.Fraction);
                                        writer.Write(transaction.Currency);
                                        writer.Write(0);
                                    }
                                    bytes = memoryStream.ToArray();
                                }

                                var lastHash = SimpleBase.Base58.Bitcoin.Encode(client.GetLastHash());

                                //Sign the bytearray with the privateKey
                                var signature = Ed25519.Sign(bytes, privateKeyBytes);

                                //Verify the signature is correct.
                                var verifyResult = Ed25519.Verify(signature, bytes, SimpleBase.Base58.Bitcoin.Decode(publicKey).ToArray());
                                if (!verifyResult)
                                {
                                    throw new Exception("Signature could not be verified");
                                }

                                transaction.Signature = signature;
                                var transactionResult = client.TransactionFlow(transaction);
                                #endregion
                                Debugger.Break();

                                await Task.Delay(10);
                            }
                        }
                    }
                }
                catch (Exception exc)
                {
                    Console.WriteLine(exc.Message);
                }
            });
            Console.ReadKey();
        }
Exemplo n.º 17
0
        public static void Main(string[] args)
        {
            long appId;

            if (args.Length == 0)
            {
                Process.Start("SAM.Picker.exe");
                return;
            }

            if (long.TryParse(args[0], out appId) == false)
            {
                MessageBox.Show(
                    "Could not parse application ID from command line argument.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            if (API.Steam.GetInstallPath() == Application.StartupPath)
            {
                MessageBox.Show(
                    "This tool declines to being run from the Steam directory.",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            API.Client client;
            try
            {
                client = new API.Client();

                if (client.Initialize(appId) == false)
                {
                    MessageBox.Show(
                        "Steam is not running. Please start Steam then run this tool again.",
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }
            }
            catch (DllNotFoundException)
            {
                MessageBox.Show(
                    "You've caused an exceptional error!",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            /* Disable server certificate validation.
             * This is for media downloads (achievement icons).
             * https://media.steamcommunity.com/ has certs issued to (various).e.akamai.net.
             */
            ServicePointManager.ServerCertificateValidationCallback = (s, ce, ch, e) => true;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Manager(appId, client));
        }
Exemplo n.º 18
0
        public static void Main(string[] args)
        {
            long appId;

            if (args.Length == 0)
            {
                Process.Start("SAM.Picker.exe");
                return;
            }

            if (long.TryParse(args[0], out appId) == false)
            {
                MessageBox.Show(
                    ResourcesUI.DLG_PARSE_ID_ERROR,
                    "Steam Achievement Manager",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            if (API.Steam.GetInstallPath() == Application.StartupPath)
            {
                MessageBox.Show(
                    ResourcesUI.DLG_STEAM_DIR_ERROR,
                    "Steam Achievement Manager",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            using (var client = new API.Client())
            {
                try
                {
                    client.Initialize(appId);
                }
                catch (API.ClientInitializeException e)
                {
                    if (e.Failure == API.ClientInitializeFailure.ConnectToGlobalUser)
                    {
                        MessageBox.Show(
                            ResourcesUI.DLG_STEAM_NOT_RUN_ERROR + "\n\n" +
                            ResourcesUI.DLG_FAMILY_SHARE_ERROR + "\n\n" +
                            "(" + e.Message + ")",
                            "Steam Achievement Manager",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    else if (string.IsNullOrEmpty(e.Message) == false)
                    {
                        MessageBox.Show(
                            ResourcesUI.DLG_STEAM_NOT_RUN_ERROR + "\n\n" +
                            "(" + e.Message + ")",
                            "Steam Achievement Manager",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(
                            ResourcesUI.DLG_STEAM_NOT_RUN_ERROR,
                            "Steam Achievement Manager",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                    }
                    return;
                }
                catch (DllNotFoundException)
                {
                    MessageBox.Show(
                        ResourcesUI.DLG_EXCEPT_ERROR,
                        "Steam Achievement Manager",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Manager(appId, client));
            }
        }