public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime lifetime) { Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(_configuration) .WriteTo.Console(new JsonFormatter()) .Enrich.FromLogContext() .CreateLogger(); _logger.LogInformation("Starting service"); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } RunSSHDeamon(lifetime, loggerFactory.CreateLogger("sshd")); var executor = ShellHelper.Executor.WithWorkingDirectory(_configuration.GetValue <string>("REPO_LOCATION")) .ForwardEnvVariable("GIT_SSH"); var gitValidationFlow = new GitValidationFlow { Validators = { (Patterns.Manifests, new CircularDependencyValidator()), (Patterns.JPad, new CompileJPadValidator()) } }; var minioConfig = _configuration.GetSection("Minio"); var storageClient = Policy.Handle <Exception>() .WaitAndRetryAsync(3, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))) .ExecuteAsync(() => MinioBucketStorage.GetOrCreateBucket(CreateMinioClient(minioConfig), minioConfig.GetValue("Bucket", "tweek-ruleset"))) .Result; var natsClient = new NatsPublisher(_configuration.GetSection("Nats").GetValue <string>("Endpoint")); var versionPublisher = natsClient.GetSubjectPublisher("version"); var repoSynchronizer = new RepoSynchronizer(executor.WithUser("git").CreateCommandExecutor("git")); var storageSynchronizer = new StorageSynchronizer(storageClient, executor.WithUser("git"), new Packer()); storageSynchronizer.Sync(repoSynchronizer.CurrentHead().Result, checkForStaleRevision: false).Wait(); RunIntervalPublisher(lifetime, versionPublisher, repoSynchronizer, storageSynchronizer); var syncActor = SyncActor.Create(storageSynchronizer, repoSynchronizer, natsClient, lifetime.ApplicationStopping, loggerFactory.CreateLogger("SyncActor")); app.UseRouter(router => { router.MapGet("validate", ValidationHandler.Create(executor, gitValidationFlow, loggerFactory.CreateLogger <ValidationHandler>())); router.MapGet("sync", SyncHandler.Create(syncActor, _syncPolicy)); router.MapGet("push", PushHandler.Create(syncActor)); router.MapGet("log", async(req, res, routedata) => _logger.LogInformation(req.Query["message"])); router.MapGet("health", async(req, res, routedata) => await res.WriteAsync(JsonConvert.SerializeObject(new { }))); router.MapGet("version", async(req, res, routedata) => await res.WriteAsync(Assembly.GetEntryAssembly() .GetCustomAttribute <AssemblyInformationalVersionAttribute>().InformationalVersion)); }); }
public void OnSceneUnloaded(Scene scene) { if (scene.name == "GameCore") { if (SyncHandler.Instance != null) { SyncHandler.Destroy(); } if (ScoreMonitor.Instance != null) { ScoreMonitor.Destroy(); } if (FloatingScoreScreen.Instance != null) { FloatingScoreScreen.Destroy(); } if (DisablePause) { DisablePause = false; //We can't disable this up above since SyncHandler might need to know info about its status } if (client != null && client.Connected) { (client.Self as Player).PlayState = Player.PlayStates.Waiting; var playerUpdated = new Event(); playerUpdated.Type = Event.EventType.PlayerUpdated; playerUpdated.ChangedObject = client.Self; client.Send(new Packet(playerUpdated)); } } }
void GetChannels(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var channels = sync.GetAllChannels(); var packet = new IPCWriter(IPC.ChannelList); packet.Write(channels.Count); // server count foreach (var server in channels) { packet.Write((int)server.Key); // server id packet.Write(server.Value.Count); // channel count foreach (var channel in server.Value) { packet.Write(channel.Value.id); packet.Write(channel.Value.type); packet.Write((int)channel.Value.ip); packet.Write(channel.Value.port); packet.Write(channel.Value.maxPlayers); packet.Write(channel.Value.curPlayers); } } receiver.Send(packet); }
void AddChannel(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var serverId = data.ReadByte(); var channelId = data.ReadByte(); var type = data.ReadInt32(); var ip = data.ReadUInt32(); var port = data.ReadInt16(); var maxPlayers = data.ReadInt16(); if (!sync.ServerExists(serverId)) { sync.AddServer(serverId); } if (sync.ServerHasChannel(serverId, channelId)) { return; } sync.AddServerChannel(serverId, channelId, new ChannelData(channelId, type, ip, port, maxPlayers, 0)); receiver.SetServerInfo(serverId, channelId); if (!Configuration.serverDBs.ContainsKey(serverId)) { Configuration.LoadMasterServer(serverId); Log.Message("Connecting to Database for Server " + serverId.ToString() + "...", Log.DefaultFG); var db = new DatabaseHandler(Configuration.serverDBTypes[serverId], Configuration.serverDBIPs[serverId], Configuration.serverDBs[serverId], Configuration.serverDBUsers[serverId], Configuration.serverDBPasses[serverId]); sync.AddServerDB(serverId, db); } }
/// <summary> /// 安装Apk,先检测是否安装过相应版本 /// </summary> /// <param name="path"></param> /// <param name="option"></param> /// <param name="error"></param> /// <returns></returns> public bool Install(string path, string option = null, Action <ErrorResult> error = null) { var flag = true; // 上传Apk var are = new AutoResetEvent(false); var sync = new SyncHandler(serial) { Exit = success => { flag = success; are.Set(); } }; sync.BeginPush(path, "/data/local/tmp/base.apk", 0100777, error ?? this.error); // 等待文件上传成功 are.WaitOne(); if (!flag) { return(flag); } // 执行安装命令 var cmd = $"pm install {option} /data/local/tmp/base.apk"; var res = ShellExecuter.Execute(serial, cmd, error ?? this.error); flag = !string.IsNullOrEmpty(res) && res.Contains("Success"); return(flag); }
public async Task SyncImplementation() { var handler = new SyncHandler(); var services = new ServiceCollection().AddSingleton <IRequestHandler <StringRequest, string> >(handler); var mediator = new Mediator(services.BuildServiceProvider()); (await mediator.Send(new StringRequest())).ShouldBe("success"); }
void AddUser(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var magic = data.ReadUInt64(); var id = data.ReadInt32(); if (!sync.UserExists(magic)) { sync.AddUser(magic, id); } }
public void OnSync(Int64 eventId) { if (Sync != null) { foreach (SyncHandler syncHandler in Sync.GetInvocationList()) { try { Sync(eventId); } catch (SocketException) { Sync -= syncHandler; } } } }
void GetUser(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var magic = data.ReadUInt64(); var packet = new IPCWriter(IPC.GetUser); if (!sync.UserExists(magic)) { packet.Write(-1); receiver.Send(packet); return; } var id = sync.GetUser(magic); packet.Write(id); receiver.Send(packet); }
/*********************************************************************/ /* Insert into local store */ /*********************************************************************/ public void PurgeDatabaseAsync() { CurrentUser = null; _assignmentTable = null; _courseTable = null; _professorTable = null; _eventsTable = null; _eventSignupTable = null; _studentEventTable = null; _offenseTable = null; _offenseCategoryTable = null; _fourWindsTable = null; _varsityTable = null; _grabAndGoTable = null; _localTokenTable = null; _azureTokenTable = null; _studentTable = null; _attendanceTable = null; _eagleDatabase = null; _syncHandler = null; }
/*********************************************************************/ /* Initialize the database and specify locally persistent tables */ /*********************************************************************/ public async Task InitLocalStore() { _eagleDatabase = new MobileServiceSQLiteStore(App.DatabaseName); //_eagleDatabase = MobileServiceClient.EnsureFileExists(App.DatabaseName); /* Define all the tables */ DefineTables(); /* Create the sync handler and specify tables to exclude */ _syncHandler = new SyncHandler(); _syncHandler.Exclude <LocalToken>(); /* Sync or something */ await _client.SyncContext.InitializeAsync(_eagleDatabase, _syncHandler); /* Get references to the tables */ GetReferences(); CurrentUser = App.Locator.User; }
public void OnSync(Int64 eventId) { if (Sync != null) { foreach (SyncHandler syncHandler in Sync.GetInvocationList()) { try { Sync(eventId); } catch (SocketException) { Sync -= syncHandler; } } } }
internal SyncNotificationInfo(SyncHandler _enclosing) { throw new System.NotImplementedException(); }
protected override void Client_PacketRecieved(Packet packet) { base.Client_PacketRecieved(packet); if (packet.Type == PacketType.PlaySong) { PlaySong playSong = packet.SpecificPacket as PlaySong; var desiredLevel = SongUtils.masterLevelList.First(x => x.levelID == playSong.Beatmap.LevelId); var desiredCharacteristic = desiredLevel.previewDifficultyBeatmapSets.FirstOrDefault(x => x.beatmapCharacteristic.serializedName == playSong.Beatmap.Characteristic.SerializedName).beatmapCharacteristic ?? desiredLevel.previewDifficultyBeatmapSets.First().beatmapCharacteristic; var desiredDifficulty = (BeatmapDifficulty)playSong.Beatmap.Difficulty; var playerData = Resources.FindObjectsOfTypeAll <PlayerDataModel>().First().playerData; var playerSettings = playerData.playerSpecificSettings; //Override defaults if we have forced options enabled if (playSong.PlayerSettings.Options != PlayerOptions.None) { playerSettings = new PlayerSpecificSettings(); playerSettings.leftHanded = playSong.PlayerSettings.Options.HasFlag(PlayerOptions.LeftHanded); playerSettings.staticLights = playSong.PlayerSettings.Options.HasFlag(PlayerOptions.StaticLights); playerSettings.noTextsAndHuds = playSong.PlayerSettings.Options.HasFlag(PlayerOptions.NoHud); playerSettings.advancedHud = playSong.PlayerSettings.Options.HasFlag(PlayerOptions.AdvancedHud); playerSettings.reduceDebris = playSong.PlayerSettings.Options.HasFlag(PlayerOptions.ReduceDebris); } var gameplayModifiers = new GameplayModifiers(); gameplayModifiers.batteryEnergy = playSong.GameplayModifiers.Options.HasFlag(GameOptions.BatteryEnergy); gameplayModifiers.disappearingArrows = playSong.GameplayModifiers.Options.HasFlag(GameOptions.DisappearingArrows); gameplayModifiers.failOnSaberClash = playSong.GameplayModifiers.Options.HasFlag(GameOptions.FailOnClash); gameplayModifiers.fastNotes = playSong.GameplayModifiers.Options.HasFlag(GameOptions.FastNotes); gameplayModifiers.ghostNotes = playSong.GameplayModifiers.Options.HasFlag(GameOptions.GhostNotes); gameplayModifiers.instaFail = playSong.GameplayModifiers.Options.HasFlag(GameOptions.InstaFail); gameplayModifiers.noBombs = playSong.GameplayModifiers.Options.HasFlag(GameOptions.NoBombs); gameplayModifiers.noFail = playSong.GameplayModifiers.Options.HasFlag(GameOptions.NoFail); gameplayModifiers.noObstacles = playSong.GameplayModifiers.Options.HasFlag(GameOptions.NoObstacles); gameplayModifiers.noArrows = playSong.GameplayModifiers.Options.HasFlag(GameOptions.NoArrows); if (playSong.GameplayModifiers.Options.HasFlag(GameOptions.SlowSong)) { gameplayModifiers.songSpeed = GameplayModifiers.SongSpeed.Slower; } if (playSong.GameplayModifiers.Options.HasFlag(GameOptions.FastSong)) { gameplayModifiers.songSpeed = GameplayModifiers.SongSpeed.Faster; } var colorScheme = playerData.colorSchemesSettings.overrideDefaultColors ? playerData.colorSchemesSettings.GetSelectedColorScheme() : null; PlaySong?.Invoke(desiredLevel, desiredCharacteristic, desiredDifficulty, gameplayModifiers, playerSettings, playerData.overrideEnvironmentSettings, colorScheme, playSong.FloatingScoreboard, playSong.StreamSync, playSong.DisablePause, playSong.DisableFail); } else if (packet.Type == PacketType.Command) { Command command = packet.SpecificPacket as Command; if (command.CommandType == Command.CommandTypes.ReturnToMenu) { if (SyncHandler.Instance != null) { ScreenOverlay.Instance.Clear(); } if ((Self as Player).PlayState == Player.PlayStates.InGame) { PlayerUtils.ReturnToMenu(); } } else if (command.CommandType == Command.CommandTypes.ScreenOverlay_ShowPng) { ScreenOverlay.Instance.ShowPng(); } else if (command.CommandType == Command.CommandTypes.DelayTest_Finish) { UnityMainThreadDispatcher.Instance().Enqueue(() => { ScreenOverlay.Instance.Clear(); SyncHandler.Instance.Resume(); SyncHandler.Destroy(); }); } } else if (packet.Type == PacketType.LoadSong) { LoadSong loadSong = packet.SpecificPacket as LoadSong; Action <IBeatmapLevel> SongLoaded = (loadedLevel) => { //Send updated download status (Self as Player).DownloadState = Player.DownloadStates.Downloaded; var playerUpdate = new Event(); playerUpdate.Type = Event.EventType.PlayerUpdated; playerUpdate.ChangedObject = Self; Send(new Packet(playerUpdate)); //Notify any listeners of the client that a song has been loaded LoadedSong?.Invoke(loadedLevel); Logger.Debug($"SENT DOWNLOADED SIGNAL {(playerUpdate.ChangedObject as Player).DownloadState}"); }; if (OstHelper.IsOst(loadSong.LevelId)) { SongLoaded?.Invoke(SongUtils.masterLevelList.First(x => x.levelID == loadSong.LevelId) as BeatmapLevelSO); } else { if (SongUtils.masterLevelList.Any(x => x.levelID == loadSong.LevelId)) { SongUtils.LoadSong(loadSong.LevelId, SongLoaded); } else { Action <bool> loadSongAction = (succeeded) => { if (succeeded) { SongUtils.LoadSong(loadSong.LevelId, SongLoaded); } else { (Self as Player).DownloadState = Player.DownloadStates.DownloadError; var playerUpdated = new Event(); playerUpdated.Type = Event.EventType.PlayerUpdated; playerUpdated.ChangedObject = Self; Send(new Packet(playerUpdated)); Logger.Debug($"SENT DOWNLOADED SIGNAL {(playerUpdated.ChangedObject as Player).DownloadState}"); } }; (Self as Player).DownloadState = Player.DownloadStates.Downloading; var playerUpdate = new Event(); playerUpdate.Type = Event.EventType.PlayerUpdated; playerUpdate.ChangedObject = Self; Send(new Packet(playerUpdate)); Logger.Debug($"SENT DOWNLOAD SIGNAL {(playerUpdate.ChangedObject as Player).DownloadState}"); SongDownloader.DownloadSong(loadSong.LevelId, songDownloaded: loadSongAction, downloadProgressChanged: (progress) => Logger.Debug($"DOWNLOAD PROGRESS: {progress}")); } } } else if (packet.Type == PacketType.File) { File file = packet.SpecificPacket as File; if (file.Intention == File.Intentions.SetPngToShowWhenTriggered) { var pngBytes = file.Compressed ? CompressionUtils.Decompress(file.Data) : file.Data; ScreenOverlay.Instance.SetPngBytes(pngBytes); } else if (file.Intention == File.Intentions.ShowPngImmediately) { var pngBytes = file.Compressed ? CompressionUtils.Decompress(file.Data) : file.Data; ScreenOverlay.Instance.SetPngBytes(pngBytes); ScreenOverlay.Instance.ShowPng(); } Send(packet.From, new Packet(new Acknowledgement() { PacketId = packet.Id, Type = Acknowledgement.AcknowledgementType.FileDownloaded })); } }
public void SetSyncHandler(SyncHandler syncHandler) { SyncHandler = syncHandler; }
/// <exception cref="NotAvailableException">Channel object is no longer available.</exception> /// <exception cref="BassErrorException"> /// Some error occur to call a Bass function, check the error code and error message /// to get more error information. /// </exception> /// <exception cref="BassNotLoadedException"> /// Bass DLL not loaded, you must use <see cref="BassManager.Initialize" /> to /// load Bass DLL first. /// </exception> IntPtr IChannelInternal.SetSyncCallback(SyncHandlerType type, UInt64 param, SyncHandler handler, IntPtr user) { CheckAvailable(); return ChannelModule.ChannelSetSyncFunction.CheckResult(ChannelModule.ChannelSetSyncFunction.Delegate(Handle, type, param, handler, user)); }
void HeartBeat(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var packet = new IPCWriter(IPC.HeartBeat); receiver.Send(packet); }
protected override void Client_PacketReceived(Packet packet) { base.Client_PacketReceived(packet); if (packet.Type == PacketType.PlaySong) { PlaySong playSong = packet.SpecificPacket as PlaySong; var desiredLevel = SongUtils.masterLevelList.First(x => x.levelID == playSong.GameplayParameters.Beatmap.LevelId); var desiredCharacteristic = desiredLevel.previewDifficultyBeatmapSets.FirstOrDefault(x => x.beatmapCharacteristic.serializedName == playSong.GameplayParameters.Beatmap.Characteristic.SerializedName).beatmapCharacteristic ?? desiredLevel.previewDifficultyBeatmapSets.First().beatmapCharacteristic; var desiredDifficulty = (BeatmapDifficulty)playSong.GameplayParameters.Beatmap.Difficulty; var playerData = Resources.FindObjectsOfTypeAll <PlayerDataModel>().First().playerData; var playerSettings = playerData.playerSpecificSettings; //Override defaults if we have forced options enabled if (playSong.GameplayParameters.PlayerSettings.Options != PlayerOptions.None) { playerSettings = new PlayerSpecificSettings( playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.StaticLights), playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.LeftHanded), playSong.GameplayParameters.PlayerSettings.PlayerHeight, playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AutoPlayerHeight), playSong.GameplayParameters.PlayerSettings.SfxVolume, playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.ReduceDebris), playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.NoHud), playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.NoFailEffects), playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AdvancedHud), playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AutoRestart), playSong.GameplayParameters.PlayerSettings.SaberTrailIntensity, playSong.GameplayParameters.PlayerSettings.NoteJumpStartBeatOffset, playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.HideNoteSpawnEffect), playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AdaptiveSfx) ); } var songSpeed = GameplayModifiers.SongSpeed.Normal; if (playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.SlowSong)) { songSpeed = GameplayModifiers.SongSpeed.Slower; } if (playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.FastSong)) { songSpeed = GameplayModifiers.SongSpeed.Faster; } var gameplayModifiers = new GameplayModifiers( playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.DemoNoFail), playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.DemoNoObstacles), playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.BatteryEnergy) ? GameplayModifiers.EnergyType.Battery : GameplayModifiers.EnergyType.Bar, playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoFail), playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.InstaFail), playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.FailOnClash), playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoObstacles) ? GameplayModifiers.EnabledObstacleType.NoObstacles : GameplayModifiers.EnabledObstacleType.All, playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoBombs), playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.FastNotes), playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.StrictAngles), playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.DisappearingArrows), songSpeed, playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoArrows), playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.GhostNotes) ); var colorScheme = playerData.colorSchemesSettings.overrideDefaultColors ? playerData.colorSchemesSettings.GetSelectedColorScheme() : null; //Disable score submission if nofail is on. This is specifically for Hidden Sabers, though it may stay longer if (playSong.DisableScoresaberSubmission) { BS_Utils.Gameplay.ScoreSubmission.DisableSubmission(SharedConstructs.Name); } if (playSong.ShowNormalNotesOnStream) { var customNotes = IPA.Loader.PluginManager.GetPluginFromId("CustomNotes"); if (customNotes != null) { EnableHMDOnly(); } } PlaySong?.Invoke(desiredLevel, desiredCharacteristic, desiredDifficulty, gameplayModifiers, playerSettings, playerData.overrideEnvironmentSettings, colorScheme, playSong.FloatingScoreboard, playSong.StreamSync, playSong.DisablePause, playSong.DisableFail); } else if (packet.Type == PacketType.Command) { Command command = packet.SpecificPacket as Command; if (command.CommandType == Command.CommandTypes.ReturnToMenu) { if (SyncHandler.Instance != null) { ScreenOverlay.Instance.Clear(); } if ((Self as Player).PlayState == Player.PlayStates.InGame) { PlayerUtils.ReturnToMenu(); } } else if (command.CommandType == Command.CommandTypes.ScreenOverlay_ShowPng) { ScreenOverlay.Instance.ShowPng(); } else if (command.CommandType == Command.CommandTypes.DelayTest_Finish) { UnityMainThreadDispatcher.Instance().Enqueue(() => { ScreenOverlay.Instance.Clear(); SyncHandler.Instance.Resume(); SyncHandler.Destroy(); }); } } else if (packet.Type == PacketType.LoadSong) { LoadSong loadSong = packet.SpecificPacket as LoadSong; Action <IBeatmapLevel> SongLoaded = (loadedLevel) => { //Send updated download status (Self as Player).DownloadState = Player.DownloadStates.Downloaded; var playerUpdate = new Event(); playerUpdate.Type = Event.EventType.PlayerUpdated; playerUpdate.ChangedObject = Self; Send(new Packet(playerUpdate)); //Notify any listeners of the client that a song has been loaded LoadedSong?.Invoke(loadedLevel); }; if (OstHelper.IsOst(loadSong.LevelId)) { SongLoaded?.Invoke(SongUtils.masterLevelList.First(x => x.levelID == loadSong.LevelId) as BeatmapLevelSO); } else { if (SongUtils.masterLevelList.Any(x => x.levelID == loadSong.LevelId)) { SongUtils.LoadSong(loadSong.LevelId, SongLoaded); } else { Action <string, bool> loadSongAction = (hash, succeeded) => { if (succeeded) { SongUtils.LoadSong(loadSong.LevelId, SongLoaded); } else { (Self as Player).DownloadState = Player.DownloadStates.DownloadError; var playerUpdated = new Event(); playerUpdated.Type = Event.EventType.PlayerUpdated; playerUpdated.ChangedObject = Self; Send(new Packet(playerUpdated)); } }; (Self as Player).DownloadState = Player.DownloadStates.Downloading; var playerUpdate = new Event(); playerUpdate.Type = Event.EventType.PlayerUpdated; playerUpdate.ChangedObject = Self; Send(new Packet(playerUpdate)); SongDownloader.DownloadSong(loadSong.LevelId, songDownloaded: loadSongAction, downloadProgressChanged: (hash, progress) => Logger.Debug($"DOWNLOAD PROGRESS ({hash}): {progress}"), customHostUrl: loadSong.CustomHostUrl); } } } else if (packet.Type == PacketType.File) { File file = packet.SpecificPacket as File; if (file.Intent == File.Intentions.SetPngToShowWhenTriggered) { var pngBytes = file.Compressed ? CompressionUtils.Decompress(file.Data) : file.Data; ScreenOverlay.Instance.SetPngBytes(pngBytes); } else if (file.Intent == File.Intentions.ShowPngImmediately) { var pngBytes = file.Compressed ? CompressionUtils.Decompress(file.Data) : file.Data; ScreenOverlay.Instance.SetPngBytes(pngBytes); ScreenOverlay.Instance.ShowPng(); } Send(packet.From, new Packet(new Acknowledgement() { PacketId = packet.Id, Type = Acknowledgement.AcknowledgementType.FileDownloaded })); } }
public void StartScan() { Debug.WriteLine("XAML: Start Scan..."); SyncHandler.GetInstance().StartScan(); }