Пример #1
0
        virtual public void __FillStartInputItemQueue(InputItemQueue start_input_item_queue, Type start_input_item_type)
        {
            Log.Main.Write("Filling queue of " + start_input_item_queue.Name + " with input file.");

            if (!File.Exists(Settings.Input.File))
            {
                throw (new Exception("Input file " + Settings.Input.File + " does not exist."));
            }

            if (Path.GetExtension(Settings.Input.File).StartsWith(".xls", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new Exception("Reading excel is not supported");
            }

            FileReader fr = new FileReader(Settings.Input.File, Settings.Input.FileFormat);

            for (FileReader.Row r = fr.ReadLine(); r != null; r = fr.ReadLine())
            {
                InputItem.Add2QueueBeforeStart(start_input_item_queue, start_input_item_type, r.Headers.ToDictionary(x => x, x => r[x]));
            }

            if (start_input_item_queue.CountOfNew < 1)
            {
                LogMessage.Error("Input queue is empty so nothing is to do. Check your input data.");
            }
        }
Пример #2
0
 public IEnumerable <Row> ReadAll()
 {
     lock (this)
     {
         for (FileReader.Row r = ReadLine(); r != null; r = ReadLine())
         {
             yield return(r);
         }
     }
 }
Пример #3
0
        static public void FillStartInputItemQueue(InputItemQueue start_input_item_queue, Type start_input_item_type)
        {
            Log.Main.Write("Filling queue of " + start_input_item_queue.Name + " with input file.");

            if (!File.Exists(Properties.Input.Default.InputFile))
            {
                throw (new Exception("Input file " + Properties.Input.Default.InputFile + " does not exist."));
            }

            if (Path.GetExtension(Properties.Input.Default.InputFile).StartsWith(".xls", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new Exception("Reading excel was not implemented");
            }

            FileReader fr = new FileReader(Properties.Input.Default.InputFile, Properties.Input.Default.InputFieldSeparator);

            for (FileReader.Row r = fr.ReadLine(); r != null; r = fr.ReadLine())
            {
                InputItem.Add2QueueBeforeStart(start_input_item_queue, start_input_item_type, r.Headers.ToDictionary(x => x, x => r[x]));
            }
        }