Skip to content

Commit

Permalink
修正前の版を使っている人がアプでしたとき、処理がフリーズしないよう調整
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Aug 28, 2022
1 parent 1d697e0 commit d127c1a
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions KmyKeiba/Models/Race/ExNumber/ExternalNumberConfigModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ public class ExternalNumberConfigItem : IDisposable, ICheckableItem
public ExternalNumberConfigItem(ExternalNumberConfig data)
{
this.Data = data;

this.CheckInvalidData();
this.LoadFromData();

this.Name
Expand All @@ -143,9 +145,9 @@ public ExternalNumberConfigItem(ExternalNumberConfig data)
return;
}
if (this.IsFormatHorseCsv.Value == this.IsFormatRaceFixedLength.Value == this.IsFormatRaceCsv.Value == this.IsFormatHorseFixedLength.Value == false ||
this.IsValuesNumberOnly.Value == this.IsValuesNumberAndOrder.Value == false ||
this.IsSortLarger.Value == this.IsSortSmaller.Value == this.IsSortSmallerWithoutZero.Value == false)
if ((this.IsFormatHorseCsv.Value == false && this.IsFormatRaceFixedLength.Value == false && this.IsFormatRaceCsv.Value == false && this.IsFormatHorseFixedLength.Value == false) ||
(this.IsValuesNumberOnly.Value == false && this.IsValuesNumberAndOrder.Value == false) ||
(this.IsSortLarger.Value == false && this.IsSortSmaller.Value == false && this.IsSortSmallerWithoutZero.Value == false))
{
// UIのせいでなぜか全部falseになってイベント通知してくることがある
this.LoadFromData();
Expand Down Expand Up @@ -178,6 +180,24 @@ public ExternalNumberConfigItem(ExternalNumberConfig data)
this._isInitializing = false;
}

private void CheckInvalidData()
{
var data = this.Data;

if (data.FileFormat == ExternalNumberFileFormat.Unknown)
{
data.FileFormat = ExternalNumberFileFormat.RaceCsv;
}
if (data.ValuesFormat == ExternalNumberValuesFormat.Unknown)
{
data.ValuesFormat = ExternalNumberValuesFormat.NumberOnly;
}
if (data.SortRule == ExternalNumberSortRule.Unknown)
{
data.SortRule = ExternalNumberSortRule.Larger;
}
}

private void LoadFromData()
{
var data = this.Data;
Expand Down

0 comments on commit d127c1a

Please sign in to comment.