Пример #1
0
        /// <summary>
        /// Place installable files in folders
        /// </summary>
        /// <param name="workPath"></param>
        /// <returns></returns>
        private static bool PrepareBinaries(string workPath)
        {
            string WorkBinariesPath = Path.Combine(workPath, BinariesSubDir);
            bool   isCopied         = false;

            if (!IsLocal)
            {
                ExtractZip exz = new ExtractZip();
                int        rc  = exz.DownloadAndExtract(GitUrl, workPath, BinariesSubDir, IsX64);
                isCopied = rc == 0;
            }
            else
            {
                if (!FolderHelper.MakeFolder(workPath))
                {
                    return(false);
                }

                if (LocalExePath != WorkBinariesPath)
                {
                    if (!FolderHelper.MakeFolderReset(WorkBinariesPath))
                    {
                        return(false);
                    }

                    Shell  sh     = new Shell();
                    Folder outdir = sh.NameSpace(WorkBinariesPath);
                    IEnumerable <string> subfiles = Directory.EnumerateFiles(LocalExePath, "*.exe");
                    foreach (string file in subfiles)
                    {
                        string filepath = Path.Combine(LocalExePath, file);
                        outdir.CopyHere(filepath, 0);  // 4 for no progress dialog, 16 for Yes to all
                    }
                    subfiles = Directory.EnumerateFiles(LocalExePath, "*.pdb");
                    foreach (string file in subfiles)
                    {
                        string filepath = Path.Combine(LocalExePath, file);
                        outdir.CopyHere(filepath, 0);  // 4 for no progress dialog, 16 for Yes to all
                    }
                }

                // return true if redis-server exists
                isCopied = File.Exists(Path.Combine(WorkBinariesPath, @"redis-server.exe"));
            }

            if (isCopied)
            {
                // copy redis.conf file to workPath
                string redisconf = File.ReadAllText(Path.Combine(RedisConfPath, @"redis.conf"));
                File.WriteAllText(Path.Combine(workPath, @"redis.conf"), redisconf);
            }
            return(isCopied);
        }
Пример #2
0
        /// <summary>
        /// Place installable files in folders
        /// </summary>
        /// <param name="workPath"></param>
        /// <returns></returns>
        private static bool PrepareBinaries(string workPath)
        {
            string WorkBinariesPath  = Path.Combine(workPath, BinariesSubDir);
            bool isCopied = false;

            if (!IsLocal)
            {
                ExtractZip exz = new ExtractZip();
                int rc = exz.DownloadAndExtract(GitUrl, workPath, BinariesSubDir, IsX64);
                isCopied = rc == 0;
            }
            else
            {
                if (!FolderHelper.MakeFolder(workPath))
                    return false;

                if (LocalExePath != WorkBinariesPath)
                {
                    if (!FolderHelper.MakeFolderReset(WorkBinariesPath))
                        return false;

                    Shell sh = new Shell();
                    Folder outdir = sh.NameSpace(WorkBinariesPath);
                    IEnumerable<string> subfiles = Directory.EnumerateFiles(LocalExePath, "*.exe");
                    foreach (string file in subfiles)
                    {
                        string filepath = Path.Combine(LocalExePath, file);
                        outdir.CopyHere(filepath, 0);  // 4 for no progress dialog, 16 for Yes to all
                    }
                    subfiles = Directory.EnumerateFiles(LocalExePath, "*.pdb");
                    foreach (string file in subfiles)
                    {
                        string filepath = Path.Combine(LocalExePath, file);
                        outdir.CopyHere(filepath, 0);  // 4 for no progress dialog, 16 for Yes to all
                    }
                }

                // return true if redis-server exists
                isCopied = File.Exists(Path.Combine(WorkBinariesPath, @"redis-server.exe"));
            }

            if (isCopied)
            {
                // copy redis.conf file to workPath
                string redisconf = File.ReadAllText(Path.Combine(RedisConfPath, @"redis.conf"));
                File.WriteAllText(Path.Combine(workPath, @"redis.conf"), redisconf);
            }
            return isCopied;
        }