/// <summary>
        /// 下載XML檔案
        /// </summary>
        public void getXmlFiles( )
        {
            //string[] arr = new string[] { "R22", "R23", "R04", "RS9", "RS4", "R96", "R08","R89","R99" };
            string[] arr        = new string[] { "R00", "R22", "RS9", "RS4", "R99", "R96", "R89", "R08", "R04" };
            string   filePath   = "";
            string   fileName   = "";
            string   okPath     = "";
            string   returnPath = ""; //回傳下載的路徑

            try
            {
                //批次操作

                pl.startLog();
                for (int i = 0; i < arr.Length - 1; i++)
                {
                    this.type = (PROCESS_TYPE)Enum.Parse(typeof(PROCESS_TYPE), arr[i]);
                    filePath  = this.ftp + "/" + arr[i] + "/WORK/";
                    okPath    = this.ftp + "/" + arr[i] + "/OK/";
                    // fileName = arr[i] + this.ecKey + "DFM" + DateTime.Now.ToString("yyyyMMdd") + ".XML.zip";

                    string target = filePath;

                    LCL.Net.Ftp ftp      = new LCL.Net.Ftp(target, this.id, this.pwd);
                    string[]    fileList = ftp.getFileList();

                    if (fileList != null)
                    {
                        foreach (string myFileName in fileList)
                        {
                            //測試用
                            //fileName = arr[i] + this.ecKey + "DFM" + execDate + ".XML.zip";
                            fileName = myFileName;
                            pl.logMessage("\r\n開始下載檔案:" + filePath + fileName);
                            returnPath = downloadFile(filePath, fileName, okPath);
                            pl.logMessage("完成下載檔案:" + filePath + fileName);
                            if (returnPath != "")
                            {
                                pl.logMessage("\r\n開始讀入檔案:" + returnPath);
                                processFile(returnPath);
                                pl.logMessage("完成讀入檔案:" + returnPath);
                            }
                        }
                    }
                    else
                    {
                        pl.logMessage(filePath + "沒有任何檔案");
                    }
                }
                pl.endLog();
            }
            catch (Exception e) {
                FileLog.logError(e.ToString());
            }
        }
Beispiel #2
0
            private string URL(PROCESS_TYPE type)
            {
                switch (type)
                {
                case PROCESS_TYPE.MINIT:
                    return(string.Format("http://{0}{1}/{2}?uploads", m_bucket, Config.UCLOUD_PROXY_SUFFIX, m_key));

                case PROCESS_TYPE.MUPLOAD:
                    return(string.Format("http://{0}{1}/{2}?uploadId={3}&partNumber={4}", m_bucket, Config.UCLOUD_PROXY_SUFFIX, m_key, m_uploadid, m_part_number));

                case PROCESS_TYPE.MFINISH:
                    return(string.Format("http://{0}{1}/{2}?uploadId={3}", m_bucket, Config.UCLOUD_PROXY_SUFFIX, m_key, m_uploadid));

                case PROCESS_TYPE.MCANCEL: return("");

                    return(string.Format("http://{0}{1}/{2}?uploadId={3}", m_bucket, Config.UCLOUD_PROXY_SUFFIX, m_key, m_uploadid));

                default:
                    throw new Exception("invalid url type for multiuploader");
                }
            }
Beispiel #3
0
            private string URL(PROCESS_TYPE type)
            {
                string encodedKey = System.Web.HttpUtility.UrlEncode(m_key);

                encodedKey = encodedKey.Replace("+", "%20");
                switch (type)
                {
                case PROCESS_TYPE.MINIT:
                    return(string.Format("http://{0}{1}/{2}?uploads", m_bucket, Config.UCLOUD_PROXY_SUFFIX, encodedKey));

                case PROCESS_TYPE.MUPLOAD:
                    return(string.Format("http://{0}{1}/{2}?uploadId={3}&partNumber={4}", m_bucket, Config.UCLOUD_PROXY_SUFFIX, encodedKey, m_uploadid, m_part_number));

                case PROCESS_TYPE.MFINISH:
                    return(string.Format("http://{0}{1}/{2}?uploadId={3}", m_bucket, Config.UCLOUD_PROXY_SUFFIX, encodedKey, m_uploadid));

                case PROCESS_TYPE.MCANCEL: return("");

                    return(string.Format("http://{0}{1}/{2}?uploadId={3}", m_bucket, Config.UCLOUD_PROXY_SUFFIX, encodedKey, m_uploadid));

                default:
                    throw new Exception("invalid url type for multiuploader");
                }
            }
Beispiel #4
0
 private string URL(PROCESS_TYPE type)
 {
     switch(type) {
         case PROCESS_TYPE.MINIT:
             return string.Format("http://{0}{1}/{2}?uploads", m_bucket, Config.UCLOUD_PROXY_SUFFIX, m_key);
         case PROCESS_TYPE.MUPLOAD:
             return string.Format("http://{0}{1}/{2}?uploadId={3}&partNumber={4}", m_bucket, Config.UCLOUD_PROXY_SUFFIX, m_key, m_uploadid, m_part_number);
         case PROCESS_TYPE.MFINISH:
             return string.Format("http://{0}{1}/{2}?uploadId={3}", m_bucket, Config.UCLOUD_PROXY_SUFFIX, m_key, m_uploadid);
         case PROCESS_TYPE.MCANCEL: return "";
             return string.Format("http://{0}{1}/{2}?uploadId={3}", m_bucket, Config.UCLOUD_PROXY_SUFFIX, m_key, m_uploadid);
         default:
             throw new Exception("invalid url type for multiuploader");
     }
 }
        /// <summary>
        /// 下載XML檔案
        /// </summary>
        public void getXmlFiles( )
        {
            //string[] arr = new string[] { "R22", "R23", "R04", "RS9", "RS4", "R96", "R08","R89","R99" };
            string[] arr = new string[] { "R00","R22", "RS9","RS4","R99","R96","R89","R08","R04" };
            string filePath = "";
            string fileName = "";
            string okPath = "";
            string returnPath = ""; //回傳下載的路徑

            try
            {
                //批次操作

                pl.startLog();
                for (int i = 0; i < arr.Length - 1; i++)
                {
                    this.type = (PROCESS_TYPE)Enum.Parse(typeof(PROCESS_TYPE),arr[i]);
                    filePath = this.ftp + "/" + arr[i] + "/WORK/";
                    okPath = this.ftp + "/" + arr[i] + "/OK/";
                    // fileName = arr[i] + this.ecKey + "DFM" + DateTime.Now.ToString("yyyyMMdd") + ".XML.zip";

                    string target = filePath;

                    LCL.Net.Ftp ftp = new LCL.Net.Ftp(target, this.id, this.pwd);
                    string[] fileList = ftp.getFileList();

                    if (fileList != null)
                    {
                        foreach (string myFileName in fileList)
                        {
                            //測試用
                            //fileName = arr[i] + this.ecKey + "DFM" + execDate + ".XML.zip";
                            fileName = myFileName;
                            pl.logMessage("\r\n開始下載檔案:" + filePath + fileName);
                            returnPath = downloadFile(filePath, fileName, okPath);
                            pl.logMessage("完成下載檔案:" + filePath + fileName);
                            if (returnPath != "")
                            {
                                pl.logMessage("\r\n開始讀入檔案:" + returnPath);
                                processFile(returnPath);
                                pl.logMessage("完成讀入檔案:" + returnPath);
                            }
                        }

                    }
                    else {
                        pl.logMessage(filePath + "沒有任何檔案");
                    }

                }
                pl.endLog();
            }
            catch (Exception e) {
                FileLog.logError( e.ToString());
            }
        }