Skip to content

Commit 10d5482

Browse files
Supported PascalCase (version 2.0.0)
1 parent df8212b commit 10d5482

File tree

2 files changed

+55
-55
lines changed

2 files changed

+55
-55
lines changed

Program.cs

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,68 @@
44
/// This is an custom made input buffer so that we can get the output even if the user have not completed typing.
55
/// coded by @pradosh-arduino (github)
66
/// </summary>
7-
public class prad_buffer {
7+
public class PradBuffer {
88
private char[] buffer;
9-
private int buffer_size;
9+
private int BufferSize;
1010

1111
/// <summary>
1212
/// Stores the current index of the input buffer.
1313
/// </summary>
14-
public int buffer_index = 0;
14+
public int BufferIndex = 0;
1515

1616
/// <summary>
1717
/// Stores the total length of the input buffer.
1818
/// </summary>
19-
public int length = 0;
19+
public int Length = 0;
2020

2121
/// <summary>
2222
/// Constructor to initialize the buffer with its size.
2323
/// </summary>
24-
public prad_buffer()
24+
public PradBuffer()
2525
{
26-
buffer_size = 1024;
27-
buffer = new char[buffer_size];
26+
BufferSize = 1024;
27+
buffer = new char[BufferSize];
2828
}
2929

3030
/// <summary>
3131
/// Constructor to initialize the buffer with your own size.
3232
/// </summary>
3333
/// <param name="size">The size of the buffer.</param>
34-
public prad_buffer(int size)
34+
public PradBuffer(int size)
3535
{
36-
buffer_size = size;
37-
buffer = new char[buffer_size];
36+
BufferSize = size;
37+
buffer = new char[BufferSize];
3838
}
3939

4040
/// <summary>
4141
/// Function to add a character to the buffer.
4242
/// </summary>
4343
/// <param name="c">The character to be added.</param>
44-
public void add_char(char c){
45-
if(buffer_index >= buffer.Length)
44+
public void AddChar(char c){
45+
if(BufferIndex >= buffer.Length)
4646
return;
4747

48-
buffer[buffer_index] = c;
49-
buffer_index++;
50-
length++;
48+
buffer[BufferIndex] = c;
49+
BufferIndex++;
50+
Length++;
5151
}
5252

5353
/// <summary>
5454
/// Clears the buffer for next usage, This function will not be automatically called, you have to call by yourself.
5555
/// </summary>
56-
public void clear_buffer(){
56+
public void ClearBuffer(){
5757
for(int i = 0; i < buffer.Length; i++){
5858
buffer[i] = '\0';
5959
}
6060

61-
buffer_index = 0;
62-
length = 0;
61+
BufferIndex = 0;
62+
Length = 0;
6363
}
6464

6565
/// <summary>
6666
/// Gets the input and stores it in the input buffer array cleanly. It does <b>NOT</b> return the buffer.
6767
/// </summary>
68-
public void get_input(){
68+
public void GetInput(){
6969
ConsoleKeyInfo current;
7070

7171
while (true)
@@ -76,12 +76,12 @@ public void get_input(){
7676

7777
if (current.Key == ConsoleKey.Enter)
7878
{
79-
if(length != 0)
79+
if(Length != 0)
8080
Console.WriteLine();
8181

82-
for(int i=0; i<length;i++){
82+
for(int i=0; i<Length;i++){
8383
if(buffer[i] == '\0'){
84-
length = i;
84+
Length = i;
8585
break;
8686
}
8787
}
@@ -90,36 +90,36 @@ public void get_input(){
9090
}
9191
else if (current.Key == ConsoleKey.Backspace)
9292
{
93-
if (buffer_index > 0)
93+
if (BufferIndex > 0)
9494
{
95-
buffer_index--;
96-
length--;
95+
BufferIndex--;
96+
Length--;
9797
Console.Write("\b \b");
9898
}
9999
}
100100
else if(current.Key == ConsoleKey.LeftArrow){
101101
if(Console.CursorLeft > 0){
102102
Console.CursorLeft--;
103-
buffer_index--;
103+
BufferIndex--;
104104
}
105105
}
106106
else if(current.Key == ConsoleKey.RightArrow){
107-
if(Console.CursorLeft < length){
107+
if(Console.CursorLeft < Length){
108108
Console.CursorLeft++;
109-
buffer_index++;
109+
BufferIndex++;
110110
}
111111
}
112112
else if(current.Key == ConsoleKey.Home){
113113
Console.Write("\r");
114-
buffer_index = 0;
114+
BufferIndex = 0;
115115
}
116116
else if(current.Key == ConsoleKey.End){
117-
Console.CursorLeft = length;
118-
buffer_index = length;
117+
Console.CursorLeft = Length;
118+
BufferIndex = Length;
119119
}
120120
else
121121
{
122-
add_char(current.KeyChar);
122+
AddChar(current.KeyChar);
123123
Console.Write(current.KeyChar);
124124
}
125125
}
@@ -129,7 +129,7 @@ public void get_input(){
129129
/// Gets the input and stores it in the input buffer array cleanly. It does <b>NOT</b> return the buffer. We can add a prefix to the input.
130130
/// </summary>
131131
/// <param name="prefix">The actual prefix needed to be displayed</param>
132-
public void get_input(string prefix){
132+
public void GetInput(string prefix){
133133
ConsoleKeyInfo current;
134134

135135
Console.Write(prefix);
@@ -142,12 +142,12 @@ public void get_input(string prefix){
142142

143143
if (current.Key == ConsoleKey.Enter)
144144
{
145-
if(length != 0)
145+
if(Length != 0)
146146
Console.WriteLine();
147147

148-
for(int i=0; i<length;i++){
148+
for(int i=0; i<Length;i++){
149149
if(buffer[i] == '\0'){
150-
length = i;
150+
Length = i;
151151
break;
152152
}
153153
}
@@ -156,37 +156,37 @@ public void get_input(string prefix){
156156
}
157157
else if (current.Key == ConsoleKey.Backspace)
158158
{
159-
if (buffer_index > 0)
159+
if (BufferIndex > 0)
160160
{
161-
buffer_index--;
162-
length--;
161+
BufferIndex--;
162+
Length--;
163163
Console.Write("\b \b");
164164
}
165165
}
166166
else if(current.Key == ConsoleKey.LeftArrow){
167167
if(Console.CursorLeft > prefix.Length){
168168
Console.CursorLeft--;
169-
buffer_index--;
169+
BufferIndex--;
170170
}
171171
}
172172
else if(current.Key == ConsoleKey.RightArrow){
173-
if(Console.CursorLeft < length + prefix.Length){
173+
if(Console.CursorLeft < Length + prefix.Length){
174174
Console.CursorLeft++;
175-
buffer_index++;
175+
BufferIndex++;
176176
}
177177
}
178178
else if(current.Key == ConsoleKey.Home){
179179
Console.Write("\r");
180180
Console.CursorLeft += prefix.Length;
181-
buffer_index = 0;
181+
BufferIndex = 0;
182182
}
183183
else if(current.Key == ConsoleKey.End){
184-
Console.CursorLeft = length + prefix.Length;
185-
buffer_index = length;
184+
Console.CursorLeft = Length + prefix.Length;
185+
BufferIndex = Length;
186186
}
187187
else
188188
{
189-
add_char(current.KeyChar);
189+
AddChar(current.KeyChar);
190190
Console.Write(current.KeyChar);
191191
}
192192
}
@@ -196,34 +196,34 @@ public void get_input(string prefix){
196196
/// Function to get the buffer values.
197197
/// </summary>
198198
/// <returns>It returns the buffer as an character array.</returns>
199-
public char[] get_buffer(){
199+
public char[] GetBuffer(){
200200
return buffer;
201201
}
202202

203203
/// <summary>
204204
/// Function to get the buffer array as a string.
205205
/// </summary>
206206
/// <returns>A proper string with buffer values.</returns>
207-
public string get_buffer_as_string(){
208-
return new string(buffer, 0, length);
207+
public string GetBufferAsString(){
208+
return new string(buffer, 0, Length);
209209
}
210210

211211
/// <summary>
212212
/// Function to get the allocated buffer size.
213213
/// </summary>
214214
/// <returns>The buffer size in integer.</returns>
215-
public int get_buffer_size(){
216-
return buffer_size;
215+
public int GetBufferSize(){
216+
return BufferSize;
217217
}
218218

219219
/// <summary>
220220
/// Function to set the buffer size.
221221
/// This function will <b>CLEAR</b> the buffer and reallocate the buffer with the new size.
222222
/// </summary>
223223
/// <param name="size">The size of buffer (default is 1024)</param>
224-
public void set_buffer_size(int size){
225-
buffer_size = size;
226-
buffer = new char[buffer_size];
224+
public void SetBufferSize(int size){
225+
BufferSize = size;
226+
buffer = new char[BufferSize];
227227
}
228228
}
229229
}

buffer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Nullable>enable</Nullable>
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
99

10-
<Version>1.2.0</Version>
10+
<Version>2.0.0</Version>
1111
<Authors>Pradosh (helloImPR)</Authors>
1212
<Description>A fast, completely controllable input method solution for C#.</Description>
1313
<PackageLicenseExpression>MIT</PackageLicenseExpression>

0 commit comments

Comments
 (0)