Skip to content

Commit e213dd8

Browse files
committed
0.2.4.1
1 parent 9ebaf7e commit e213dd8

File tree

6 files changed

+38
-22
lines changed

6 files changed

+38
-22
lines changed

Generative/SyntacticGenerator.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ namespace MTLib.Generative;
55
/// Provides a high level interface for sequential syntax generation.
66
/// </summary>
77
public sealed class SyntacticGenerator {
8-
public SyntacticGenerator() { }
8+
public SyntacticGenerator() {
9+
10+
}
911

1012
public SyntacticGenerator(String languageName) {
1113
this.Language = languageName;
@@ -22,7 +24,7 @@ public String? Language {
2224
get { return language; }
2325
set { language = value; }
2426
}
25-
private Dictionary<Byte, String> literals = [];
27+
private readonly Dictionary<Byte, String> literals = [];
2628
public Dictionary<Byte, String> Literals {
2729
get { return literals; }
2830
}
@@ -48,8 +50,7 @@ public SyntacticGenerator WriteLine(
4850
Byte literal,
4951
TabType tabType = TabType.MAINTAIN
5052
) {
51-
ArgumentNullException.ThrowIfNull(
52-
Literals[literal], nameof(literal));
53+
ArgumentNullException.ThrowIfNull(Literals[literal], nameof(literal));
5354
Result.Append(TabString + Literals[literal] + "\n");
5455
switch (tabType) {
5556
case TabType.MAINTAIN:
@@ -73,8 +74,7 @@ public SyntacticGenerator Write(
7374
Boolean putTab = false,
7475
TabType tabType = TabType.MAINTAIN
7576
) {
76-
ArgumentNullException.ThrowIfNull(
77-
Literals[literal], nameof(literal));
77+
ArgumentNullException.ThrowIfNull(Literals[literal], nameof(literal));
7878
Result.Append((putTab ? TabString : "") + Literals[literal]);
7979
switch (tabType) {
8080
case TabType.MAINTAIN:

MTLib.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
ver. format: major.minor.build.revision
1010
-->
1111
<AssemblyVersion></AssemblyVersion>
12-
<Version>0.1.5.0</Version>
12+
<Version>0.2.6.1</Version>
1313
<Authors>MTadder</Authors>
1414
<Company>MTLaboratory</Company>
1515
<Title>MTLibrary</Title>

MetaInfo.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
namespace MTLib;
22
public static class MetaInfo {
3-
public static readonly String VersionString = "Criminogenic";
4-
public static readonly String VersionNumber = "0.1.4";
3+
public static readonly String VersionString = "Galactogenetic";
54
}

Secure/Authenticator.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@
22

33
namespace MTLib.Secure;
44
public sealed class Authenticator {
5-
private List<String> _keys;
6-
private Salt _salt;
7-
public void Clear() => this._keys.Clear();
8-
public void Register(String key) => this._keys.Add(this.Hash(key));
5+
private List<String> keys;
6+
private Salt salt;
7+
public void Clear() => this.keys.Clear();
8+
public void Register(String key) => this.keys.Add(this.Hash(key));
99
public void Register(String[] keys) {
1010
ArgumentNullException.ThrowIfNull(keys);
1111
String[] hashedKeys = new String[keys.Length];
1212
for (Int32 i = 0; i < keys.Length; i++) {
1313
hashedKeys[i] = this.Hash(keys[i]);
1414
}
15-
this._keys.AddRange(hashedKeys);
15+
this.keys.AddRange(hashedKeys);
1616
}
1717
public void Register(Collection<String> keys) => this.Register(keys.ToArray());
1818
public void Register(Char key) => this.Register(key.ToString());
1919
public void Register(Single key) => this.Register(key.ToString());
2020
public void Register(Double key) => this.Register(Convert.ToString(key));
2121
public bool IsRegistered(String data, Boolean doHash = true) {
2222
String hashedQuery = doHash ? this.Hash(data) : data;
23-
foreach (String key in this._keys) {
23+
foreach (String key in this.keys) {
2424
if (key.Equals(hashedQuery, StringComparison.Ordinal)) {
2525
return true;
2626
}
2727
}
2828
return false;
2929
}
3030
public Authenticator() {
31-
this._keys = [];
32-
this._salt = new();
31+
this.keys = [];
32+
this.salt = new();
3333
}
34-
public String Hash(String data) => this._salt.Hash(data);
34+
public String Hash(String data) => this.salt.Hash(data);
3535
}

Secure/DictionaryFile.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace MTLib.Secure;
88
/// </summary>
99
/// <typeparam name="T1">Key type</typeparam>
1010
/// <typeparam name="T2">Value type</typeparam>
11-
public sealed class DictionaryFile<T1, T2> // TODO: DOCUMENT
12-
where T1 : notnull {
11+
public sealed class DictionaryFile<T1, T2>
12+
where T1 : notnull {
1313
private Dictionary<T1, T2> revertMemory = [];
1414

1515
public Dictionary<T1, T2> Memory = [];

Terminal.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,17 @@ public Style Push() {
8282
/// <see cref="Style"/>.
8383
/// </summary>
8484
/// <param name="msg">The <see cref="String"/> to write.</param>
85-
/// <param name="style">The <see cref="Style"/> to use whilst writing.</param>
85+
/// <param name="writer">The <see cref="IConsoleWriter"/> to use for writing.</param>
8686
public void Write(String msg, IConsoleWriter writer) {
87+
ArgumentNullException.ThrowIfNullOrEmpty(msg);
88+
writer ??= Writers.NormalConsoleWriter;
8789
Style old_Style = this.Push();
8890
writer.Write(msg);
8991
_ = old_Style.Push();
9092
}
9193
public void WriteLine(String msg, IConsoleWriter writer) {
94+
ArgumentNullException.ThrowIfNullOrEmpty(msg);
95+
writer ??= Writers.NormalConsoleWriter;
9296
Style old_Style = this.Push();
9397
writer.WriteLine(msg);
9498
_ = old_Style.Push();
@@ -100,16 +104,19 @@ public void WriteLine(String msg, IConsoleWriter writer) {
100104
/// </summary>
101105
/// <param name="style">The <see cref="Style"/> to implicitly cast.</param>
102106
public static implicit operator (ConsoleColor fg, ConsoleColor bg)(Style style) {
107+
ArgumentNullException.ThrowIfNull(style);
103108
return new(style.Foreground, style.Background);
104109
}
110+
105111
/// <summary>
106112
/// Explicitly casts a <see cref="Style"/> from a
107113
/// <see cref="ConsoleColor"/> <see cref="Tuple"/>.
108114
/// </summary>
109-
/// <param name="tup">The <see cref="Tuple"/> to cast.</param>
115+
/// <param name="tuple">The <see cref="Tuple"/> to cast.</param>
110116
public static explicit operator Style((ConsoleColor fg, ConsoleColor bg) tuple) {
111117
return new() { Foreground = tuple.fg, Background = tuple.bg };
112118
}
119+
113120
/// <summary>
114121
/// Explicitly casts a <see cref="Style"/> from a
115122
/// <see cref="ConsoleColor"/> instance.
@@ -119,6 +126,16 @@ public static explicit operator Style((ConsoleColor fg, ConsoleColor bg) tuple)
119126
public static explicit operator Style(ConsoleColor color) {
120127
return new(color);
121128
}
129+
130+
public (ConsoleColor fg, ConsoleColor bg) ToValueTuple() {
131+
throw new NotImplementedException();
132+
}
133+
134+
public static Style ToStyle(Style fg, Style bg) {
135+
return new() { Foreground = fg, Background = bg };
136+
throw new NotImplementedException();
137+
}
138+
122139
}
123140
public class Menu {
124141
#region Properties

0 commit comments

Comments
 (0)