-
Notifications
You must be signed in to change notification settings - Fork 21
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
46f2d2a
commit f2fc458
Showing
7 changed files
with
63 additions
and
34 deletions.
There are no files selected for viewing
8 changes: 7 additions & 1 deletion
8
ProjBobcat/ProjBobcat/Class/Model/LauncherProfile/ResolutionModel.cs
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,12 +1,18 @@ | ||
using Newtonsoft.Json; | ||
using ProjBobcat.Interface; | ||
|
||
namespace ProjBobcat.Class.Model.LauncherProfile; | ||
|
||
public class ResolutionModel | ||
public class ResolutionModel : IDefaultValueChecker | ||
{ | ||
[JsonProperty("width")] public uint Width { get; set; } | ||
|
||
[JsonProperty("height")] public uint Height { get; set; } | ||
|
||
[JsonIgnore] public bool FullScreen { get; set; } | ||
|
||
public bool IsDefault() | ||
{ | ||
return Width == 0 && Height == 0; | ||
} | ||
} |
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,19 +1,24 @@ | ||
using Newtonsoft.Json; | ||
using ProjBobcat.Interface; | ||
|
||
namespace ProjBobcat.Class.Model; | ||
|
||
public class ServerSettings | ||
public class ServerSettings : IDefaultValueChecker | ||
{ | ||
public string Address { get; set; } | ||
public ushort Port { get; set; } | ||
public string Address { get; init; } | ||
public ushort Port { get; init; } | ||
|
||
[JsonIgnore] public bool IsDefaultValue => IsDefault(); | ||
[JsonIgnore] public string DisplayStr => ToString(); | ||
|
||
[JsonIgnore] public bool IsDefault => string.IsNullOrEmpty(Address) || Port == 0; | ||
|
||
public override string ToString() | ||
{ | ||
if (IsDefault) return "[N/A]"; | ||
if (IsDefault()) return "[N/A]"; | ||
return $"{Address}:{Port}"; | ||
} | ||
|
||
public bool IsDefault() | ||
{ | ||
return string.IsNullOrEmpty(Address) && Port == 0; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace ProjBobcat.Interface; | ||
|
||
public interface IDefaultValueChecker | ||
{ | ||
bool IsDefault(); | ||
} |
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