本文整理汇总了C#中Keyword.Decode方法的典型用法代码示例。如果您正苦于以下问题:C# Keyword.Decode方法的具体用法?C# Keyword.Decode怎么用?C# Keyword.Decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keyword
的用法示例。
在下文中一共展示了Keyword.Decode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run() {
Console.WriteLine("Available algorithms for encoding/decoding:");
Console.WriteLine("1 - Vigenere Substitution.");
Console.WriteLine("2 - Transposition Letter by Letter.");
Console.WriteLine("3 - Phone Code.");
Console.WriteLine("4 - Binary Code.");
Console.WriteLine("5 - Keyword.");
Console.Write("\nType the algoritm #: ");
algoritm = Convert.ToInt32(Console.ReadLine());
Console.Write("Type the phrase: ");
input_phrase = Console.ReadLine();
switch (algoritm) {
case 1:
Console.WriteLine("\nVigenere Substitution.");
Console.Write("Type the value: ");
value = Convert.ToInt32(Console.ReadLine());
if (value > 10 && value < 99) {
Console.WriteLine("1 - Encode.");
Console.WriteLine("2 - Decode.");
Console.Write("Procedure #: ");
procedure = Convert.ToInt32(Console.ReadLine());
Vigenere_Substitution vs = new Vigenere_Substitution(input_phrase, value.ToString());
switch (procedure) {
case 1:
vs.Encode();
Console.WriteLine("\n-- Successful encoding procedure --");
Console.WriteLine("Original phrase: " + vs.GetInput_Phrase());
Console.WriteLine("Encoded phrase: " + vs.GetOutput_Phrase());
break;
case 2:
vs.Decode();
Console.WriteLine("\n-- Successful encoding procedure --");
Console.WriteLine("Original phrase: " + vs.GetInput_Phrase());
Console.WriteLine("Decoded phrase: " + vs.GetOutput_Phrase());
break;
default:
Console.WriteLine("\nNo option.");
break;
}
Console.Write("\nExport results? (Y/N) ");
export = Console.ReadLine();
switch (export[0]) {
case 'Y':
Console.Write("Type a name for the output file: ");
file_name = Console.ReadLine();
vs.Export(file_name);
break;
case 'N':
break;
default:
Console.WriteLine("No option.");
break;
}
}
else {
Console.WriteLine("Invalid value.");
}
break;
case 2:
Console.WriteLine("\nTransposition Letter by Letter.");
Console.WriteLine("1 - Encode phrase.");
Console.WriteLine("2 - Decode phrase.");
Console.Write("Procedure #: ");
procedure = Convert.ToInt32(Console.ReadLine());
Transposition t = new Transposition(input_phrase);
switch (procedure) {
case 1:
t.Encode();
Console.WriteLine("\n-- Successful encoding procedure --");
Console.WriteLine("Original phrase: " + t.GetInput_Phrase());
Console.WriteLine("Encoded phrase: " + t.GetOutput_Phrase());
break;
case 2:
t.Decode();
Console.WriteLine("\n-- Successful encoding procedure --");
Console.WriteLine("Original phrase: " + t.GetInput_Phrase());
Console.WriteLine("Decoded phrase: " + t.GetOutput_Phrase());
break;
default:
Console.WriteLine("\nNo option.");
break;
}
Console.Write("\nExport results? (Y/N) ");
export = Console.ReadLine();
switch (export[0]) {
case 'Y':
Console.Write("Type a name for the output file: ");
file_name = Console.ReadLine();
t.Export(file_name);
break;
case 'N':
break;
default:
Console.WriteLine("No option.");
break;
}
break;
case 3:
Console.WriteLine("\nPhone Code.");
//.........这里部分代码省略.........