public static async Task Main() { Console.WriteLine($"Started: {DateTime.Now}"); RtmpStreamContent Content = new RtmpStreamContent() { RtmpUri = Rtmp }; NetStreamConfigurations configurations = new NetStreamConfigurations() { EnableSsl = true }; RtmpConnectionRequest Request = new RtmpConnectionRequest(Content, configurations); RtmpClient client = new RtmpClient(Request); await client.ConnectAsync(); await client.StreamAsync(); Console.WriteLine($"Finished: {DateTime.Now}"); Console.ReadKey(); }
static async Task test_connect() { var key = "live_key"; var options = new RtmpClient.Options { // required parameters: Url = $"rtmp://live.twitch.tv/app/{key}", Context = new SerializationContext(), // optional parameters: AppName = "app", // optional app name, passed to the remote server during connect. //PageUrl = "", // optional page url, passed to the remote server during connect. //SwfUrl = "", // optional swf url, passed to the remote server during connect. //FlashVersion = "WIN 21,0,0,174", // optional flash version, paased to the remote server during connect. //ChunkLength = 4192, // optional outgoing rtmp chunk length. //Validate = (sender, certificate, chain, errors) => true // optional certificate validation callback. used only in tls connections. }; using (var client = await RtmpClient.ConnectAsync(options)) { //var exists = await client.InvokeAsync<bool>("storage", "exists", new { name = "music.pdf" }); var createStream = await client.Connection.CreateStreamAsync(); await createStream.PublishAndWaitAsync(key, "live"); } }
public SummonerClient(RtmpClient _rC, string _summonerName) { Program._connectedClients.Add(this); _rtmpClient = _rC; _rtmpClient.Disconnected += _rtmpClient_Disconnected; Console.WriteLine("[" + _summonerName + "] Connected"); }
public Client(BaseRegion region, string version) { _heartbeatCount = 0; _region = region; _version = version; _client = new RtmpClient(new Uri(string.Format("rtmps://{0}:2099", region.Server)), GetContext(), ObjectEncoding.Amf3); }
static void ClientCommandReceieved(object sender, CommandMessageReceivedEventArgs e) { RtmpClient client = sender as RtmpClient; if (e.Message.Operation == CommandOperation.Login) { ClientDynamicConfigurationNotification clientConfig = new ClientDynamicConfigurationNotification { Delta = false, Config = new Dictionary <string, object>() { { "Chroma", new Dictionary <string, object>() { { "IsEnabled", true } } }, { "LootConfig", new Dictionary <string, object>() { { "NewPlayerChestEnabled", true }, { "Enabled", true }, { "PurchaseChestsEnabled", true }, { "MinSummonerLevel", 1 }, { "Visible", true }, { "NoRefundConfirmationEnabled", false }, { "EventChestsEnabled", true }, } } } }; client.InvokeDestReceive("cn-200006292", "cn-200006292", "messagingDestination", clientConfig); } }
public ForwardPlayer(BaseShard Shard, SerializationContext Context) { _client = new RtmpClient(new Uri("rtmps://" + Shard.URL + ":2099"), Context, ObjectEncoding.Amf3); //_client.MessageReceived += Client_MessageReceived; //_client.CallbackException += Client_CallbackException; Connect(); }
public async void Disconnect() { try { string str = await Logout(SessionToken).ConfigureAwait(false); } catch { } if (!RtmpClient.IsDisconnected) { try { RtmpClient.Close(); } catch (Exception ex) { Tools.Log(ex.Message); Tools.Log(ex.StackTrace); } } HeartbeatCount = 0; Timer heartbeatTimer = _heartbeatTimer; if (heartbeatTimer != null) { heartbeatTimer.Stop(); } IsConnected = false; OnDisconnect?.Invoke(this, EventArgs.Empty); }
public SummonerClient(RtmpClient _rC, Session _s) { Program._connectedClients.Add(this); _rtmpClient = _rC; _session = _s; _rtmpClient.MessageReceived += _rtmpClient_MessageReceived; _rtmpClient.CallbackException += _rtmpClient_CallbackException; _rtmpClient.Disconnected += _rtmpClient_Disconnected; Console.WriteLine("[" + _session.Summary.Username + "] Connected"); }
/// <summary> /// /// </summary> /// <param name="regionData"></param> /// <param name="rsoAuthToken"></param> /// <param name="partnerCred">Same as AccessToken</param> /// <returns></returns> public static async Task <RtmpLoginResult> LoginRtmps(RegionData regionData, string rsoAuthToken, string partnerCred, string userName) { var client = new RiotCalls(); var rtmpClasses = HelperFunctions.GetInstances <RiotRtmpObject>(); var typeList = new List <Type>(); foreach (var rtmpClass in rtmpClasses) { typeList.Add(rtmpClass.GetType()); } var context = new SerializationContext(typeList.ToArray()); var options = new RtmpClient.Options { Url = $"rtmps://{regionData.Servers.Lcds.LcdsHost}:{regionData.Servers.Lcds.LcdsPort}", Context = context, Validate = (sender, certificate, chain, errors) => true, AppName = "LCU", PageUrl = null, SwfUrl = null, ChunkLength = 16500 }; //Pass to the rtmpclient client.RiotConnection = await RtmpClient.ConnectAsync(options); client.IsConnectedToRtmp = true; var authCred = new AuthenticationCredentials { MacAddress = LoginSystemData.MacAddress, AuthToken = rsoAuthToken, PartnerCredentials = partnerCred, OperatingSystem = LoginSystemData.OperatingSystem, Username = userName }; var loginResult = await client.Login(authCred); if (loginResult.GetType() == typeof(Session)) { client.RegionData = regionData; client.RiotSession = (Session)loginResult; return(new RtmpLoginResult(true, client, null)); } if (loginResult.GetType() != typeof(LoginFailedException)) { return(new RtmpLoginResult(false, null, null)); } client.IsConnectedToRtmp = false; await client.RiotConnection.CloseAsync(); return(new RtmpLoginResult(false, null, (LoginFailedException)loginResult)); }
public async void Reset() { _auth = false; _heartbeatCount = 0; _heartbeatTimer.Stop(); _client.Close(); _client = new RtmpClient(new Uri(string.Format("rtmps://{0}:2099", _region.Server)), GetContext(), ObjectEncoding.Amf3); _client.MessageReceived += _backupHandler; _client.Disconnected += _backupDisconnected; await Connect(_session.AccountSummary.Username, _session.Password); }
public long Open(DataSpec p0) { if (this._isOpened) { this.Close(); } this.Uri = p0.Uri.ToString(); this._rtmpClient = new RtmpClient(); this._rtmpClient.Open(p0.Uri.ToString(), false); this._isOpened = true; return C.LengthUnbounded; }
static async Task <RtmpClient> BotClientAsync() { try { Console.WriteLine("Client connecting..."); var options = new RtmpClient.Options { Url = "rtmp://localhost:4000", AppName = "bot", }; var client = await RtmpClient.ConnectAsync(options); Console.WriteLine("Client connected."); //client.Disconnected += (o, s) => { ((RtmpClient)o).InvokeAsync<object>("FCUnpublish").Wait(); }; client.DispatchInvoke = s => { switch (s.MethodName) { case "a": var windowName = (string)s.Arguments[0]; botHandle = Interop.GetHandleByWindow(windowName ?? "Star Citizen"); break; case "k": var key = (char)s.Arguments[0]; Interop.PressKey((byte)key); break; case "c": Interop.ClickMouseButton(botHandle, InteropMouseButton.Left, new Point(545, 300)); break; case "bf": Interop.BringToFront(botHandle); break; default: Console.WriteLine(s.MethodName); break; } }; return(client); } catch (Exception e) { Console.WriteLine(e.Message); return(null); } }
internal void Login() { if (!loggedIn) { this.rtmpClient = new RtmpClient(new Uri(credentials.Region.getAddress()), RegisterSerializationContext(), ObjectEncoding.Amf3); rtmpClient.CallbackException += CallbackException; rtmpClient.MessageReceived += OnMessageReceived; rtmpClient.Disconnected += OnDisconnect; using (var webclient = new WebClient()) { login: String payload = "user="******",password="******"/login-queue/rest/queue/authenticate", payload); var queue = JsonConvert.DeserializeObject(queueResponse) as JObject; String status = (String)queue["status"]; if (status == null || status == "") { throw new Exception("FATAL ERROR"); } if (status == "LOGIN") { String token = (String)queue["token"]; if (token == null || token == "") { throw new Exception("FATAL ERROR"); } this.loginToken = token; RtmpConnect(); return; } else if (status == "QUEUE") { var delay = (int)queue["delay"]; var node = (int)queue["node"]; foreach (var ticker in (queue["tickers"] as JArray)) { if ((int)ticker["node"] == node) { Console.WriteLine("Currently #" + ((int)ticker["id"] - (int)ticker["current"]) + " in Queue for " + credentials.Region.ToString() + " with Account: " + credentials.Username); break; } } Task.Delay(delay / 2).Wait(); goto login; } } } }
void ClientCommandReceieved(object sender, CommandMessageReceivedEventArgs e) { RtmpClient client = sender as RtmpClient; if (e.Message.Operation == CommandOperation.Login) { ClientDynamicConfigurationNotification clientConfig = new ClientDynamicConfigurationNotification { Delta = false, //TODO: not have this data stored in code Config = "{\"PlatformShutdown\":{\"Enabled\":false},\"BotConfigurations\":{\"IntermediateInCustoms\":true},\"ShareMatchHistory\":{\"MatchHistoryUrlTemplate\":\"http://matchhistory.oce.leagueoflegends.com/{2}/#login?redirect=%23player-search%2FcurrentAccount%2FOC1%2F{0}\",\"AdvancedGameDetailsUrlTemplate\":\"http://matchhistory.oce.leagueoflegends.com/{2}/#match-details/OC1/{0}/{1}/eog\",\"AdvancedGameDetailsEnabled\":true,\"MatchDetailsUrlTemplate\":\"http://matchhistory.oce.leagueoflegends.com/{2}/#match-details/OC1/{0}/{1}\",\"ShareEndOfGameEnabled\":true,\"ShareGameUrlTemplate\":\"http://matchhistory.oce.leagueoflegends.com/{2}/#match-details/OC1/{0}/{1}/eog\",\"MatchHistoryEnabled\":true},\"GuestSlots\":{\"Enabled\":null},\"ServiceStatusAPI\":{\"Enabled\":true},\"GameTimerSync\":{\"Enabled\":false,\"PercentOfTotalTimerToSyncAt\":0.8},\"QueueRestriction\":{\"ServiceEnabled\":true,\"RankedDuoQueueRestrictionMode\":\"TIER\",\"KarmaEnabled\":false,\"RankedDuoQueueRestrictionMaxDelta\":1,\"RankedDuoQueueDefaultUnseededTier\":\"SILVER\"},\"DockedPrompt\":{\"EnabledNewDockedPromptRenderer\":true},\"QueueImages\":{\"OverrideQueueImage\":true},\"SuggestedPlayers\":{\"HonoredPlayersLimit\":4,\"FriendsOfFriendsLimit\":22,\"Enabled\":true,\"OnlineFriendsLimit\":4,\"PreviousPremadesLimit\":4,\"MaxNumSuggestedPlayers\":8,\"VictoriousComradesLimit\":4,\"FriendsOfFriendsEnabled\":true,\"MaxNumReplacements\":22},\"DisabledChampions\":{\"FIRSTBLOOD\":\"[]\",\"KINGPORO\":\"[161]\",\"ARAM_UNRANKED_5x5\":\"[]\",\"ONEFORALL_5x5\":\" []\",\"ASCENSION\":\"[83]\",\"SR_6x6\":\"[]\",\"URF\":\"[120,16,76,12,10,72,13,38,37]\",\"KING_PORO\":\"[161]\",\"ODIN_UNRANKED\":\"[]\",\"NIGHTMARE_BOT\":\"[]\",\"RANKED_SOLO_5x5\":\"[]\",\"TUTORIAL\":\"[]\",\"URF_BOT\":\"[]\",\"FIRSTBLOOD_2x2\":\"[]\",\"FIRSTBLOOD_1x1\":\"[]\",\"CLASSIC\":\"[]\",\"RANKED_TEAM_5x5\":\"[]\",\"RANKED_TEAM_3x3\":\"[]\",\"HEXAKILL\":\"[]\",\"BOT\":\"[]\",\"ODIN\":\"[]\",\"ONEFORALL\":\"[]\",\"NORMAL\":\"[]\",\"NORMAL_3x3\":\"[]\",\"BOT_3x3\":\"[]\",\"ARAM\":\"[]\"},\"Mutators\":{\"EnabledMutators\":\"[]\",\"EnabledModes\":\"[\\\"CLASSIC\\\",\\\"TUTORIAL\\\",\\\"ODIN\\\",\\\"ARAM\\\"]\"},\"EndOfGameGifting\":{\"Enabled\":true},\"SkinRentals\":{\"Enabled\":\"PROCESSONLY\"},\"ContextualEducation\":{\"TargetMinionsPerWave\":0.4,\"Enabled\":false,\"MaxTargetSummonerLevel\":10.0},\"DisabledChampionSkins\":{\"DisabledChampionSkins\":\"[]\"},\"EndOfGameGiftSettings\":{\"SenderGiftDailyMax\":5,\"GiftRecipientLevelMin\":5,\"GiftSenderRPMax\":50000,\"RecipientGiftDailyMax\":5,\"GiftSenderLevelMin\":15},\"Chat\":{\"Rename_general_group_throttle\":1.0,\"Default_public_chat_rooms\":\"\"},\"GameInvites\":{\"ServiceEnabled\":true,\"InviteBulkMaxSize\":200,\"LobbyCreationEnabled\":true},\"ContextualEducationURLs\":{\"LAST_HIT\":\"null\"},\"NewPlayerRouter\":{\"QueueID\":\"31\",\"ABDisablingOfTutorial\":true},\"SeasonReward\":{\"Maximum_team_reward_level\":3,\"Enabled\":true,\"ServiceCallEnabled\":true,\"QualificationWarningEnabled\":false,\"Minimum_points_per_reward_level\":\"20,45,75\",\"Minimum_win_team_reward_level_2\":35,\"Minimum_win_team_reward_level_1\":10,\"Minimum_win_team_reward_level_3\":75},\"String\":{\"String\":null},\"LeagueConfig\":{\"IsPreseason\":true,\"MasterTierEnabled\":true,\"PreseasonName\":\"2015\",\"SeasonName\":\"2014\"},\"ChampionTradeService\":{\"Enabled\":true},\"ChampionSelect\":{\"UseOptimizedChampSelectProcessor\":false,\"UseOptimizedSpellSelectProcessor\":false,\"AllChampsAvailableInAram\":false,\"UseOptimizedBotChampionSelectProcessor\":false,\"AutoReconnectEnabled\":false,\"CollatorChampionFilterEnabled\":false},\"FeaturedGame\":{\"MetadataEnabled\":\"OFF\"}}" }; client.InvokeDestReceive("cn-1", "cn-1", "messagingDestination", clientConfig); } }
void ClientCommandReceieved(object sender, CommandMessageReceivedEventArgs e) { RtmpClient client = sender as RtmpClient; if (e.Message.Operation == CommandOperation.Login) { ClientDynamicConfigurationNotification clientConfig = new ClientDynamicConfigurationNotification { Delta = false, //TODO: not have this data stored in code Config = "{\"Chroma\":{\"IsEnabled\":true},\"PlatformShutdown\":{\"Enabled\":false},\"BotConfigurations\":{\"IntermediateInCustoms\":true},\"ShareMatchHistory\":{\"MatchHistoryUrlTemplate\":\"http://matchhistory.oce.leagueoflegends.com/{2}/#login?redirect=%23player-search%2FcurrentAccount%2FOC1%2F{0}\",\"AdvancedGameDetailsUrlTemplate\":\"http://matchhistory.oce.leagueoflegends.com/{2}/#match-details/OC1/{0}/{1}/eog\",\"AdvancedGameDetailsEnabled\":true,\"MatchDetailsUrlTemplate\":\"http://matchhistory.oce.leagueoflegends.com/{2}/#match-details/OC1/{0}/{1}\",\"ShareEndOfGameEnabled\":true,\"ShareGameUrlTemplate\":\"http://matchhistory.oce.leagueoflegends.com/{2}/#match-details/OC1/{0}/{1}/eog\",\"MatchHistoryEnabled\":true},\"GuestSlots\":{\"Enabled\":null},\"ServiceStatusAPI\":{\"Enabled\":true},\"FriendRecommendations\":{\"FaqLink\":\"http://oce.leagueoflegends.com/en/page/faq-add-friends\",\"StatusExpiryMillis\":300000,\"EnableAddFriendButton\":true,\"EnabledPercent\":100,\"ShowToolTip\":true,\"RegistrationPollRateMillis\":5000,\"HideFriends\":false,\"PlayerLevelForNewNotification\":0,\"RegistrationPollDurationMillis\":300000,\"ContactsUrlTemplate\":\"https://recofriender.leagueoflegends.com/v1/contacts/{0}/{1}\",\"ContactDetailsUrlTemplate\":\"https://recofriender.leagueoflegends.com/v1/contactdetails/{0}/{1}/{2}/\",\"AssociationUrlTemplate\":\"https://recofriender.leagueoflegends.com/v1/facebook-oauth?locale={0}\",\"EnableViewAllPanel\":true,\"UnlinkUrlTemplate\":\"https://recofriender.leagueoflegends.com/v1/facebook-oauth/unlink/{0}/{1}\",\"UseNativeFacebookPop\":false},\"GameTimerSync\":{\"Enabled\":false,\"PercentOfTotalTimerToSyncAt\":0.8},\"DockedPrompt\":{\"EnabledNewDockedPromptRenderer\":true},\"QueueRestriction\":{\"ServiceEnabled\":true,\"RankedDuoQueueRestrictionMode\":\"TIER\",\"KarmaEnabled\":false,\"RankedDuoQueueRestrictionMaxDelta\":1,\"RankedDuoQueueDefaultUnseededTier\":\"SILVER\"},\"PartyRewards\":{\"Enabled\":false,\"GameFlowVisualUpdate\":false},\"QueueImages\":{\"OverrideQueueImage\":true},\"SuggestedPlayers\":{\"HonoredPlayersLimit\":4,\"FriendsOfFriendsLimit\":22,\"Enabled\":true,\"OnlineFriendsLimit\":4,\"PreviousPremadesLimit\":4,\"MaxNumSuggestedPlayers\":8,\"VictoriousComradesLimit\":4,\"FriendsOfFriendsEnabled\":true,\"MaxNumReplacements\":22},\"DisabledChampions\":{\"FIRSTBLOOD\":\"[]\",\"KINGPORO\":\"[161]\",\"ARAM_UNRANKED_5x5\":\"[]\",\"ONEFORALL_5x5\":\" []\",\"ASCENSION\":\"[83]\",\"SR_6x6\":\"[]\",\"BILGEWATER\":\"[]\",\"URF\":\"[]\",\"KING_PORO\":\"[161]\",\"ODIN_UNRANKED\":\"[]\",\"NIGHTMARE_BOT\":\"[]\",\"RANKED_SOLO_5x5\":\"[]\",\"TUTORIAL\":\"[]\",\"URF_BOT\":\"[]\",\"FIRSTBLOOD_2x2\":\"[]\",\"FIRSTBLOOD_1x1\":\"[]\",\"CLASSIC\":\"[]\",\"RANKED_TEAM_5x5\":\"[]\",\"COUNTER_PICK\":\"[]\",\"RANKED_TEAM_3x3\":\"[]\",\"HEXAKILL\":\"[]\",\"BOT\":\"[]\",\"ODIN\":\"[]\",\"ONEFORALL\":\"[]\",\"NORMAL\":\"[]\",\"NORMAL_3x3\":\"[]\",\"BOT_3x3\":\"[]\",\"ARAM\":\"[]\"},\"Mutators\":{\"CustomGameMutators\":\"[]\",\"BattleTrainingMutators\":\"[]\",\"EnabledMutators\":\"[\\\"Bilgewater\\\"]\",\"BasicTutorialMutators\":\"[\\\"BasicTutorial\\\"]\",\"EnabledModes\":\"[\\\"CLASSIC\\\",\\\"TUTORIAL\\\",\\\"ODIN\\\",\\\"ARAM\\\"]\"},\"EndOfGameGifting\":{\"Enabled\":true},\"ProfileHoverCard\":{\"IsEnabledForBuddyPanelView\":\"true\",\"ACSLookup\":\"true\",\"IsEnabledForSummonerQuickView\":\"true\",\"IsEnabledForGameLobbySuggestedPlayers\":\"true\",\"IsEnabledForGroupFinderCapViewSuggestedPlayers\":null,\"IsEnabledForChatFriendsList\":\"true\",\"IsEnabledForChatGroupChatParticipants\":\"true\",\"IsEnabledForCustomGameLobby\":\"true\",\"IsEnabled\":\"true\",\"ChampionMasteryLookup\":\"true\",\"IsEnabledForTeamBuilderSuggestedPlayers\":\"true\",\"LeagueLookup\":\"true\"},\"SkinRentals\":{\"Enabled\":\"ON\"},\"ContextualEducation\":{\"TargetMinionsPerWave\":0.4,\"Enabled\":false,\"MaxTargetSummonerLevel\":10.0},\"DisabledChampionSkins\":{\"DisabledChampionSkins\":\"[]\"},\"ChampionMasteryConfig\":{\"Enabled\":true,\"MinSummonerLevel\":5,\"EndOfGameEnabled\":true,\"SupportedQueueTypes\":\"RANKED_SOLO_5x5,RANKED_TEAM_5x5,CAP_5x5,NORMAL,BILGEWATER-5x5\",\"MaxChampionLevel\":5,\"ShowGradeAvailablePopup\":true,\"CapUnlockChampionLevel\":4,\"GradeEnabled\":true},\"EndOfGameGiftSettings\":{\"SenderGiftDailyMax\":5,\"GiftRecipientLevelMin\":5,\"GiftSenderRPMax\":50000,\"RecipientGiftDailyMax\":5,\"GiftSenderLevelMin\":15},\"GameInvites\":{\"ServiceEnabled\":true,\"InviteBulkMaxSize\":200,\"LobbyCreationEnabled\":true},\"Chat\":{\"Rename_general_group_throttle\":1.0,\"Default_public_chat_rooms\":\"\",\"MaximumRosterSize\":325},\"ContextualEducationURLs\":{\"LAST_HIT\":\"null\"},\"NewMatchHistory\":{\"Enabled\":true,\"PostIPXPToLegSEnabled\":true,\"SharingEnabled\":true},\"NewPlayerRouter\":{\"QueueID\":\"31\",\"ABDisablingOfTutorial\":true},\"SeasonReward\":{\"Maximum_team_reward_level\":3,\"Enabled\":true,\"ServiceCallEnabled\":true,\"QualificationWarningEnabled\":true,\"Minimum_points_per_reward_level\":\"20,45,75\",\"Minimum_win_team_reward_level_2\":35,\"Minimum_win_team_reward_level_1\":10,\"Minimum_win_team_reward_level_3\":75},\"String\":{\"String\":null},\"LeagueConfig\":{\"IsPreseason\":false,\"MasterTierEnabled\":true,\"PreseasonName\":\"2015\",\"SeasonName\":\"2015\"},\"ChampionTradeService\":{\"Enabled\":true},\"ChampionSelect\":{\"UseOptimizedChampSelectProcessor\":false,\"UseOptimizedSpellSelectProcessor\":false,\"AllChampsAvailableInAram\":false,\"UseOptimizedBotChampionSelectProcessor\":false,\"AutoReconnectEnabled\":true,\"CollatorChampionFilterEnabled\":false,\"AlwaysShowRewardIcon\":false},\"FeaturedGame\":{\"MetadataEnabled\":\"OFF\"},\"PlatfromShutdown\":{\"Enabled\":false}}" }; client.InvokeDestReceive("cn-200006292", "cn-200006292", "messagingDestination", clientConfig); } }
public RemotingMessageReceivedEventArgs HandleMessage(object sender, RemotingMessageReceivedEventArgs e) { object[] body = e.Body as object[]; AuthenticationCredentials creds = body[0] as AuthenticationCredentials; //Console.WriteLine("Login von: " + creds.Username + " : " + creds.Password); RtmpClient client = sender as RtmpClient; SummonerClient newClient = new SummonerClient(client, creds.Username); Dictionary <string, string> Data = DatabaseManager.getAccountData(creds.Username, creds.Password); Dictionary <string, string> SummonerData = DatabaseManager.getSummonerData(Data["summonerId"]); Session session = new Session { Password = creds.Password, Summary = new AccountSummary { AccountId = Convert.ToDouble(Data["id"]), Username = creds.Username, HasBetaAccess = true, IsAdministrator = true, PartnerMode = true, NeedsPasswordReset = false }, Token = creds.AuthToken }; newClient.setSession(session); newClient._accId = Convert.ToDouble(Data["id"]); newClient._sumId = Convert.ToDouble(SummonerData["id"]); newClient._summonername = SummonerData["summonerName"]; newClient._sumIcon = Convert.ToDouble(SummonerData["icon"]); newClient._IP = Convert.ToDouble(Data["IP"]); newClient._RP = Convert.ToDouble(Data["RP"]); e.ReturnRequired = true; e.Data = session; return(e); }
private static async Task MainAsync() { // Socket s = new Socket(AddressFamily.Ipx, SocketType.Stream, ProtocolType.IP); // await s.ConnectAsync( const string uri = "rtmp://x.kipod.com/live/51:902b3459783c:6?signature=JJa-cs2s660ec4FEjugXHA&expires=1441112256"; AKUtils.Trace(uri); var client = new RtmpClient( new Uri(uri), new SerializationContext(), ObjectEncoding.Amf3); // connect to the server await client.ConnectAsync(); // await client.(); // call a remote service // var songs = await client.InvokeAsync<string[]>("musicalService", "findSongs"); var streamId = await client.CreateStreamInvokeAsync(); var play = await client.PlayInvokeAsync();//<object>("play", "51:902b3459783c:6:live"); }
static async Task test_client_server() { var serverOptions = new RtmpServer.Options { Url = "rtmp://localhost:4000/key", Context = new SerializationContext(), }; using (var server = await RtmpServer.ConnectAsync(serverOptions, x => { })) { var clientOptions = new RtmpClient.Options { Url = "rtmp://localhost:4000/key", Context = new SerializationContext(), }; using (var client = await RtmpClient.ConnectAsync(clientOptions)) { Console.WriteLine("Connect"); } } }
static void ClientMessageReceived(object sender, RemotingMessageReceivedEventArgs e) { try { RemotingMessageReceivedEventArgs tempRecv = null; if (e.Operation == "login") { tempRecv = _handler.Handle(sender, e); } RtmpClient client = sender as RtmpClient; SummonerClient targetSummoner = _connectedClients.FirstOrDefault(tSum => tSum._rtmpClient.ClientId == client.ClientId); if (e.Operation != "login") { tempRecv = _handler.Handle(targetSummoner, e); } LogRequest(tempRecv, e, targetSummoner); e = tempRecv; } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void Close() { this._rtmpClient.Close(); this._rtmpClient = null; this._isOpened = false; }
async void OnClientAccepted(IAsyncResult ar) { TcpListener listener = ar.AsyncState as TcpListener; if (listener == null) return; try { TcpClient client = listener.EndAcceptTcpClient(ar); var stream = await GetRtmpStreamAsync(client); // read c0+c1 var c01 = await RtmpHandshake.ReadAsync(stream, true); var random = new Random(); var randomBytes = new byte[1528]; random.NextBytes(randomBytes); // write s0+s1+s2 var s01 = new RtmpHandshake() { Version = 3, Time = (uint)Environment.TickCount, Time2 = 0, Random = randomBytes }; var s02 = s01.Clone(); s02.Time2 = (uint)Environment.TickCount; await RtmpHandshake.WriteAsync(stream, s01, s02, true); // read c02 var c02 = await RtmpHandshake.ReadAsync(stream, false); RtmpClient rtmpClient = new RtmpClient(_serverUri, _context, stream); rtmpClient.ServerMessageReceived += ServerMessageReceived; rtmpClient.ServerCommandReceived += ServerCommandReceived; _clients.Add(rtmpClient); } finally { listener.BeginAcceptTcpClient(OnClientAccepted, listener); } }
static void ClientCommandReceieved(object sender, CommandMessageReceivedEventArgs e) { RtmpClient client = sender as RtmpClient; SummonerClient targetSummoner = _connectedClients.FirstOrDefault <SummonerClient>(tSum => client.ClientId == tSum._rtmpClient.ClientId); if (e.Message.Operation == CommandOperation.Login) { var configData = new Dictionary <string, dynamic> { { "LootConfig", new Dictionary <string, dynamic> { { "NewPlayerChestEnabled", true }, { "Enabled", true }, { "PurchaseChestsEnabled", true }, { "MinSummonerLevel", 5 }, { "Visible", true }, { "NoRefundConfirmationEnabled", true }, { "EventChestsEnabled", true }, } }, { "ChampionMasteryConfig", new Dictionary <string, dynamic> { { "Enabled", true }, { "MinSummonerLevel", 1 }, { "EndOfGameEnabled", false }, { "SupportedQueueTypes", "RANKED_SOLO_5x5," }, { "MaxChampionLevel", 5 }, { "LootChestsEnabled", true }, { "ShowGradeAvailablePopup", true }, { "ChampionPointQueueTypes", "RANKED_SOLO_5x5," }, { "GradeEnabled", true }, { "CapUnlockChampionLevel", 5 } } } }; ClientDynamicConfigurationNotification clientConfig = new ClientDynamicConfigurationNotification { Delta = false, //Config = JsonConvert.SerializeObject(configData) //TODO: not have this data stored in code Config = "{\"Chroma\":{\"IsEnabled\":true},\"LcuAlphaShutdown\":{\"Countdown\":15,\"Enabled\":true},\"Masteries\":{\"ShowPointsResetMessage\":false},\"DisabledChampion\":{\"ODINBOT-5x5\":null},\"PlatformShutdown\":{\"Enabled\":false},\"BotConfigurations\":{\"IntermediateInCustoms\":true},\"ShareMatchHistory\":{\"MatchHistoryUrlTemplate\":\"http://matchhistory.euw.leagueoflegends.com/{2}/#login?redirect=%23player-search%2FcurrentAccount%2FEUW1%2F{0}\",\"AdvancedGameDetailsUrlTemplate\":\"http://matchhistory.euw.leagueoflegends.com/{2}/#match-details/EUW1/{0}/{1}/eog\",\"AdvancedGameDetailsEnabled\":false,\"MatchDetailsUrlTemplate\":\"http://matchhistory.euw.leagueoflegends.com/{2}/#match-details/EUW1/{0}/{1}\",\"ShareEndOfGameEnabled\":true,\"ShareGameUrlTemplate\":\"http://matchhistory.euw.leagueoflegends.com/{2}/#match-details/EUW1/{0}/{1}/eog\",\"MatchHistoryEnabled\":true},\"CustomGame\":{\"BotsAvailableInAram\":false},\"GuestSlots\":{\"Enabled\":null},\"ServiceStatusAPI\":{\"Enabled\":true},\"FriendRecommendations\":{\"FaqLink\":\"http://euw.leagueoflegends.com/{0}/page/features/faq-add-friends\",\"StatusExpiryMillis\":300000,\"EnableAddFriendButton\":true,\"EnabledPercent\":100,\"ShowToolTip\":true,\"RegistrationPollRateMillis\":5000,\"HideFriends\":false,\"PlayerLevelForNewNotification\":5,\"RegistrationPollDurationMillis\":300000,\"ContactsUrlTemplate\":\"https://recofriender.leagueoflegends.com/v1/contacts/{0}/{1}\",\"ContactDetailsUrlTemplate\":\"https://recofriender.leagueoflegends.com/v1/contactdetails/{0}/{1}/{2}/\",\"AssociationUrlTemplate\":\"https://recofriender.leagueoflegends.com/v1/facebook-oauth?locale={0}\",\"EnableViewAllPanel\":true,\"UnlinkUrlTemplate\":\"https://recofriender.leagueoflegends.com/v1/facebook-oauth/unlink/{0}/{1}\",\"UseNativeFacebookPop\":false},\"GameTimerSync\":{\"Enabled\":false,\"PercentOfTotalTimerToSyncAt\":0.8},\"DockedPrompt\":{\"EnabledNewDockedPromptRenderer\":true},\"QueueRestriction\":{\"ServiceEnabled\":true,\"RankedDuoQueueRestrictionMode\":\"TIER\",\"RankedLowSkillRestrictionMaxDelta\":1,\"KarmaEnabled\":true,\"RankedDuoQueueRestrictionMaxDelta\":1,\"RankedHighSkillLowestTier\":\"DIAMOND\",\"RankedLowSkillRestrictionMode\":\"TIER\",\"RankedHighSkillRestrictionMaxDelta\":2,\"RankedHighSkillRestrictionMode\":\"RANK\",\"RankedDuoQueueDefaultUnseededTier\":\"SILVER\"},\"PartyRewards\":{\"Enabled\":false,\"GameFlowVisualUpdate\":false},\"QueueImages\":{\"OverrideQueueImage\":true},\"PlayerFeedbackTool\":{\"BackendUrl\":\"\"},\"TeamBoost\":{\"RandomSkinEnabled\":\"ON\",\"AllSkinEnabled\":\"OFF\"},\"SuggestedPlayers\":{\"HonoredPlayersLimit\":4,\"FriendsOfFriendsLimit\":22,\"Enabled\":true,\"OnlineFriendsLimit\":4,\"PreviousPremadesLimit\":4,\"MaxNumSuggestedPlayers\":8,\"VictoriousComradesLimit\":4,\"FriendsOfFriendsEnabled\":true,\"MaxNumReplacements\":22},\"PersonalizedOffers\":{\"BaseServiceURL\":\"po-service.euw1.leagueoflegends.com\",\"Port\":443,\"ServiceConfig\":\"[{\\\"endpoint\\\":\\\"/player/offers\\\",\\\"version\\\":1,\\\"operation\\\":\\\"GET\\\"},{\\\"endpoint\\\":\\\"/player/offers/accept\\\",\\\"version\\\":1,\\\"operation\\\":\\\"POST\\\"},{\\\"endpoint\\\":\\\"/player/offers/deny\\\",\\\"version\\\":1,\\\"operation\\\":\\\"POST\\\"},{\\\"endpoint\\\":\\\"/player/offers/view\\\",\\\"version\\\":1,\\\"operation\\\":\\\"POST\\\"},{\\\"endpoint\\\":\\\"/player/wallet\\\",\\\"version\\\":1,\\\"operation\\\":\\\"GET\\\"},{\\\"endpoint\\\":\\\"/player/authenticate\\\",\\\"version\\\":1,\\\"operation\\\":\\\"POST\\\"},{\\\"endpoint\\\":\\\"/player/payletter\\\",\\\"version\\\":1,\\\"operation\\\":\\\"GET\\\"}]\",\"ServicePath\":\"personalized-offers/\",\"HubEnabled\":false,\"Protocol\":\"https://\"},\"DisabledChampions\":{\"ARAM_BOT\":\"[]\",\"KINGPORO\":\"[]\",\"FIRSTBLOOD\":\"[]\",\"ARAM_UNRANKED_5x5\":\"[]\",\"ONEFORALL_5x5\":\"[17,30]\",\"ODINBOT-5x5\":\"[14]\",\"ASCENSION\":\"[]\",\"SR_6x6\":\"[]\",\"BILGEWATER\":\"[]\",\"KING_PORO\":\"[]\",\"ODIN_UNRANKED\":\"[]\",\"URF\":\"[]\",\"ODINBOT\":\"[14]\",\"NIGHTMARE_BOT\":\"[]\",\"ODINBOT_5x5\":\"[14]\",\"RANKED_SOLO_5x5\":\"[]\",\"TUTORIAL\":\"[]\",\"URF_BOT\":\"[]\",\"KINGPORO-5X5\":\"[161]\",\"FIRSTBLOOD_1x1\":\"[]\",\"FIRSTBLOOD_2x2\":\"[]\",\"CLASSIC\":\"[]\",\"RANKED_TEAM_5x5\":\"[]\",\"COUNTER_PICK\":\"[]\",\"RANKED_TEAM_3x3\":\"[]\",\"HEXAKILL\":\"[]\",\"BOT\":\"[]\",\"ODIN\":\"[]\",\"RANKED_PREMADE_3x3\":\"[]\",\"ONEFORALL\":\"[17,30]\",\"NORMAL\":\"[]\",\"BOT_3x3\":\"[]\",\"NORMAL_3x3\":\"[]\",\"ARAM\":\"[]\",\"RANKED_PREMADE_5x5\":\"[]\"},\"PersonlizedOffers\":{\"Port\":443,\"BaseServiceURL\":\"po-service.usw2.leagueoflegends.com\",\"ServiceConfig\":\"[{\\\"endpoint\\\":\\\"/player/offers\\\",\\\"version\\\":1,\\\"operation\\\":\\\"GET\\\"},{\\\"endpoint\\\":\\\"/player/offers/accept\\\",\\\"version\\\":1,\\\"operation\\\":\\\"POST\\\"},{\\\"endpoint\\\":\\\"/player/offers/deny\\\",\\\"version\\\":1,\\\"operation\\\":\\\"POST\\\"},{\\\"endpoint\\\":\\\"/player/offers/view\\\",\\\"version\\\":1,\\\"operation\\\":\\\"POST\\\"},{\\\"endpoint\\\":\\\"/player/wallet\\\",\\\"version\\\":1,\\\"operation\\\":\\\"GET\\\"},{\\\"endpoint\\\":\\\"/player/authenticate\\\",\\\"version\\\":1,\\\"operation\\\":\\\"POST\\\"},{\\\"endpoint\\\":\\\"/player/payletter\\\",\\\"version\\\":1,\\\"operation\\\":\\\"GET\\\"}]\",\"HubEnabled\":true,\"ServicePath\":\"personalized-offers/\",\"Protocol\":\"https://\"},\"Mutators\":{\"CustomGameMutators\":\"[]\",\"BattleTrainingMutators\":\"[]\",\"EnabledMutators\":\"[]\",\"BasicTutorialMutators\":\"[\\\"BasicTutorial\\\"]\",\"EnabledModes\":\"[\\\"CLASSIC\\\",\\\"TUTORIAL\\\",\\\"ARAM\\\"]\"},\"EndOfGameGifting\":{\"Enabled\":true},\"ProfileHoverCard\":{\"ACSLookup\":\"true\",\"IsEnabledForBuddyPanelView\":\"true\",\"CreateStringConfiguration\":null,\"IsEnabledForSummonerQuickView\":\"true\",\"IsEnabledForClubChatParticipants\":\"false\",\"IsEnabledForGameLobbySuggestedPlayers\":\"true\",\"IsEnabledForGroupFinderCapViewSuggestedPlayers\":null,\"IsEnabledForChatFriendsList\":\"true\",\"IsEnabledForChatGroupChatParticipants\":\"true\",\"IsEnabledForCustomGameLobby\":\"true\",\"IsEnabled\":\"true\",\"ChampionMasteryLookup\":\"true\",\"LeagueLookup\":\"true\",\"IsEnabledForTeamBuilderSuggestedPlayers\":\"true\"},\"SkinRentals\":{\"Enabled\":\"ON\"},\"ContextualEducation\":{\"TargetMinionsPerWave\":0.4,\"Enabled\":false,\"MaxTargetSummonerLevel\":10.0},\"DisabledChampionSkins\":{\"DisabledChampionSkins\":\"[]\"},\"ChampionMasteryConfig\":{\"Enabled\":true,\"MinSummonerLevel\":5,\"EndOfGameEnabled\":true,\"SupportedQueueTypes\":\"RANKED_SOLO_5x5,RANKED_TEAM_5x5,CAP_5x5,NORMAL,RANKED_PREMADE_3x3,RANKED_PREMADE_5x5,RANKED_TEAM_3x3,NORMAL_3x3,ARAM_UNRANKED_5x5,ASCENSION,KING_PORO\",\"MaxChampionLevel\":5,\"LootChestsEnabled\":true,\"ShowGradeAvailablePopup\":true,\"ChampionPointQueueTypes\":\"RANKED_SOLO_5x5,RANKED_TEAM_5x5,CAP_5x5,NORMAL,KING_PORO,ASCENSION\",\"GradeEnabled\":true,\"CapUnlockChampionLevel\":4},\"WardSkinConfig\":{\"WardSkinSelection\":true},\"EndOfGameGiftSettings\":{\"SenderGiftDailyMax\":5,\"GiftRecipientLevelMin\":5,\"GiftSenderRPMax\":50000,\"RecipientGiftDailyMax\":5,\"GiftSenderLevelMin\":15},\"Esports\":{\"NotificationsAssetMagickURL\":\"http://am-a.akamaihd.net/image/?f=\",\"NotificationsStreamGroupSlug\":\"eu-lcs,na-lcs\",\"NotificationsServiceEndpoint\":\"http://api.lolesports.com/api/v2/streamgroups\",\"NotificationsEnabled\":true,\"NotificationsStreamURL\":\"http://watch.lolesports.com?utm_source=euw_pvp_client\\u0026utm_medium=referral\\u0026utm_campaign=match_notifications\"},\"PlayerPreferences\":{\"Enabled\":true,\"ServiceEndpoint\":\"https://playerpreferences.riotgames.com:443\"},\"GameInvites\":{\"ServiceEnabled\":true,\"GameInviteServiceEnabled\":false,\"InviteBulkMaxSize\":200,\"LobbyCreationEnabled\":true},\"Chat\":{\"Rename_general_group_throttle\":1.0,\"Default_public_chat_rooms\":\"\",\"MaximumRosterSize\":325,\"ChatHistoryEnabled\":true,\"ChatHistoryThreshold\":1.0,\"MobileEnabled\":true},\"NewMatchHistory\":{\"Enabled\":true,\"PostIPXPToLegSEnabled\":true,\"SharingEnabled\":true},\"ContextualEducationURLs\":{\"LAST_HIT\":\"null\"},\"NewPlayerRouter\":{\"QueueID\":\"31\",\"ABDisablingOfTutorial\":true},\"TeamBuilderDraft\":{\"TakeoverEnabled\":true,\"SkinPurchaseEnabled\":false},\"Clubs\":{\"ClubsEnabled\":false,\"InviteToClubLobbyEnabled\":true,\"ClubServiceUrl\":\"https://clubs.leagueoflegends.com/\",\"ClubPresenceDecryptionKey\":\"-----BEGIN RSA PRIVATE KEY-----|MIICXAIBAAKBgQCIPHDgCEhsrODynDW4ecpo5JnQi31Iow9oq4x1pQvtMVynAtrq|zUj9eowbfi2dpcr8+fnpmJIs5+Q8LCT5KC2DmXVdzeDXR1VFh85GL7gSW81QWr0R|y1i/pLI5TIC+x1wx2zu74TmLm2rXCGnPmpYDWiLIg6AaKkgUKPaJe4i3DwIDAQAB|AoGAP1rELxsK+ybmMUy9mr1giKkOcrH7oCTcTJPCbQ9E3Zgf+zbTsW+n6uDrePmT|owVvwXdKZfxitelc9TKeOxQZHbN6ySjYmPWYRpzRzTK028TCxSoFA4Gbw7Y5pvCF|w6efflWMZFcbCY5pIhSRtl++hSk/xVTemXalEvnbIqMeZaECQQDXAAaurwa8D+6J|zcoZg1vBlQMOlxWEcZ8DBRXnC4K12EY2CXVCMHecCo3xPEw3zGi5bo9Hs9eff1j7|6E4AeZT/AkEAojdHA6DpZbjNKNIKzZbgo1q3aeHRHRpwYzRBdSjcxQrhS+JE2D5A|ZSAOg1OfnRuph+iOxaNHparSntAWLv2N8QJAYnyTkw+AMUPHDH8lVfyTWqDs7pEM|/UejBJoex2DBdpVkzDoW6cQT9nnrPZdWfrT3QAJCRiE+48RNOc/Xc2Y+dwJAHQvW|3HB4um0v10pdAtksWjPJOd1ki1iLnUfjHK53cZT0KJlYiHwFHdZyotNbdk9YuOxM|fFkzYBfJZQSPpFRkkQJBALAlNqBc4VPBKiwgBN9sHexfgCsVEnedrXsTsWXj1tCY|nK4RQUMFTs3uDucwju0fgLeef25CSdxxKBi2j1QhlzI=|-----END RSA PRIVATE KEY-----\"},\"SeasonReward\":{\"Maximum_team_reward_level\":3,\"Enabled\":false,\"ServiceCallEnabled\":true,\"QualificationWarningEnabled\":true,\"Minimum_points_per_reward_level\":\"20,45,75\",\"Minimum_win_team_reward_level_2\":35,\"Minimum_win_team_reward_level_1\":10,\"Minimum_win_team_reward_level_3\":75},\"LootConfig\":{\"NewPlayerChestEnabled\":true,\"Enabled\":true,\"PurchaseChestsEnabled\":true,\"MinSummonerLevel\":5,\"Visible\":true,\"NoRefundConfirmationEnabled\":false,\"EventChestsEnabled\":false},\"LeagueConfig\":{\"PromoHelperEnabled\":true,\"IsPreseason\":false,\"MasterTierEnabled\":true,\"PreseasonName\":\"2016\",\"SeasonName\":\"2016\"},\"ChampionTradeService\":{\"Enabled\":true},\"ChampionSelect\":{\"UseOptimizedChampSelectProcessor\":false,\"UseOptimizedSpellSelectProcessor\":false,\"AllChampsAvailableInAram\":false,\"UseOptimizedBotChampionSelectProcessor\":false,\"AutoReconnectEnabled\":true,\"CollatorChampionFilterEnabled\":false,\"AlwaysShowRewardIcon\":false},\"FeaturedGame\":{\"MetadataEnabled\":\"OFF\"}}" }; client.InvokeDestReceive("cn-" + targetSummoner._accId, "cn-" + targetSummoner._accId, "messagingDestination", clientConfig); } }
public static Task <LoginDataPacket> GetLoginPacket(RtmpClient client) { return(InvokeAsync <LoginDataPacket>(client, "clientFacadeService", "getLoginDataPacketForUser")); }
private static Task <Session> Login(RtmpClient client, AuthenticationCredentials auth) { return(InvokeAsync <Session>(client, "loginService", "login", auth)); }
internal async Task Login(AuthResult auth) { if (!Init.IsCompleted) { await Init; } if (auth.Content.Status != "LOGIN") { throw new ArgumentException("Invalid auth credentials"); } var context = Riot.Services.Service.RegisterObjects(); rtmp = new RtmpClient(new Uri("rtmps://" + Region.Current.MainServer + ":2099"), context, ObjectEncoding.Amf3); rtmp.MessageReceived += Rtmp_MessageReceived; rtmp.Disconnected += Rtmp_Disconnected; await rtmp.ConnectAsync(); chat.Connect(auth); LoginSession session = null; do { try { var creds = auth.GetAuthCredentials(); creds.ClientVersion = clientVersion; session = await LoginService.Login(creds); } catch (InvocationException x) when(x.RootCause is ClientVersionMismatchException) { var inner = (ClientVersionMismatchException)x.RootCause; clientVersion = (string)inner.SubstitutionArguments[1]; Log("Patch (DDragon outdated): " + clientVersion); } } while (session == null); string bc = $"bc-{session.AccountSummary.AccountId}"; string gn = $"gn-{session.AccountSummary.AccountId}"; string cn = $"cn-{session.AccountSummary.AccountId}"; await Task.WhenAll( rtmp.SubscribeAsync("my-rtmps", "messagingDestination", "bc", bc), rtmp.SubscribeAsync("my-rtmps", "messagingDestination", gn, gn), rtmp.SubscribeAsync("my-rtmps", "messagingDestination", cn, cn) ); await rtmp.LoginAsync(auth.Username.ToLower(), session.Token); string state = await AccountService.GetAccountState(); if (state != "ENABLED") { Log(state); throw new AuthenticationException("Not Enabled: " + state); } this.LoginQueue = auth.Content; this.loginSession = session; this.Me = await summoner.Connect(session); try { Authed?.Invoke(this, EventArgs.Empty); } catch (Exception x) { Log("Caught exception while dispatching auth: " + x); } BackEndServer.Async("/kappa/defer/auth", new JSONObject()); new Thread(HeartBeatLoop) { IsBackground = true }.Start(); }
public async Task <bool> ConnectAndLogin() { if (_useGarena) { //this.RaiseError("Garena servers are not yet supported.", ErrorType.Connect); //return false; } SetDefaultsParams(); RtmpClient = new RtmpClient(new Uri(_gameServer), SerializationContext, ObjectEncoding.Amf3); // ISSUE: reference to a compiler-generated field RtmpClient.MessageReceived += OnMessageReceived; LoginQueue loginQueue = new LoginQueue(Username, Password, Region); loginQueue.OnAuthFailed += message => RaiseError(message, ErrorType.Login); loginQueue.OnUpdateStatusMessage += (sender, s) => { if (OnUpdateStatusMessage == null) { return; } object sender1 = sender; string e = s; OnUpdateStatusMessage(sender1, e); }; if (!await loginQueue.GetAuthToken().ConfigureAwait(false)) { return(false); } this.AuthToken = loginQueue.AuthToken; this.UserId = loginQueue.UserId; Stopwatch sw = new Stopwatch(); sw.Start(); try { while (sw.ElapsedMilliseconds / 1000L <= ConnectTimeoutSeconds) { try { AsObject asObject = await RtmpClient.ConnectAsync().ConfigureAwait(false); sw.Stop(); goto label_13; } catch (Exception ex) { Tools.Log(ex.StackTrace); } await Task.Delay(5000).ConfigureAwait(false); continue; label_13: OnConnect?.Invoke((object)this, EventArgs.Empty); this.RtmpClient.SetChunkSize(int.MaxValue); AuthenticationCredentials cred = new AuthenticationCredentials() { Username = Username, Password = Password, ClientVersion = ClientVersion, Domain = "lolclient.lol.riotgames.com", Locale = _locale, OperatingSystem = "Windows 10", AuthToken = AuthToken }; if (_useGarena) { cred.PartnerCredentials = loginQueue.Token; cred.Username = loginQueue.User;//UserId cred.Password = null; } this.Session = await this.Login(cred).ConfigureAwait(false); string[] strArray = new string[3] { "gn", "cn", "bc" }; for (int index = 0; index < strArray.Length; ++index) { strArray[index] = string.Format("{0}-{1}", strArray[index], Session.AccountSummary.AccountId); } bool[] flagArray = await Task.WhenAll(new Task <bool>[3] { RtmpClient.SubscribeAsync("my-rtmps", "messagingDestination", strArray[0], strArray[0]), RtmpClient.SubscribeAsync("my-rtmps", "messagingDestination", strArray[1], strArray[1]), RtmpClient.SubscribeAsync("my-rtmps", "messagingDestination", "bc", strArray[2]) }).ConfigureAwait(false); if (_useGarena) { IsConnected = await RtmpClient.LoginAsync(cred.Username, Session.Token).ConfigureAwait(false); } else { IsConnected = await RtmpClient.LoginAsync(Username.ToLower(), Session.Token).ConfigureAwait(false); } //IsConnected = await RtmpClient.LoginAsync(Username.ToLower(), Session.Token).ConfigureAwait(false); _heartbeatTimer = new Timer(); _heartbeatTimer.Elapsed += new ElapsedEventHandler(DoHeartBeat); _heartbeatTimer.Interval = 120000.0; _heartbeatTimer.Start(); _uptime = DateTime.Now; OnLogin?.Invoke(Username); return(true); } sw.Stop(); RaiseError("Connection failed.", ErrorType.Connect); return(false); } catch (InvocationException ex) { if (ex.RootCause != null && ex.RootCause.GetType() == typeof(LoginFailedException)) { LoginFailedException rootCause = (LoginFailedException)ex.RootCause; string errorCode = rootCause.ErrorCode; if (!(errorCode == "LOGIN-0018")) { if (errorCode == "LOGIN-0019") { RaiseError("User blocked.", ErrorType.Login); return(false); } this.RaiseError(string.Format("{0}: {1}", "LoginFailedException", rootCause.ErrorCode).Trim(), ErrorType.Login); return(false); } RaiseError("Password change required.", ErrorType.Password); return(false); } if (!string.IsNullOrEmpty(ex.Message)) { RaiseError(ex.Message, ErrorType.Invoke); return(false); } } catch (Exception ex) { Tools.Log(ex.StackTrace); } finally { sw.Stop(); } this.RaiseError("Login failed with unknown error. Try again later.", ErrorType.Login); return(false); }
private static Task <T> InvokeAsync <T>(RtmpClient client, string destination, string method, params object[] argument) { return(client.InvokeAsync <T>("my-rtmps", destination, method, argument)); }