public RunExp(string full_api_token, int fleet_id, int mission_id, int interval) { this.kcp = new KanColleProxy(full_api_token); this.fleet_id = fleet_id; this.mission_id = mission_id; this.interval = interval; this.run_count = 0; this.member_id = getMemberId(); this.port = this.kcp.GetPort(this.member_id); getShipList(fleet_id); this.accumulated = new int[4] { 0, 0, 0, 0 }; // Debug. /* * Console.WriteLine(this.member_id); * Console.WriteLine(this.ship_list); */ // Run once only. checkIfExistingMission(); }
void Start() { KanColleProxy.Start(); r_Owner.Page = r_Owner.GameInformation; Step = InitializationStep.None; }
public RunExpKai() { InitializeComponent(); // Debug flag. Set to true only for debug builds. this.debug = false; // Read in api token, read in api_port, initialize the interfaces. Console.OutputEncoding = Encoding.Unicode; StreamReader reader = new StreamReader(API_TOKEN_DIR); string full_api_token = reader.ReadLine(); reader.Close(); this.flash.LoadMovie(0, API_PORT_DIR); this.eip = new ExternalInterfaceProxy(this.flash); this.kcp = new KanColleProxy(full_api_token); // Run once on program startup to fetch initial data. this.member_id = int.Parse(this.kcp.GetBasic().api_member_id); this.port = this.kcp.GetPort(this.member_id.ToString()); this.mission_list = this.kcp.GetStart2().api_mst_mission; this.fleet_lists = new int[4][]; this.fleet_lists[0] = null; this.fleet_lists[1] = this.port.api_deck_port[1].api_ship; this.fleet_lists[2] = this.port.api_deck_port[2].api_ship; this.fleet_lists[3] = this.port.api_deck_port[3].api_ship; this.accumulated = new int[4][]; }
public ItemLog(KanColleProxy proxy) { proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request)); this.Filename = "DevelopmentLog.csv"; this.LoggerName = "Development"; this.DefaultFormat = "{0},{2},{3},{4},{5},{6},{7}"; }
public MainWindow() { InitializeComponent(); // Initialization stuff // Update UI elements if user data is available // Initialize RunExps. this.Fleet2 = new RunExp(this); this.Fleet3 = new RunExp(this); this.Fleet4 = new RunExp(this); // Initialize member ship list but do nothing this.ShipList_Member = new Dictionary <int, KanColle.Member.Ship>(); // Read in master ship list KanColle.Master.Ship[] ships = KanColleProxy.ParseArbitraryJSON <KanColle.Master.Ship[]>("shiplist.dat"); this.ShipList_Master = new Dictionary <int, KanColle.Master.Ship>(); foreach (KanColle.Master.Ship ship in ships) { this.ShipList_Master.Add(ship.api_id, ship); } // Read in master mission list KanColle.Master.Mission[] missions = KanColleProxy.ParseArbitraryJSON <KanColle.Master.Mission[]>("missionlist.dat"); this.MissionList_Master = new Dictionary <int, KanColle.Master.Mission>(); foreach (KanColle.Master.Mission mission in missions) { this.MissionList_Master.Add(mission.api_id, mission); } // Put in mission list into ComboBoxes this.Fleet_2_Select.ItemsSource = this.MissionList_Master.Values; this.Fleet_3_Select.ItemsSource = this.MissionList_Master.Values; this.Fleet_4_Select.ItemsSource = this.MissionList_Master.Values; // Set collected values for this session to 0. this.fuel = 0; this.ammo = 0; this.steel = 0; this.baux = 0; // Try to read from user prefs // and preload them. if (!File.Exists("settings.ini")) { File.Create("settings.ini"); } else { StreamReader reader = new StreamReader("settings.ini"); string api_token = reader.ReadLine(); string fleet2settings = reader.ReadLine(); string fleet3settings = reader.ReadLine(); string fleet4settings = reader.ReadLine(); this.Api_Token_Box.Text = api_token; } }
public Sparkler(string full_api_token, int fleet_id) { this.kcp = new KanColleProxy(full_api_token); this.fleet_id = fleet_id; this.member_id = getMemberId(); this.ship_list_array = getShipListArray(this.fleet_id); }
private void SetBattleResultDisposable(KanColleProxy proxy) { var comBatResult = proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => Update(x.Data)); var batResult = proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => Update(x.Data)); _CompositDisposable.Add(comBatResult); _CompositDisposable.Add(batResult); }
public UpdateMaterial(KanColleProxy proxy) { proxy.api_port.TryParse <kcsapi_port>().Subscribe(x => { update(x.Data.api_material); }); proxy.api_get_member_material.TryParse <kcsapi_material[]>().Subscribe(x => update(x.Data)); }
public Sparkler(string full_api_token, int fleet_id) { this.kcp = new KanColleProxy(full_api_token); this.fleet_id = fleet_id; this.member_id = getMemberId(); this.ship_list_array = getShipListArray(this.fleet_id); }
public BattleLog(KanColleProxy proxy) { proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data)); proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>().Subscribe(x => this.BattleResult(x.Data)); this.Filename = "BattleLog.csv"; this.LoggerName = "BattleResults"; this.DefaultFormat = "{0},{2},{3},{4},{5}"; }
public Teitoku(string api_token, string server) { this.Proxy = new KanColleProxy(api_token, server); UpdateBasic(); UpdatePort(); // UpdateStart2(); }
public ItemDestroyCounter(KanColleProxy proxy) { proxy.api_req_kousyou_destroyitem2 .TryParse() .Where(x => x.IsSuccess) .Subscribe(_ => this.Count++); this.Text = "Number of scrapped equipment"; }
public ItemDestroyCounter(KanColleProxy proxy) { proxy.api_req_kousyou_destroyitem2 .TryParse() .Where(x => x.IsSuccess) .Subscribe(_ => this.Count++); this.Text = "장비분해횟수"; }
public SupplyCounter(KanColleProxy proxy) { proxy.api_req_hokyu_charge .TryParse() .Where(x => x.IsSuccess) .Subscribe(_ => this.Count++); this.Text = "칸무스 보급횟수"; }
public ConstructionLog(KanColleProxy proxy) { this.shipmats = new int[5]; proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request)); proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data)); this.Filename = "ConstructionLog.csv"; this.LoggerName = "Construction"; this.DefaultFormat = "{0},{2},{3},{4},{5},{6},{7}"; }
public MissionCounter(KanColleProxy proxy) { proxy.api_req_mission_result .TryParse <kcsapi_mission_result>() .Where(x => x.IsSuccess) .Where(x => x.Data.api_clear_result == 1 || x.Data.api_clear_result == 2) .Subscribe(_ => this.Count++); this.Text = "원정성공횟수"; }
internal Logger(KanColleProxy proxy) { this.shipmats = new int[5]; proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request)); proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request)); proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data)); proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data)); proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>().Subscribe( x => this.CombinedBattleResult(x.Data)); }
private void SetMapDisposable(KanColleProxy proxy) { var mapStart = proxy.api_req_map_start.TryParse <kcsapi_map_start>().Subscribe(x => Create(x.Data)); _CompositDisposable.Add(mapStart); var next = KanColleClient.Current.Proxy.ApiSessionSource.Where (x => x.Request.PathAndQuery == "/kcsapi/api_req_map/next").TryParse <kcsapi_map_start>().Subscribe(x => Update(x.Data)); _CompositDisposable.Add(next); }
//initialize internal Logger(KanColleProxy proxy) { this.shipmats = new int[5]; proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request)); proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request)); proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data)); proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data)); proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>().Subscribe(x => this.CombinedBattleResult(x.Data)); //proxy.api_req_sortie_battleresult.TryParse<kcsapi_map_start>().Subscribe(x => this.MapStart(x.Data)); proxy.api_get_member_material.TryParse <kcsapi_material[]>().Subscribe(x => this.MaterialsHistory(x.Data)); proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x => this.MaterialsHistory(x.Data.api_material)); proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(x => this.MaterialsHistory(x.Data.api_material)); }
public ResponseFileWriter(KanColleProxy proxy) { this.Log = new DispatcherCollection <string>(DispatcherHelper.UIDispatcher); //kcsとkcsapi以下を保存。キャッシュにある奴は保存されない。 var kscSessionSource = proxy.SessionSource .Where(s => s.Request.PathAndQuery.StartsWith("/kcs/") || s.Request.PathAndQuery.StartsWith("/kcsapi/")); kscSessionSource.Subscribe(s => s.SaveResponseBody(s.GetSaveFilePath())); kscSessionSource .Subscribe(s => Log.Add(DateTimeOffset.Now.ToString("HH:mm:ss : ") + s.Request.PathAndQuery)); }
public MaterialsLog(KanColleProxy proxy) { proxy.api_port.TryParse <kcsapi_port>().Subscribe(x => this.MaterialsHistory(x.Data.api_material)); proxy.api_get_member_material.TryParse <kcsapi_material[]>().Subscribe(x => this.MaterialsHistory(x.Data)); proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x => this.MaterialsHistory(x.Data.api_material)); proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(x => this.MaterialsHistory(x.Data.api_material)); this.Filename = "MaterialsExpenditureLog.csv"; this.LoggerName = "Materials"; this.DefaultFormat = "{0},{2},{3},{4},{5},{6},{7},{8},{9}"; for (int i = 0; i < 8; i++) { materials[i] = 0; } }
public ExpeditionViewModel(ExpeditionListPlugin plugin) { //KanColleClient.Current.Homeport.Organization // .Subscribe(nameof(Organization.Fleets), this.InitializeFleets).AddTo(this); this.notifier = new ExpeditionNotifier(plugin); InitializeExpedition(); KanColleProxy proxy = KanColleClient.Current.Proxy; proxy.api_port.Subscribe(x => this.UpdateView()); proxy.api_get_member_ship3.Subscribe(x => this.UpdateView()); proxy.api_req_hensei_change.Subscribe(x => this.UpdateView()); proxy.ApiSessionSource .Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_hensei/preset_select").Subscribe(x => this.UpdateView()); }
public async void Start() { Step = InitializationStep.Initializing; await Task.Run(new Action(CheckProxyPort)); if (IsPortAvailable && IsUpstreamProxyAvailable) { KanColleProxy.Start(); r_Owner.Page = r_Owner.GameInformation; Step = InitializationStep.None; return; } Step = InitializationStep.Error; }
internal SlotItemTracker(Homeport parent, KanColleProxy proxy) { this.homeport = parent; this.SlotItems = new MemberTable <SlotItem>(); proxy.api_get_member_slot_item.TryParse <kcsapi_slotitem[]>().Subscribe(x => this.Update(x.Data)); proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data)); proxy.api_req_kousyou_destroyitem2.TryParse <kcsapi_destroyitem2>().Subscribe(this.DestroyItem); proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>().Subscribe(x => { this.RemoveFromRemodel(x.Data); this.RemodelSlotItem(x.Data); }); foreach (var item in this.homeport.Itemyard.SlotItems) { this.SlotItems.Add(new SlotItem(item.Value.RawData)); } }
public AirBaseTroopViewModel(KanColleProxy proxy) { var homeport = KanColleClient.Current.Homeport; this.IsNotinitialized = true; // 기항대 정보를 불러옴 proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_get_member/mapinfo") .TryParse <kcsapi_mapinfo_airbase>() .Where(x => x.IsSuccess) .Subscribe(x => { this.IsNotinitialized = false; this.AirBases = x.Data.api_air_base? .Select(y => new AirBase(y, homeport)) .GroupBy(y => y.RawData.api_area_id) .ToDictionary(y => y.Key, y => y.ToDictionary(z => z.RawData.api_rid, z => z)); }); // 기항대 상태 변경 proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_air_corps/set_action") .TryParse <kcsapi_empty_result>() .Where(x => x.IsSuccess) .Subscribe(x => { int actionKind; int area_id, base_id; if (!int.TryParse(x.Request["api_area_id"], out area_id)) { return; } if (!int.TryParse(x.Request["api_base_id"], out base_id)) { return; } if (!this.AirBases.ContainsKey(area_id) || !this.AirBases[area_id].ContainsKey(base_id)) { return; } if (!int.TryParse(x.Request["api_action_kind"], out actionKind)) { return; } this.AirBases[area_id][base_id].UpdateActionKind((AirBaseAction)actionKind); this.RaisePropertyChanged(nameof(this.AirBases)); }); // 기항대 보급 proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_air_corps/supply") .TryParse <kcsapi_airbase_corps_supply>() .Where(x => x.IsSuccess) .Subscribe(x => { int area_id, base_id; if (!int.TryParse(x.Request["api_area_id"], out area_id)) { return; } if (!int.TryParse(x.Request["api_base_id"], out base_id)) { return; } if (!this.AirBases.ContainsKey(area_id) || !this.AirBases[area_id].ContainsKey(base_id)) { return; } this.AirBases[area_id][base_id].Update(x.Data); this.RaisePropertyChanged(nameof(this.AirBases)); }); // 기항대 변경 proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_air_corps/set_plane") .TryParse <kcsapi_airbase_corps_set_plane>() .Where(x => x.IsSuccess) .Subscribe(x => { int area_id, base_id; if (!int.TryParse(x.Request["api_area_id"], out area_id)) { return; } if (!int.TryParse(x.Request["api_base_id"], out base_id)) { return; } if (!this.AirBases.ContainsKey(area_id) || !this.AirBases[area_id].ContainsKey(base_id)) { return; } this.AirBases[area_id][base_id].Update(x.Data); this.RaisePropertyChanged(nameof(this.AirBases)); }); }
protected override void OnStartup(StartupEventArgs e) { DispatcherUtil.UIDispatcher = Dispatcher; Environment.CurrentDirectory = Path.GetDirectoryName(GetType().Assembly.Location); if (!Debugger.IsAttached) { DispatcherUnhandledException += App_DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; } base.OnStartup(e); if (e.Args.Length >= 3 && e.Args[0] == "browser") { var rLayoutEngine = e.Args[1]; var rHostProcessID = int.Parse(e.Args[2]); new BrowserWrapper(rLayoutEngine, rHostProcessID); Task.Factory.StartNew(() => { Process.GetProcessById(rHostProcessID).WaitForExit(); Process.GetCurrentProcess().Kill(); }, TaskCreationOptions.LongRunning); return; } ThemeManager.Instance.Initialize(this, Accent.Blue); CoreDatabase.Initialize(); DataService.Instance.EnsureDirectory(); RecordService.Instance.Initialize(); QuestProgressService.Instance.Initialize(); MapService.Instance.Initialize(); ExpeditionService.Instance.Initialize(); EnemyEncounterService.Instance.Initialize(); Preference.Instance.Initialize(); Preference.Instance.Reload(); StringResources.Instance.Initialize(); StringResources.Instance.LoadMainResource(Preference.Instance.Language); StringResources.Instance.LoadExtraResource(Preference.Instance.ExtraResourceLanguage); StatusBarService.Instance.Initialize(); CacheService.Instance.Initialize(); NotificationService.Instance.Initialize(); ServiceManager.Register <IBrowserService>(BrowserService.Instance); PluginService.Instance.Initialize(); KanColleProxy.Start(); ShutdownMode = ShutdownMode.OnMainWindowClose; Task.Factory.StartNew(UpdateService.Instance.CheckForUpdate); if (e.Args.Any(r => r.OICEquals("--background"))) { return; } MainWindow = new MainWindow(); MainWindow.DataContext = Root = new MainWindowViewModel(); MainWindow.Show(); }
//initialize internal Counter(KanColleProxy proxy) { proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data)); }
private void SetDisposable(KanColleProxy proxy) { SetMapDisposable(proxy); SetBattleResultDisposable(proxy); }
public PostData(KanColleProxy proxy, string endPoint) { proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == endPoint).Parse().Subscribe(); }
public static IObservable <SvData <T> > Observe <T>(this KanColleProxy proxy, string path) { return(proxy.ApiSessionSource .Where(x => x.Request.PathAndQuery == path) .TryParse <T>()); }