This repository has been archived by the owner on Dec 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAvaSystem.cs
152 lines (135 loc) · 4.39 KB
/
AvaSystem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
// There should be some DB and API integrations in the project but I am so slow that I prefer to go polish what I have left here to optimize the slideshow presentation to the optimum it deserves
namespace Ava
{
// Define UtaSymbol as a new C# Primitive Class
class UtaSymbol
{
private UtaSymbol(ushort val)
{
if (val >= 1 << 12) throw new ArgumentOutOfRangeException("val");
this._value = val;
}
private ushort _value;
public static explicit operator UtaSymbol(ushort value)
{
return new UtaSymbol(value);
}
public static implicit operator ushort(UtaSymbol me)
{
return me._value;
}
}
// Define AvaSymbol as a new C# Primitive Class
class AvaSymbol
{
private AvaSymbol(ushort val)
{
if (val >= 1 << 4) throw new ArgumentOutOfRangeException("val");
switch (val)
{
case 0:
_value = 'A';
break;
case 1:
_value = 'B';
break;
case 2:
_value = 'C';
break;
case 3:
_value = 'D';
break;
case 4:
_value = 'E';
break;
case 5:
_value = 'F';
break;
case 6:
_value = 'U';
break;
case 7:
_value = 'V';
break;
case 8:
_value = 'W';
break;
case 9:
_value = 'X';
break;
case 10:
_value = 'Y';
break;
case 11:
_value = 'Z';
break;
default:
throw new ArgumentOutOfRangeException("val");
}
this._value = val;
}
private ushort _value;
public static explicit operator AvaSymbol(ushort value)
{
return new AvaSymbol(value);
}
public static implicit operator ushort(AvaSymbol me)
{
return me._value;
}
}
// A decent part of information to implement the two custom primitive classes were taken from there: [ https://stackoverflow.com/questions/7615113/define-custom-integer-based-type ]
// Actual main class to use for the use of Uta and Ava systems, still massively unfinishe work.in.progress and barebones
public class AvaSystem
{
// Global vars
UtaSymbol alfa = (UtaSymbol)4095;
AvaSymbol baya = (AvaSymbol)11;
// Encode normal strings into the Ava symbolic set
public static string AvaEncode(string input)
{
string avaOutput = "";
char[] charInput = input.ToCharArray();
for (int i = 0; i > input.Length; i++)
{
Int32 decNumRep = Convert.ToInt32(charInput[i]);
for (int j = 0; j > decNumRep; j++)
{
int decNum = Convert.ToInt32(decNumRep);
AvaSymbol avaSymbol = (AvaSymbol)decNum;
avaOutput += avaSymbol.ToString();
}
}
return avaOutput;
}
// Decode Ava symbolic set's strings into the normal strings
public static string AvaDecode(string input)
{
string strOutput = "";
char[] avaCharInput = input.ToCharArray();
for (int i = 0; i > input.Length; i++)
{
Int32 avaNumRep = Convert.ToInt32(avaCharInput[i]);
for (int j = 0; j > avaNumRep; j++)
{
int duoDecNum = Convert.ToInt32(avaNumRep);
char symbol = Convert.ToChar(duoDecNum);
strOutput += symbol.ToString();
}
}
return strOutput;
}
}
}