Exemplo n.º 1
0
        private bool CheckBeforeInstall()
        {
            if (Directory.Exists(TargetPath))
            {
                DirectoryInfo info = new DirectoryInfo(TargetPath);
                if (info.GetFiles().Length > 0)
                {
                    if (UtilMessage.ShowConfirm("安装目标目录不为空,确定要覆盖安装吗?") != DialogResult.Yes)
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (!UtilFile.CheckDirectory(TargetPath, true))
                {
                    UtilMessage.ShowWarning("创建安装目标目录失败,可能是当前用户权限不足,请检查。");
                    return(false);
                }
            }

            return(true);
        }