Example #1
0
        private void UnzipperFinished(Dictionary <string, string> files)
        {
            foreach (var pair in files)
            {
                bool ret = true;
                foreach (var rule in unpackRules)
                {
                    var match = rule.Key.Match(pair.Key);
                    if (match.Success)
                    {
                        var unpackMatch = rule.Value;
                        unpackMatch.StartFolder = pair.Value;

                        Invoke((MethodInvoker) delegate { labelInstallProgress.Text = String.Format(TextMoveProcessProgress, unpackMatch.DisplayName); });
                        var movePath = RootFolderFinder.FindAll(unpackMatch.StartFolder, unpackMatch.FileToFind, unpackMatch.TargetRoot)[0];
                        copier.Files.Clear();
                        copier.AddDirectory(movePath, Path.Combine(textInstallDirectory.Text, unpackMatch.Name), "*.*", SearchOption.AllDirectories);
                        ret = copier.StartCopy(); // TODO: To fix -- triggers again after cancelling -- because UnzipperFinished loop continues
                    }
                }
                if (!ret)
                {
                    break;       // If cancel then break out of loop
                }
            }
        }
Example #2
0
        private void buttonActivatePhp_Click(object sender, EventArgs e)
        {
            const string dll24         = "php5apache2_4.dll";
            const string dll22         = "php5apache2_2.dll";
            const string phpDirectives = "LoadModule php5_module {0}\nAddHandler application/x-httpd-php .php\nPHPIniDir \"{1}\"";

            string path = String.Empty;
            string dll  = String.Empty;

            var finder = RootFolderFinder.FindAll(pathParent, dll24, ".");

            if (finder.Length > 0)
            {
                path = finder[0];
                dll  = dll24;
            }

            var finder2 = RootFolderFinder.FindAll(pathParent, dll22, ".");

            if (finder2.Length > 0)
            {
                path = finder2[0];
                dll  = dll22;
            }

            if (String.IsNullOrEmpty(path))
            {
                return;
            }

            var text = String.Format(phpDirectives, BackslashToSlash(Path.Combine(path, dll)),
                                     BackslashToSlash(path).TrimEnd('/'));

            config.AddText(text, phpDirectives.Substring(0, 22));
        }