private void Form1_Load(object sender, EventArgs e) { // we wanna know when device list changes YAPI.RegisterDeviceArrivalCallback(devicelistchanged); YAPI.RegisterDeviceRemovalCallback(devicelistchanged); moduleInventory(); UpdateListTimer.Interval = 1000; UpdateListTimer.Start(); }
public Vysor() { InitializeComponent(); _channelFactory = new DuplexChannelFactory <IListener>(new ClientCallBack(), "ListenerServiceEndPoint"); Server = _channelFactory.CreateChannel(); string hostName = null; string winVer = null; string campaing = null; string audioVar = null; string loginSince = null; string windowsLockScreen = null; ScreensLbl.Visible = false; using (RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\WOW6432Node\\Microsoft\\MOS\\BURAN")) { if (key != null) { Object o = key.GetValue("USER_BURAN");// if (o != null) { hostName = o.ToString(); } o = key.GetValue("VERSAOWINDOWS_INSTALACAO"); if (o != null) { winVer = o.ToString(); } o = key.GetValue("CAMPANHA"); if (o != null) { campaing = o.ToString(); } o = key.GetValue("VARIACAO"); if (o != null) { audioVar = o.ToString(); } o = key.GetValue("WINDOWS_LOGADO_HORARIO"); if (o != null) { loginSince = o.ToString(); } o = key.GetValue("WINDOWS_LOGADO"); if (o != null) { windowsLockScreen = o.ToString(); } } } UpdateListTimer.Start(); UserInfoTimer.Start(); //Server.Login(Environment.UserName, hostName, campaing, winVer, loginSince, true); }
private void HostPlugin_PlayerNewRecord(object sender, PlayerNewRecordEventArgs e) { RunCatchLog(() => { if (!e.OldPosition.HasValue) { if (Settings.ShowMessages) { string message = FormatMessage(Settings.FirstLocalRankMessage, "Nickname", StripTMColorsAndFormatting(e.Nickname), "Rank", e.NewPosition.ToString()); Context.RPCClient.Methods.SendNotice(message, e.Login, Convert.ToInt32(Settings.NoticeDelayInSeconds)); Context.RPCClient.Methods.ChatSendServerMessage(message); } } else if (e.NewPosition > e.OldPosition) { if (Settings.ShowMessages) { string message = FormatMessage(Settings.NewLocalRankMessage, "Nickname", StripTMColorsAndFormatting(e.Nickname), "OldRank", e.OldPosition.ToString(), "NewRank", e.NewPosition.ToString()); Context.RPCClient.Methods.SendNotice(message, e.Login, Convert.ToInt32(Settings.NoticeDelayInSeconds)); Context.RPCClient.Methods.ChatSendServerMessage(message); } } else { if (Settings.ShowMessages) { string message = FormatMessage(Settings.ImprovedLocalRankMessage, "Nickname", StripTMColorsAndFormatting(e.Nickname), "Rank", e.NewPosition.ToString()); Context.RPCClient.Methods.SendNotice(message, e.Login, Convert.ToInt32(Settings.NoticeDelayInSeconds)); Context.RPCClient.Methods.ChatSendServerMessage(message); } } if (Settings.ShowPBUserInterface) { SendPBManiaLinkPage(e.Login, Convert.ToUInt32(e.TimeOrScore)); } if (LocalBestTimeOrScore == null || e.TimeOrScore < LocalBestTimeOrScore) { LocalBestTimeOrScore = Convert.ToUInt32(e.TimeOrScore); if (Settings.ShowLocalRecordUserInterface) { UpdateLocalRecordTimer.Enqueue(SendLocalRecordManiaLinkPageToAll, null); } //SendLocalRecordManiaLinkPageToAll(); } if (Settings.ShowLocalRecordUserInterface) { UpdateListTimer.Enqueue(SendRecordListToAllPlayers, HostPlugin.LocalRecords); } //SendRecordListToAllPlayers(HostPlugin.LocalRecords); }, "Error in HostPlugin_PlayerNewRecord Method.", true); }
protected override void Dispose(bool connectionLost) { UpdateListTimer.Stop(); UpdateRecordTimer.Stop(); HostPlugin.RankChanged -= HostPlugin_RankChanged; HostPlugin.RankingsChanged -= HostPlugin_RankingsChanged; Context.RPCClient.Callbacks.PlayerConnect -= Callbacks_PlayerConnect; Context.RPCClient.Callbacks.EndRace -= Callbacks_EndRace; if (!connectionLost) { SendEmptyManiaLinkPage(_dedimaniaManiaLinkPageID); SendEmptyManiaLinkPage(_dedimaniaRecordListManiaLinkPageID); } }
private void HostPlugin_RankingsChanged(object sender, EventArgs <DedimaniaRanking[]> e) { RunCatchLog(() => { if (Settings.ShowRecordUI) { UpdateRecordTimer.Enqueue(SendDedimaniaRecordManiaLinkPageToAll, null); } //SendDedimaniaRecordManiaLinkPageToAll(); if (Settings.ShowRecordListUI) { UpdateListTimer.Enqueue(SendRecordListToAllPlayers, new List <DedimaniaRanking>(e.Value).ToArray()); } //SendRecordListToAllPlayers(e.Value); }, "Error in HostPlugin_RankingsChanged Method.", false); }
private void Callbacks_EndRace(object sender, TMSPS.Core.Communication.EventArguments.Callbacks.EndRaceEventArgs e) { RunCatchLog(() => { UpdateListTimer.Clear(); UpdateRecordTimer.Clear(); if (Settings.ShowRecordUI) { SendEmptyManiaLinkPage(_dedimaniaManiaLinkPageID); } if (Settings.ShowRecordListUI && Settings.HideRecordListUIOnFinish) { SendEmptyManiaLinkPage(_dedimaniaRecordListManiaLinkPageID); } }, "Error in Callbacks_EndRace Method.", false); }
protected override void Dispose(bool connectionLost) { UpdateListTimer.Stop(); UpdateLocalRecordTimer.Stop(); HostPlugin.PlayerNewRecord -= HostPlugin_PlayerNewRecord; HostPlugin.LocalRecordsDetermined -= HostPlugin_LocalRecordsDetermined; HostPlugin.PlayerWins -= HostPlugin_PlayerWins; Context.RPCClient.Callbacks.EndRace -= Callbacks_EndRace; Context.RPCClient.Callbacks.PlayerConnect -= Callbacks_PlayerConnect; Context.RPCClient.Callbacks.PlayerChat -= Callbacks_PlayerChat; if (!connectionLost) { SendEmptyManiaLinkPage(_localRecordListManiaLinkPageID); SendEmptyManiaLinkPage(_localRecordManiaLinkPageID); SendEmptyManiaLinkPage(_pbManiaLinkPageID); } }
private void Callbacks_EndRace(object sender, EndRaceEventArgs e) { RunCatchLog(() => { UpdateListTimer.Clear(); UpdateLocalRecordTimer.Clear(); if (Settings.ShowPBUserInterface) { SendEmptyManiaLinkPage(_pbManiaLinkPageID); } if (Settings.ShowLocalRecordUserInterface) { SendEmptyManiaLinkPage(_localRecordManiaLinkPageID); } if (Settings.ShowLocalRecordListUserInterface && Settings.HideRecordListUIOnFinish) { SendEmptyManiaLinkPage(_localRecordListManiaLinkPageID); } }, "Error in Callbacks_EndRace Method.", true); }