Hallo
Ja ich hab heute viele Fragen...
Bei meinem kleinen Hexconverter hab ich jetz ein Vergleich eingebaut: Zuerst gibt man dn ersten Pfad der ersten Datei an und dann der zweiten. Dann wird der Text verglichen und ich will das er die Stellen die NICHT gleich sind unten hingeschrieben werden etwa in dem Format: (File1) 2F -> (File2) 3F
Wie mach ich das nun das er es anzeigt?
Hier mal der Code:
|
C#-Quelltext
|
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
|
string path = Console.ReadLine();
// Open the file to read from.
string readText = File.ReadAllText(path);
char[] values = readText.ToCharArray();
foreach (char letter in values)
{
// Get the integral value of the character.
int value = Convert.ToInt32(letter);
// Convert the decimal value to a hexadecimal value in string form.
string hexOutput = String.Format("{0:X}", value);
Console.Write("{1} ", letter, hexOutput, readText);
}
string path1 = Console.ReadLine();
// Open the file to read from.
string readText1 = File.ReadAllText(path1);
char[] values1 = readText1.ToCharArray();
foreach (char letter1 in values1)
{
// Get the integral value of the character.
int value1 = Convert.ToInt32(letter1);
// Convert the decimal value to a hexadecimal value in string form.
string hexOutput = String.Format("{0:X}", value1);
Console.Write("{1} ", letter1, hexOutput, readText1);
}
string MyString = path;
Console.WriteLine(String.Compare(MyString, path1));
if(MyString == path1)
{
Console.WriteLine("Gleich!");
}
else
{
Console.WriteLine("Nicht Gleich!");
}
Console.ReadKey();
|
Und ist es eigentlich möglich in der Konsolenanwendung ein Fenster aufzurufen in dem man die Datei auwählen kann statt den Pfad einzugeben?
Und ist es auch möglich Text in die Konsolenanwendung zu kopieren? Diese Frage ist aber nicht so wichtig!