Cypher

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

ResdFiles.cs (1209B)


      1 using System;
      2 using System.Collections.Generic;
      3 using System.Linq;
      4 using System.Text;
      5 using System.Threading.Tasks;
      6 
      7 namespace Cypher
      8 {
      9     internal class ResdFiles
     10     {
     11         public int[] ReadKeyFile(string whereKeyFile)
     12         {
     13             int[] order = new int[1000];
     14             int inNumber = 0;
     15             //keyファイルが1000行か確認する
     16             string[] lines = File.ReadAllLines(whereKeyFile);
     17             if (lines.Length != 1000)
     18             {
     19                 Console.WriteLine("The key file you selected is not key file");
     20                 Console.WriteLine("We can't continu this program!");
     21                 Console.WriteLine("We will stop by 10seconds.");
     22                 Thread.Sleep(10000);
     23                 Environment.Exit(0);
     24             }
     25             //順序ファイルの読み込み
     26             StreamReader sr = new StreamReader(whereKeyFile);
     27             //配列に順序を読み込み
     28             while (inNumber < 1000)
     29             {
     30                 order[inNumber] = int.Parse(sr.ReadLine());
     31                 inNumber++;
     32             }
     33             sr.Close();
     34             Console.WriteLine("key file was readed");
     35             return order;
     36         }
     37     }
     38 }