Exemplo n.º 1
0
        public void CopyFile(FileSystemEventArgs e)
        {
            List <ItemPath> paths = Utility.GetListMapPath(Constants.MAPPING_SERVER_FILENAME);
            string          dir   = e.FullPath.Substring(0, e.FullPath.LastIndexOf("\\"));

            ItemPath item = paths.Find(i => i.Source == dir);

            if (item != null)
            {
                string filename = e.FullPath.Substring(e.FullPath.LastIndexOf("\\") + 1);

                string sourceFile = item.Source + "\\" + filename;
                string desFile    = item.Destination + "\\" + filename;

                DTProcess dTProcess = new DTProcess();
                dTProcess.SourceDir     = sourceFile;
                dTProcess.DesDir        = desFile;
                dTProcess.Type          = TypeProcess.COPY;
                dTProcess.ClientProcess = false;
                dTProcess.log           = log;

                if (!fileProcessor.CheckExistProcess(dTProcess))
                {
                    fileProcessor.EnqueueProcess(dTProcess);
                    log.Info("File: " + e.FullPath + " " + filename);
                }
            }
            else
            {
                log.Error("Do not exist path in map: " + e.FullPath);
            }
        }
Exemplo n.º 2
0
        public void CopyFile(FileSystemEventArgs e)
        {
            List <ItemPath> paths = Utility.GetListMapPath(Constants.MAPPING_CLIENT_FILENAME);
            string          dir   = e.FullPath.Substring(0, e.FullPath.LastIndexOf("\\"));

            // var items = paths.Find(i => i.Source == dir);
            foreach (var item in paths)
            {
                if (item.Source == dir)
                {
                    InitFtp();
                    string filename = e.FullPath.Substring(e.FullPath.LastIndexOf("\\") + 1);

                    string sourceFile = item.Source + "\\" + filename;

                    DTProcess dTProcess = new DTProcess();
                    dTProcess.SourceDir = sourceFile;
                    dTProcess.DesDir    = item.Destination;
                    dTProcess.Type      = TypeProcess.COPY;
                    dTProcess.ftp       = ftp;
                    dTProcess.log       = log;

                    if (!fileProcessor.CheckExistProcess(dTProcess))
                    {
                        fileProcessor.EnqueueProcess(dTProcess);
                        log.Info("File: " + e.FullPath);
                    }
                }
            }
        }