예제 #1
0
        private async void FormMain_Load(object sender, EventArgs e)
        {
            foreach (var _ in _modules)
            {
                ;
            }

            this.Text            = LanguageData.Current.MainWindow_Title;
            btnOpen.Text         = LanguageData.Current.FormMain_ButtonOpen;
            cboxAllowEscape.Text = LanguageData.Current.FormMain_CheckBoxAllowEscape;
            labelVersion.Text    = VersionInfo.GetCaption();

            _app              = new App();
            _app.OpenWindow   = false;
            _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            _app.InitializeComponent();

            cboxAllowEscape.Checked = _context.AllowEscape;

            if (_context.LogFilesToOpen is not null)
            {
                var files = _context.LogFilesToOpen;
                int count = files.Count;
                for (int i = 0; i < count; ++i)
                {
                    var mwnd = this.CreateMainWindow();
                    if (await mwnd.OpenFile(files[i], _context.AllowEscape))
                    {
                        this.ShowMainWindow(mwnd);
                    }
                }
            }
        }
예제 #2
0
        private async void FormMain_Load(object sender, EventArgs e)
        {
            foreach (var module in _modules)
            {
                PluginLoader.Load(module, this, menuFeatures);
            }

            this.Text         = LanguageData.Current.MainWindow_Title;
            btnOpen.Text      = LanguageData.Current.FormMain_ButtonOpen;
            menuFeatures.Text = LanguageData.Current.FormMain_FeaturesMenu;
            menuFeatures_showReceiver.Text = LanguageData.Current.FormMain_FeaturesMenu_ShowReceiver;
            menuFeatures_showSender.Text   = LanguageData.Current.FormMain_FeaturesMenu_ShowSender;
            cboxAllowEscape.Text           = LanguageData.Current.FormMain_CheckBoxAllowEscape;
            labelVersion.Text = VersionInfo.GetCaption() + "\r\n" + VersionInfo.GetCopyright();

            _app              = new App();
            _app.OpenWindow   = false;
            _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            _app.InitializeComponent();

            cboxAllowEscape.Checked = _context.AllowEscape;

            if (_context.LogFilesToOpen is not null)
            {
                var files = _context.LogFilesToOpen;
                int count = files.Count;
                for (int i = 0; i < count; ++i)
                {
                    await this.OpenFileAsync(files[i]);
                }
            }
        }
예제 #3
0
 public MainWindow(TransformerPipeline transformerPipeline)
 {
     _transformer = transformerPipeline.Build(m => m ?? string.Empty);
     this.InitializeComponent();
     this.Title             = LanguageData.Current.MainWindow_Title;
     btnOpen.Content        = LanguageData.Current.MainWindow_ButtonOpen;
     lblVersion.Content     = $"{VersionInfo.GetCaption()}\t{VersionInfo.GetCopyright()}";
     controller.MainWindow  = this;
     controller.LogFileView = lfv;
 }
예제 #4
0
 /// <summary>
 ///  バージョン情報を書き込みます。
 ///  プログラム名も設定されます。
 /// </summary>
 /// <param name="ver">バージョン情報を表すオブジェクトです。</param>
 /// <exception cref="System.ArgumentNullException"/>
 public void WriteVersion(VersionInfo ver)
 {
     ver.EnsureNotNull(nameof(ver));
     _appName = ver.Name;
     _sb.Append(ver.GetCaption());
     _sb.Append(" - ");
     _sb.AppendLine(Resources.ManualBuilder_WriteVersion);
     _sb.AppendLine(ver.Copyright);
     _sb.AppendLine();
     _sb.AppendLine(ver.Description);
     _sb.AppendFormat(Resources.ManualBuilder_WriteVersion_Authors, ver.Authors);
     _sb.AppendLine();
     _sb.AppendLine();
 }
예제 #5
0
        private static void NotifyWhenJapanese()
        {
            string suppressor = Path.Combine(AppContext.BaseDirectory, "c19r.lv.en.suppress-notify-when-japanese");

            if (!File.Exists(suppressor))
            {
                var asm = Assembly.GetExecutingAssembly();
                MessageBox.Show(
                    $"英語版で起動します。日本語版で起動する場合は「{asm.GetName().Name}.dll」を削除してください。",
                    VersionInfo.GetCaption(asm),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                    );
                try {
                    File.Create(suppressor).Close();
                } catch (Exception e) {
                    // Ignore I/O error on release build, log on debug build.
                    Debug.Fail(e.Message, e.ToString());
                }
            }
        }
예제 #6
0
        public void GetCaptionTest1()
        {
            string caption;

            caption = VersionInfo.GetCaption("CocoaLogViewer", new(0, 0, 0, 0), "c19r.lv00a0", "初期バージョンの題名");
            Assert.AreEqual("CocoaLogViewer [v0.0.0.0, cn:c19r.lv00a0, bc:初期バージョンの題名]", caption);

            caption = VersionInfo.GetCaption("Name", new(1, 2, 3, 4), "Hello", "World");
            Assert.AreEqual("Name [v1.2.3.4, cn:Hello, bc:World]", caption);

            caption = VersionInfo.GetCaption("AppName", new(1, 0, 0, 0), "abc123", VersionInfo.Debug);
            Assert.AreEqual("AppName - デバッグ版 [v1.0.0.0, cn:abc123]", caption);

            caption = VersionInfo.GetCaption("AppName", new(1, 0, 0, 0), "abc123", VersionInfo.Release);
            Assert.AreEqual("AppName [v1.0.0.0, cn:abc123]", caption);

            caption = VersionInfo.GetCaption("AppName", new(1, 0, 0, 0), "abc123", null);
            Assert.AreEqual("AppName [v1.0.0.0, cn:abc123, bc:<不明>]", caption);

            caption = VersionInfo.GetCaption("AppName", null, "abc123", null);
            Assert.AreEqual("AppName [v?.?.?.?, cn:abc123, bc:<不明>]", caption);

            caption = VersionInfo.GetCaption("AppName", new(1, 0, 0, 0), "", null);
            Assert.AreEqual("AppName [v1.0.0.0, cn:, bc:<不明>]", caption);

            caption = VersionInfo.GetCaption("AppName", new(int.MaxValue, 0x7FFFFFFF, 0, 0), "", null);
            Assert.AreEqual("AppName [v2147483647.2147483647.0.0, cn:, bc:<不明>]", caption);

            caption = VersionInfo.GetCaption("AppName", new(1, 0, 0, 0), null, null);
            Assert.AreEqual("AppName [v1.0.0.0, cn:<不明>, bc:<不明>]", caption);

            caption = VersionInfo.GetCaption("1234", new(99, 0, 0, 5), null, "Debug");
            Assert.AreEqual("1234 - デバッグ版 [v99.0.0.5, cn:<不明>]", caption);

            caption = VersionInfo.GetCaption(null, new(99, 0, 0, 5), null, "Debug");
            Assert.AreEqual(" - デバッグ版 [v99.0.0.5, cn:<不明>]", caption);

            caption = VersionInfo.GetCaption(null, null, null, "Release");
            Assert.AreEqual(" [v?.?.?.?, cn:<不明>]", caption);
        }
예제 #7
0
        public void VersionInfoTest()
        {
            VersionInfo.PrintAllAssemblies();

            var vi = VersionInfo.Library;

            vi = new VersionInfo(typeof(PublicAPICompatibilityTests_old_V0_0).Assembly);

            Assembly?asm;
            string   str;
            Version? ver;

            asm = vi.Assembly;
            str = vi.Name;
            str = vi.DisplayName;
            str = vi.Copyright;
            ver = vi.Version;
            str = vi.CodeName;
            str = vi.GetCaption();
            str = vi.GetFullVersionString();
            str = vi.GetVersionString();

            vi.Print();
        }
예제 #8
0
        public void GetCaptionTest2()
        {
            // 同一のアセンブリに対して必ず同じ結果を出力しなければならない。

            Assert.AreEqual(
                VersionInfo.GetCaption(),
                VersionInfo.GetCaption(typeof(VersionInfo).Assembly)
                );

            Assert.AreNotEqual(
                VersionInfo.GetCaption(),
                VersionInfo.GetCaption(typeof(VersionInfoTests).Assembly)
                );

            Assert.AreEqual(
                VersionInfo.GetCaption(Assembly.GetExecutingAssembly()),
                VersionInfo.GetCaption(typeof(VersionInfoTests).Assembly)
                );

            Assert.AreNotEqual(
                VersionInfo.GetCaption(Assembly.GetExecutingAssembly()),
                VersionInfo.GetCaption(typeof(VersionInfo).Assembly)
                );
        }