Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Also fixed: Translations.cs

Conflicts:
	Grabacr07.KanColleViewer/Models/ProductInfo.cs
	Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs
	Grabacr07.KanColleWrapper/Homeport.cs
  • Loading branch information
Zharay committed Apr 23, 2014
2 parents 212ec35 + bd6429b commit 144c431
Show file tree
Hide file tree
Showing 40 changed files with 1,539 additions and 92 deletions.
10 changes: 10 additions & 0 deletions Grabacr07.Desktop.Metro/Desktop.Metro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>bin\Release\Desktop.Metro.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release %28beta%29|AnyCPU'">
<OutputPath>bin\Release %28beta%29\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>bin\Release\Desktop.Metro.xml</DocumentationFile>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Livet">
<HintPath>..\packages\LivetCask.1.1.0.0\lib\net45\Livet.dll</HintPath>
Expand Down
10 changes: 10 additions & 0 deletions Grabacr07.KanColleViewer/KanColleViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@
<PropertyGroup>
<ApplicationIcon>Assets\app.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release %28beta%29|AnyCPU'">
<OutputPath>bin\Release %28beta%29\</OutputPath>
<DefineConstants>TRACE;BETA</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="CoreAudioApi, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
4 changes: 4 additions & 0 deletions Grabacr07.KanColleViewer/Models/ProductInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ public Version Version

public string VersionString
{
#if BETA
get { return this.Version.ToString() + " β"; }
#else
get { return this.Version.ToString(); }
#endif
}

public IReadOnlyCollection<Library> Libraries
Expand Down
6 changes: 3 additions & 3 deletions Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("KanColleViewer!")]
[assembly: AssemblyDescription("KanColleViewer!")]
[assembly: AssemblyDescription("KanColleViewer! β")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("grabacr.net")]
[assembly: AssemblyProduct("KanColleViewer!")]
[assembly: AssemblyProduct("KanColleViewer! β")]
[assembly: AssemblyCopyright("Copyright © 2013 Grabacr07")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down Expand Up @@ -51,4 +51,4 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.0.420")]
[assembly: AssemblyVersion("2.6.0.0")]
51 changes: 41 additions & 10 deletions Grabacr07.KanColleWrapper/Homeport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,39 @@ public MemberTable<UseItem> UseItems

internal Homeport(KanColleProxy proxy)
{
this.Ships = new MemberTable<Ship>();
this.Fleets = new MemberTable<Fleet>();
this.SlotItems = new MemberTable<SlotItem>();
this.UseItems = new MemberTable<UseItem>();
this.Dockyard = new Dockyard(proxy);
this.Repairyard = new Repairyard(this, proxy);
this.Logger = new Logger(proxy);
this.Quests = new Quests(proxy);

// ToDo: カオスってるので、あとで整理する

proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/basic")
.TryParse<kcsapi_basic>()
.Subscribe(x => this.Admiral = new Admiral(x));

proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_port/port")
.TryParse<kcsapi_port>()
.Subscribe(x =>
{
this.Ships = new MemberTable<Ship>(x.api_ship.Select(s => new Ship(this, s)));
this.Materials = new Materials(x.api_material.Select(m => new Material(m)).ToArray());
this.Repairyard.Update(x.api_ndock);
this.UpdateFleets(x.api_deck_port);
});

proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_hokyu/charge")
.TryParse<kcsapi_charge>()
.Subscribe(this.Charge);

proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/material")
.TryParse<kcsapi_material[]>()
.Subscribe(x => this.Materials = new Materials(x.Select(m => new Material(m)).ToArray()));

this.Ships = new MemberTable<Ship>();
this.Fleets = new MemberTable<Fleet>();
proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship")
.Select(x => { SvData<kcsapi_ship2[]> result; return SvData.TryParse(x, out result) ? result : null; })
.Where(x => x != null && x.IsSuccess)
Expand All @@ -206,12 +229,10 @@ internal Homeport(KanColleProxy proxy)
this.UpdateFleets(x.api_deck_data);
});

this.SlotItems = new MemberTable<SlotItem>();
proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/slotitem")
proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/slot_item")
.TryParse<kcsapi_slotitem[]>()
.Subscribe(x => this.SlotItems = new MemberTable<SlotItem>(x.Select(s => new SlotItem(s))));

this.UseItems = new MemberTable<UseItem>();
proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/useitem")
.TryParse<kcsapi_useitem[]>()
.Subscribe(x => this.UseItems = new MemberTable<UseItem>(x.Select(s => new UseItem(s))));
Expand All @@ -223,11 +244,6 @@ internal Homeport(KanColleProxy proxy)
proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/deck_port")
.TryParse<kcsapi_deck[]>()
.Subscribe(this.UpdateFleets);

this.Dockyard = new Dockyard(proxy);
this.Repairyard = new Repairyard(this, proxy);
this.Logger = new Logger(proxy);
this.Quests = new Quests(proxy);
this.Rankings = new Rankings(proxy);
this.Logger = new Logger(proxy);
this.Translations = new Translations();
Expand All @@ -250,5 +266,20 @@ private void UpdateFleets(kcsapi_deck[] source)
this.Fleets = new MemberTable<Fleet>(source.Select(x => new Fleet(this, x)));
}
}

private void Charge(kcsapi_charge charge)
{
if (charge == null) return;

foreach (var ship in charge.api_ship)
{
var target = this.Ships[ship.api_id];
if (target == null) continue;

target.Charge(ship.api_fuel, ship.api_bull, ship.api_onslot);
}

foreach (var f in Fleets.Values) f.UpdateShips();
}
}
}
14 changes: 10 additions & 4 deletions Grabacr07.KanColleWrapper/KanColleClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Text;
using System.Threading.Tasks;
using Grabacr07.KanColleWrapper.Internal;
using Grabacr07.KanColleWrapper.Models.Raw;
using Livet;

namespace Grabacr07.KanColleWrapper
Expand Down Expand Up @@ -74,13 +75,18 @@ private KanColleClient()
this.Errors = new ObservableSynchronizedCollection<KanColleError>();

this.Proxy = new KanColleProxy();
this.Master = new Master(this.Proxy);
//this.Master = new Master(this.Proxy);
this.Homeport = new Homeport(this.Proxy);
this.Updater = new Updater();

this.Proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_start")
.TryParse()
.Subscribe(x => this.IsStarted = x.IsSuccess);
this.Proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_start2")
.TryParse<kcsapi_start2>()
.Select(x => new Master(x))
.Subscribe(x =>
{
this.Master = x;
this.IsStarted = true;
});
}
}
}
20 changes: 16 additions & 4 deletions Grabacr07.KanColleWrapper/KanColleWrapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release %28beta%29|AnyCPU'">
<OutputPath>bin\Release %28beta%29\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="FiddlerCore4, Version=4.4.5.3, Culture=neutral, PublicKeyToken=67cb91587178ac5a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -100,15 +109,18 @@
<Compile Include="Models\QuestState.cs" />
<Compile Include="Models\QuestType.cs" />
<Compile Include="Models\Ranking.cs" />
<Compile Include="Models\Raw\kcsapi_charge.cs" />
<Compile Include="Models\Raw\kcsapi_battleresult.cs" />
<Compile Include="Models\Raw\kcsapi_createitem.cs" />
<Compile Include="Models\Raw\kcsapi_createship.cs" />
<Compile Include="Models\Raw\kcsapi_port.cs" />
<Compile Include="Models\Raw\kcsapi_quest.cs" />
<Compile Include="Models\Raw\kcsapi_questlist.cs" />
<Compile Include="Models\Raw\kcsapi_ranking.cs" />
<Compile Include="Models\Raw\kcsapi_ranking_getlist.cs" />
<Compile Include="Models\Raw\kcsapi_ship3.cs" />
<Compile Include="Models\Raw\kcsapi_slot_data.cs" />
<Compile Include="Models\Raw\kcsapi_start2.cs" />
<Compile Include="Models\RepairingCompletedEventArgs.cs" />
<Compile Include="Models\BuildingCompletedEventArgs.cs" />
<Compile Include="Models\ConditionType.cs" />
Expand All @@ -125,7 +137,7 @@
<Compile Include="Models\Raw\kcsapi_material.cs" />
<Compile Include="Models\Raw\kcsapi_ndock.cs" />
<Compile Include="Models\Raw\kcsapi_start.cs" />
<Compile Include="Models\Raw\kcsapi_stype.cs" />
<Compile Include="Models\Raw\kcsapi_mst_stype.cs" />
<Compile Include="Models\RepairingDock.cs" />
<Compile Include="Models\RepairingDockState.cs" />
<Compile Include="Models\ShipCriticalConditionEventArgs.cs" />
Expand All @@ -145,11 +157,11 @@
<Compile Include="Models\Rank.cs" />
<Compile Include="Models\Raw\kcsapi_deck.cs" />
<Compile Include="Models\Raw\kcsapi_ship.cs" />
<Compile Include="Models\Raw\kcsapi_master_ship.cs" />
<Compile Include="Models\Raw\kcsapi_mst_ship.cs" />
<Compile Include="Models\Raw\kcsapi_slotitem.cs" />
<Compile Include="Models\Raw\kcsapi_master_slotitem.cs" />
<Compile Include="Models\Raw\kcsapi_mst_slotitem.cs" />
<Compile Include="Models\Raw\kcsapi_useitem.cs" />
<Compile Include="Models\Raw\kcsapi_master_useitem.cs" />
<Compile Include="Models\Raw\kcsapi_mst_useitem.cs" />
<Compile Include="Models\Ship.cs" />
<Compile Include="Models\ShipInfo.cs" />
<Compile Include="Models\SlotItem.cs" />
Expand Down
25 changes: 5 additions & 20 deletions Grabacr07.KanColleWrapper/Master.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,12 @@ public class Master
public MasterTable<ShipType> ShipTypes { get; private set; }


internal Master(KanColleProxy proxy)
internal Master(kcsapi_start2 start2)
{
this.Ships = new MasterTable<ShipInfo>();
proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_master/ship")
.TryParse<kcsapi_master_ship[]>()
.Subscribe(x => this.Ships = new MasterTable<ShipInfo>(x.Select(s => new ShipInfo(s))));

this.SlotItems = new MasterTable<SlotItemInfo>();
proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_master/slotitem")
.TryParse<kcsapi_master_slotitem[]>()
.Subscribe(x => this.SlotItems = new MasterTable<SlotItemInfo>(x.Select(s => new SlotItemInfo(s))));

this.UseItems = new MasterTable<UseItemInfo>();
proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_master/useitem")
.TryParse<kcsapi_master_useitem[]>()
.Subscribe(x => this.UseItems = new MasterTable<UseItemInfo>(x.Select(s => new UseItemInfo(s))));

this.ShipTypes = new MasterTable<ShipType>();
proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_master/stype")
.TryParse<kcsapi_stype[]>()
.Subscribe(x => this.ShipTypes = new MasterTable<ShipType>(x.Select(s => new ShipType(s))));
this.ShipTypes = new MasterTable<ShipType>(start2.api_mst_stype.Select(x => new ShipType(x)));
this.Ships = new MasterTable<ShipInfo>(start2.api_mst_ship.Select(x => new ShipInfo(x)));
this.SlotItems = new MasterTable<SlotItemInfo>(start2.api_mst_slotitem.Select(x => new SlotItemInfo(x)));
this.UseItems = new MasterTable<UseItemInfo>(start2.api_mst_useitem.Select(x => new UseItemInfo(x)));
}
}
}
7 changes: 7 additions & 0 deletions Grabacr07.KanColleWrapper/Models/Fleet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ internal void UpdateStatus()
else this.State = FleetState.Ready;
}

internal void UpdateShips()
{
this.RaisePropertyChanged("Ships");
this.ReSortie.Update(this.Ships, this.homeport.Repairyard);
this.UpdateStatus();
}

public override string ToString()
{
return string.Format("ID = {0}, Name = \"{1}\", Ships = {2}", this.Id, this.Name, this.GetShips().Select(s => "\"" + s.Info.Name + "\"").ToString(","));
Expand Down
5 changes: 5 additions & 0 deletions Grabacr07.KanColleWrapper/Models/LimitedValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public LimitedValue(int current, int maximum, int minimum)
this.Maximum = maximum;
this.Minimum = minimum;
}

public LimitedValue Update(int current)
{
return new LimitedValue(current, this.Maximum, this.Minimum);
}
}

/// <summary>
Expand Down
24 changes: 24 additions & 0 deletions Grabacr07.KanColleWrapper/Models/Raw/kcsapi_charge.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Grabacr07.KanColleWrapper.Models.Raw
{
// ReSharper disable InconsistentNaming
public class kcsapi_charge
{
public kcsapi_charge_ship[] api_ship { get; set; }
public int[] api_material { get; set; }
public int api_use_bou { get; set; }
}
public class kcsapi_charge_ship
{
public int api_id { get; set; }
public int api_fuel { get; set; }
public int api_bull { get; set; }
public int[] api_onslot { get; set; }
}
// ReSharper restore InconsistentNaming
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Grabacr07.KanColleWrapper.Models.Raw
{
// ReSharper disable InconsistentNaming
public class kcsapi_master_ship
public class kcsapi_mst_ship
{
public int api_id { get; set; }
public int api_sortno { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Grabacr07.KanColleWrapper.Models.Raw
{
// ReSharper disable InconsistentNaming
public class kcsapi_master_slotitem
public class kcsapi_mst_slotitem
{
public int api_id { get; set; }
public int api_sortno { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Grabacr07.KanColleWrapper.Models.Raw
{
// ReSharper disable InconsistentNaming
public class kcsapi_stype
public class kcsapi_mst_stype
{
public int api_id { get; set; }
public int api_sortno { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Grabacr07.KanColleWrapper.Models.Raw
{
// ReSharper disable InconsistentNaming
public class kcsapi_master_useitem
public class kcsapi_mst_useitem
{
public int api_id { get; set; }
public int api_usetype { get; set; }
Expand Down
Loading

0 comments on commit 144c431

Please sign in to comment.