Exemplo n.º 1
0
 public virtual RankFile GetRankFile()
 {
     if (is_input_from_file_)
     {
         if (!File.Exists(input_path_))
         {
             throw new Exception("入力ランクファイルが存在しません。");
         }
         return(new RankFile(input_path_, custom_format_));
     }
     else
     {
         if (is_input_from_stdin_)
         {
             StreamReader reader = null;
             try
             {
                 reader      = new StreamReader(System.Console.OpenStandardInput());
                 input_text_ = reader.ReadToEnd();
             }
             finally
             {
                 if (reader != null)
                 {
                     reader.Close();
                 }
             }
             is_input_from_stdin_ = false;
         }
         RankFile rank_file = new RankFile(custom_format_);
         string   separator = custom_format_.GetInputSeparator();
         if (input_text_.IndexOf(separator) >= 0)
         {
             rank_file.Parse(input_text_);
         }
         else
         {
             rank_file.ParseFromIdList(input_text_);
         }
         return(rank_file);
     }
 }