-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCapturav1.cs
172 lines (171 loc) · 5.37 KB
/
Capturav1.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
using System;
using System.Collections.Generic;
using System.Security;
namespace captura
{
class captura
{
static void Main(string[] args)
{
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";
do{
Console.WriteLine("");
Console.WriteLine("Confirma tu clave: ");
var confirma = Clave();
CONFIRMACION = new System.Net.NetworkCredential(string.Empty, confirma).Password;
}while(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("");
}
//
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;
}
//
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;
}
//
}
}
}