示例#1
0
        protected override void Execution(object sender = null, DoWorkEventArgs e = null)
        {
            string ftpFilePath   = Path.Combine(FTP_FILE_PATH, FILE_NAME);
            string localFilePath = Path.Combine(LOCAL_FILE_PATH, FILE_NAME);

            var res = FtpWorks.DownloadFileFromFtpOld(localFilePath, ftpFilePath, FTP_LOGIN, FTP_PASSWORD);

            if (!res.IsComplete)
            {
                throw new Exception(res.Message);
            }

            if (!File.Exists(localFilePath))
            {
                throw new Exception($"Файл не существует:{Environment.NewLine}{localFilePath}");
            }

            var act = new MagicUpdaterCommon.CommonActions.StartWithParameter1C(Id, Parameters1C.CmdParams1C.ExecProcessing(localFilePath));

            act.ActRun();

            if (!act.NewProc.HasExited)
            {
                act.NewProc.WaitForExit(60000 * 5);
            }

            if (!act.NewProc.HasExited)
            {
                act.NewProc.Kill();
            }
        }
示例#2
0
        protected override void Execution(object sender = null, DoWorkEventArgs e = null)
        {
            if (!Directory.Exists(DISTRIB_PATH))
            {
                Directory.CreateDirectory(DISTRIB_PATH);
            }

            if (!Directory.Exists(Path.Combine(DISTRIB_PATH, WGET)))
            {
                Directory.CreateDirectory(Path.Combine(DISTRIB_PATH, WGET));
            }

            if (!File.Exists(Path.Combine(DISTRIB_PATH, WGET, WGET_EXE)))
            {
                var res = FtpWorks.DownloadFileFromFtpOld(Path.Combine(DISTRIB_PATH, WGET, WGET_EXE), Path.Combine(FTP_PATH, WGET_EXE), LOGIN, PASSWORD);
                if (!res.IsComplete)
                {
                    throw new Exception(res.Message);
                }
            }

            var process = Process.Start($"{Path.Combine(DISTRIB_PATH, WGET, WGET_EXE)}", $" -c -nc ftp://{LOGIN}:{PASSWORD}@{FTP_PATH_PART} - P \"{DISTRIB_PATH}\"");
        }