コード例 #1
0
        public AboutBox()
        {
            InitializeComponent();

            foreach (Assembly s in AppDomain.CurrentDomain.GetAssemblies())
            {
                string[] lvsi = new string[3];
                lvsi[0] = s.GetName().Name;
                lvsi[1] = s.GetName().FullName;
                lvsi[2] = s.GetName().Version.ToString();
                ListViewItem lvi = new ListViewItem(lvsi, 0);
                this.ListOfAssemblies.Items.Add(lvi);
            }

            AssemblyCopyrightAttribute   objCopyright   = AssemblyCopyrightAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute)) as AssemblyCopyrightAttribute;
            AssemblyDescriptionAttribute objDescription = AssemblyDescriptionAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute)) as AssemblyDescriptionAttribute;
            AssemblyCompanyAttribute     objCompany     = AssemblyCompanyAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyCompanyAttribute)) as AssemblyCompanyAttribute;
            AssemblyTrademarkAttribute   objTrademark   = AssemblyTrademarkAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyTrademarkAttribute)) as AssemblyTrademarkAttribute;
            AssemblyProductAttribute     objProduct     = AssemblyProductAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute)) as AssemblyProductAttribute;
            AssemblyTitleAttribute       objTitle       = AssemblyTitleAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute)) as AssemblyTitleAttribute;
            GuidAttribute         objGuid         = GuidAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(GuidAttribute)) as GuidAttribute;
            DebuggableAttribute   objDebuggable   = DebuggableAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(DebuggableAttribute)) as DebuggableAttribute;
            CLSCompliantAttribute objCLSCompliant = CLSCompliantAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(CLSCompliantAttribute)) as CLSCompliantAttribute;

            AppName.Text        = objProduct.Product;
            BigTitle.Text       = objTitle.Title;
            ProdVer.Text        = QuestDesignerMain.Version;
            AppDesc.Text        = objDescription.Description;
            CopyrightLabel.Text = objCopyright.Copyright;
            SerialNo.Text       = objGuid.Value;
            Company.Text        = objCompany.Company;
        }
コード例 #2
0
        /// <summary>
        ///   Creates foldername (in user's ApplicationData) where configuration
        ///   is stored.
        /// </summary>
        /// <returns>
        ///   Path to the folder with configuration file.
        /// </returns>
        public static string GetConfigurationFolder()
        {
            string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string appName     = ((AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute))).Product;

            return(Path.Combine(appDataPath, appName));
        }
コード例 #3
0
        private void FillCombos()
        {
            AssemblyProductAttribute myProduct = (AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                                                       typeof(AssemblyProductAttribute));
            string        appName  = myProduct.Product;
            List <Perfil> perfiles = DAL.Login.Perfil.ObtenerPerfiles(appName);

            cmbPerfil.DisplayMember = "Descripcion";
            cmbPerfil.ValueMember   = "Codigo";
            Perfil per = new DAL.Login.Perfil()
            {
                Codigo      = 0,
                Descripcion = "Todos"
            };

            cmbPerfil.Items.Add(per);
            if (perfiles != null && perfiles.Count > 0)
            {
                foreach (Perfil item in perfiles)
                {
                    cmbPerfil.Items.Add(item);
                }
            }
            cmbPerfil.SelectedItem = per;
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AboutDialog"/> class.
        /// </summary>
        /// <param name="parentForm">The parent form.</param>
        public AboutDialog(Form parentForm)
        {
            this.InitializeComponent();

            // Setup form information
            Assembly assembly = this.GetType().Assembly;

            AssemblyCopyrightAttribute copyrightAttribute = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(assembly, typeof(AssemblyCopyrightAttribute));

            this.CopyrightLabel.Text = copyrightAttribute.Copyright;

            AssemblyDescriptionAttribute descriptionAttribute = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute));

            this.DescriptionLabel.Text = descriptionAttribute.Description;

            AssemblyProductAttribute productAttribute = (AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(assembly, typeof(AssemblyProductAttribute));

            this.NameLabel.Text = productAttribute.Product;

            AssemblyFileVersionAttribute fileVersionAttribute = (AssemblyFileVersionAttribute)AssemblyTitleAttribute.GetCustomAttribute(assembly, typeof(AssemblyFileVersionAttribute));

            this.VersionLabel.Text = string.Format(CultureInfo.InvariantCulture, "{0} ({1})", fileVersionAttribute.Version, assembly.GetName().Version);

            this.Text = string.Format(CultureInfo.InvariantCulture, "About {0}", productAttribute.Product);

            if (parentForm == null)
            {
                return;
            }

            this.Icon          = parentForm.Icon;
            this.picIcon.Image = parentForm.Icon.ToBitmap();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: zerodowned/genovaproject-1
        private static string GetSolutionName()
        {
            Assembly asm = Assembly.GetExecutingAssembly();
            AssemblyProductAttribute info = AssemblyProductAttribute.GetCustomAttribute(asm, typeof(AssemblyProductAttribute)) as AssemblyProductAttribute;

            return(info.Product);
        }
コード例 #6
0
        public ProxyDialog()
        {
            InitializeComponent();
            Assembly asm = Assembly.GetCallingAssembly();

            optCurrentAppProxies.Text = ((AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(asm, typeof(AssemblyProductAttribute))).Product + " Proxies";
        }
コード例 #7
0
        private void ShowVersion()
        {
            AssemblyCompanyAttribute objCompany = (AssemblyCompanyAttribute)
                                                  AssemblyCompanyAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                              typeof(AssemblyCompanyAttribute));
            AssemblyDescriptionAttribute objDescription = (AssemblyDescriptionAttribute)
                                                          AssemblyDescriptionAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                                          typeof(AssemblyDescriptionAttribute));
            AssemblyProductAttribute objProduct = (AssemblyProductAttribute)
                                                  AssemblyProductAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                              typeof(AssemblyProductAttribute));
            AssemblyTitleAttribute objTitle = (AssemblyTitleAttribute)
                                              AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                        typeof(AssemblyTitleAttribute));

            /*
             * AssemblyVersionAttribute objVersion = (AssemblyVersionAttribute)
             *  AssemblyVersionAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
             *  typeof(AssemblyVersionAttribute));
             */
            StringBuilder sb = new StringBuilder();

            sb.Append("Product: ");
            sb.AppendLine(objProduct.Product);
            sb.Append("Title: ");
            sb.AppendLine(objTitle.Title);
            sb.Append("Company: ");
            sb.AppendLine(objCompany.Company);
            sb.Append("Description: ");
            sb.AppendLine(objDescription.Description);
            sb.Append("Version: ");
            sb.AppendLine(Assembly.GetExecutingAssembly().GetName().Version.ToString());
            this.AboutText.Text = sb.ToString();
        }
コード例 #8
0
        //acá hay que definir cosas que habría que ir a buscar cdo arranca la app
        //si hay un ws acá estaría una propiedad estática que crearía la conexión!

        public static void ObtenerUsuario(string usuario, string dominio, string contraseña)
        {
            AssemblyProductAttribute myProduct = (AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                                                       typeof(AssemblyProductAttribute));
            string appName = myProduct.Product;

            Usuario = new Usuario();
            Usuario = Usuario.ObtenerUsuario(usuario, dominio, contraseña, appName);
        }
コード例 #9
0
        private void SetupControl()
        {
            Assembly asm      = _CallingAssembly;
            string   AppTitle = ((AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(asm, typeof(AssemblyProductAttribute))).Product;

            AppTitle += " v" + asm.GetName().Version.ToString(2);

            lblAppName.Text = AppTitle;

            lblAppTitle.Text = ((AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute))).Description;

            lblCopyright.Text = ((AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute))).Copyright;

            StringBuilder AuthorBuilder = new StringBuilder();

            if (_Authors == null)
            {
                AuthorBuilder.Append("Authors: Anonymous");
            }
            else
            {
                if (_Authors.Length == 1)
                {
                    AuthorBuilder.Append("Author: ");
                }
                else
                {
                    AuthorBuilder.Append("Authors: ");
                }

                bool First = true;
                foreach (string Auth in _Authors)
                {
                    if (!First)
                    {
                        AuthorBuilder.Append(", ");
                    }
                    AuthorBuilder.Append(Auth);
                    First = false;
                }
            }

            lblAuthors.Text = AuthorBuilder.ToString();

            //Visual Studio requires the namespace to be applied to the resource name, otherwise it can't find it.
            Stream LicenseStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LICENSE");

            if (LicenseStream == null)
            {
                LicenseStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Absinthe.Gui.LICENSE");
            }
            StreamReader str = new StreamReader(LicenseStream);

            txtLicense.Text = str.ReadToEnd();
            txtLicense.Select(0, 0);
        }
コード例 #10
0
        private void GetProjectAndSolutionInfo()
        {
            AssemblyProductAttribute myProject = (AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute));
            string runningPath      = AppDomain.CurrentDomain.BaseDirectory;
            int    indexProjectName = runningPath.IndexOf(myProject.Product);

            solutionName = myProject.Product;
            solutionPath = runningPath.Substring(0, indexProjectName + myProject.Product.Length);

            int indexBinFolder = runningPath.IndexOf("\\bin");

            projectPath = runningPath.Substring(0, indexBinFolder);
        }
コード例 #11
0
        public static void TestInitalize()
        {
            try
            {
                //IncludeMe.IncludeThisLibrary();

                AssemblyProductAttribute project = (AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute));
                string projectName = project.Product;
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                throw (exception);
            }
        }
コード例 #12
0
        /// <summary>
        /// 用于安装的类
        /// </summary>
        public FokiteCoreInstaller()
        {
            AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute));

            AssemblyTitleAttribute title = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute));

            AssemblyProductAttribute displayname = (AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute));

            using (processInstaller = new ServiceProcessInstaller())
            {
                serviceInstaller             = new ServiceInstaller();
                processInstaller.Account     = ServiceAccount.LocalSystem;
                serviceInstaller.StartType   = ServiceStartMode.Automatic;
                serviceInstaller.ServiceName = title.Title;
                serviceInstaller.DisplayName = displayname.Product;
                serviceInstaller.Description = description.Description;
                Installers.Add(serviceInstaller);
                Installers.Add(processInstaller);
            }
        }
コード例 #13
0
        private static void ReadGeneratorSettings()
        {
            var assembly         = typeof(Settings).Assembly;
            var companyAttribute = AssemblyCompanyAttribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute)) as AssemblyCompanyAttribute;
            var productAttribute = AssemblyProductAttribute.GetCustomAttribute(assembly, typeof(AssemblyProductAttribute)) as AssemblyProductAttribute;
            var companyName      = companyAttribute?.Company;
            var productName      = productAttribute?.Product;
            var specialPath      = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            if (!string.IsNullOrWhiteSpace(companyName) && !string.IsNullOrWhiteSpace(productName) && !string.IsNullOrWhiteSpace(specialPath))
            {
                var folder = Path.Combine(specialPath, companyName, productName);
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
                var filename = Path.Combine(folder, "settings.xml");
                if (!File.Exists(filename))
                {
                    new XDocument(new XElement("Settings")).Save(filename);
                    return;
                }

                var doc = XDocument.Load(filename);

                var requiredExtensions           = doc.Element("Settings").Elements("RequiredExtensions");
                var generatorExtensionDictionary =
                    requiredExtensions.Elements("Generator").Select(x =>
                {
                    Guid.TryParse(x.Element("Extension").Attribute("Guid").Value, out var guid);
                    return(new
                    {
                        ExtGuid = guid,
                        Generator = x.Attribute("Name"),
                        Command = x.Element("Extension").Attribute("Command").Value,
                        Param1 = x.Element("Extension").Attribute("Param1")?.Value,
                        Param2 = x.Element("Extension").Attribute("Param2")?.Value,
                        Param3 = x.Element("Extension").Attribute("Param3")?.Value,
                        Param4 = x.Element("Extension").Attribute("Param4")?.Value
                    });
                }).ToDictionary(g => g.Generator, g => new ExtensionCommand {
                    ExtensionGuid = g.ExtGuid,
                    Command       = g.Command,
                    Param1        = g.Param1,
                    Param2        = g.Param2,
                    Param3        = g.Param3,
                    Param4        = g.Param4
                });

                var lg = new List <Guid>();

                var stuff0 = (from element in doc.Element("Settings").Elements("RequiredExtensions")
                              .Elements("Generator").Elements("Extension")
                              select element
                              );


                var stuff = (from element in doc.Element("Settings").Elements("RequiredExtensions")
                             let gen = element.Elements("Generator").Elements("Extension")
                                       select gen
                             );

                var stuff2 = doc.Elements("Settings").Elements("RequiredExtensions")
                             .Elements("Generator").Elements("Extension").Select(e => (string)e.Attribute("Guid"));

                //Console.WriteLine($"stuff.Count is {stuff.Count()}");

                var r1 = doc.Element("Settings").Elements("RequiredExtensions");
                var r2 = r1.Elements("Generator").Elements("Extension");
                var r3 = r2.Attributes("Guid");

                //foreach (var p in generatorExtensionDictionary)
                //{
                //    var generatorName = p.Key;
                //    var guid = p.Value.Guid;
                //    Console.WriteLine($"key:{generatorName} guid:{guid}");
                //}
            }
            //var docPath =
            //XDocument xd = XDocument
        }
コード例 #14
0
 /// <summary>
 ///   Identifies configuration folder for each user and deletes it if
 ///   exists.
 /// </summary>
 private void DeleteConfigurations()
 {
     using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(ProfilesSubKey))
     {
         string[] profilesSubKeys = rk.GetSubKeyNames();
         foreach (string profile in profilesSubKeys)
         {
             using (RegistryKey rkSub = rk.OpenSubKey(profile))
             {
                 string configurationFolder = (string)rkSub.GetValue("ProfileImagePath") + "\\Application Data\\" + ((AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute))).Product;
                 if (Directory.Exists(configurationFolder))
                 {
                     Directory.Delete(configurationFolder, true);
                 }
             }
         }
     }
 }