-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCapturav2.cs
248 lines (245 loc) · 8.32 KB
/
Capturav2.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
using System;
using System.Collections.Generic;
using System.Security;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
using System.Collections;
namespace captura
{
class captura
{
static void Main(string[] args)
{
CSV("data.csv");
Console.WriteLine("");
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
Console.WriteLine(" MY SBOOKGRAM REGISTER");
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
//
Console.Write("Escriba su nombre: ");
string nom = "a";
nom = CatchLetters();
Console.WriteLine("");
Console.WriteLine(nom);
Console.WriteLine("");
//
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
//
Console.Write("Escriba su apellido: ");
string ape = CatchLetters();
Console.WriteLine("");
Console.WriteLine(ape);
Console.WriteLine("");
//
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
//
Console.Write("Escriba su edad: ");
string eda = CatchNUM();
Console.WriteLine("");
Console.WriteLine(eda);
Console.WriteLine("");
//
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
//
Console.Write("Escriba su monto: ");
string mon = CatchDEC();
Console.WriteLine("");
Console.WriteLine(mon);
Console.WriteLine("");
//
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
//
Console.WriteLine("Escribe tu clave: ");
Console.WriteLine("");
var pass = Clave();
string LACLAVE = new System.Net.NetworkCredential(string.Empty, pass).Password;
Console.WriteLine("");
//
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
//
string CONFIRMACION = "a";
char usucon = 'a';
int lol = 0;
do{
if(lol == 0){
Console.WriteLine("Confirma tu clave: ");
Console.WriteLine("");
var confirma = Clave();
CONFIRMACION = new System.Net.NetworkCredential(string.Empty, confirma).Password;
lol++;
}
else{
Console.WriteLine("");
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
Console.WriteLine("!!!ERROR!!!\nDATOS ERRONEOS!\nDesea continuar?\n(1)si (0)no");
usucon = LOVE();
if(usucon == '1'){
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
Console.WriteLine("Confirma tu clave: ");
Console.WriteLine("");
var confirma = Clave();
CONFIRMACION = new System.Net.NetworkCredential(string.Empty, confirma).Password;
}
}
}while(LACLAVE != CONFIRMACION && usucon != '0');
if(LACLAVE == CONFIRMACION){
Console.WriteLine("");
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-");
Console.WriteLine("");
Console.WriteLine("Sus credenciales han sido registradas exitosamente!\n\nBienvenido a MY SBOOKGRAM!");
Console.Beep(450, 100);
Console.WriteLine("");
CSV1(nom,ape,eda,mon,LACLAVE,"data.csv");
}
}
//
public static string CatchLetters()
{
//
int Charnum;
char[] CONST = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', ' ', 'z'};
//
List<char> CharS = new List<char>();
//
do
{
Charnum = Console.Read();
char numeroh = (char)Charnum;
foreach(char ykc in CONST){
if (numeroh == ykc){
CharS.Add(numeroh);
}
}
}while(Charnum != 13);
//
string res = string.Join(null,CharS);
return res;
}
//
public static string CatchNUM()
{
//
int Charnum;
char[] CONST = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
//
List<char> CharS = new List<char>();
//
do
{
Charnum = Console.Read();
char numeroh = (char)Charnum;
foreach(char ykc in CONST){
if (numeroh == ykc){
CharS.Add(numeroh);
}
}
}while(Charnum != 13);
//
string res = string.Join(null,CharS);
return res;
}
//
public static string CatchDEC()
{
//
int Charnum;
char[] CONST = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.'};
//
List<char> CharS = new List<char>();
//
do
{
Charnum = Console.Read();
char numeroh = (char)Charnum;
foreach(char ykc in CONST){
if (numeroh == ykc){
CharS.Add(numeroh);
}
}
}while(Charnum != 13);
//
string res = string.Join(null,CharS);
return res;
}
//
public static SecureString Clave()
{
//
SecureString pass = new SecureString();
ConsoleKeyInfo keyInfo;
//
do
{
keyInfo = Console.ReadKey(true);
if(!char.IsControl(keyInfo.KeyChar))
{
pass.AppendChar(keyInfo.KeyChar);
Console.Write("*");
}
else if(keyInfo.Key == ConsoleKey.Backspace && pass.Length > 0)
{
pass.RemoveAt(pass.Length - 1);
Console.Write("\b \b");
}
}while(keyInfo.Key != ConsoleKey.Enter);
{
return pass;
}
//
}
//
public static void CSV(string path){
StringBuilder csv = new StringBuilder();
if(!File.Exists(path)){
csv.AppendLine("Nombre,Apellido,Edad,Monto,Clave");
File.AppendAllText(path, csv.ToString());
}
}
//
public static void CSV1(string nom, string ape, string eda, string mon, string cla ,string path){
StringBuilder csv = new StringBuilder();
csv.AppendLine(nom+","+ape+","+eda+","+mon+","+cla);
File.AppendAllText(path, csv.ToString());
}
//
public static char LOVE()
{
ConsoleKeyInfo keyInfo;
keyInfo = Console.ReadKey(true);
return keyInfo.KeyChar;
// int Charnum = Console.Read();
// char numeroh = (char)Charnum;
// return numeroh;
}
//
// public static string CatchLetters()
// {
// //
// int Charnum;
// //
// List<int> CharN = new List<int>();
// List<char> CharS = new List<char>();
// //
// do
// {
// Charnum = Console.Read();
// if(Charnum != 13){
// CharN.Add(Charnum);
// }
// }while(Charnum != 13);
// //
// foreach(int gg in CharN)
// {
// char JesusEstaPasandoPorAqui = (char)gg;
// CharS.Add(JesusEstaPasandoPorAqui);
// }
// //
// string res = string.Join(null,CharS);
// res = res.Replace(System.Environment.NewLine, "");
// return res;
// }
}
}