Пример #1
0
        public void Constructor()
        {
            var propertyValueListResponse = BuildTPropertyValueListResponseFromFile("ListServer_TPropertyValueListResponse.xml");

            Assert.NotNull(propertyValueListResponse);
            Assert.NotNull(propertyValueListResponse.HttpRequestResult);
            Assert.NotNull(propertyValueListResponse.Items);
            Assert.AreEqual(35, propertyValueListResponse.Items.Count);

            var account = new ListServer(propertyValueListResponse.Items);

            //shared properties
            Assert.True(account.U_Type.HasValue);
            Assert.AreEqual(AccountType.ListServer, account.U_Type.Value);
            Assert.AreEqual("listserver", account.U_Alias);
            Assert.AreEqual("*****@*****.**", account.U_AliasList);
            Assert.True(String.IsNullOrEmpty(account.U_Name));
            Assert.AreEqual("eJxjY2BgYLRmGKmAEURw5WQWlxSnFpWlFg20ewYECJWkFpc4gIjMvHS95Hy90uyBdhKdgQyK52MQ6UGvpKJkoB1HB8A40A4YcDAaAqNgFIyCwQAYwYAJzmcbQLeMdAAAZJkXNA==", account.U_Backup);
            Assert.False(account.U_GW_DailyAgenda.HasValue);

            //account type specific properties
            Assert.AreEqual(@"testing.co.uk\listserver.txt", account.L_ListFile);
            Assert.True(account.L_ListSubject.HasValue);
            Assert.True(account.L_ListSubject.Value);
            Assert.True(account.L_SendAllLists.HasValue);
            Assert.AreEqual(ListServerMembersSource.AllDomainMailingLists, account.L_SendAllLists.Value);
        }
Пример #2
0
        void InitListServer()
        {
            IListServerServerApi serverApi = new ListServerServerApi(this, requestCreator);
            IListServerClientApi clientApi = new ListServerClientApi(this, requestCreator, _onServerListUpdated);

            ListServer = new ListServer(serverApi, clientApi);
        }
Пример #3
0
        public void InsertServer(Server server)
        {
            Button button = CreateServerButton(server);

            ListServer.Add(server);
            button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
        }
Пример #4
0
        private async void CreateServerDialog_RequestCreateServer(object sender, RequestCreateServerArgs e)
        {
            Server server = await ResourcesCreator.CreateServerAsync(e.ServerName);

            ListServer.Add(server);
            CreateServerButton(server);
        }
Пример #5
0
        //�I������
        public void Dispose()
        {
            //	        if (RunMode != RunMode.Service && RunMode != RunMode.Remote) {
            //	            //**********************************************
            //	            // ��U�t�@�C����폜���Č��ݗL���Ȃ�̂���������߂�
            //	            //**********************************************
            //	            var iniDb = new IniDb(ProgDir(),"Option");
            //	            iniDb.DeleteIni();

            //Ver5.8.6 Java fix
            if (RunMode == RunMode.Normal)
            {
                var iniTmp = new IniDb(ProgDir(), "$tmp");//�o�b�N�A�b�v��쐬����ini�t�@�C����폜����
                //��U�A�ʃt�@�C���Ɍ��ݗL���Ȃ�̂���������߂�
                ListOption.Save(iniTmp);
                //�㏑������
                File.Copy(iniTmp.Path, IniDb.Path, true);
                iniTmp.Delete();
            }
            else if (RunMode == RunMode.Remote)
            {
                IniDb.Delete(); //$Remote.ini�̍폜
            }


            //**********************************************
            // �j��
            //**********************************************
            ListServer.Dispose(); //�e�T�[�o�͒�~�����
            ListOption.Dispose();
            ListTool.Dispose();
            MailBox = null;
            //	        }
            if (RemoteClient != null)
            {
                RemoteClient.Dispose();
            }

            View.Dispose();
            if (TraceDlg != null)
            {
                TraceDlg.Dispose();
            }
            if (Menu != null)
            {
                Menu.Dispose();
            }
            if (WindowSize != null)
            {
                View.Save(WindowSize);
                WindowSize.Dispose(); //Dispose���Ȃ���Reg.Dispose(�ۑ�)����Ȃ�
            }
        }
Пример #6
0
        //終了処理
        public void Dispose()
        {
            //	        if (RunMode != RunMode.Service && RunMode != RunMode.Remote) {
            //	            //**********************************************
            //	            // 一旦ファイルを削除して現在有効なものだけを書き戻す
            //	            //**********************************************
            //	            var iniDb = new IniDb(ProgDir(),"Option");
            //	            iniDb.DeleteIni();

            //Ver5.8.6 Java fix
            if (RunMode == RunMode.Normal)
            {
                var iniTmp = new IniDb(ProgDir(), "$tmp");//バックアップを作成してiniファイルを削除する
                //一旦、別ファイルに現在有効なものだけを書き戻す
                ListOption.Save(iniTmp);
                //上書きする
                File.Copy(iniTmp.Path, IniDb.Path, true);
                iniTmp.Delete();
            }
            else if (RunMode == RunMode.Remote)
            {
                IniDb.Delete(); //$Remote.iniの削除
            }


            //**********************************************
            // 破棄
            //**********************************************
            ListServer.Dispose(); //各サーバは停止される
            ListOption.Dispose();
            ListTool.Dispose();
            MailBox = null;
            //	        }
            if (RemoteClient != null)
            {
                RemoteClient.Dispose();
            }

            View.Dispose();
            if (TraceDlg != null)
            {
                TraceDlg.Dispose();
            }
            if (Menu != null)
            {
                Menu.Dispose();
            }
            if (WindowSize != null)
            {
                View.Save(WindowSize);
                WindowSize.Dispose(); //DisposeしないとReg.Dispose(保存)されない
            }
        }
Пример #7
0
 private void AttachListButton()
 {
     GridServerButton.Children.Clear();
     DockPanelServerButton = new DockPanel()
     {
         LastChildFill = false
     };
     GridServerButton.Children.Add(DockPanelServerButton);
     for (int i = 0; i < ListServer.Count; i++)
     {
         CreateServerButton(ListServer.ElementAt(i));
     }
 }
Пример #8
0
        public void RemoveServer(int serverId)
        {
            Server server = ListServer.Where(s => s.ServerId == serverId).FirstOrDefault();

            if (server == null)
            {
                return;
            }
            Button button = ButtonServers.Where(bs => bs.Value == server).FirstOrDefault().Key;

            ListServer.Remove(server);
            ButtonServers.Remove(button);
            DockPanelServerButton.Children.Remove(button);
        }
Пример #9
0
 private void Stop()
 {
     //�T�[�r�X�o�^����Ă���ꍇ�̏���
     if (RunMode == RunMode.NormalRegist)
     {
         //            var setupService = new SetupService(this);
         //            if (setupService.Status == ServiceControllerStatus.Running) {
         //                setupService.Job(ServiceCmd.Stop);
         //            }
     }
     else
     {
         ListServer.Stop();
     }
 }
Пример #10
0
 private void Stop()
 {
     //サービス登録されている場合の処理
     if (RunMode == RunMode.NormalRegist)
     {
         //            var setupService = new SetupService(this);
         //            if (setupService.Status == ServiceControllerStatus.Running) {
         //                setupService.Job(ServiceCmd.Stop);
         //            }
     }
     else
     {
         ListServer.Stop();
     }
 }
Пример #11
0
        //public string Env(string str) {
        //    str = Util.SwapStr("%ExecutablePath%", ProgDir(), str);
        //    return str;
        //}


        private void Start()
        {
            //�T�[�r�X�o�^����Ă���ꍇ�̏���
            if (RunMode == RunMode.NormalRegist)
            {
                //            var setupService = new SetupService(this);
                //            if (setupService.Status != ServiceControllerStatus.Running) {
                //                setupService.Job(ServiceCmd.Start);
                //            }
            }
            else
            {
                if (ListServer.Count == 0)
                {
                    _logger.Set(LogKind.Error, null, 9000030, "");
                }
                else
                {
                    ListServer.Start();
                }
            }
        }
Пример #12
0
        //���j���[�I����̏���
        public void MenuOnClick(String cmd)
        {
            if (cmd.IndexOf("Option_") == 0)
            {
                if (RunMode == RunMode.Remote)
                {
                    //Java fix RunMOde==Remote�̏ꍇ�̃��j���[����
                    RemoteClient.MenuOnClick(cmd);
                }
                else
                {
                    var oneOption = ListOption.Get(cmd.Substring(7));
                    if (oneOption != null)
                    {
                        var dlg = new OptionDlg(this, oneOption);
                        if (DialogResult.OK == dlg.ShowDialog())
                        {
                            //Ver5.8.6 Java fix
                            //oneOption.Save(OptionIni.GetInstance());
                            oneOption.Save(IniDb);
                            MenuOnClick("StartStop_Reload");
                        }
                    }
                }
            }
            else if (cmd.IndexOf("Tool_") == 0)
            {
                if (RunMode == RunMode.Remote)
                {
                    //Java fix RunMOde==Remote�̏ꍇ�̃��j���[����
                    RemoteClient.MenuOnClick(cmd);
                }
                else
                {
                    var nameTag = cmd.Substring(5);
                    var oneTool = ListTool.Get(nameTag);
                    if (oneTool == null)
                    {
                        return;
                    }

                    //BJD.EXE�ȊO�̏ꍇ�A�T�[�o�I�u�W�F�N�g�ւ̃|�C���^���K�v�ɂȂ�
                    OneServer oneServer = null;
                    if (nameTag != "BJD")
                    {
                        oneServer = ListServer.Get(nameTag);
                        if (oneServer == null)
                        {
                            return;
                        }
                    }

                    ToolDlg dlg = oneTool.CreateDlg(oneServer);
                    dlg.ShowDialog();
                }
            }
            else if (cmd.IndexOf("StartStop_") == 0)
            {
                if (RunMode == RunMode.Remote)
                {
                    //Java fix RunMOde==Remote�̏ꍇ�̃��j���[����
                    RemoteClient.MenuOnClick(cmd);
                }
                else
                {
                    switch (cmd)
                    {
                    case "StartStop_Start":
                        Start();
                        break;

                    case "StartStop_Stop":
                        Stop();
                        break;

                    case "StartStop_Restart":
                        Stop();
                        Thread.Sleep(300);
                        Start();
                        break;

                    case "StartStop_Reload":
                        Stop();
                        ListInitialize();
                        Start();
                        break;

                    case "StartStop_Service":
                        SetupService();     //�T�[�r�X�̐ݒ�
                        break;

                    default:
                        Util.RuntimeException(string.Format("cmd={0}", cmd));
                        break;
                    }
                    View.SetColor();  //�E�C���h�̃J���[������
                    Menu.SetEnable(); //��Ԃɉ������L���E����
                }
            }
            else
            {
                switch (cmd)
                {
                case "File_LogClear":
                    LogView.Clear();
                    break;

                case "File_LogCopy":
                    LogView.SetClipboard();
                    break;

                case "File_Trace":
                    TraceDlg.Open();
                    break;

                case "File_Exit":
                    View.MainForm.Close();
                    break;

                case "Help_Version":
                    var dlg = new VersionDlg(this);
                    dlg.ShowDialog();
                    break;

                case "Help_Homepage":
                    Process.Start(Define.WebHome());
                    break;

                case "Help_Document":
                    Process.Start(Define.WebDocument());
                    break;

                case "Help_Support":
                    Process.Start(Define.WebSupport());
                    break;
                }
            }
        }
Пример #13
0
        //�T�[�o�ċN���ŁA�ēx���s����鏉����
        public void ListInitialize()
        {
            //Logger���g�p�ł��Ȃ��Ԃ̃��O�́A������ɕۑ����āA���Logger�ɑ���
            var tmpLogger = new TmpLogger();

            //************************************************************
            // �j��
            //************************************************************
            if (ListOption != null)
            {
                ListOption.Dispose();
                ListOption = null;
            }
            //Java fix
            if (ListTool != null)
            {
                ListTool.Dispose();
                ListTool = null;
            }
            if (ListServer != null)
            {
                ListServer.Dispose();
                ListServer = null;
            }
            if (MailBox != null)
            {
                MailBox = null;
            }
            if (LogFile != null)
            {
                LogFile.Dispose();
                LogFile = null;
            }

            //************************************************************
            // ������
            //************************************************************
            //ListPlugin �́BListOption��ListServer�����������Ԃ�����������
            //isTest=true�̏ꍇ�A�p�X��""�ɂ��āA�v���O�C��0�‚ŏ�������������

            //ListPlugin listPlugin = new ListPlugin((isTest) ? "" : string.Format("%s\\plugins", getProgDir()));
            var listPlugin = new ListPlugin(ProgDir());

            foreach (var o in listPlugin)
            {
                //�����[�g�N���C�A���g�̏ꍇ�A���̃��O�́A��₱�����̂ŕ\�����Ȃ�
                if (RunMode == RunMode.Normal)
                {
                    tmpLogger.Set(LogKind.Detail, null, 9000008, string.Format("{0}Server", o.Name));
                }
            }

            //ListOption�Ŋe�I�v�V���������������O�ɁAisJp�����͏��������Ă����K�v������̂�
            //�ŏ���OptionBasic��lang������ǂݏo��
            //Ver5.8.6 Java fix
            //_isJp = OptionIni.GetInstance().IsJp();
            _isJp = IniDb.IsJp();

            ListOption = new ListOption(this, listPlugin);

            //Ver5.9.1
            //���߂Ă�����ʉ߂���Ƃ��A�ߋ��̃o�[�W������Option��ǂݍ��ނ�
            //���I�v�V�����̓I�u�W�F�N�g�̒���OneOption�ɂ̂ݕێ������
            //���̏�ԂŁA�����̃I�v�V�����w���OK����ƁA���̃I�v�V�����ȊO��
            //Option.ini�ɕۑ�����Ȃ����ߔj������Ă��܂�
            //���̖��ɑΏ����邽�߁A�����ň�x�AOption.ini��ۑ����邱�Ƃɂ���
            if (!_isTest)
            {
                ListOption.Save(IniDb);
            }


            //OptionBasic
            var confBasic = new Conf(ListOption.Get("Basic"));

            EditBrowse = (bool)confBasic.Get("editBrowse");

            //OptionLog
            var confOption = new Conf(ListOption.Get("Log"));

            LogView.SetFont((Font)confOption.Get("font"));

            if (RunMode == RunMode.Normal || RunMode == RunMode.Service)
            {
                //LogFile�̏�����
                var saveDirectory = (String)confOption.Get("saveDirectory");
                saveDirectory = ReplaceOptionEnv(saveDirectory);
                var normalLogKind = (int)confOption.Get("normalLogKind");
                var secureLogKind = (int)confOption.Get("secureLogKind");
                var saveDays      = (int)confOption.Get("saveDays");
                //Ver6.0.7
                var useLogFile  = (bool)confOption.Get("useLogFile");
                var useLogClear = (bool)confOption.Get("useLogClear");
                if (!useLogClear)
                {
                    saveDays = 0; //���O�̎����폜�������ȏꍇ�AsaveDays��0��Z�b�g����
                }
                if (saveDirectory == "")
                {
                    tmpLogger.Set(LogKind.Error, null, 9000045, "It is not appointed");
                }
                else
                {
                    tmpLogger.Set(LogKind.Detail, null, 9000032, saveDirectory);
                    try{
                        LogFile = new LogFile(saveDirectory, normalLogKind, secureLogKind, saveDays, useLogFile);
                    } catch (IOException e) {
                        LogFile = null;
                        tmpLogger.Set(LogKind.Error, null, 9000031, e.Message);
                    }
                }

                //Ver5.8.7 Java fix
                //mailBox������
                foreach (var o in ListOption)
                {
                    //SmtpServer�Ⴕ���́APop3Server���g�p�����ꍇ�̂݃��[���{�b�N�X�����������
                    if (o.NameTag == "Smtp" || o.NameTag == "Pop3")
                    {
                        if (o.UseServer)
                        {
                            var conf    = new Conf(ListOption.Get("MailBox"));
                            var dir     = ReplaceOptionEnv((String)conf.Get("dir"));
                            var datUser = (Dat)conf.Get("user");
                            var logger  = CreateLogger("MailBox", (bool)conf.Get("useDetailsLog"), null);
                            MailBox = new MailBox(logger, datUser, dir);
                            break;
                        }
                    }
                }
            }
            _logger = CreateLogger("kernel", true, null);
            tmpLogger.Release(_logger);


            //Ver5.8.7 Java fix �����[�g�N���C�A���g�̏ꍇ����[���{�b�N�X��쐬���Ă��܂��o�O��C��
//            //mailBox������
//            foreach (var o in ListOption){
//                //SmtpServer�Ⴕ���́APop3Server���g�p�����ꍇ�̂݃��[���{�b�N�X�����������
//                if (o.NameTag == "Smtp" || o.NameTag == "Pop3"){
//                    if (o.UseServer){
//                        var conf = new Conf(ListOption.Get("MailBox"));
//                        MailBox = new MailBox(this, conf);
//                        break;
//                    }
//                }
//            }

            ListServer = new ListServer(this, listPlugin);

            ListTool = new ListTool();
            ListTool.Initialize(this);

            View.SetColumnText();    //Log�r���[�̃J�����e�L�X�g�̏�����
            Menu.Initialize(IsJp()); //���j���[�\�z�i����e�[�u���̏������j

            WebApi = new WebApi();
        }
Пример #14
0
        //�T�[�o�ċN���ŁA�ēx���s����鏉����
        public void ListInitialize()
        {
            //Logger���g�p�ł��Ȃ��Ԃ̃��O�́A������ɕۑ����āA���Logger�ɑ���
            var tmpLogger = new TmpLogger();

            //************************************************************
            // �j��
            //************************************************************
            if (ListOption != null){
                ListOption.Dispose();
                ListOption = null;
            }
            //Java fix
            if (ListTool != null){
                ListTool.Dispose();
                ListTool = null;
            }
            if (ListServer != null){
                ListServer.Dispose();
                ListServer = null;
            }
            if (MailBox != null){
                MailBox = null;
            }
            if (LogFile != null){
                LogFile.Dispose();
                LogFile = null;
            }

            //************************************************************
            // ������
            //************************************************************
            //ListPlugin �́BListOption��ListServer�����������Ԃ�����������
            //isTest=true�̏ꍇ�A�p�X��""�ɂ��āA�v���O�C��0�‚ŏ�������������

            //ListPlugin listPlugin = new ListPlugin((isTest) ? "" : string.Format("%s\\plugins", getProgDir()));
            var listPlugin = new ListPlugin(ProgDir());
            foreach (var o in listPlugin){
                //�����[�g�N���C�A���g�̏ꍇ�A���̃��O�́A��₱�����̂ŕ\�����Ȃ�
                if (RunMode == RunMode.Normal){
                    tmpLogger.Set(LogKind.Detail, null, 9000008, string.Format("{0}Server", o.Name));
                }
            }

            //ListOption�Ŋe�I�v�V���������������O�ɁAisJp�����͏��������Ă����K�v������̂�
            //�ŏ���OptionBasic��lang������ǂݏo��
            //Ver5.8.6 Java fix
            //_isJp = OptionIni.GetInstance().IsJp();
            _isJp = IniDb.IsJp();

            ListOption = new ListOption(this, listPlugin);

            //Ver5.9.1
            //���߂Ă�����ʉ߂���Ƃ��A�ߋ��̃o�[�W������Option��ǂݍ��ނ�
            //���I�v�V�����̓I�u�W�F�N�g�̒���OneOption�ɂ̂ݕێ������
            //���̏�ԂŁA�����̃I�v�V�����w���OK����ƁA���̃I�v�V�����ȊO��
            //Option.ini�ɕۑ�����Ȃ����ߔj������Ă��܂�
            //���̖��ɑΏ����邽�߁A�����ň�x�AOption.ini��ۑ����邱�Ƃɂ���
            if (!_isTest){
                ListOption.Save(IniDb);
            }

            //OptionBasic
            var confBasic = new Conf(ListOption.Get("Basic"));
            EditBrowse = (bool) confBasic.Get("editBrowse");

            //OptionLog
            var confOption = new Conf(ListOption.Get("Log"));
            LogView.SetFont((Font) confOption.Get("font"));

            if (RunMode == RunMode.Normal || RunMode == RunMode.Service){
                //LogFile�̏�����
                var saveDirectory = (String) confOption.Get("saveDirectory");
                saveDirectory = ReplaceOptionEnv(saveDirectory);
                var normalLogKind = (int) confOption.Get("normalLogKind");
                var secureLogKind = (int) confOption.Get("secureLogKind");
                var saveDays = (int) confOption.Get("saveDays");
                //Ver6.0.7
                var useLogFile = (bool)confOption.Get("useLogFile");
                var useLogClear = (bool) confOption.Get("useLogClear");
                if (!useLogClear){
                    saveDays = 0; //���O�̎����폜�������ȏꍇ�AsaveDays��0��Z�b�g����
                }
                if (saveDirectory == ""){
                    tmpLogger.Set(LogKind.Error, null, 9000045, "It is not appointed");
                } else{
                    tmpLogger.Set(LogKind.Detail, null, 9000032, saveDirectory);
                    try{
                        LogFile = new LogFile(saveDirectory, normalLogKind, secureLogKind, saveDays,useLogFile);
                    } catch (IOException e){
                        LogFile = null;
                        tmpLogger.Set(LogKind.Error, null, 9000031, e.Message);
                    }
                }

                //Ver5.8.7 Java fix
                //mailBox������
                foreach (var o in ListOption) {
                    //SmtpServer�Ⴕ���́APop3Server���g�p�����ꍇ�̂݃��[���{�b�N�X�����������
                    if (o.NameTag == "Smtp" || o.NameTag == "Pop3") {
                        if (o.UseServer) {
                            var conf = new Conf(ListOption.Get("MailBox"));
                            var dir = ReplaceOptionEnv((String) conf.Get("dir"));
                            var datUser = (Dat) conf.Get("user");
                            var logger = CreateLogger("MailBox", (bool)conf.Get("useDetailsLog"), null);
                            MailBox = new MailBox(logger,datUser, dir);
                            break;
                        }
                    }
                }

            }
            _logger = CreateLogger("kernel", true, null);
            tmpLogger.Release(_logger);

            //Ver5.8.7 Java fix �����[�g�N���C�A���g�̏ꍇ����[���{�b�N�X��쐬���Ă��܂��o�O��C��
            //            //mailBox������
            //            foreach (var o in ListOption){
            //                //SmtpServer�Ⴕ���́APop3Server���g�p�����ꍇ�̂݃��[���{�b�N�X�����������
            //                if (o.NameTag == "Smtp" || o.NameTag == "Pop3"){
            //                    if (o.UseServer){
            //                        var conf = new Conf(ListOption.Get("MailBox"));
            //                        MailBox = new MailBox(this, conf);
            //                        break;
            //                    }
            //                }
            //            }

            ListServer = new ListServer(this, listPlugin);

            ListTool = new ListTool();
            ListTool.Initialize(this);

            View.SetColumnText(); //Log�r���[�̃J�����e�L�X�g�̏�����
            Menu.Initialize(IsJp()); //���j���[�\�z�i����e�[�u���̏������j

            WebApi = new WebApi();
        }
Пример #15
0
        public void PropertyNames()
        {
            var propertyNames = new ListServer().PropertyNamesList();

            Assert.AreEqual(35, propertyNames.Count);
        }
Пример #16
0
        //メニュー選択時の処理
        public void MenuOnClick(String cmd)
        {
            if (cmd.IndexOf("Option_") == 0)
            {
                if (RunMode == RunMode.Remote)
                {
                    //Java fix RunMOde==Remoteの場合のメニュー処理
                    RemoteClient.MenuOnClick(cmd);
                }
                else
                {
                    var oneOption = ListOption.Get(cmd.Substring(7));
                    if (oneOption != null)
                    {
                        var dlg = new OptionDlg(this, oneOption);
                        if (DialogResult.OK == dlg.ShowDialog())
                        {
                            //Ver5.8.6 Java fix
                            //oneOption.Save(OptionIni.GetInstance());
                            oneOption.Save(IniDb);
                            MenuOnClick("StartStop_Reload");
                        }
                    }
                }
            }
            else if (cmd.IndexOf("Tool_") == 0)
            {
                if (RunMode == RunMode.Remote)
                {
                    //Java fix RunMOde==Remoteの場合のメニュー処理
                    RemoteClient.MenuOnClick(cmd);
                }
                else
                {
                    var nameTag = cmd.Substring(5);
                    var oneTool = ListTool.Get(nameTag);
                    if (oneTool == null)
                    {
                        return;
                    }

                    //BJD.EXE以外の場合、サーバオブジェクトへのポインタが必要になる
                    OneServer oneServer = null;
                    if (nameTag != "BJD")
                    {
                        oneServer = ListServer.Get(nameTag);
                        if (oneServer == null)
                        {
                            return;
                        }
                    }

                    ToolDlg dlg = oneTool.CreateDlg(oneServer);
                    dlg.ShowDialog();
                }
            }
            else if (cmd.IndexOf("StartStop_") == 0)
            {
                if (RunMode == RunMode.Remote)
                {
                    //Java fix RunMOde==Remoteの場合のメニュー処理
                    RemoteClient.MenuOnClick(cmd);
                }
                else
                {
                    switch (cmd)
                    {
                    case "StartStop_Start":
                        Start();
                        break;

                    case "StartStop_Stop":
                        Stop();
                        break;

                    case "StartStop_Restart":
                        Stop();
                        Thread.Sleep(300);
                        Start();
                        break;

                    case "StartStop_Reload":
                        Stop();
                        ListInitialize();
                        Start();
                        break;

                    case "StartStop_Service":
                        SetupService();     //サービスの設定
                        break;

                    default:
                        Util.RuntimeException(string.Format("cmd={0}", cmd));
                        break;
                    }
                    View.SetColor();  //ウインドのカラー初期化
                    Menu.SetEnable(); //状態に応じた有効・無効
                }
            }
            else
            {
                switch (cmd)
                {
                case "File_LogClear":
                    LogView.Clear();
                    break;

                case "File_LogCopy":
                    LogView.SetClipboard();
                    break;

                case "File_Trace":
                    TraceDlg.Open();
                    break;

                case "File_Exit":
                    View.MainForm.Close();
                    break;

                case "Help_Version":
                    var dlg = new VersionDlg(this);
                    dlg.ShowDialog();
                    break;

                case "Help_Homepage":
                    Process.Start(Define.WebHome());
                    break;

                case "Help_Document":
                    Process.Start(Define.WebDocument());
                    break;

                case "Help_Support":
                    Process.Start(Define.WebSupport());
                    break;
                }
            }
        }
Пример #17
0
        //サーバ再起動で、再度実行される初期化
        public void ListInitialize()
        {
            //Loggerが使用できない間のログは、こちらに保存して、後でLoggerに送る
            var tmpLogger = new TmpLogger();

            //************************************************************
            // 破棄
            //************************************************************
            if (ListOption != null)
            {
                ListOption.Dispose();
                ListOption = null;
            }
            //Java fix
            if (ListTool != null)
            {
                ListTool.Dispose();
                ListTool = null;
            }
            if (ListServer != null)
            {
                ListServer.Dispose();
                ListServer = null;
            }
            if (MailBox != null)
            {
                MailBox = null;
            }
            if (LogFile != null)
            {
                LogFile.Dispose();
                LogFile = null;
            }

            //************************************************************
            // 初期化
            //************************************************************
            //ListPlugin は。ListOptionとListServerを初期化する間だけ生存する
            //isTest=trueの場合、パスを""にして、プラグイン0個で初期化さあせる

            //ListPlugin listPlugin = new ListPlugin((isTest) ? "" : string.Format("%s\\plugins", getProgDir()));
            var listPlugin = new ListPlugin(ProgDir());

            foreach (var o in listPlugin)
            {
                //リモートクライアントの場合、このログは、ややこしいので表示しない
                if (RunMode == RunMode.Normal)
                {
                    tmpLogger.Set(LogKind.Detail, null, 9000008, string.Format("{0}Server", o.Name));
                }
            }

            //ListOptionで各オプションを初期化する前に、isJpだけは初期化しておく必要があるので
            //最初にOptionBasicのlangだけを読み出す
            //Ver5.8.6 Java fix
            //_isJp = OptionIni.GetInstance().IsJp();
            _isJp = IniDb.IsJp();

            ListOption = new ListOption(this, listPlugin);

            //Ver5.9.1
            //初めてここを通過するとき、過去のバージョンのOptionを読み込むと
            //旧オプションはオブジェクトの中のOneOptionにのみ保持される
            //この状態で、何かのオプション指定でOKすると、そのオプション以外が
            //Option.iniに保存されないため破棄されてしまう
            //この問題に対処するため、ここで一度、Option.iniを保存することにする
            if (!_isTest)
            {
                ListOption.Save(IniDb);
            }


            //OptionBasic
            var confBasic = new Conf(ListOption.Get("Basic"));

            EditBrowse = (bool)confBasic.Get("editBrowse");

            //OptionLog
            var confOption = new Conf(ListOption.Get("Log"));

            LogView.SetFont((Font)confOption.Get("font"));

            if (RunMode == RunMode.Normal || RunMode == RunMode.Service)
            {
                //LogFileの初期化
                var saveDirectory = (String)confOption.Get("saveDirectory");
                saveDirectory = ReplaceOptionEnv(saveDirectory);
                var normalLogKind = (int)confOption.Get("normalLogKind");
                var secureLogKind = (int)confOption.Get("secureLogKind");
                var saveDays      = (int)confOption.Get("saveDays");
                //Ver6.0.7
                var useLogFile  = (bool)confOption.Get("useLogFile");
                var useLogClear = (bool)confOption.Get("useLogClear");
                if (!useLogClear)
                {
                    saveDays = 0; //ログの自動削除が無効な場合、saveDaysに0をセットする
                }
                if (saveDirectory == "")
                {
                    tmpLogger.Set(LogKind.Error, null, 9000045, "It is not appointed");
                }
                else
                {
                    tmpLogger.Set(LogKind.Detail, null, 9000032, saveDirectory);
                    try
                    {
                        LogFile = new LogFile(saveDirectory, normalLogKind, secureLogKind, saveDays, useLogFile);
                    }
                    catch (IOException e)
                    {
                        LogFile = null;
                        tmpLogger.Set(LogKind.Error, null, 9000031, e.Message);
                    }
                }

                //Ver5.8.7 Java fix
                //mailBox初期化
                foreach (var o in ListOption)
                {
                    //SmtpServer若しくは、Pop3Serverが使用される場合のみメールボックスを初期化する
                    if (o.NameTag == "Smtp" || o.NameTag == "Pop3")
                    {
                        if (o.UseServer)
                        {
                            var conf    = new Conf(ListOption.Get("MailBox"));
                            var dir     = ReplaceOptionEnv((String)conf.Get("dir"));
                            var datUser = (Dat)conf.Get("user");
                            var logger  = CreateLogger("MailBox", (bool)conf.Get("useDetailsLog"), null);
                            MailBox = new MailBox(logger, datUser, dir);
                            break;
                        }
                    }
                }
            }
            _logger = CreateLogger("kernel", true, null);
            tmpLogger.Release(_logger);


            //Ver5.8.7 Java fix リモートクライアントの場合もメールボックスを作成してしまうバグを修正
            //            //mailBox初期化
            //            foreach (var o in ListOption){
            //                //SmtpServer若しくは、Pop3Serverが使用される場合のみメールボックスを初期化する
            //                if (o.NameTag == "Smtp" || o.NameTag == "Pop3"){
            //                    if (o.UseServer){
            //                        var conf = new Conf(ListOption.Get("MailBox"));
            //                        MailBox = new MailBox(this, conf);
            //                        break;
            //                    }
            //                }
            //            }

            ListServer = new ListServer(this, listPlugin);

            ListTool = new ListTool();
            ListTool.Initialize(this);

            View.SetColumnText();    //Logビューのカラムテキストの初期化
            Menu.Initialize(IsJp()); //メニュー構築(内部テーブルの初期化)

            WebApi = new WebApi();
        }