Exemple #1
0
        public static string GetVersionInformation()
        {
            var assembly    = Assembly.GetEntryAssembly();
            var versionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);

            return($"{versionInfo.FileDescription}{NewLine}" +
                   $"{versionInfo.Comments}{NewLine}" +
                   $"{versionInfo.InternalName}. Version {versionInfo.FileVersion} ({ApplicationType.ToString()}){NewLine}" +
                   $"{versionInfo.CompanyName}{NewLine}" +
                   $"{versionInfo.LegalCopyright}");
        }
Exemple #2
0
        private List <ApplicationItemProperty> GetApplicationItemPropertiesFromAssembly(ApplicationTypes applicationType)
        {
            List <ApplicationItemProperty> applicationItemProperties = new List <ApplicationItemProperty>();

            Assembly     _assembly;
            Stream       _imageStream;
            StreamReader _textStreamReader;

            _assembly         = Assembly.GetExecutingAssembly();
            _imageStream      = _assembly.GetManifestResourceStream("Sobiens.Connectors.Common.Resources." + applicationType.ToString() + "Settings.xml");
            _textStreamReader = new StreamReader(_imageStream);
            string xml = _textStreamReader.ReadToEnd();

            XElement   solutionXml = XElement.Parse(xml);
            XNamespace m_Namespace = solutionXml.GetDefaultNamespace();

            var properties =
                from element in solutionXml.Elements(m_Namespace + "ItemProperties").Elements(m_Namespace + "Property")
                //where element.Attributes(m_Namespace + "Hidden").First().Value == "False"
                select element;

            foreach (XElement property in properties)
            {
                string name        = string.Empty;
                string displayName = string.Empty;
                Type   type        = null;
                bool   hidden      = true;

                foreach (XAttribute attribute in property.Attributes())
                {
                    switch (attribute.Name.LocalName)
                    {
                    case "Name":
                        name = attribute.Value;
                        break;

                    case "DisplayName":
                        displayName = attribute.Value;
                        break;

                    case "Type":
                        switch (attribute.Value)
                        {
                        case "olNumber":
                            type = typeof(decimal);
                            break;

                        case "olText":
                            type = typeof(string);
                            break;

                        case "olDateTime":
                            type = typeof(DateTime);
                            break;

                        case "olYesNo":
                            type = typeof(bool);
                            break;

                        case "olOutlookInternal":
                        default:
                            break;
                            //Not Supported
                        }
                        break;

                    case "Hidden":
                        if (bool.TryParse(attribute.Value, out hidden) == false)
                        {
                            hidden = true;
                        }
                        break;

                    default:
                        continue;
                    }
                }
                if (hidden == false && type != null && string.IsNullOrEmpty(name) == false && string.IsNullOrEmpty(displayName) == false)
                {
                    ApplicationItemProperty itemProperty = new ApplicationItemProperty(name, displayName, type);
                    applicationItemProperties.Add(itemProperty);
                }
            }
            return(applicationItemProperties);
        }