Esempio n. 1
0
        }// NewPermissionSetDescription


        private CodeGroup ImportCodegroup()
        {
            CodeGroup cg = null;

            try
            {
                SecurityElement se = SecurityXMLStuff.GetSecurityElementFromXMLFile(CodeGroupFilename);
                if (se == null)
                {
                    throw new Exception("Invalid XML");
                }

                Type t = Type.GetType((String)se.Attributes["class"]);

                if (t != null)
                {
                    cg = (CodeGroup)Activator.CreateInstance(t, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, null, null);
                }
                if (cg == null)
                {
                    MessageBox(CResourceStore.GetString("CNewCodeGroupWizard:UnknownClass"),
                               String.Format(CResourceStore.GetString("CNewCodeGroupWizard:UnknownClassTitle"), (String)se.Attributes["class"]),
                               MB.ICONEXCLAMATION);
                }
                else
                {
                    cg.FromXml(se);

                    if (cg.Name == null || cg.Name.Length == 0)
                    {
                        cg.Name = Security.FindAGoodCodeGroupName(m_pl, "CustomCodegroup");
                    }

                    return(cg);
                }
            }
            catch (Exception)
            {
                MessageBox(CResourceStore.GetString("CNewCodeGroupWizard:XMLNoCodegroup"),
                           CResourceStore.GetString("CNewCodeGroupWizard:XMLNoCodegroupTitle"),
                           MB.ICONEXCLAMATION);
            }
            return(null);
        }// ImportCodegroup