Esempio n. 1
0
        /// <summary>
        /// 获取合法的本地路径
        /// </summary>
        /// <param name="destPath">目的路径</param>
        /// <param name="objectpath">报错路径</param>
        /// <returns></returns>
        private string GetValidLocalPath(string macPath, string macBasePath, string destBasePath)
        {
            string localpath = string.Empty;

            try
            {
                //替换为目的路径
                localpath = PathConvertToLocal(macPath, macBasePath, destBasePath);
                //特殊字符替换
                localpath = PathValidUtil.GetValidPath(localpath);
            }
            catch (System.Exception ex)
            {
                Common.Util.LogManager.WriteLog(LogFile.Error, MessageUtil.GetExceptionMsg(ex, ""));
                throw;
            }

            return(localpath);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取文件对应的SSH本地文件路径
        /// </summary>
        /// <param name="ms"></param>
        /// <param name="macPath"></param>
        /// <returns></returns>
        private string GetLocalSSHPath(MonitorServer ms, string macPath, string sshOP)
        {
            string localBasePath = ms.monitorLocalPath;

            //获取SSH输出基础路径 暂时不支持网络位置
            string localSSHBasePath = string.Empty;

            if (string.IsNullOrWhiteSpace(sshOP.Trim()))
            {
                localSSHBasePath = localBasePath.Substring(0, localBasePath.IndexOf(':') + 1) + "\\SSH\\" + ms.monitorServerName + "-SSH";
            }
            else
            {
                sshOP.TrimEnd('\\');
                localSSHBasePath = sshOP + "\\" + ms.monitorServerName + "-SSH";
            }
            string localSSHPath = macPath.Replace(ms.monitorMacPath, localSSHBasePath).Replace('/', '\\');

            localSSHPath = PathValidUtil.GetValidPath(localSSHPath);
            return(localSSHPath);
        }