private void MsiSelector_MsiSelected(object sender, EventArgs e)
        {
            //DONE: aggiunto try-catch [verificare eccezione System.InvalidCastException: Unable to cast object of type 'MsiClassicModePlugin.SelectorFromCCNet' to type 'System.Windows.Forms.TextBox'.
            //  at MsiClassicModePlugin.frmMsiClassicMode.MsiSelector_MsiSelected(Object sender, EventArgs e)]
            try
            {
                txtboxFileMsi.Text = msiselector.SelectedMsiFilePath;
                if (msiselector != null)
                {
                    msiselector.Visible = false;
                }

                if (!IsUpdating && txtInstanceName.Text == string.Empty)
                {
                    txtInstanceName.Text = msiselector.SelectedInstanceName;
                }
            }
            catch (Exception ex)
            {
                PluginException plgnex = new PluginException("", ex);

                plgnex.ParamName  = "SelectedMsiFilePath";
                plgnex.ParamValue = msiselector.SelectedMsiFilePath;
                plgnex.ToString();
                plgnex.ParamName  = "SelectedInstanceName";
                plgnex.ParamValue = msiselector.SelectedInstanceName;
                plgnex.ToString();
                throw plgnex;
            }
        }
예제 #2
0
        internal string ProvideInstanceName()
        {
            FileInfo fi = new FileInfo(SelectedMsiFileName);

            string instancename = "{0}-{1}";
            string root         = "";
            string buildnumb    = string.Empty;

            try
            {
                if (SelectedMsiFileName.IndexOf("build") < 0)
                {
                    buildnumb = (fi.Name).Substring((fi.Name).IndexOf("x.") + 2, 4);
                }
                else
                {
                    buildnumb = (fi.Name).Substring((fi.Name).IndexOf("build") + 5, 4);
                }
            }
            catch (Exception e)
            {
                PluginException plgnex = new PluginException("", e);

                plgnex.ParamName  = "SelectedMsiFileName";
                plgnex.ParamValue = SelectedMsiFileName;
                plgnex.ToString();
                throw plgnex;
            }

            if (SelectedMsiFileName.ToLowerInvariant().Contains("mago4"))
            {
                root = "M4";
            }
            if (SelectedMsiFileName.ToLowerInvariant().Contains("magonet"))
            {
                root = "MN";
            }

            if (SessionTest)

            {
                instancename = "Session-" + instancename; // 0 - build ; 1 -  root}
                return(string.Format(instancename, buildnumb, root));
            }


            return(string.Format(instancename, root, buildnumb));
        }