-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acb57ce
commit 6a4135d
Showing
5 changed files
with
10 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,21 @@ | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Couple.Client.States.Image; | ||
|
||
public class CreateUpdateImageStateContainer | ||
{ | ||
private string _day; | ||
|
||
private string _month; | ||
|
||
private string _year; | ||
|
||
public CreateUpdateImageStateContainer() | ||
{ | ||
var today = DateTime.Today; | ||
Day = today.Day.ToString(); | ||
Month = today.Month.ToString(); | ||
Year = today.Year.ToString()[2..]; | ||
Date = DateOnly.FromDateTime(DateTime.Now); | ||
IsFavourite = false; | ||
} | ||
|
||
public CreateUpdateImageStateContainer(DateOnly date, bool isFavourite, byte[] data) | ||
{ | ||
Day = date.Day.ToString(); | ||
Month = date.Month.ToString(); | ||
Year = date.Year.ToString()[2..]; | ||
Date = date; | ||
IsFavourite = isFavourite; | ||
Data = data; | ||
} | ||
|
||
public string Day | ||
{ | ||
get => _day; | ||
set | ||
{ | ||
if (value.Length != 0 && !Regex.IsMatch(value, "^[0-9]{1,2}$")) | ||
{ | ||
return; | ||
} | ||
|
||
_day = value; | ||
} | ||
} | ||
|
||
public string Month | ||
{ | ||
get => _month; | ||
set | ||
{ | ||
if (value.Length != 0 && !Regex.IsMatch(value, "^[0-9]{1,2}$")) | ||
{ | ||
return; | ||
} | ||
|
||
_month = value; | ||
} | ||
} | ||
|
||
public string Year | ||
{ | ||
get => _year; | ||
set | ||
{ | ||
if (value.Length != 0 && !Regex.IsMatch(value, "^[0-9]{1,2}$")) | ||
{ | ||
return; | ||
} | ||
|
||
_year = value; | ||
} | ||
} | ||
|
||
public DateOnly Date { get; set; } | ||
public bool IsFavourite { get; set; } | ||
public byte[] Data { get; set; } | ||
|
||
public DateOnly GetDate() => new(int.Parse($"20{Year}"), int.Parse(Month), int.Parse(Day)); | ||
} |