diff --git a/Changelog.txt b/Changelog.txt index 11f0f2598..2f2d39d57 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,6 +2,13 @@ KCV Change Log ======================== +v2.6.0 β r431 - 4/24/2014 + * API links now work with the flash settings! + * The item catalog will now display the item's original Japanese name under the translated + one. This does not show if you have translations disabled. + * Ships will now show their original Japanese name with tool tips in the Fleet, Overview, + and Roster. + v2.6.0 β r426 - 4/23/2014 The Spring Time Youth * Direct fix from the main man himself, @Grabacr07. * Back end - All it was is just file name changes and a few additional packets. diff --git a/Grabacr07.KanColleViewer/App.config b/Grabacr07.KanColleViewer/App.config index e5df5d626..942aca702 100644 --- a/Grabacr07.KanColleViewer/App.config +++ b/Grabacr07.KanColleViewer/App.config @@ -4,6 +4,9 @@
+ +
+ @@ -125,4 +128,11 @@ function CheckChange() {{ + + + + <embed id="KCVGenerated" width="800" height="480" wmode="{1}" quality="{0}" bgcolor="#000" allowScriptAccess="always" type="application/x-shockwave-flash" src="{2}"> + + + diff --git a/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs b/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs index 1a5dec451..7b14c492a 100644 --- a/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs +++ b/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs @@ -51,4 +51,4 @@ // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.6.0.426")] +[assembly: AssemblyVersion("2.6.0.431")] diff --git a/Grabacr07.KanColleViewer/Properties/Resources.Designer.cs b/Grabacr07.KanColleViewer/Properties/Resources.Designer.cs index d9a56500c..d6dd8f323 100644 --- a/Grabacr07.KanColleViewer/Properties/Resources.Designer.cs +++ b/Grabacr07.KanColleViewer/Properties/Resources.Designer.cs @@ -952,7 +952,7 @@ public static string Settings_Flash { } /// - /// Looks up a localized string similar to You must use the default method of playing Kancolle through DMM.com's website or through a OSAPI link. SWF/API links do not work! + /// Looks up a localized string similar to This works with DMM.com. OSAPI, and API links now! ///[You must reload the game for the changes to take affect.]. /// public static string Settings_Flash_Message { diff --git a/Grabacr07.KanColleViewer/Properties/Resources.en.resx b/Grabacr07.KanColleViewer/Properties/Resources.en.resx index d4fa01d39..51e55a702 100644 --- a/Grabacr07.KanColleViewer/Properties/Resources.en.resx +++ b/Grabacr07.KanColleViewer/Properties/Resources.en.resx @@ -694,4 +694,8 @@ Low: Performance over quality. Ugliest setting. Give a notification when a fleet's fatigue as reset. + + This works with DMM.com. OSAPI, and API links now! +[You must reload the game for the changes to take affect.] + \ No newline at end of file diff --git a/Grabacr07.KanColleViewer/Properties/Resources.resx b/Grabacr07.KanColleViewer/Properties/Resources.resx index 50558c061..5b3abc29a 100644 --- a/Grabacr07.KanColleViewer/Properties/Resources.resx +++ b/Grabacr07.KanColleViewer/Properties/Resources.resx @@ -708,10 +708,6 @@ Auto-High: Automatically lowers quality when needed. Medium: Average Performance AutoLow: Will emphasize speed when needed Low: Performance over quality. Ugliest setting. - - - You must use the default method of playing Kancolle through DMM.com's website or through a OSAPI link. SWF/API links do not work! -[You must reload the game for the changes to take affect.] Get Latest KCV @@ -728,4 +724,8 @@ Low: Performance over quality. Ugliest setting. Give a notification when a fleet's fatigue as reset. (Not 100% accurate!) + + This works with DMM.com. OSAPI, and API links now! +[You must reload the game for the changes to take affect.] + \ No newline at end of file diff --git a/Grabacr07.KanColleViewer/Properties/Settings.Designer.cs b/Grabacr07.KanColleViewer/Properties/Settings.Designer.cs index 0a1dfb14f..c8ebfbdfc 100644 --- a/Grabacr07.KanColleViewer/Properties/Settings.Designer.cs +++ b/Grabacr07.KanColleViewer/Properties/Settings.Designer.cs @@ -156,5 +156,19 @@ public string FlashQualityJS { return ((string)(this["FlashQualityJS"])); } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string FlashEmbed { + get { + return ((string)(this["FlashEmbed"])); + } + set { + this["FlashEmbed"] = value; + } + } } } diff --git a/Grabacr07.KanColleViewer/Properties/Settings.settings b/Grabacr07.KanColleViewer/Properties/Settings.settings index 3964b5d8c..c0180bd0a 100644 --- a/Grabacr07.KanColleViewer/Properties/Settings.settings +++ b/Grabacr07.KanColleViewer/Properties/Settings.settings @@ -110,5 +110,8 @@ function CheckChange() {{ clearInterval(TimedInject); }} + + <embed id="KCVGenerated" width="800" height="480" wmode="{1}" quality="{0}" bgcolor="#000" allowScriptAccess="always" type="application/x-shockwave-flash" src="{2}"> + \ No newline at end of file diff --git a/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml b/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml index 702e9f072..046759b7f 100644 --- a/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml +++ b/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml @@ -592,7 +592,8 @@ + Margin="0,3" + ToolTip="{Binding Ship.Info.UntranslatedName, Mode=OneWay}"/> diff --git a/Grabacr07.KanColleViewer/Views/Catalogs/SlotItemCatalogWindow.xaml b/Grabacr07.KanColleViewer/Views/Catalogs/SlotItemCatalogWindow.xaml index f02d1c880..509072d4c 100644 --- a/Grabacr07.KanColleViewer/Views/Catalogs/SlotItemCatalogWindow.xaml +++ b/Grabacr07.KanColleViewer/Views/Catalogs/SlotItemCatalogWindow.xaml @@ -137,9 +137,14 @@ - + + + + + diff --git a/Grabacr07.KanColleViewer/Views/Controls/KanColleHost.cs b/Grabacr07.KanColleViewer/Views/Controls/KanColleHost.cs index 7212cd724..1dd1fdd02 100644 --- a/Grabacr07.KanColleViewer/Views/Controls/KanColleHost.cs +++ b/Grabacr07.KanColleViewer/Views/Controls/KanColleHost.cs @@ -53,13 +53,13 @@ private static void WebBrowserPropertyChangedCallback(DependencyObject d, Depend if (oldBrowser != null) { - oldBrowser.LoadCompleted -= instance.ApplyFlashQualityScript; oldBrowser.LoadCompleted -= instance.ApplyStyleSheet; + oldBrowser.LoadCompleted -= instance.ApplyFlashQualityScript; } if (newBrowser != null) { - newBrowser.LoadCompleted += instance.ApplyFlashQualityScript; newBrowser.LoadCompleted += instance.ApplyStyleSheet; + newBrowser.LoadCompleted += instance.ApplyFlashQualityScript; } if (instance.scrollViewer != null) { @@ -128,6 +128,7 @@ public void Update() this.WebBrowser.Width = (kanColleSize.Width * (zoomFactor / dpi.ScaleX)) / dpi.ScaleX; this.WebBrowser.Height = (kanColleSize.Height * (zoomFactor / dpi.ScaleY)) / dpi.ScaleY; this.MinWidth = this.WebBrowser.Width; + if (percentage != 100) ApplyFlashQualityScript(null, null); } else { @@ -213,8 +214,8 @@ public void ApplyFlashQualityScript(object sender, NavigationEventArgs e) { try { - var doc = this.WebBrowser.Document as HTMLDocument; - FramesCollection frames = doc.frames; + var document = this.WebBrowser.Document as HTMLDocument; + FramesCollection frames = document.frames; HTMLDocument mainFrame = null; for (int i = 0; i < frames.length; i++) { @@ -223,17 +224,26 @@ public void ApplyFlashQualityScript(object sender, NavigationEventArgs e) if (frame != null && ((HTMLDocument)frame).getElementById("flashWrap") != null) mainFrame = (HTMLDocument)frame; else - mainFrame = doc; + mainFrame = document; } if (mainFrame != null) { + // Javascript injection - Greasemonkey style. Suppose to be more dynamic on DOM objects. + // Main reason for JS method is that the flash itself doesn't exist until after it has been added to the "flashWrap" DIV element! + // Leave the timing of when the flash is added to the script. IHTMLElement head = (IHTMLElement)((IHTMLElementCollection)mainFrame.all.tags("head")).item(null, 0); IHTMLScriptElement scriptOjbect = (IHTMLScriptElement)mainFrame.createElement("script"); scriptOjbect.type = @"text/javascript"; scriptOjbect.text = string.Format(Properties.Settings.Default.FlashQualityJS, KCVSettings.Current.FlashQuality, KCVSettings.Current.FlashWindow); ((HTMLHeadElement)head).appendChild((IHTMLDOMNode)scriptOjbect); } + + if (mainFrame == null && document.url.Contains(".swf?")) + { + // No dynamic way of accessing and editing this, so we forcefully make our own embed since its already provided for us. + document.body.innerHTML = string.Format(Properties.Settings.Default.FlashEmbed, KCVSettings.Current.FlashQuality, KCVSettings.Current.FlashWindow, document.url); + } } catch (Exception ex) { diff --git a/Grabacr07.KanColleWrapper/Models/Ship.cs b/Grabacr07.KanColleWrapper/Models/Ship.cs index 386614727..5fe0cae05 100644 --- a/Grabacr07.KanColleWrapper/Models/Ship.cs +++ b/Grabacr07.KanColleWrapper/Models/Ship.cs @@ -177,7 +177,8 @@ public string Detail get { string AddDetail = ""; - + if (this.Info.Name != this.Info.RawData.api_name) + AddDetail += this.Info.RawData.api_name + "\n"; AddDetail += string.Format("{0}: {1} ({2})\n", KanColleClient.Current.Homeport.Translations.Firepower, this.Firepower.Current, (this.Firepower.IsMax ? @"MAX" : "+" + (this.Firepower.Max - this.Firepower.Current).ToString())); AddDetail += string.Format("{0}: {1} ({2})\n", KanColleClient.Current.Homeport.Translations.Torpedo, this.Torpedo.Current, (this.Torpedo.IsMax ? @"MAX" : "+" + (this.Torpedo.Max - this.Torpedo.Current).ToString())); AddDetail += string.Format("{0}: {1} ({2})\n", KanColleClient.Current.Homeport.Translations.AntiAir, this.AA.Current, (this.AA.IsMax ? @"MAX" : "+" + (this.AA.Max - this.AA.Current).ToString())); diff --git a/Grabacr07.KanColleWrapper/Models/ShipInfo.cs b/Grabacr07.KanColleWrapper/Models/ShipInfo.cs index 12610a584..5a20052f7 100644 --- a/Grabacr07.KanColleWrapper/Models/ShipInfo.cs +++ b/Grabacr07.KanColleWrapper/Models/ShipInfo.cs @@ -39,6 +39,17 @@ public string Name } } + /// + /// Get the untranslated version of the name. If it is untranslated, return nothing. + /// + public string UntranslatedName + { + get + { + return this.Name != RawData.api_name ? RawData.api_name : ""; + } + } + /// /// 艦種を取得します。 /// diff --git a/Grabacr07.KanColleWrapper/Models/SlotItemInfo.cs b/Grabacr07.KanColleWrapper/Models/SlotItemInfo.cs index bf1177afd..9a1c1332c 100644 --- a/Grabacr07.KanColleWrapper/Models/SlotItemInfo.cs +++ b/Grabacr07.KanColleWrapper/Models/SlotItemInfo.cs @@ -39,6 +39,14 @@ public string DetailedName } } + public string UntranslatedName + { + get + { + return (this.RawData.api_name != this.Name ? this.RawData.api_name : ""); + } + } + public string Detail { get diff --git a/Grabacr07.KanColleWrapper/Rankings.cs b/Grabacr07.KanColleWrapper/Rankings.cs index a658d3303..d78750165 100644 --- a/Grabacr07.KanColleWrapper/Rankings.cs +++ b/Grabacr07.KanColleWrapper/Rankings.cs @@ -20,30 +20,30 @@ namespace Grabacr07.KanColleWrapper { public class Rankings : NotificationObject { - private readonly ConcurrentDictionary currentData; + private readonly ConcurrentDictionary currentData; - public int TotalRanked { get; private set; } - public int TotalPages { get; private set; } - public int CurrentPage { get; private set; } + public int TotalRanked { get; private set; } + public int TotalPages { get; private set; } + public int CurrentPage { get; private set; } - public IReadOnlyCollection Current - { - get - { - return this.currentData - .Select(kvp => kvp.Value) - .OrderBy(x => x.Id) - .ToList(); - } - } + public IReadOnlyCollection Current + { + get + { + return this.currentData + .Select(kvp => kvp.Value) + .OrderBy(x => x.Id) + .ToList(); + } + } - internal Rankings(KanColleProxy proxy) + internal Rankings(KanColleProxy proxy) { - this.currentData = new ConcurrentDictionary(); + this.currentData = new ConcurrentDictionary(); - this.TotalRanked = 0; - this.TotalPages = 0; - this.CurrentPage = 0; + this.TotalRanked = 0; + this.TotalPages = 0; + this.CurrentPage = 0; proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_ranking/getlist") .Select(Serialize) @@ -51,33 +51,33 @@ internal Rankings(KanColleProxy proxy) .Subscribe(this.Update); } - private static kcsapi_ranking_getlist Serialize(Session session) + private static kcsapi_ranking_getlist Serialize(Session session) { try { var djson = DynamicJson.Parse(session.GetResponseAsJson()); - var rankings = new kcsapi_ranking_getlist + var rankings = new kcsapi_ranking_getlist { api_count = Convert.ToInt32(djson.api_data.api_count), api_disp_page = Convert.ToInt32(djson.api_data.api_disp_page), api_page_count = Convert.ToInt32(djson.api_data.api_page_count), }; - var list = new List(); - var serializer = new DataContractJsonSerializer(typeof(kcsapi_ranking)); + var list = new List(); + var serializer = new DataContractJsonSerializer(typeof(kcsapi_ranking)); foreach (var x in (object[])djson.api_data.api_list) { try { - list.Add(serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(x.ToString()))) as kcsapi_ranking); + list.Add(serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(x.ToString()))) as kcsapi_ranking); } catch (SerializationException ex) { Debug.WriteLine(ex.Message); } } - rankings.api_list = list.ToArray(); - return rankings; + rankings.api_list = list.ToArray(); + return rankings; } catch (Exception ex) { @@ -86,17 +86,17 @@ private static kcsapi_ranking_getlist Serialize(Session session) } } - private void Update(kcsapi_ranking_getlist ranklist) + private void Update(kcsapi_ranking_getlist ranklist) { - this.TotalRanked = ranklist.api_count; - this.TotalPages = ranklist.api_page_count; - this.CurrentPage = ranklist.api_disp_page; + this.TotalRanked = ranklist.api_count; + this.TotalPages = ranklist.api_page_count; + this.CurrentPage = ranklist.api_disp_page; - this.currentData.Clear(); - ranklist.api_list.Select(x => new Ranking(x)) - .ForEach(x => this.currentData.AddOrUpdate(x.Id, x, (_, __) => x)); + this.currentData.Clear(); + ranklist.api_list.Select(x => new Ranking(x)) + .ForEach(x => this.currentData.AddOrUpdate(x.Id, x, (_, __) => x)); - this.RaisePropertyChanged("Current"); + this.RaisePropertyChanged("Current"); } } } diff --git a/Grabacr07.KanColleWrapper/Translations.cs b/Grabacr07.KanColleWrapper/Translations.cs index d4ce93172..18e84bd7b 100644 --- a/Grabacr07.KanColleWrapper/Translations.cs +++ b/Grabacr07.KanColleWrapper/Translations.cs @@ -13,439 +13,439 @@ namespace Grabacr07.KanColleWrapper { - public class Translations : NotificationObject - { - private XDocument ShipsXML; - private XDocument ShipTypesXML; - private XDocument EquipmentXML; - private XDocument OperationsXML; - private XDocument QuestsXML; - private string CurrentCulture; - - public bool EnableTranslations { get; set; } - public bool EnableAddUntranslated { get; set; } - - #region EquipmentVersion 変更通知プロパティ - - private string _EquipmentVersion; - - public string EquipmentVersion - { - get { return _EquipmentVersion; } - set - { - if (_EquipmentVersion != value) - { - _EquipmentVersion = value; - this.RaisePropertyChanged(); - } - } - } - - #endregion - - #region OperationsVersion 変更通知プロパティ - - private string _OperationsVersion; - - public string OperationsVersion - { - get { return _OperationsVersion; } - set - { - if (_OperationsVersion != value) - { - _OperationsVersion = value; - this.RaisePropertyChanged(); - } - } - } - - #endregion - - #region QuestsVersion 変更通知プロパティ - - private string _QuestsVersion; - - public string QuestsVersion - { - get { return _QuestsVersion; } - set - { - if (_QuestsVersion != value) - { - _QuestsVersion = value; - this.RaisePropertyChanged(); - } - } - } - - #endregion - - #region ShipsVersion 変更通知プロパティ - - private string _ShipsVersion; - - public string ShipsVersion - { - get { return _ShipsVersion; } - set - { - if (_ShipsVersion != value) - { - _ShipsVersion = value; - this.RaisePropertyChanged(); - } - } - } - - #endregion - - #region ShipTypesVersion 変更通知プロパティ - - private string _ShipTypesVersion; - - public string ShipTypesVersion - { - get { return _ShipTypesVersion; } - set - { - if (_ShipTypesVersion != value) - { - _ShipTypesVersion = value; - this.RaisePropertyChanged(); - } - } - } - - #endregion - - // Item Stat Translations - public string Firepower { get; set; } - public string AntiAir { get; set; } - public string Accuracy { get; set; } - public string Torpedo { get; set; } - public string AntiSub { get; set; } - public string DiveBomb { get; set; } - public string Evasion { get; set; } - public string AttackRange { get; set; } - public string SightRange { get; set; } - public string Luck { get; set; } - public string Speed { get; set; } - public string Armor { get; set; } - public string Health { get; set; } - - internal Translations() - { - try - { - if (File.Exists("Translations\\Ships.xml")) ShipsXML = XDocument.Load("Translations\\Ships.xml"); - if (File.Exists("Translations\\ShipTypes.xml")) ShipTypesXML = XDocument.Load("Translations\\ShipTypes.xml"); - if (File.Exists("Translations\\Equipment.xml")) EquipmentXML = XDocument.Load("Translations\\Equipment.xml"); - if (File.Exists("Translations\\Operations.xml")) OperationsXML = XDocument.Load("Translations\\Operations.xml"); - if (File.Exists("Translations\\Quests.xml")) QuestsXML = XDocument.Load("Translations\\Quests.xml"); - - GetVersions(); - } - catch { } - } - - public void ChangeCulture(string Culture) - { - CurrentCulture = Culture == "en-US" || Culture == "en" ? "" : (Culture + "\\"); - - ShipsXML = null; - ShipTypesXML = null; - EquipmentXML = null; - OperationsXML = null; - QuestsXML = null; - - if (!EnableTranslations || CurrentCulture == "ja-JP") - return; - - try - { - if (!Directory.Exists("Translations")) Directory.CreateDirectory("Translations"); - if (!Directory.Exists("Translations\\" + CurrentCulture)) Directory.CreateDirectory("Translations\\" + CurrentCulture); - if (File.Exists("Translations\\" + CurrentCulture + "Ships.xml")) ShipsXML = XDocument.Load("Translations\\" + CurrentCulture + "Ships.xml"); - if (File.Exists("Translations\\" + CurrentCulture + "ShipTypes.xml")) ShipTypesXML = XDocument.Load("Translations\\" + CurrentCulture + "ShipTypes.xml"); - if (File.Exists("Translations\\" + CurrentCulture + "Equipment.xml")) EquipmentXML = XDocument.Load("Translations\\" + CurrentCulture + "Equipment.xml"); - if (File.Exists("Translations\\" + CurrentCulture + "Operations.xml")) OperationsXML = XDocument.Load("Translations\\" + CurrentCulture + "Operations.xml"); - if (File.Exists("Translations\\" + CurrentCulture + "Quests.xml")) QuestsXML = XDocument.Load("Translations\\" + CurrentCulture + "Quests.xml"); - - GetVersions(); - } - catch { } - } - - private void GetVersions() - { - if (ShipsXML != null) - ShipsVersion = ShipsXML.Root.Attribute("Version").Value; - else - ShipsVersion = "0.0.0"; - if (ShipTypesXML != null) - ShipTypesVersion = ShipTypesXML.Root.Attribute("Version").Value; - else - ShipTypesVersion = "0.0.0"; - if (EquipmentXML != null) - EquipmentVersion = EquipmentXML.Root.Attribute("Version").Value; - else - EquipmentVersion = "0.0.0"; - if (OperationsXML != null) - OperationsVersion = OperationsXML.Root.Attribute("Version").Value; - else - OperationsVersion = "0.0.0"; - if (QuestsXML != null) - QuestsVersion = QuestsXML.Root.Attribute("Version").Value; - else - QuestsVersion = "0.0.0"; - } - - private IEnumerable GetTranslationList(TranslationType Type) - { - switch(Type) - { - case TranslationType.Ships: - if (ShipsXML != null) - return ShipsXML.Descendants("Ship"); - break; - case TranslationType.ShipTypes: - if (ShipTypesXML != null) - return ShipTypesXML.Descendants("Type"); - break; - case TranslationType.Equipment: - if (EquipmentXML != null) - return EquipmentXML.Descendants("Item"); - break; - case TranslationType.OperationMaps: - if (OperationsXML != null) - return OperationsXML.Descendants("Map"); - break; - case TranslationType.OperationSortie: - if (OperationsXML != null) - return OperationsXML.Descendants("Sortie"); - break; - case TranslationType.Quests: - case TranslationType.QuestTitle: - case TranslationType.QuestDetail: - if (QuestsXML != null) - return QuestsXML.Descendants("Quest"); - break; - } - - return null; - } - - public string GetTranslation(string JPString, TranslationType Type, Object RawData, int ID = -1) - { - if (!EnableTranslations || CurrentCulture == "ja-JP") - return JPString; - - try - { - IEnumerable TranslationList = GetTranslationList(Type); - - if (TranslationList == null) - { - AddTranslation(RawData, Type); - return JPString; - } - - string JPChildElement = "JP-Name"; - string TRChildElement = "TR-Name"; - - if (Type == TranslationType.QuestDetail) - { - JPChildElement = "JP-Detail"; - TRChildElement = "TR-Detail"; - } - - IEnumerable FoundTranslation = TranslationList.Where(b => b.Element(JPChildElement).Value.Equals(JPString)); - - foreach (XElement el in FoundTranslation) - { + public class Translations : NotificationObject + { + private XDocument ShipsXML; + private XDocument ShipTypesXML; + private XDocument EquipmentXML; + private XDocument OperationsXML; + private XDocument QuestsXML; + private string CurrentCulture; + + public bool EnableTranslations { get; set; } + public bool EnableAddUntranslated { get; set; } + + #region EquipmentVersion 変更通知プロパティ + + private string _EquipmentVersion; + + public string EquipmentVersion + { + get { return _EquipmentVersion; } + set + { + if (_EquipmentVersion != value) + { + _EquipmentVersion = value; + this.RaisePropertyChanged(); + } + } + } + + #endregion + + #region OperationsVersion 変更通知プロパティ + + private string _OperationsVersion; + + public string OperationsVersion + { + get { return _OperationsVersion; } + set + { + if (_OperationsVersion != value) + { + _OperationsVersion = value; + this.RaisePropertyChanged(); + } + } + } + + #endregion + + #region QuestsVersion 変更通知プロパティ + + private string _QuestsVersion; + + public string QuestsVersion + { + get { return _QuestsVersion; } + set + { + if (_QuestsVersion != value) + { + _QuestsVersion = value; + this.RaisePropertyChanged(); + } + } + } + + #endregion + + #region ShipsVersion 変更通知プロパティ + + private string _ShipsVersion; + + public string ShipsVersion + { + get { return _ShipsVersion; } + set + { + if (_ShipsVersion != value) + { + _ShipsVersion = value; + this.RaisePropertyChanged(); + } + } + } + + #endregion + + #region ShipTypesVersion 変更通知プロパティ + + private string _ShipTypesVersion; + + public string ShipTypesVersion + { + get { return _ShipTypesVersion; } + set + { + if (_ShipTypesVersion != value) + { + _ShipTypesVersion = value; + this.RaisePropertyChanged(); + } + } + } + + #endregion + + // Item Stat Translations + public string Firepower { get; set; } + public string AntiAir { get; set; } + public string Accuracy { get; set; } + public string Torpedo { get; set; } + public string AntiSub { get; set; } + public string DiveBomb { get; set; } + public string Evasion { get; set; } + public string AttackRange { get; set; } + public string SightRange { get; set; } + public string Luck { get; set; } + public string Speed { get; set; } + public string Armor { get; set; } + public string Health { get; set; } + + internal Translations() + { + try + { + if (File.Exists("Translations\\Ships.xml")) ShipsXML = XDocument.Load("Translations\\Ships.xml"); + if (File.Exists("Translations\\ShipTypes.xml")) ShipTypesXML = XDocument.Load("Translations\\ShipTypes.xml"); + if (File.Exists("Translations\\Equipment.xml")) EquipmentXML = XDocument.Load("Translations\\Equipment.xml"); + if (File.Exists("Translations\\Operations.xml")) OperationsXML = XDocument.Load("Translations\\Operations.xml"); + if (File.Exists("Translations\\Quests.xml")) QuestsXML = XDocument.Load("Translations\\Quests.xml"); + + GetVersions(); + } + catch { } + } + + public void ChangeCulture(string Culture) + { + CurrentCulture = Culture == "en-US" || Culture == "en" ? "" : (Culture + "\\"); + + ShipsXML = null; + ShipTypesXML = null; + EquipmentXML = null; + OperationsXML = null; + QuestsXML = null; + + if (!EnableTranslations || CurrentCulture == "ja-JP") + return; + + try + { + if (!Directory.Exists("Translations")) Directory.CreateDirectory("Translations"); + if (!Directory.Exists("Translations\\" + CurrentCulture)) Directory.CreateDirectory("Translations\\" + CurrentCulture); + if (File.Exists("Translations\\" + CurrentCulture + "Ships.xml")) ShipsXML = XDocument.Load("Translations\\" + CurrentCulture + "Ships.xml"); + if (File.Exists("Translations\\" + CurrentCulture + "ShipTypes.xml")) ShipTypesXML = XDocument.Load("Translations\\" + CurrentCulture + "ShipTypes.xml"); + if (File.Exists("Translations\\" + CurrentCulture + "Equipment.xml")) EquipmentXML = XDocument.Load("Translations\\" + CurrentCulture + "Equipment.xml"); + if (File.Exists("Translations\\" + CurrentCulture + "Operations.xml")) OperationsXML = XDocument.Load("Translations\\" + CurrentCulture + "Operations.xml"); + if (File.Exists("Translations\\" + CurrentCulture + "Quests.xml")) QuestsXML = XDocument.Load("Translations\\" + CurrentCulture + "Quests.xml"); + + GetVersions(); + } + catch { } + } + + private void GetVersions() + { + if (ShipsXML != null) + ShipsVersion = ShipsXML.Root.Attribute("Version").Value; + else + ShipsVersion = "0.0.0"; + if (ShipTypesXML != null) + ShipTypesVersion = ShipTypesXML.Root.Attribute("Version").Value; + else + ShipTypesVersion = "0.0.0"; + if (EquipmentXML != null) + EquipmentVersion = EquipmentXML.Root.Attribute("Version").Value; + else + EquipmentVersion = "0.0.0"; + if (OperationsXML != null) + OperationsVersion = OperationsXML.Root.Attribute("Version").Value; + else + OperationsVersion = "0.0.0"; + if (QuestsXML != null) + QuestsVersion = QuestsXML.Root.Attribute("Version").Value; + else + QuestsVersion = "0.0.0"; + } + + private IEnumerable GetTranslationList(TranslationType Type) + { + switch(Type) + { + case TranslationType.Ships: + if (ShipsXML != null) + return ShipsXML.Descendants("Ship"); + break; + case TranslationType.ShipTypes: + if (ShipTypesXML != null) + return ShipTypesXML.Descendants("Type"); + break; + case TranslationType.Equipment: + if (EquipmentXML != null) + return EquipmentXML.Descendants("Item"); + break; + case TranslationType.OperationMaps: + if (OperationsXML != null) + return OperationsXML.Descendants("Map"); + break; + case TranslationType.OperationSortie: + if (OperationsXML != null) + return OperationsXML.Descendants("Sortie"); + break; + case TranslationType.Quests: + case TranslationType.QuestTitle: + case TranslationType.QuestDetail: + if (QuestsXML != null) + return QuestsXML.Descendants("Quest"); + break; + } + + return null; + } + + public string GetTranslation(string JPString, TranslationType Type, Object RawData, int ID = -1) + { + if (!EnableTranslations || CurrentCulture == "ja-JP") + return JPString; + + try + { + IEnumerable TranslationList = GetTranslationList(Type); + + if (TranslationList == null) + { + AddTranslation(RawData, Type); + return JPString; + } + + string JPChildElement = "JP-Name"; + string TRChildElement = "TR-Name"; + + if (Type == TranslationType.QuestDetail) + { + JPChildElement = "JP-Detail"; + TRChildElement = "TR-Detail"; + } + + IEnumerable FoundTranslation = TranslationList.Where(b => b.Element(JPChildElement).Value.Equals(JPString)); + + foreach (XElement el in FoundTranslation) + { #if DEBUG - if (ID >= 0 && el.Element("ID") != null && Convert.ToInt32(el.Element("ID").Value) == ID) - Debug.WriteLine(string.Format("Translation: {0,-20} {1,-20} {2}", JPString, el.Element(TRChildElement).Value, ID)); + if (ID >= 0 && el.Element("ID") != null && Convert.ToInt32(el.Element("ID").Value) == ID) + Debug.WriteLine(string.Format("Translation: {0,-20} {1,-20} {2}", JPString, el.Element(TRChildElement).Value, ID)); #endif - if (ID >= 0 && el.Element("ID") != null && Convert.ToInt32(el.Element("ID").Value) == ID) - return el.Element(TRChildElement).Value; - else if (ID < 0) - return el.Element(TRChildElement).Value; + if (ID >= 0 && el.Element("ID") != null && Convert.ToInt32(el.Element("ID").Value) == ID) + return el.Element(TRChildElement).Value; + else if (ID < 0) + return el.Element(TRChildElement).Value; - } + } #if DEBUG - Debug.WriteLine(string.Format("Can't find Translation: {0,-20} {1}", JPString, ID)); + Debug.WriteLine(string.Format("Can't find Translation: {0,-20} {1}", JPString, ID)); #endif - } - catch { } - - AddTranslation(RawData, Type); - - return JPString; - } - - public void AddTranslation(Object RawData, TranslationType Type) - { - if (RawData == null || !EnableAddUntranslated) - return; - - try - { - switch (Type) - { - case TranslationType.Ships: - if (ShipsXML == null) - { - ShipsXML = new XDocument(); - ShipsXML.Add(new XElement("Ships")); - ShipsXML.Root.SetAttributeValue("Version", "0.0.0"); - ShipsVersion = "0.0.0"; - } - - kcsapi_mst_ship ShipData = RawData as kcsapi_mst_ship; - - if (ShipData == null) - return; - - ShipsXML.Root.Add(new XElement("Ship", - new XElement("JP-Name", ShipData.api_name), - new XElement("TR-Name", ShipData.api_name) - )); - - ShipsXML.Save("Translations\\" + CurrentCulture + "Ships.xml"); - break; - - case TranslationType.ShipTypes: - if (ShipTypesXML == null) - { - ShipTypesXML = new XDocument(); - ShipTypesXML.Add(new XElement("ShipTypes")); - ShipTypesXML.Root.SetAttributeValue("Version", "0.0.0"); - ShipTypesVersion = "0.0.0"; - } + } + catch { } + + AddTranslation(RawData, Type); + + return JPString; + } + + public void AddTranslation(Object RawData, TranslationType Type) + { + if (RawData == null || !EnableAddUntranslated) + return; + + try + { + switch (Type) + { + case TranslationType.Ships: + if (ShipsXML == null) + { + ShipsXML = new XDocument(); + ShipsXML.Add(new XElement("Ships")); + ShipsXML.Root.SetAttributeValue("Version", "0.0.0"); + ShipsVersion = "0.0.0"; + } + + kcsapi_mst_ship ShipData = RawData as kcsapi_mst_ship; + + if (ShipData == null) + return; + + ShipsXML.Root.Add(new XElement("Ship", + new XElement("JP-Name", ShipData.api_name), + new XElement("TR-Name", ShipData.api_name) + )); + + ShipsXML.Save("Translations\\" + CurrentCulture + "Ships.xml"); + break; + + case TranslationType.ShipTypes: + if (ShipTypesXML == null) + { + ShipTypesXML = new XDocument(); + ShipTypesXML.Add(new XElement("ShipTypes")); + ShipTypesXML.Root.SetAttributeValue("Version", "0.0.0"); + ShipTypesVersion = "0.0.0"; + } kcsapi_mst_stype TypeData = RawData as kcsapi_mst_stype; - if (TypeData == null) - return; + if (TypeData == null) + return; - ShipTypesXML.Root.Add(new XElement("Type", - new XElement("ID", TypeData.api_id), - new XElement("JP-Name", TypeData.api_name), - new XElement("TR-Name", TypeData.api_name) - )); + ShipTypesXML.Root.Add(new XElement("Type", + new XElement("ID", TypeData.api_id), + new XElement("JP-Name", TypeData.api_name), + new XElement("TR-Name", TypeData.api_name) + )); - ShipTypesXML.Save("Translations\\" + CurrentCulture + "ShipTypes.xml"); - break; + ShipTypesXML.Save("Translations\\" + CurrentCulture + "ShipTypes.xml"); + break; - case TranslationType.Equipment: - if (EquipmentXML == null) - { - EquipmentXML = new XDocument(); - EquipmentXML.Add(new XElement("Equipment")); - EquipmentXML.Root.SetAttributeValue("Version", "0.0.0"); - EquipmentVersion = "0.0.0"; - } + case TranslationType.Equipment: + if (EquipmentXML == null) + { + EquipmentXML = new XDocument(); + EquipmentXML.Add(new XElement("Equipment")); + EquipmentXML.Root.SetAttributeValue("Version", "0.0.0"); + EquipmentVersion = "0.0.0"; + } kcsapi_mst_slotitem EqiupData = RawData as kcsapi_mst_slotitem; - if (EqiupData == null) - return; - - EquipmentXML.Root.Add(new XElement("Item", - new XElement("JP-Name", EqiupData.api_name), - new XElement("TR-Name", EqiupData.api_name) - )); - - EquipmentXML.Save("Translations\\" + CurrentCulture + "Equipment.xml"); - break; - - case TranslationType.OperationMaps: - case TranslationType.OperationSortie: - if (OperationsXML == null) - { - OperationsXML = new XDocument(); - OperationsXML.Add(new XElement("Operations")); - OperationsXML.Root.SetAttributeValue("Version", "0.0.0"); - OperationsVersion = "0.0.0"; - } - - kcsapi_battleresult OperationsData = RawData as kcsapi_battleresult; - - if (OperationsData == null) - return; - - if (Type == TranslationType.OperationMaps) - { - OperationsXML.Root.Add(new XElement("Map", - new XElement("JP-Name", OperationsData.api_quest_name), - new XElement("TR-Name", OperationsData.api_quest_name) - )); - } - else - { - OperationsXML.Root.Add(new XElement("Sortie", - new XElement("JP-Name", OperationsData.api_enemy_info.api_deck_name), - new XElement("TR-Name", OperationsData.api_enemy_info.api_deck_name) - )); - } - - OperationsXML.Save("Translations\\" + CurrentCulture + "Operations.xml"); - break; - - case TranslationType.Quests: - case TranslationType.QuestTitle: - case TranslationType.QuestDetail: - if (QuestsXML == null) - { - QuestsXML = new XDocument(); - QuestsXML.Add(new XElement("Quests")); - QuestsXML.Root.SetAttributeValue("Version", "0.0.0"); - QuestsVersion = "0.0.0"; - } - - kcsapi_quest QuestData = RawData as kcsapi_quest; - - if (QuestData == null) - return; - - IEnumerable FoundTranslationDetail = QuestsXML.Descendants("Quest").Where(b => b.Element("JP-Detail").Value.Equals(QuestData.api_detail)); - IEnumerable FoundTranslationTitle = QuestsXML.Descendants("Quest").Where(b => b.Element("JP-Name").Value.Equals(QuestData.api_title)); - - // Check the current list for any errors and fix them before writing a whole new element. - if (Type == TranslationType.QuestTitle && FoundTranslationDetail != null && FoundTranslationDetail.Any()) - { - // The title is wrong, but the detail is right. Fix the title. - foreach (XElement el in FoundTranslationDetail) - el.Element("JP-Name").Value = QuestData.api_title; - - } - else if (Type == TranslationType.QuestDetail && FoundTranslationTitle != null && FoundTranslationTitle.Any()) - { - // We found an existing detail, the title must be broken. Fix it. - foreach (XElement el in FoundTranslationTitle) - el.Element("JP-Detail").Value = QuestData.api_detail; - } - else - { - // The quest doesn't exist at all. Add it. - QuestsXML.Root.Add(new XElement("Quest", - new XElement("ID", QuestData.api_no), - new XElement("JP-Name", QuestData.api_title), - new XElement("TR-Name", QuestData.api_title), - new XElement("JP-Detail", QuestData.api_detail), - new XElement("TR-Detail", QuestData.api_detail) - )); - } - - QuestsXML.Save("Translations\\" + CurrentCulture + "Quests.xml"); - break; - } - } - catch { } - } - - } + if (EqiupData == null) + return; + + EquipmentXML.Root.Add(new XElement("Item", + new XElement("JP-Name", EqiupData.api_name), + new XElement("TR-Name", EqiupData.api_name) + )); + + EquipmentXML.Save("Translations\\" + CurrentCulture + "Equipment.xml"); + break; + + case TranslationType.OperationMaps: + case TranslationType.OperationSortie: + if (OperationsXML == null) + { + OperationsXML = new XDocument(); + OperationsXML.Add(new XElement("Operations")); + OperationsXML.Root.SetAttributeValue("Version", "0.0.0"); + OperationsVersion = "0.0.0"; + } + + kcsapi_battleresult OperationsData = RawData as kcsapi_battleresult; + + if (OperationsData == null) + return; + + if (Type == TranslationType.OperationMaps) + { + OperationsXML.Root.Add(new XElement("Map", + new XElement("JP-Name", OperationsData.api_quest_name), + new XElement("TR-Name", OperationsData.api_quest_name) + )); + } + else + { + OperationsXML.Root.Add(new XElement("Sortie", + new XElement("JP-Name", OperationsData.api_enemy_info.api_deck_name), + new XElement("TR-Name", OperationsData.api_enemy_info.api_deck_name) + )); + } + + OperationsXML.Save("Translations\\" + CurrentCulture + "Operations.xml"); + break; + + case TranslationType.Quests: + case TranslationType.QuestTitle: + case TranslationType.QuestDetail: + if (QuestsXML == null) + { + QuestsXML = new XDocument(); + QuestsXML.Add(new XElement("Quests")); + QuestsXML.Root.SetAttributeValue("Version", "0.0.0"); + QuestsVersion = "0.0.0"; + } + + kcsapi_quest QuestData = RawData as kcsapi_quest; + + if (QuestData == null) + return; + + IEnumerable FoundTranslationDetail = QuestsXML.Descendants("Quest").Where(b => b.Element("JP-Detail").Value.Equals(QuestData.api_detail)); + IEnumerable FoundTranslationTitle = QuestsXML.Descendants("Quest").Where(b => b.Element("JP-Name").Value.Equals(QuestData.api_title)); + + // Check the current list for any errors and fix them before writing a whole new element. + if (Type == TranslationType.QuestTitle && FoundTranslationDetail != null && FoundTranslationDetail.Any()) + { + // The title is wrong, but the detail is right. Fix the title. + foreach (XElement el in FoundTranslationDetail) + el.Element("JP-Name").Value = QuestData.api_title; + + } + else if (Type == TranslationType.QuestDetail && FoundTranslationTitle != null && FoundTranslationTitle.Any()) + { + // We found an existing detail, the title must be broken. Fix it. + foreach (XElement el in FoundTranslationTitle) + el.Element("JP-Detail").Value = QuestData.api_detail; + } + else + { + // The quest doesn't exist at all. Add it. + QuestsXML.Root.Add(new XElement("Quest", + new XElement("ID", QuestData.api_no), + new XElement("JP-Name", QuestData.api_title), + new XElement("TR-Name", QuestData.api_title), + new XElement("JP-Detail", QuestData.api_detail), + new XElement("TR-Detail", QuestData.api_detail) + )); + } + + QuestsXML.Save("Translations\\" + CurrentCulture + "Quests.xml"); + break; + } + } + catch { } + } + + } } diff --git a/README.md b/README.md index 32601befb..f49caf981 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This is the translation project of the original [KanColleViewer](http://grabacr. * [southrop](https://github.com/southrop) -- Original text file translation code (defunct) * [m-kc](https://github.com/m-kc) -- Rankings section * [taihou](https://github.com/taihou) -- Logging option +* [FreyYa](https://github.com/FreyYa) -- Custom Sound ## Downloads All builds can be found in the following links below. @@ -21,6 +22,9 @@ All builds can be found in the following links below. ## Frequently Asked Questions +#### Is KCV safe? +Yes. You are mainly playing off Internet Explorer (IE). The program itself wraps itself around IE and captures all network coming in and out. It only looks for incoming data and uses that for displaying in game information such as ships, expeditions, quests, and so on. **This does not change the game itself in any way**. **It does not change the packets in any way**. For other solutions to say that their version is "safer" while they are asking you to use an API link are just as much a problem as it is with this program. + #### How do I use KCV to play Kancolle without a VPN? Before or after logging in, press the "Set Regional Cookie" button. This will change your status from being an IP from outside Japan to being a Japanese native one. It doesn't change your IP or do anything else except change a flag value on your visitor cookie. @@ -38,33 +42,37 @@ Install [Flash for Internet Explorer](http://get.adobe.com/flashplayer/othervers #### I'm on Windows 7/XP and the program does not run! You need to have [.NET Framework 4.5](http://www.microsoft.com/en-us/download/details.aspx?id=30653) installed for your version of Windows. Those on Windows 8 do not have to do this. +#### I have a white screen / error message about being unable to connect. +Please let me know if this is happening and tell me what OS you are using and the version of IE. My suspicion is an outdated version of IE. Reports have also shown that clearing your cache+cookies and re-installing flash will also fix this issue. + +#### My Fleets and Expeditions don't show/update! +Clear your cache and relaunch KCV again. Especially after updates or playing between versions of KCV, this should fix any issues regarding this. + #### I want the original Japanese names for ships/items/etc. Easiest way is to just disable translations in the options menu. You can also set the UI's language to Japanese which will disable all translations by default. If you only want certain things translated, deleting the corresponding XML file in the translation folder is your best bet (just be sure to disable auto update). #### I'm missing XXXX translations! (XXXX is in Japanese) Please help me with these when you run into them. The translation engine has the ability to add untranslated text to the corresponding XML file found in translations. Find the untranslated parts at the bottom of the list and message it to me through pastebin on twitter (@Zharay) or as a bug in GitHub. -#### I have a white screen! -Please let me know if this is happening and tell me what OS you are using and the version of IE. My suspicion is an outdated version of IE. - #### Custom Sound Notifications - What? -These are sounds that play immediately when a normal windows notification is to be displayed. Supported formats are WAV and MP3. You must place them in the "Sounds" and under the subdirectory corresponding to the notification you require. It doesn't matter the name or the number you have; a random file will be chosen to be played every time. +These are sounds that play immediately when a normal windows notification is to be displayed. Supported formats are WAV and MP3. You must place them in the "Sounds" and under the sub-directory corresponding to the notification you require. It doesn't matter the name or the number you have; a random file will be chosen to be played every time. Note! For those not in English UI, you may need to place them in the folders that are generated *after* a notification is played once. Any missing folders will be created for you. -#### What is the difference between this and the original? +#### What is the difference between this and the original KCV by Grabarc07? * Horizontal version is unique to this project. * The translation of all equipment, ships, and quests -* Detailed equipment information (for now) -* Logging features (for now) -* Ranking information (for now) -* Calculator (for now) -* Auto updating and version checking. +* Detailed equipment information +* Logging features +* Ranking information +* EXP Calculator +* Auto updating and version checking * Regional cookie setting. * Flash quality settings * Custom sound notifications +* Extra stat display on ships and equipment -Other than the above, this version is the same with just some minor tweaks to make it fit for an English translation. The plan is to hopefully add some features into the main project for all to enjoy. +Other than the above, this version is the same with some tweaks to make it fit for an English translation. The plan is to hopefully add some features into the main project for all to enjoy. ## About This Project KanColleViewer uses the web browser component of the Windows Presentation Foundation (WPF) in combination of [FiddlerCore](http://fiddler2.com/fiddlercore) to capture communication packets in-between the server and the page itself. diff --git a/resources/Version.xml b/resources/Version.xml index f964fa908..4dfdd6ba0 100644 --- a/resources/Version.xml +++ b/resources/Version.xml @@ -2,8 +2,8 @@ App - 2.6.0.426 - https://github.com/Zharay/KanColleViewer/releases/tag/v2.6.0r426 + 2.6.0.431 + https://github.com/Zharay/KanColleViewer/releases/tag/v2.6.0r431 Equipment