Esempio n. 1
0
        public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {

            try
            {
                // Installation directory
                RegistryKey rkSoftware = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{A0BA6EF4-24AC-47F8-AEFE-FFBA1904024C}_is1", false);
                string installDir = String.Empty;
                if (rkSoftware != null)
                {
                    installDir = rkSoftware.GetValue("InstallLocation").ToString();
                    //Assembly.LoadFrom(Path.Combine(Path.Combine(installDir, "lib"), "MARC.Everest.dll"));
                }
                else
                {
                    MessageBox.Show("Could not locate Everest Framework 1.1 on this machine, please reinstall");
                    return;
                }

                // Wizard Creation
                var wzrd = new frmWizard();
                ValueDataParameter wp = new ValueDataParameter();
                wp.Name = "InstallDir";
                wp.Value = installDir;
                wzrd.Parameters.Add(wp);
                var wStg = new wstgSelectRelease();
                wzrd.Text = "Setup Everest Project";
                wzrd.ShowStage(wStg, WizardDirection.Forward);
                shouldAdd = true;
                wzrd.ShowDialog();

                // Get the namespaces
                replacementsDictionary.Add("$rmimusings$", Path.GetFileNameWithoutExtension(wStg.MessageTypeAssemblyFile));
                Assembly rmim = Assembly.ReflectionOnlyLoadFrom(wStg.MessageTypeAssemblyFile);
                replacementsDictionary.Add("$rmiminclude$", String.Format("<Reference Include=\"{0}\"><SpecificVersion>False</SpecificVersion><HintPath>{1}</HintPath></Reference>", rmim.FullName, wStg.MessageTypeAssemblyFile));
                replacementsDictionary.Add("$featureinclude$", "");
                replacementsDictionary.Add("$featureusings$", "");
                foreach (var ns in wStg.Features)
                {
                    try
                    {
                        Assembly asm = Assembly.ReflectionOnlyLoadFrom(ns.Value);
                        replacementsDictionary["$featureinclude$"] += String.Format("<Reference Include=\"{0}\"><SpecificVersion>False</SpecificVersion><HintPath>{1}</HintPath></Reference>", asm.FullName, ns.Value);
                        replacementsDictionary["$featureusings$"] += String.Format("using {0};\r\n", Path.GetFileNameWithoutExtension(ns.Value));
                    }
                    catch { }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error Occurred");
            }


        }
Esempio n. 2
0
        public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            try
            {
                // Installation directory
                RegistryKey rkSoftware = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{A0BA6EF4-24AC-47F8-AEFE-FFBA1904024C}_is1", false);
                string      installDir = String.Empty;
                if (rkSoftware != null)
                {
                    installDir = rkSoftware.GetValue("InstallLocation").ToString();
                    //Assembly.LoadFrom(Path.Combine(Path.Combine(installDir, "lib"), "MARC.Everest.dll"));
                }
                else
                {
                    MessageBox.Show("Could not locate Everest Framework 1.1 on this machine, please reinstall");
                    return;
                }

                // Wizard Creation
                var wzrd = new frmWizard();
                ValueDataParameter wp = new ValueDataParameter();
                wp.Name  = "InstallDir";
                wp.Value = installDir;
                wzrd.Parameters.Add(wp);
                var wStg = new wstgSelectRelease();
                wzrd.Text = "Setup Everest Project";
                wzrd.ShowStage(wStg, WizardDirection.Forward);
                shouldAdd = true;
                wzrd.ShowDialog();

                // Get the namespaces
                replacementsDictionary.Add("$rmimusings$", Path.GetFileNameWithoutExtension(wStg.MessageTypeAssemblyFile));
                Assembly rmim = Assembly.ReflectionOnlyLoadFrom(wStg.MessageTypeAssemblyFile);
                replacementsDictionary.Add("$rmiminclude$", String.Format("<Reference Include=\"{0}\"><SpecificVersion>False</SpecificVersion><HintPath>{1}</HintPath></Reference>", rmim.FullName, wStg.MessageTypeAssemblyFile));
                replacementsDictionary.Add("$featureinclude$", "");
                replacementsDictionary.Add("$featureusings$", "");
                foreach (var ns in wStg.Features)
                {
                    try
                    {
                        Assembly asm = Assembly.ReflectionOnlyLoadFrom(ns.Value);
                        replacementsDictionary["$featureinclude$"] += String.Format("<Reference Include=\"{0}\"><SpecificVersion>False</SpecificVersion><HintPath>{1}</HintPath></Reference>", asm.FullName, ns.Value);
                        replacementsDictionary["$featureusings$"]  += String.Format("using {0};\r\n", Path.GetFileNameWithoutExtension(ns.Value));
                    }
                    catch { }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error Occurred");
            }
        }