Ejemplo n.º 1
0
        public List <FileInfo> GetNewFiles()
        {
            List <FileInfo> new_files = GetFiles(new DirectoryInfo(path_));

            foreach (FileInfo s in last_file_list_)
            {
                int file_index = new_files.FindIndex(x => x.FullName.Contains(s.FullName));

                if (file_index >= 0)
                {
                    new_files.RemoveAt(file_index);
                }
            }

            FileProcessEventArgs event_arg = new FileProcessEventArgs(this, "FILE_STATUS");

            foreach (FileInfo f in new_files)
            {
                last_file_list_.Add(f);
                event_arg.input_files.Add(f);
                event_arg.msg.Add("수신시작");
            }

            if (event_use_ && event_arg.input_files.Count > 0)
            {
                EventControl.Instance().SendEvent(event_arg);
            }

            return(new_files);
        }
Ejemplo n.º 2
0
        protected override void SizeCheckCompleted(object sender, EventArgs e)
        {
            FileSize ch = (sender as FileSize);

            ch.Pause();

            check_count++;

            if (check_count == file_size_checker_.Count)
            {
                FileProcessEventArgs event_args = new FileProcessEventArgs(this, "PROCESS_COMPLETE");

                foreach (FileInfo f in input_files)
                {
                    event_args.input_files.Add(f);
                }

                foreach (FileSize f in file_size_checker_)
                {
                    event_args.output_files.Add(f.current_file);
                    event_args.msg.Add("계산완료");
                    f.Resume();
                }

                check_count            = 0;
                event_args.output_path = output_;
                EventControl.Instance().SendEvent(event_args);

                process_flag_ = false;
            }
        }
Ejemplo n.º 3
0
        private void OutputLogicStartEvent(Object sender, EventArgs e)
        {
            CustomEventArgs custom = (e as CustomEventArgs);

            if (custom.ChkDestination("FILE_COMPLETE"))
            {
                FileProcessEventArgs args = (custom as FileProcessEventArgs);
                output_path_.Enqueue(args);
            }
        }
Ejemplo n.º 4
0
        public void InitializeFiles()
        {
            last_file_list_.Clear();

            FileProcessEventArgs event_arg = new FileProcessEventArgs(this, "FILE_STATUS");

            foreach (FileInfo f in GetFiles(new DirectoryInfo(path_)))
            {
                last_file_list_.Add(f);
                event_arg.input_files.Add(f);
                event_arg.msg.Add("기존파일");
            }

            if (event_use_)
            {
                EventControl.Instance().SendEvent(event_arg);
            }
        }
Ejemplo n.º 5
0
        public void Run()
        {
            List <FileInfo> input_file_info = new List <FileInfo>();

            FileProcessEventArgs event_args = new FileProcessEventArgs(this, "FILE_COMPLETE");

            foreach (FileInfo f in input_files_)
            {
                event_args.input_files.Add(f);
                event_args.msg.Add("계산시작");
            }

            String output_path = StartEnvi(input_file_info);

            event_args.output_path = output_path;

            EventControl.Instance().SendEvent(event_args);
        }
Ejemplo n.º 6
0
        protected override void SizeCheckCompleted(object sender, EventArgs e)
        {
            FileProcessEventArgs event_args = new FileProcessEventArgs(this, "FILE_STATUS");

            FileSize ch = (sender as FileSize);

            ch.Pause();

            event_args.input_files.Add(ch.current_file);
            event_args.msg.Add("수신완료");

            EventControl.Instance().SendEvent(event_args);

            check_count++;

            if (check_count == file_size_checker_.Count)
            {
                FileProcessEventArgs new_event_args = new FileProcessEventArgs(this, "FILE_COMPLETE");
                List <FileInfo>      input_file     = new List <FileInfo>();
                foreach (FileSize f in file_size_checker_)
                {
                    input_file.Add(f.current_file);
                    new_event_args.input_files.Add(f.current_file);
                    new_event_args.msg.Add("계산시작");
                    f.Resume();
                }

                String output_path = "";

                if (module_type_ == 0)
                {
                    output_path = (new AlgorithmControl()).StartNDSIModule(input_file, output_path_);
                }
                else
                {
                }

                check_count = 0;

                new_event_args.output_path = output_path;

                EventControl.Instance().SendEvent(new_event_args);
            }
        }
Ejemplo n.º 7
0
        protected override void TimerEvent(object sender, EventArgs e)
        {
            if (output_path_.Count > 0 && process_flag_ == false)
            {
                process_flag_ = true;
                FileProcessEventArgs args = output_path_.Dequeue();

                ChangePath(args.output_path);

                input_files.Clear();

                foreach (FileInfo f in args.input_files)
                {
                    input_files.Add(f);
                }
            }

            base.TimerEvent(sender, e);
        }
Ejemplo n.º 8
0
        private void CheckFileSize(FileInfo file)
        {
            long prev_size = 0;

            do
            {
                FileInfo check_file = new FileInfo(file.FullName);
                current_file = check_file;

                FileProcessEventArgs event_arg = new FileProcessEventArgs(this, "FILE_STATUS");

                if (prev_size == check_file.Length && check_file.Length > 0)
                {
                    event_arg.input_files.Add(check_file);
                    event_arg.msg.Add("수신완료");

                    if (event_use_)
                    {
                        EventControl.Instance().SendEvent(event_arg);
                    }

                    break;
                }

                event_arg.input_files.Add(check_file);
                event_arg.msg.Add("수신중");

                if (event_use_)
                {
                    EventControl.Instance().SendEvent(event_arg);
                }

                prev_size = check_file.Length;

                Thread.Sleep(10 * 1000);
            } while (operate_);

            if (FileSizeCheckCompleted != null && operate_ == true)
            {
                FileSizeCheckCompleted(this, null);
            }
        }