Beispiel #1
0
        public ITLAbout()
        {
            InitializeComponent();

            //获取此App的Assembly(AssemblyInfo.cpp中的内容)
            System.Reflection.Assembly oAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            System.Reflection.AssemblyTitleAttribute     oTiltleAttribute    = System.Reflection.AssemblyTitleAttribute.GetCustomAttribute(oAssembly, typeof(System.Reflection.AssemblyTitleAttribute)) as System.Reflection.AssemblyTitleAttribute;
            System.Reflection.AssemblyCopyrightAttribute oCopyRightAttribute = System.Reflection.AssemblyCopyrightAttribute.GetCustomAttribute(oAssembly, typeof(System.Reflection.AssemblyCopyrightAttribute)) as System.Reflection.AssemblyCopyrightAttribute;

            this.labelProductName.Text = oTiltleAttribute.Title;
            System.Version oVer = oAssembly.GetName().Version;
            this.labelVersion.Text = String.Format("Ver. {0}.{1} (Build: {2})", oVer.Major, oVer.Minor, oVer.Build);

            //Hyper link -. link ITL to www.infbj.com
            linkLabelCopyrights.Text = oCopyRightAttribute.Copyright;
            string strITL  = "INF Technologies Ltd.";
            int    nLength = strITL.Length;

            if (linkLabelCopyrights.Text.Length >= nLength)
            {
                int nPos = linkLabelCopyrights.Text.IndexOf(strITL, System.StringComparison.OrdinalIgnoreCase);
                if (nPos >= 0)
                {
                    linkLabelCopyrights.Links.Add(nPos, nLength, "www.infbj.com");
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Adds an entry to the event log.
        /// </summary>
        /// <param name="sText">Text to add to the event log entry</param>
        /// <param name="eEntryType">Type of event log entry</param>
        public static void AddEventLogEntry(string sText, EventLogEntryType eEntryType)
        {
            // Get the current executing Assembly
            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();

            // Get the Title Attribute
            System.Reflection.AssemblyTitleAttribute assTitleAttr = (System.Reflection.AssemblyTitleAttribute)asm.GetCustomAttributes(typeof(System.Reflection.AssemblyTitleAttribute), false)[0];
            string AppName = assTitleAttr.Title;

            // Ensure application is registered in event log
            if (!EventLog.SourceExists(AppName))
            {
                EventLog.CreateEventSource(AppName, "Application");
            }

            //   Add entry
            EventLog.WriteEntry(AppName, sText, eEntryType);
        }
Beispiel #3
0
        public About()
        {
            InitializeComponent();

            //NameLabel.Content = Application.ProductName;//NameLabelに製品名を入れる
            //VersionLabel.Content = ("Version:" + Application.ProductVersion);//VarsionLabelにバージョンを入れる

            //--------------情報を取得-----------ここから
            System.Reflection.AssemblyTitleAttribute asmttl = (System.Reflection.AssemblyTitleAttribute)Attribute.
                                                              GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyTitleAttribute));
            var fullname = typeof(App).Assembly.Location;
            var info     = System.Diagnostics.FileVersionInfo.GetVersionInfo(fullname);
            var ver      = info.FileVersion;

            System.Reflection.AssemblyCopyrightAttribute asmcpy = (System.Reflection.AssemblyCopyrightAttribute)Attribute.
                                                                  GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyCopyrightAttribute));
            //-------------------------------------------ここまで
            NameLabel.Content    = asmttl.Title;
            VersionLabel.Content = ("Version:" + ver);
            CRLabel.Content      = asmcpy.Copyright.ToString();      //CRLabelに取得したコピーライトを入れる
            MITLabel.Text        = "Released under the MIT license"; //MITLabelに定型文
        }
Beispiel #4
0
 /// <summary>
 /// フォームロード時のイベント(初期化として利用)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Main_Load(object sender, EventArgs e)
 {
     System.Reflection.AssemblyTitleAttribute asmttl = (System.Reflection.AssemblyTitleAttribute)Attribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyTitleAttribute));
     System.Diagnostics.FileVersionInfo       ver    = System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
     this.Text = String.Format("{0} [{1}]",
                               asmttl.Title, ver.FileVersion);
     //フォームのアイコンを設定する
     this.Icon = Properties.Resources.icon;
     // 全部品でMain_KeyDownを許可する。
     this.KeyPreview = true;
     // 画像リスト読み込みディレクトリの初期値指定
     this.textBox1.Text = System.Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
     // ディレクトリリスト読み込みの初期値指定
     this.textBox2.Text = System.Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
     // 画像リスト読み込み
     SetImages(this.textBox1.Text);
     // ディレクトリリスト読み込み
     getSubDir(this.textBox2.Text);
     this.text1 = this.textBox1.Text;
     this.text2 = this.textBox2.Text;
     ReflectionSettings();
 }
Beispiel #5
0
        public void CheckForShortcut()
        {
            try
            {
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    return;
                }
                System.Deployment.Application.ApplicationDeployment ad = default(System.Deployment.Application.ApplicationDeployment);
                ad = System.Deployment.Application.ApplicationDeployment.CurrentDeployment;

                if ((ad.IsFirstRun))
                {
                    System.Reflection.Assembly code = System.Reflection.Assembly.GetExecutingAssembly();
                    string company     = string.Empty;
                    string description = string.Empty;

                    if ((Attribute.IsDefined(code, typeof(System.Reflection.AssemblyCompanyAttribute))))
                    {
                        System.Reflection.AssemblyCompanyAttribute ascompany = null;
                        ascompany = (System.Reflection.AssemblyCompanyAttribute)Attribute.GetCustomAttribute(code, typeof(System.Reflection.AssemblyCompanyAttribute));
                        company   = ascompany.Company;
                    }

                    if ((Attribute.IsDefined(code, typeof(System.Reflection.AssemblyTitleAttribute))))
                    {
                        System.Reflection.AssemblyTitleAttribute asdescription = null;
                        asdescription = (System.Reflection.AssemblyTitleAttribute)Attribute.GetCustomAttribute(code, typeof(System.Reflection.AssemblyTitleAttribute));
                        description   = asdescription.Title;
                    }

                    if ((company != string.Empty & description != string.Empty))
                    {
                        //description = Replace(description, "_", " ")

                        string desktopPath = string.Empty;
                        desktopPath = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "\\", description, ".appref-ms");

                        string shortcutName = string.Empty;
                        shortcutName = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "\\", company, "\\", description, ".appref-ms");

                        if (!File.Exists(shortcutName))
                        {
                            shortcutName = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "\\", company, "\\", description, " - 1 .appref-ms");
                        }

                        if (!File.Exists(shortcutName))
                        {
                            shortcutName = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "\\", company, "\\", description, " - 2 .appref-ms");
                        }

                        System.IO.File.Copy(shortcutName, desktopPath, true);
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("Missing company or description: " + company + " - " + description);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(GetErrorText(ex));
            }
        }
Beispiel #6
0
        /// <summary>
        /// フォームLoadイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMain_Load(object sender, EventArgs e)
        {
            //タイトル初期化
            System.Reflection.AssemblyTitleAttribute asmttl = (System.Reflection.AssemblyTitleAttribute)
                                                              Attribute.GetCustomAttribute(
                System.Reflection.Assembly.GetExecutingAssembly(),
                typeof(System.Reflection.AssemblyTitleAttribute));
            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            System.Version             ver = asm.GetName().Version;
            this.Text = asmttl.Title + " " + ver.Major + "." + ver.Minor + "." + ver.Build;

            //フォーム位置初期化
            this.Left = _Settings.FormPosX;
            this.Top  = _Settings.FormPosY;

            //実行対象初期化
            chkExecField.Checked   = _Settings.ExecField;
            chkExecMum.Checked     = _Settings.ExecMum;
            chkExecAbyssea.Checked = _Settings.ExecAbyssea;

            //MUMゲーム初期化
            DataTable MumGameTable = new DataTable();

            MumGameTable.Columns.Add("ID", typeof(BoxTypeKind));
            MumGameTable.Columns.Add("NAME", typeof(string));
            for (int i = 0; i < _Constant.GetMumGameType().GetLength(0); i++)
            {
                DataRow row = MumGameTable.NewRow();
                row["ID"]   = _Constant.MUMGAMEINFO[i].Id;
                row["NAME"] = _Constant.MUMGAMEINFO[i].Name;
                MumGameTable.Rows.Add(row);
            }
            MumGameTable.AcceptChanges();
            cmbMumGameId.Items.Clear();
            cmbMumGameId.DataSource    = MumGameTable;
            cmbMumGameId.DisplayMember = "NAME";
            cmbMumGameId.ValueMember   = "ID";
            cmbMumGameId.SelectedValue = _Settings.MumGameId;

            //MUM挑戦回数初期化
            txtMumTryCount.Text = _Settings.MumTryCount.ToString();

            //候補初期化
            txtTargets.Text = "";

            //enterminity初期化
            chkUseEnternity.Checked = _Settings.UseEnternity;

            //実行ボタン初期化
            btnExec.Text = "開  始";

            //メッセージ初期化
            lblMessage.Text = "";

            //POLを検索する
            Process[] pol = Process.GetProcessesByName("pol");
            if (1 > pol.Length)
            {
                MessageBox.Show("FFXIを起動してください。");
                System.Environment.Exit(0);
            }

            DataTable PolTable = new DataTable();

            PolTable.Columns.Add("ID", typeof(int));
            PolTable.Columns.Add("NAME", typeof(string));
            foreach (Process v in pol)
            {
                DataRow row = PolTable.NewRow();
                row["ID"]   = v.Id;
                row["NAME"] = v.MainWindowTitle;
                PolTable.Rows.Add(row);
            }
            PolTable.AcceptChanges();
            cmbPol.DataSource    = PolTable;
            cmbPol.DisplayMember = "NAME";
            cmbPol.ValueMember   = "ID";
            cmbPol.SelectedIndex = 0;
            AttachPol(pol[0].Id);

            //監視を自動的に開始する
            Exec(true);
        }
Beispiel #7
0
 /// <summary>
 /// アプリケーション名を取得.
 /// </summary>
 /// <returns>アプリケーション名.</returns>
 public static string GetAppName()
 {
     System.Reflection.AssemblyTitleAttribute asmttl =
         (System.Reflection.AssemblyTitleAttribute)Attribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyTitleAttribute));
     return(asmttl.Title);
 }