Ejemplo n.º 1
0
        //=====================================================================

        /// <summary>
        /// Set the version and assembly info on load
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void AboutDlg_Load(object sender, EventArgs e)
        {
            // Get assembly information not available from the application object
            Assembly asm = Assembly.GetEntryAssembly();
            AssemblyTitleAttribute title = (AssemblyTitleAttribute)
                                           AssemblyTitleAttribute.GetCustomAttribute(asm, typeof(AssemblyTitleAttribute));
            AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)
                                                   AssemblyCopyrightAttribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute));
            AssemblyDescriptionAttribute desc = (AssemblyDescriptionAttribute)
                                                AssemblyDescriptionAttribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));

            // Set the labels
            lblName.Text        = title.Title;
            lblDescription.Text = desc.Description;
            lblVersion.Text     = "Version: " + Application.ProductVersion;
            lblCopyright.Text   = copyright.Copyright;

            // Display components used by this assembly sorted by name
            foreach (AssemblyName an in asm.GetReferencedAssemblies())
            {
                ListViewItem lvi = lvComponents.Items.Add(an.Name);
                lvi.SubItems.Add(an.Version.ToString());
            }

            lvComponents.Sorting = SortOrder.Ascending;
            lvComponents.Sort();

            // Set e-mail link
            lnkHelp.Links[0].LinkData = "mailto:" + lnkHelp.Text + "?Subject=EWSoftware CalendarBrowser Demo";
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        public About()
        {
            InitializeComponent();
            Uri uri = new Uri("pack://application:,,,/B_32x32.ico", UriKind.RelativeOrAbsolute);

            this.Icon = BitmapFrame.Create(uri);
            // Populate name and version info.
            Assembly assembly            = Assembly.GetExecutingAssembly();
            AssemblyTitleAttribute title =
                (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyTitleAttribute));
            int      minVer = typeof(About).Assembly.GetName().Version.Minor;
            int      majVer = typeof(About).Assembly.GetName().Version.Major;
            double   ver    = majVer + (minVer / 100.0);
            FileInfo info   = new FileInfo(assembly.Location);
            DateTime date   = info.LastWriteTime;

            lblAppNameAndVersion.Content = title.Title + " version " + ver + " (" + date.ToShortDateString() + ")";

            // Populate copyright info
            AssemblyCopyrightAttribute copyright =
                (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyCopyrightAttribute));

            lblCopyright.Content = copyright.Copyright;
        }
Ejemplo n.º 4
0
        public AboutDialog()
        {
            this.Build();

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

            //AssemblyVersionAttribute version = (AssemblyVersionAttribute)AssemblyVersionAttribute.GetCustomAttribute(
            //                System.Reflection.Assembly.GetExecutingAssembly() , typeof(AssemblyVersionAttribute));

            label2.Markup = "<span size='x-large'>" + title.Title + "</span>"; // + " " + version.Version;

            //AssemblyCompanyAttribute company = (AssemblyCompanyAttribute)AssemblyCompanyAttribute.GetCustomAttribute(
            //                System.Reflection.Assembly.GetExecutingAssembly() , typeof(AssemblyCompanyAttribute));

            AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute));

            AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(
                System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute));

            label3.Text = description.Description;

            label4.Text = copyright.Copyright;
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     LoadDataToListView();
     textBox1.Focus();
     this.listView1.ListViewItemSorter = new Common.ListViewColumnSorter();
     this.listView1.ColumnClick       += new ColumnClickEventHandler(Common.ListViewHelper.ListView_ColumnClick);
     this.Text = ((AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute))).Title;
 }
Ejemplo n.º 7
0
        public string GetAssemblyVersion()
        {
            AssemblyTitleAttribute copyright = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute));
            string strDebug = " - debug";

#if !DEBUG
            strDebug = "- Release";
#endif
            return(copyright.Title + strDebug);
        }
Ejemplo n.º 8
0
        /// <summary>Generates the full title of the Hasher library with version number.</summary>
        /// <returns>Full title with version number.</returns>
        static public string GetFullTitleHasher()
        {
            Version version = Assembly.GetAssembly(typeof(Classless.Hasher.MD5)).GetName().Version;
            AssemblyTitleAttribute title = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetAssembly(typeof(Classless.Hasher.MD5)), typeof(AssemblyTitleAttribute));

            return(title.Title + " v" +
                   version.Major.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + "." +
                   version.Minor.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " (" +
                   version.Build.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + ")");
        }
        protected override void OnLoad(EventArgs e)
        {
            if (!IsPostBack)
            {
                System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();

                Attribute title = AssemblyTitleAttribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute));
                if (title != null)
                {
                    Page.Title = ((AssemblyTitleAttribute)title).Title;
                }

                Attribute copyright = AssemblyCopyrightAttribute.GetCustomAttribute(assembly, typeof(AssemblyCopyrightAttribute));
                //if (copyright != null)
                //    this.lblCopyright.Text = ((AssemblyCopyrightAttribute)copyright).Copyright;

                //this.lblVersion.Text = string.Format(assembly.GetName().Version.ToString());
            }

            string id = ConfigurationManager.AppSettings["GoogleAnalyticsId"];


            lblApDesc.Text           = Session["AP"].ToString();
            lblBlocoMasterDesc.Text  = Session["Bloco"].ToString();
            lblProprietarioDesc.Text = Session["Proprie1"].ToString();

            if (!string.IsNullOrEmpty(id))
            {
                string script = "";

                script += "<script type=\"text/javascript\">";

                script += "var _gaq = _gaq || [];";
                script += "_gaq.push(['_setAccount', '" + id + "']);";
                script += "_gaq.push(['_trackPageview']);";

                script += "(function() {";
                script += "  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;";
                script += "  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';";
                script += "  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);";
                script += "})();";

                script += "</script>";


                //ScriptManager.RegisterStartupScript(this, this.GetType(), "MessageAlert",
                //  "<script language=\"JavaScript\">" + Environment.NewLine +
                //  "alert(\'" + "TEST" + "\');" + Environment.NewLine +
                //  "</script>", false);


                ScriptManager.RegisterStartupScript(this, this.GetType(), "MessageAlert", script, false);
            }
        }
Ejemplo n.º 10
0
 private void PopulateAlgorithmChooseControl(List <IFrequentPatternMining> _miningAlgorithms)
 {
     foreach (IFrequentPatternMining detector in _miningAlgorithms)
     {
         AssemblyDescriptionAttribute desc;
         AssemblyTitleAttribute       title;
         desc  = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(detector.GetType().Assembly, typeof(AssemblyDescriptionAttribute));
         title = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(detector.GetType().Assembly, typeof(AssemblyTitleAttribute));
         string str = string.Format("{0}, {1}, {2}", detector.GetType().FullName, title, desc);
         combo_algoritmo.Items.Add(str);
     }
 }
        /// <summary>
        /// 初始化本服务信息,无系统报告、不能暂停
        /// </summary>
        private void ConfigServiceBase()
        {
            AssemblyTitleAttribute title = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute));

            base.ServiceName                 = title.Title;
            base.CanHandlePowerEvent         = true;
            base.CanPauseAndContinue         = true;
            base.CanShutdown                 = true;
            base.AutoLog                     = false;
            base.CanStop                     = true;
            base.CanHandleSessionChangeEvent = false;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// For the about box - gather info on build date and DLLs being used.
        /// </summary>
        /// <returns></returns>
        private string BuildVersionString()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyCopyrightAttribute copyright =
                (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyCopyrightAttribute));
            AssemblyTitleAttribute title =
                (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyTitleAttribute));
            FileInfo info = new FileInfo(assembly.Location);
            DateTime date = info.LastWriteTime;

            // Create an area class just so we can get info about the base assembly.
            Area     area        = new Area();
            string   baseName    = area.GetType().Assembly.GetName().Name;
            string   baseVersion = area.GetType().Assembly.GetName().Version.ToString();
            FileInfo baseInfo    = new FileInfo(area.GetType().Assembly.Location);
            DateTime baseDate    = baseInfo.LastWriteTime;

            Spell    spell        = new Spell();
            string   baseName2    = spell.GetType().Assembly.GetName().Name;
            string   baseVersion2 = spell.GetType().Assembly.GetName().Version.ToString();
            FileInfo baseInfo2    = new FileInfo(spell.GetType().Assembly.Location);
            DateTime baseDate2    = baseInfo2.LastWriteTime;

            string version = title.Title +
                             " version " +
                             assembly.GetName().Version +
                             " built on " +
                             date.ToShortDateString() +
                             ".\nBased on version " +
                             baseVersion +
                             " of " +
                             baseName +
                             " built on " +
                             baseDate.ToShortDateString() +
                             ".\nBased on version " +
                             baseVersion2 +
                             " of " +
                             baseName2 +
                             " built on " +
                             baseDate2.ToShortDateString() +
                             ".\nThis application is " +
                             copyright.Copyright +
                             "\nWritten by Jason Champion (Xangis).\nFor the latest version, visit http://basternae.org.";

            return(version);
        }
Ejemplo n.º 13
0
        /// <summary>Generates the full title of this application with version number.</summary>
        /// <param name="build">Include the build number in the version.</param>
        /// <returns>Full title with version number.</returns>
        static public string GetFullTitle(bool build)
        {
            Version version = Assembly.GetExecutingAssembly().GetName().Version;
            AssemblyTitleAttribute title = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute));

            string temp = title.Title + " v" +
                          version.Major.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + "." +
                          version.Minor.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat);

            if (build)
            {
                temp += " (" + version.Build.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + ")";
            }

            return(temp);
        }
Ejemplo n.º 14
0
        public Window1() : this(EditLevel.FULL)
        {
            AssemblyTitleAttribute     title;
            AssemblyCopyrightAttribute copyright;
            Assembly aAssembly = Assembly.GetExecutingAssembly();


            title = (AssemblyTitleAttribute)
                    AssemblyTitleAttribute.GetCustomAttribute(
                aAssembly, typeof(AssemblyTitleAttribute));

            copyright = (AssemblyCopyrightAttribute)
                        AssemblyCopyrightAttribute.GetCustomAttribute(
                aAssembly, typeof(AssemblyCopyrightAttribute));
            APP_TITLE     = title.Title;
            APP_VERSION   = aAssembly.GetName().Version.ToString();
            APP_COPYRIGHT = copyright.Copyright;

            icl = new ICList();

            gateCanvas.ICL          = icl;
            gateCanvas.UndoProvider = (UndoRedo.UndoManager)Resources["undoManager"];
            gateCanvas.SetCaptureICLChanges();
            spGates.ICList       = icl;
            spGates.UndoProvider = (UndoRedo.UndoManager)Resources["undoManager"];

            this.Loaded += (s2, e2) => { Gates.IOGates.Clock.CalculatePrecession(); };

            this.Closing += new CancelEventHandler(Window1_Closing);

            if (!string.IsNullOrEmpty(LOAD_ON_START))
            {
                try
                {
                    CircuitXML cxml = new CircuitXML(icl);
                    RefreshGateCanvas(cxml.Load(LOAD_ON_START, icl.Add));

                    btnSave.IsEnabled = true;
                    _filename         = LOAD_ON_START;
                    UpdateTitle();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unable to load requested circuit, reason: " + ex.ToString());
                }
            }
        }
Ejemplo n.º 15
0
        public Game()
        {
            _instance = this;

            TitleContainer.Initialize();

            LaunchParameters = new LaunchParameters();
            _services        = new GameServiceContainer();
            _components      = new GameComponentCollection();
            Content          = new ContentManager(_services);

            Platform              = GamePlatform.Create(this);
            Platform.Activated   += OnActivated;
            Platform.Deactivated += OnDeactivated;
            _services.AddService(typeof(GamePlatform), Platform);

            /* Set the window title
             * TODO: Get the title from the WindowsPhoneManifest.xml for WP7 projects
             */
            string windowTitle = string.Empty;

            // When running unit tests this can return null
            Assembly assembly = Assembly.GetEntryAssembly();

            if (assembly != null)
            {
                // Use the Title attribute of the Assembly if possible
                AssemblyTitleAttribute assemblyTitleAtt = (AssemblyTitleAttribute)
                                                          AssemblyTitleAttribute.GetCustomAttribute(
                    assembly,
                    typeof(AssemblyTitleAttribute)
                    );

                if (assemblyTitleAtt != null)
                {
                    windowTitle = assemblyTitleAtt.Title;
                }

                // Otherwise, fallback to the Name of the assembly
                if (string.IsNullOrEmpty(windowTitle))
                {
                    windowTitle = assembly.GetName().Name;
                }
            }

            Window.Title = windowTitle;
        }
Ejemplo n.º 16
0
        public Game()
        {
            _instance        = this;
            LaunchParameters = new LaunchParameters();
            _services        = new GameServiceContainer();
            _components      = new GameComponentCollection();
            Content          = new ContentManager(_services);

            Platform              = GamePlatform.Create(this);
            Platform.Activated   += OnActivated;
            Platform.Deactivated += OnDeactivated;
            _services.AddService(typeof(GamePlatform), Platform);

#if WINDOWS_STOREAPP
            Platform.ViewStateChanged += Platform_ApplicationViewChanged;
#endif

#if MONOMAC || WINDOWS || LINUX
            // Set the window title.
            // TODO: Get the title from the WindowsPhoneManifest.xml for WP7 projects.
            string windowTitle = string.Empty;

            // When running unit tests this can return null.
            var assembly = Assembly.GetEntryAssembly();
            if (assembly != null)
            {
                //Use the Title attribute of the Assembly if possible.
                var assemblyTitleAtt = ((AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute)));
                if (assemblyTitleAtt != null)
                {
                    windowTitle = assemblyTitleAtt.Title;
                }

                // Otherwise, fallback to the Name of the assembly.
                if (string.IsNullOrEmpty(windowTitle))
                {
                    windowTitle = assembly.GetName().Name;
                }
            }

            Window.Title = windowTitle;
#endif
        }
Ejemplo n.º 17
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        public AboutDlg()
        {
            InitializeComponent();

            Assembly asm = Assembly.GetExecutingAssembly();

            var titleAttr = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(asm,
                                                                                              typeof(AssemblyTitleAttribute));
            var versionAttr = (AssemblyInformationalVersionAttribute)AssemblyInformationalVersionAttribute.GetCustomAttribute(
                asm, typeof(AssemblyInformationalVersionAttribute));
            var descAttr = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(asm,
                                                                                                         typeof(AssemblyDescriptionAttribute));

            // Set the labels
            this.Title             = "About " + titleAttr.Title;
            tbApplicationName.Text = titleAttr.Title;
            tbVersion.Text         = "Version: " + versionAttr.InformationalVersion;
            tbDescription.Text     = descAttr.Description;
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Get header to print on help screen.
        /// </summary>
        /// <returns>
        /// String representing header to print on help screen.
        /// </returns>
        static string GetHeader()
        {
            const char Space = ' ';

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

            AssemblyCopyrightAttribute copyright =
                AssemblyCopyrightAttribute.GetCustomAttribute(Assembly,
                                                              typeof(AssemblyCopyrightAttribute)) as AssemblyCopyrightAttribute;

            StringBuilder header = new StringBuilder();

            header.AppendLine(title.Title + Space + Version);
            header.AppendLine(copyright.Copyright);
            header.Append(Url);

            return(header.ToString());
        }
Ejemplo n.º 19
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);
            }
        }
Ejemplo n.º 20
0
        private void LoadAssemblies(string asmName)
        {
            asm = Assembly.LoadFrom(asmName);
            AssemblyDescriptionAttribute atrDescr = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));
            string hash = atrDescr.Description;
            AssemblyTitleAttribute atrName = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(asm, typeof(AssemblyTitleAttribute));
            string    name      = atrName.Title;
            HashTable hashTable = new HashTable();

            if (hashTable.Check(name, hash))
            {
                assemblies.Add(asm);
                Type            type = typeof(object);
                IDeserializator des  = new Deserializatores.CarDeserealizator();
                ISerializer     ser  = new StandartSerializer();
                foreach (Type t in asm.GetTypes())
                {
                    if (t.IsClass && typeof(ITransport).IsAssignableFrom(t))
                    {
                        type = t;
                    }
                    if (t.IsClass && typeof(IDeserializator).IsAssignableFrom(t))
                    {
                        des = (IDeserializator)Activator.CreateInstance(t);
                    }
                    if (t.IsClass && typeof(ISerializer).IsAssignableFrom(t))
                    {
                        ser = (ISerializer)Activator.CreateInstance(t);
                    }
                }

                objectDeserializer.AddDeserializator(type, des);
                objectDeserializer.AddSerializator(type, ser);
            }
            else
            {
                MessageBox.Show("Wrong sign of plugin!");
            }
        }
Ejemplo n.º 21
0
        private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyCopyrightAttribute copyright =
                (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyCopyrightAttribute));
            AssemblyTitleAttribute title =
                (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyTitleAttribute));

            System.IO.FileInfo info = new System.IO.FileInfo(assembly.Location);
            DateTime           date = info.LastWriteTime;

            MessageBox.Show(
                title.Title +
                " version " +
                assembly.GetName().Version.ToString() + "\n" +
                "released " +
                date.ToShortDateString() +
                "\nWritten by Santiago Saldana." + "\n" +
                "For the latest version, visit http://code.google.com/p/steel-batallion-64/", "About Steel-Batallion-64", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button2, 0, "http://code.google.com/p/steel-batallion-64/w/list");
        }
Ejemplo n.º 22
0
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyCopyrightAttribute copyright =
                (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyCopyrightAttribute));
            AssemblyTitleAttribute title =
                (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyTitleAttribute));

            System.IO.FileInfo info = new System.IO.FileInfo(assembly.Location);
            DateTime           date = info.LastWriteTime;

            // Create an area class just so we can get info about the base assembly.
            HelpData.Help area        = new HelpData.Help();
            string        BaseName    = area.GetType().Assembly.GetName().Name;
            string        BaseVersion = area.GetType().Assembly.GetName().Version.ToString();

            System.IO.FileInfo BaseInfo = new System.IO.FileInfo(area.GetType().Assembly.Location);
            DateTime           BaseDate = info.LastWriteTime;

            MessageBox.Show(
                title.Title +
                " version " +
                assembly.GetName().Version.ToString() +
                " built on " +
                date.ToShortDateString() +
                ".\nBased on version " +
                BaseVersion +
                " of " +
                BaseName +
                " built on " +
                BaseDate.ToShortDateString() +
                ".\nThis application is " +
                copyright.Copyright +
                "\nWritten by Jason Champion (Xangis).\nFor the latest version, visit http://basternae.org.",
                "About " + title.Title);
        }
Ejemplo n.º 23
0
        // {{{ Constructor
        public LocalSettings(Assembly ParentAssembly)
        {
            // Get both assembly titles - we use this to find out if we
            // are being instantiated from a sub-application
            _CabinetAsmTitle = ((AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute))).Title;
            _ParentAsmTitle  = ((AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(ParentAssembly, typeof(AssemblyTitleAttribute))).Title;

            // Always load the cabinet config file
            _CabinetSettingsFile     = "/" + _CabinetAsmTitle + "-config.xml";
            _CabinetSettingsFullPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + _CabinetSettingsFile;
            LoadSettings(_CabinetSettingsFullPath);

            // Load the sub-application config file if we are being called
            // from a sub-application
            if (!_CabinetAsmTitle.Equals(_ParentAsmTitle))
            {
                _ParentSettingsFile     = "/" + _ParentAsmTitle + "-config.xml";
                _ParentSettingsFullPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + _ParentSettingsFile;
                LoadSettings(_ParentSettingsFullPath);
            }

            BuildProxyQueue();
        }
Ejemplo n.º 24
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();
        }
        private string GetFriendlySqlVersion()
        {
            Assembly assemb   = System.Reflection.Assembly.Load("Microsoft.DataWarehouse"); //get a sample assembly that's installed with BIDS and use that to detect if BIDS is installed
            string   sVersion = assemb.GetName().Version.ToString();

            try
            {
                //if it's a SQL2008 R2 release, you need to get the informational version attribute
                //SQL2005 didn't have this attribute
                AssemblyInformationalVersionAttribute attributeVersion = (AssemblyInformationalVersionAttribute)AssemblyTitleAttribute.GetCustomAttribute(assemb, typeof(AssemblyInformationalVersionAttribute));
                if (attributeVersion != null)
                {
                    sVersion = attributeVersion.InformationalVersion;
                }
            }
            catch { }

            if (sVersion.StartsWith("9."))
            {
                return("2005");
            }
            else if (sVersion.StartsWith("10.5"))
            {
                return("2008 R2");
            }
            else if (sVersion.StartsWith("10."))
            {
                return("2008");
            }
            else if (sVersion.StartsWith("11."))
            {
                return("2012");
            }
            else if (sVersion.StartsWith("12."))
            {
                return("2014");
            }
            else
            {
                return(sVersion); //todo in future post DENALI and SQL2014
            }
        }
Ejemplo n.º 26
0
        private void BIDSHelperOptionsVersionCheckPage_Load(object sender, EventArgs e)
        {
            try
            {
                // Get title from assembly info, e.g. "BIDS Helper for SQL 2008"
                Assembly assembly = this.GetType().Assembly;
                AssemblyTitleAttribute attribute = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute));
                this.lblTitle.Text = attribute.Title;

                // Conditionally select name, BIDS vs SSDBI - Retained as suspsect BI will be dropped shortly
                string bidsName = "SSDTBI";

                if (BIDSHelperPackage.AddInLoadException != null)
                {
                    this.lblBidsHelperLoadException.Text = string.Format("BIDS Helper encountered an error when Visual Studio started:\r\n{0}\r\n{1}"
                                                                         , BIDSHelperPackage.AddInLoadException.Message
                                                                         , BIDSHelperPackage.AddInLoadException.StackTrace);

                    Exception innerEx = BIDSHelperPackage.AddInLoadException.InnerException;
                    while (innerEx != null)
                    {
                        this.lblBidsHelperLoadException.Text += string.Format("\r\nInner exception:\r\n{0}\r\n{1}"
                                                                              , innerEx.Message
                                                                              , innerEx.StackTrace);
                        innerEx = innerEx.InnerException;
                    }

                    ReflectionTypeLoadException ex = BIDSHelperPackage.AddInLoadException as ReflectionTypeLoadException;
                    if (ex == null)
                    {
                        ex = BIDSHelperPackage.AddInLoadException.InnerException as ReflectionTypeLoadException;
                    }
                    if (ex == null && BIDSHelperPackage.AddInLoadException.InnerException != null)
                    {
                        ex = BIDSHelperPackage.AddInLoadException.InnerException.InnerException as ReflectionTypeLoadException;
                    }
                    if (ex != null)
                    {
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        foreach (Exception exSub in ex.LoaderExceptions)
                        {
                            sb.AppendLine();
                            sb.AppendLine(exSub.Message);
                            System.IO.FileNotFoundException exFileNotFound = exSub as System.IO.FileNotFoundException;
                            if (exFileNotFound != null)
                            {
                                if (!string.IsNullOrEmpty(exFileNotFound.FusionLog))
                                {
                                    sb.AppendLine("Fusion Log:");
                                    sb.AppendLine(exFileNotFound.FusionLog);
                                }
                            }
                            sb.AppendLine();
                        }
                        this.lblBidsHelperLoadException.Text += sb.ToString();
                    }

                    this.lblBidsHelperLoadException.Visible = true;
                    this.btnCopyError.Visible = true;
                }
                else
                {
                    this.lblBidsHelperLoadException.Visible = false;
                    this.btnCopyError.Visible = false;
                }

                try
                {
                    this.lblSqlVersion.Text = string.Format("{0} {1} ({2}) for Visual Studio {3} was detected", bidsName, VersionInfo.SqlServerFriendlyVersion, VersionInfo.SqlServerVersion, VersionInfo.VisualStudioFriendlyVersion);
                }
                catch
                {
                    //if there's an exception it's because we couldn't find SSDTBI or BIDS installed in this Visual Studio version
                    try
                    {
                        this.lblSqlVersion.Text      = bidsName + " for Visual Studio " + VersionInfo.VisualStudioFriendlyVersion + " was NOT detected. BIDS Helper disabled.";
                        this.lblSqlVersion.ForeColor = System.Drawing.Color.Red;
                        if (BIDSHelperPackage.AddInLoadException != null && BIDSHelperPackage.AddInLoadException is System.Reflection.ReflectionTypeLoadException)
                        {
                            //this is the expected exception if SSDTBI isn't installed... if this is the exception, don't show it... otherwise, show the exception
                            this.lblBidsHelperLoadException.Visible = false;
                        }
                    }
                    catch
                    {
                        this.lblSqlVersion.Visible = false;
                    }
                }

                // Set current version
                this.lblLocalVersion.Text = VersionCheckPlugin.LocalVersion;
#if DEBUG
                DateTime buildDateTime = GetBuildDateTime(assembly);
                this.lblLocalVersion.Text += string.Format(CultureInfo.InvariantCulture, " (Debug Build {0:yyyy-MM-dd HH:mm:ss})", buildDateTime);
#endif

                this.lblSqlVersion.Text += string.Format("\r\nSSDT Extensions Installed: SSAS ({0}), SSIS ({1}), SSRS ({2})",
                                                         (BIDSHelperPackage.SSASExtensionVersion == null ? "N/A" : BIDSHelperPackage.SSASExtensionVersion.ToString()),
                                                         (BIDSHelperPackage.SSISExtensionVersion == null ? "N/A" : BIDSHelperPackage.SSISExtensionVersion.ToString()),
                                                         (BIDSHelperPackage.SSRSExtensionVersion == null ? "N/A" : BIDSHelperPackage.SSRSExtensionVersion.ToString()));

                //the current BI Developer Extensions version is compatible with the following versions or higher of SSDT extensions
                Version SSASExpectedVersion = new Version("2.8.15");
                Version SSRSExpectedVersion = new Version("2.5.9");
                Version SSISExpectedVersion = new Version("2.1");

                string sUpgradeSSDTMessage = string.Empty;
                if (BIDSHelperPackage.SSASExtensionVersion != null && BIDSHelperPackage.SSASExtensionVersion < SSASExpectedVersion)
                {
                    if (sUpgradeSSDTMessage != string.Empty)
                    {
                        sUpgradeSSDTMessage += ", ";
                    }
                    sUpgradeSSDTMessage += "SSAS to " + SSASExpectedVersion;
                }
                if (BIDSHelperPackage.SSRSExtensionVersion != null && BIDSHelperPackage.SSRSExtensionVersion < SSRSExpectedVersion)
                {
                    if (sUpgradeSSDTMessage != string.Empty)
                    {
                        sUpgradeSSDTMessage += ", ";
                    }
                    sUpgradeSSDTMessage += "SSRS to " + SSRSExpectedVersion;
                }
                if (BIDSHelperPackage.SSISExtensionVersion != null && BIDSHelperPackage.SSISExtensionVersion < SSISExpectedVersion)
                {
                    if (sUpgradeSSDTMessage != string.Empty)
                    {
                        sUpgradeSSDTMessage += ", ";
                    }
                    sUpgradeSSDTMessage += "SSIS to " + SSISExpectedVersion;
                }
                if (sUpgradeSSDTMessage != string.Empty)
                {
                    this.lblSqlVersion.Text += "\r\n" + "Please upgrade " + sUpgradeSSDTMessage;
                }

                // First check we have a valid instance, the add-in may be disabled.
                if (VersionCheckPlugin.Instance == null)
                {
                    bool bConnected = false;
                    try
                    {
                        // TODO - will this code even run now that we are in an extension if the extension
                        // is not loaded
                        //foreach (EnvDTE.AddIn addin in Connect.Application.AddIns)
                        //{
                        //    if (addin.ProgID.ToLower() == "BIDSHelper.Connect".ToLower())
                        //    {
                        //        if (addin.Connected)
                        //        {
                        bConnected = true;
                        //        break;
                        //    }
                        //}
                        //}
                    }
                    catch { }

                    if (bConnected)
                    {
                        // Display disabled information and exit
                        if (BIDSHelperPackage.AddInLoadException == null)
                        {
                            lblServerVersion.Text = "The BIDS Helper Add-in is not running because of problems loading!";
                        }
                        else
                        {
                            lblServerVersion.Visible = false;
                        }
                        linkNewVersion.Visible = false;
                    }
                    else
                    {
                        // Display disabled information and exit
                        lblLocalVersion.Text  += " [Add-in Disabled]";
                        lblServerVersion.Text  = "The BIDS Helper Add-in is not currently enabled.";
                        linkNewVersion.Visible = false;
                    }


                    return; //if we don't have the version check plugin loaded, then stop now and don't check version on server
                }


                lblServerVersion.Visible = false;
                linkNewVersion.Visible   = false;
                //try
                //{
                //    //VersionCheckPlugin.Instance.LastVersionCheck = DateTime.Today;
                //    //if (!VersionCheckPlugin.VersionIsLatest(VersionCheckPlugin.LocalVersion, VersionCheckPlugin.Instance.ServerVersion))
                //    //{
                //    //    lblServerVersion.Text = "Version " + VersionCheckPlugin.Instance.ServerVersion + " is available...";
                //    //    lblServerVersion.Visible = true;
                //    //    linkNewVersion.Visible = true;
                //    //}
                //    //else
                //    //{
                //    //    lblServerVersion.Text = "BIDS Helper is up to date.";
                //    //    lblServerVersion.Visible = true;
                //    //    linkNewVersion.Visible = false;
                //    //}
                //}
                //catch (Exception ex)
                //{
                //    lblServerVersion.Text = "Unable to retrieve current available BIDS Helper version from Codeplex: " + ex.Message + "\r\n" + ex.StackTrace;
                //    linkNewVersion.Visible = false;
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, DefaultMessageBoxCaption);
            }
        }
        private void BIDSHelperOptionsVersionCheckPage_Load(object sender, EventArgs e)
        {
            try
            {
                // Get title from assembly info, e.g. "BIDS Helper for SQL 2008"
                Assembly assembly = this.GetType().Assembly;
                AssemblyTitleAttribute attribute = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute));
                this.lblTitle.Text = attribute.Title;

#if DENALI || SQL2014
                string sBIDSName = "SSDTBI";
#else
                string sBIDSName = "BIDS";
#endif

                if (Connect.AddInLoadException != null)
                {
                    this.lblBidsHelperLoadException.Text = "BIDS Helper encountered an error when Visual Studio started:\r\n" + Connect.AddInLoadException.Message + "\r\n" + Connect.AddInLoadException.StackTrace;

                    ReflectionTypeLoadException ex = Connect.AddInLoadException as ReflectionTypeLoadException;
                    if (ex != null)
                    {
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        foreach (Exception exSub in ex.LoaderExceptions)
                        {
                            sb.AppendLine();
                            sb.AppendLine(exSub.Message);
                            System.IO.FileNotFoundException exFileNotFound = exSub as System.IO.FileNotFoundException;
                            if (exFileNotFound != null)
                            {
                                if (!string.IsNullOrEmpty(exFileNotFound.FusionLog))
                                {
                                    sb.AppendLine("Fusion Log:");
                                    sb.AppendLine(exFileNotFound.FusionLog);
                                }
                            }
                            sb.AppendLine();
                        }
                        this.lblBidsHelperLoadException.Text += sb.ToString();
                    }

                    this.lblBidsHelperLoadException.Visible = true;
                    this.btnCopyError.Visible = true;
                }
                else
                {
                    this.lblBidsHelperLoadException.Visible = false;
                    this.btnCopyError.Visible = false;
                }

                try
                {
                    this.lblSqlVersion.Text = sBIDSName + " " + GetFriendlySqlVersion() + " for Visual Studio " + GetFriendlyVisualStudioVersion() + " was detected";
                }
                catch
                {
                    //if there's an exception it's because we couldn't find SSDTBI or BIDS installed in this Visual Studio version
                    try
                    {
                        this.lblSqlVersion.Text      = sBIDSName + " for Visual Studio " + GetFriendlyVisualStudioVersion() + " was NOT detected. BIDS Helper disabled.";
                        this.lblSqlVersion.ForeColor = System.Drawing.Color.Red;
                        if (Connect.AddInLoadException != null && Connect.AddInLoadException is System.Reflection.ReflectionTypeLoadException)
                        {
                            //this is the expected exception if SSDTBI isn't installed... if this is the exception, don't show it... otherwise, show the exception
                            this.lblBidsHelperLoadException.Visible = false;
                        }
                    }
                    catch
                    {
                        this.lblSqlVersion.Visible = false;
                    }
                }

                // Set current version
                this.lblLocalVersion.Text = VersionCheckPlugin.LocalVersion;
#if DEBUG
                DateTime buildDateTime = GetBuildDateTime(assembly);
                this.lblLocalVersion.Text += string.Format(CultureInfo.InvariantCulture, " (Debug Build {0:yyyy-MM-dd HH:mm:ss})", buildDateTime);
#endif

                // First check we have a valid instance, the add-in may be disabled.
                if (VersionCheckPlugin.VersionCheckPluginInstance == null)
                {
                    bool bConnected = false;
                    try
                    {
                        foreach (EnvDTE.AddIn addin in Connect.Application.AddIns)
                        {
                            if (addin.ProgID.ToLower() == "BIDSHelper.Connect".ToLower())
                            {
                                if (addin.Connected)
                                {
                                    bConnected = true;
                                    break;
                                }
                            }
                        }
                    }
                    catch { }

                    if (bConnected)
                    {
                        // Display disabled information and exit
                        if (Connect.AddInLoadException == null)
                        {
                            lblServerVersion.Text = "The BIDS Helper Add-in is not running because of problems loading!";
                        }
                        else
                        {
                            lblServerVersion.Visible = false;
                        }
                        linkNewVersion.Visible = false;
                    }
                    else
                    {
                        // Display disabled information and exit
                        lblLocalVersion.Text  += " [Add-in Disabled]";
                        lblServerVersion.Text  = "The BIDS Helper Add-in is not currently enabled.";
                        linkNewVersion.Visible = false;
                    }


                    return; //if we don't have the version check plugin loaded, then stop now and don't check version on server
                }


                try
                {
                    VersionCheckPlugin.VersionCheckPluginInstance.LastVersionCheck = DateTime.Today;
                    if (!VersionCheckPlugin.VersionIsLatest(VersionCheckPlugin.LocalVersion, VersionCheckPlugin.VersionCheckPluginInstance.ServerVersion))
                    {
                        lblServerVersion.Text    = "Version " + VersionCheckPlugin.VersionCheckPluginInstance.ServerVersion + " is available...";
                        lblServerVersion.Visible = true;
                        linkNewVersion.Visible   = true;
                    }
                    else
                    {
                        lblServerVersion.Text    = "BIDS Helper is up to date.";
                        lblServerVersion.Visible = true;
                        linkNewVersion.Visible   = false;
                    }
                }
                catch (Exception ex)
                {
                    lblServerVersion.Text  = "Unable to retrieve current available BIDS Helper version from Codeplex: " + ex.Message + "\r\n" + ex.StackTrace;
                    linkNewVersion.Visible = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, DefaultMessageBoxCaption);
            }
        }