public void StartEnterCode(PokeRoutineExecutorBase b) { if (!CreateAssets) { return; } try { var file = GetBlockFileName(b); if (CopyImageFile && File.Exists(TradeBlockFile)) { File.Copy(TradeBlockFile, file); } else { File.WriteAllBytes(file, BlackPixel); } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) #pragma warning restore CA1031 // Do not catch general exception types { LogUtil.LogError(e.Message, nameof(StreamSettings)); } }
private void GenerateBotConnection <T>(PokeRoutineExecutorBase b, PokeTradeDetail <T> detail) where T : PKM, new() { var file = b.Connection.Name; var name = string.Format(TrainerTradeStart, detail.ID, detail.Trainer.TrainerName, (Species)detail.TradeData.Species); File.WriteAllText($"{file}.txt", name); }
public void StartTrade <T>(PokeRoutineExecutorBase b, PokeTradeDetail <T> detail, PokeTradeHub <T> hub) where T : PKM, new() { if (!CreateAssets) { return; } try { if (CreateTradeStart) { GenerateBotConnection(b, detail); } if (CreateWaitedTime) { GenerateWaitedTime(detail.Time); } if (CreateEstimatedTime) { GenerateEstimatedTime(hub); } if (CreateUsersInQueue) { GenerateUsersInQueue(hub.Queues.Info.Count); } if (CreateOnDeck) { GenerateOnDeck(hub); } if (CreateOnDeck2) { GenerateOnDeck2(hub); } if (CreateUserList) { GenerateUserList(hub); } if (CreateCompletedTrades) { GenerateCompletedTrades(hub); } if (CreateTradeStartSprite) { GenerateBotSprite(b, detail); } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) #pragma warning restore CA1031 // Do not catch general exception types { LogUtil.LogError(e.Message, nameof(StreamSettings)); } }
private static void GenerateBotSprite <T>(PokeRoutineExecutorBase b, PokeTradeDetail <T> detail) where T : PKM, new() { var func = CreateSpriteFile; if (func == null) { return; } var file = b.Connection.Name; var pk = detail.TradeData; func.Invoke(pk, $"sprite_{file}.png"); }
public void IdleAssets(PokeRoutineExecutorBase b) { if (!CreateAssets) { return; } try { var files = Directory.EnumerateFiles(Directory.GetCurrentDirectory(), "*", SearchOption.TopDirectoryOnly); foreach (var file in files) { if (file.Contains(b.Connection.Name)) { File.Delete(file); } } if (CreateWaitedTime) { File.WriteAllText("waited.txt", "00:00:00"); } if (CreateEstimatedTime) { File.WriteAllText("estimatedTime.txt", "Estimated time: 0 minutes"); File.WriteAllText("estimatedTimestamp.txt", ""); } if (CreateOnDeck) { File.WriteAllText("ondeck.txt", "Waiting..."); } if (CreateOnDeck2) { File.WriteAllText("ondeck2.txt", "Queue is empty!"); } if (CreateUserList) { File.WriteAllText("users.txt", "None"); } if (CreateUsersInQueue) { File.WriteAllText("queuecount.txt", "Users in Queue: 0"); } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) #pragma warning restore CA1031 // Do not catch general exception types { LogUtil.LogError(e.Message, nameof(StreamSettings)); } }
public void EndEnterCode(PokeRoutineExecutorBase b) { try { var file = GetBlockFileName(b); if (File.Exists(file)) { File.Delete(file); } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) #pragma warning restore CA1031 // Do not catch general exception types { LogUtil.LogError(e.Message, nameof(StreamSettings)); } }
private string GetBlockFileName(PokeRoutineExecutorBase b) => string.Format(TradeBlockFormat, b.Connection.Name);
public void Add(PokeRoutineExecutorBase newbot) => Add((RoutineExecutor <PokeBotState>)newbot);