Made CorgiCoder's Shift Cipher even more awesome!

This commit is contained in:
That_One_Nerd 2023-05-26 07:18:49 -04:00
parent 2dad5db062
commit 85da23a688
5 changed files with 320 additions and 17 deletions

Binary file not shown.

View File

@ -1,16 +0,0 @@
using System;
namespace CorgiCoder.ShiftCipher;
public class ShiftSerializer
{
static ShiftSerializer()
{
Console.WriteLine("Loaded");
}
public ShiftSerializer()
{
}
}

View File

@ -0,0 +1,306 @@
using System;
using System.Runtime.CompilerServices;
namespace CorgiCoder.ShiftCipher;
public class ShiftSerializer
{
public ShiftSerializerOptions Options { get; private init; }
static ShiftSerializer()
{
// Print the logo! That's the most important part.
// This is the best way I, CorgiCoder, can think of to do this.
string[] textElements1 = new string[]
{
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
"""
};
string[] textElements2 = new string[]
{
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
""",
"""
"""
};
ConsoleColor[] colors = { ConsoleColor.Red, ConsoleColor.DarkYellow, ConsoleColor.Yellow,
ConsoleColor.DarkGreen, ConsoleColor.Green, ConsoleColor.Cyan,
ConsoleColor.DarkCyan, ConsoleColor.Blue, ConsoleColor.DarkBlue,
ConsoleColor.Magenta, ConsoleColor.DarkMagenta, ConsoleColor.DarkRed };
// Stay tuned on CorgiCoder's Shift Cipher!
int position = 0;
for (int i = 0; i < textElements1.Length; i++)
{
int maxLength = 0;
string[] lines = textElements1[i].Split('\n');
Console.ForegroundColor = colors[i % colors.Length];
for (int j = 0; j < lines.Length; j++)
{
Console.SetCursorPosition(position, j);
Console.WriteLine(lines[j]);
if (maxLength < lines[j].Length) maxLength = lines[j].Length;
}
if (i < textElements1.Length - 1) position += maxLength;
}
position = 0;
for (int i = 0; i < textElements1.Length; i++)
{
int maxLength = 0;
string[] lines = textElements1[i].Split('\n');
Console.ForegroundColor = colors[i % colors.Length];
for (int j = 0; j < lines.Length; j++)
{
Console.SetCursorPosition(position, j + textElements1.Length + 1);
Console.WriteLine(lines[j]);
if (maxLength < lines[j].Length) maxLength = lines[j].Length;
}
if (i < textElements1.Length - 1) position += maxLength;
}
Console.ResetColor();
}
private ShiftSerializer(ShiftSerializerOptions options)
{
Options = options;
}
public static ShiftSerializer Create(ShiftSerializerOptions options) => new(options);
public static ShiftSerializer CreateDefault() => new(new());
}

View File

@ -0,0 +1,13 @@
namespace CorgiCoder.ShiftCipher;
public record class ShiftSerializerOptions
{
public static readonly ShiftSerializerOptions Default = new();
public int offsetCount;
public ShiftSerializerOptions()
{
offsetCount = 0;
}
}

View File

@ -6,6 +6,6 @@ public static class Program
{ {
public static void Main() public static void Main()
{ {
ShiftSerializer shift = new(); ShiftSerializer shift = ShiftSerializer.CreateDefault();
} }
} }