Beispiel #1
0
        public String ChangeTag(String src)
        {
            var tagList = new[] { "$h", "$v", "$p", "$d", "$a", "$s" };

            foreach (var tag in tagList)
            {
                while (true)
                {
                    var index = src.IndexOf(tag);
                    if (index == -1)
                    {
                        break;
                    }
                    var tmp1 = src.Substring(0, index);
                    var tmp2 = "";
                    switch (tag)
                    {
                    case "$h":
                        var serverName = ServerName;
                        tmp2 = serverName == "" ? "localhost" : serverName;
                        break;

                    case "$v":
                        tmp2 = Ver.Version();
                        break;

                    case "$p":
                        tmp2 = Define.ApplicationName();
                        break;

                    case "$d":
                        tmp2 = Define.Date();
                        break;

                    case "$a":
                        var localAddress = LocalAddress.GetInstance();
                        tmp2 = localAddress.RemoteStr();
                        //tmp2 = Define.ServerAddress();
                        break;

                    case "$s":
                        tmp2 = ServerName;
                        break;

                    default:
                        Util.RuntimeException(string.Format("undefind tag = {0}", tag));
                        break;
                    }
                    var tmp3 = src.Substring(index + 2);
                    src = tmp1 + tmp2 + tmp3;
                }
            }
            return(src);
        }
Beispiel #2
0
        //�N�����ɁA�R���X�g���N�^����Ăяo����鏉����
        private void DefaultInitialize(MainForm mainForm, ListView listViewLog, MenuStrip menuStrip, NotifyIcon notifyIcon)
        {
            RunMode = RunMode.Normal;
            RemoteConnect = null;//�����[�g����Őڑ�����Ă��鎞���������������

            //logger�����������܂ł̃��O��ꎞ�I�ɕۊǂ���
            //ArrayList<LogTemporary> tmpLogger = new ArrayList<>();

            //�v���Z�X�N�����ɏ����������
            View = new View(this, mainForm, listViewLog, notifyIcon);
            //logView = new LogView(listViewLog);
            LogView = new LogView(this,listViewLog);
            Menu = new Menu(this, menuStrip); //�����ł́A�I�u�W�F�N�g�̐����̂݁Amenu.Initialize()�́AlistInitialize()�̒��ŌĂяo�����
            DnsCache = new DnsCache();
            Wait = new Wait();

            Ver = new Ver(); //�o�[�W�����Ǘ�

            //Java fix
            //RunMode�̏�����
            if (mainForm == null){
                RunMode = RunMode.Service; //�T�[�r�X�N��
            } else{
                if (Environment.GetCommandLineArgs().Length > 1){
                    RunMode = RunMode.Remote; //�����[�g�N���C�A���g
                } else{
                    //�T�[�r�X�o�^�̏�Ԃ�擾����
                    var setupService = new SetupService(this);
                    if (setupService.IsRegist)
                        RunMode = RunMode.NormalRegist; //�T�[�r�X�o�^�������
                }
            }

            //Ver5.8.6 Java fix
            //OptionIni.Create(this); //�C���X�^���X�̏�����

            IniDb = new IniDb(ProgDir(), (RunMode == RunMode.Remote) ? "$remote" : "Option");

            MailBox = null;

            ListInitialize(); //�T�[�o�ċN���ŁA�ēx���s����鏉����

            if (_isTest){
                return;
            }

            //�E�C���h�T�C�Y�̕���
            var path = string.Format("{0}\\BJD.ini", ProgDir());
            try{
                //�E�C���h�E�̊O�ς�ۑ��E����(View���O�ɏ���������)
                WindowSize = new WindowSize(new Conf(ListOption.Get("Basic")), path);
                View.Read(WindowSize);
            } catch (IOException){
                WindowSize = null;
                // �w�肳�ꂽWindow���ۑ��t�@�C��(BJD.ini)��IO�G���[���������Ă���
                _logger.Set(LogKind.Error, null, 9000022, path);
            }

            //TraceDlg = new TraceDlg(this, (mainForm != null) ? mainForm.getFrame() : null); //�g���[�X�\��
            TraceDlg = new TraceDlg(this); //�g���[�X�\��

            switch (RunMode){
                case RunMode.Normal:
                    MenuOnClick("StartStop_Start"); //���j���[�I��C�x���g
                    break;
                case RunMode.Remote:
                    RemoteClient = new RemoteClient(this);
                    RemoteClient.Start();
                    break;
                //Java fix Ver5.8.3
                case RunMode.NormalRegist:
                case RunMode.Service:
                    break;
                default:
                    Util.RuntimeException("Kernel.defaultInitialize() not implement (RunMode)");
                    break;
            }

            //Java fix Ver5.8.3
            View.SetColor();//�E�C���h�F�̏�����
        }
Beispiel #3
0
        //�N�����ɁA�R���X�g���N�^����Ăяo����鏉����
        private void DefaultInitialize(MainForm mainForm, ListView listViewLog, MenuStrip menuStrip, NotifyIcon notifyIcon)
        {
            RunMode       = RunMode.Normal;
            RemoteConnect = null;//�����[�g����Őڑ�����Ă��鎞���������������

            //logger�����������܂ł̃��O��ꎞ�I�ɕۊǂ���
            //ArrayList<LogTemporary> tmpLogger = new ArrayList<>();

            //�v���Z�X�N�����ɏ����������
            View = new View(this, mainForm, listViewLog, notifyIcon);
            //logView = new LogView(listViewLog);
            LogView  = new LogView(this, listViewLog);
            Menu     = new Menu(this, menuStrip); //�����ł́A�I�u�W�F�N�g�̐����̂݁Amenu.Initialize()�́AlistInitialize()�̒��ŌĂяo�����
            DnsCache = new DnsCache();
            Wait     = new Wait();

            Ver = new Ver(); //�o�[�W�����Ǘ�

            //Java fix
            //RunMode�̏�����
            if (mainForm == null)
            {
                RunMode = RunMode.Service; //�T�[�r�X�N��
            }
            else
            {
                if (Environment.GetCommandLineArgs().Length > 1)
                {
                    RunMode = RunMode.Remote; //�����[�g�N���C�A���g
                }
                else
                {
                    //�T�[�r�X�o�^�̏�Ԃ�擾����
                    var setupService = new SetupService(this);
                    if (setupService.IsRegist)
                    {
                        RunMode = RunMode.NormalRegist; //�T�[�r�X�o�^�������
                    }
                }
            }

            //Ver5.8.6 Java fix
            //OptionIni.Create(this); //�C���X�^���X�̏�����

            IniDb = new IniDb(ProgDir(), (RunMode == RunMode.Remote) ? "$remote" : "Option");

            MailBox = null;

            ListInitialize(); //�T�[�o�ċN���ŁA�ēx���s����鏉����


            if (_isTest)
            {
                return;
            }

            //�E�C���h�T�C�Y�̕���
            var path = string.Format("{0}\\BJD.ini", ProgDir());

            try{
                //�E�C���h�E�̊O�ς�ۑ��E����(View���O�ɏ���������)
                WindowSize = new WindowSize(new Conf(ListOption.Get("Basic")), path);
                View.Read(WindowSize);
            } catch (IOException) {
                WindowSize = null;
                // �w�肳�ꂽWindow���ۑ��t�@�C��(BJD.ini)��IO�G���[���������Ă���
                _logger.Set(LogKind.Error, null, 9000022, path);
            }

            //TraceDlg = new TraceDlg(this, (mainForm != null) ? mainForm.getFrame() : null); //�g���[�X�\��
            TraceDlg = new TraceDlg(this); //�g���[�X�\��

            switch (RunMode)
            {
            case RunMode.Normal:
                MenuOnClick("StartStop_Start");     //���j���[�I��C�x���g
                break;

            case RunMode.Remote:
                RemoteClient = new RemoteClient(this);
                RemoteClient.Start();
                break;

            //Java fix Ver5.8.3
            case RunMode.NormalRegist:
            case RunMode.Service:
                break;

            default:
                Util.RuntimeException("Kernel.defaultInitialize() not implement (RunMode)");
                break;
            }

            //Java fix Ver5.8.3
            View.SetColor();//�E�C���h�F�̏�����
        }
Beispiel #4
0
        //起動時に、コンストラクタから呼び出される初期化
        private void DefaultInitialize(MainForm mainForm, ListView listViewLog, MenuStrip menuStrip, NotifyIcon notifyIcon)
        {
            RunMode       = RunMode.Normal;
            RemoteConnect = null;//リモート制御で接続されている時だけ初期化される

            //loggerが生成されるまでのログを一時的に保管する
            //ArrayList<LogTemporary> tmpLogger = new ArrayList<>();

            //プロセス起動時に初期化される
            View = new View(this, mainForm, listViewLog, notifyIcon);
            //logView = new LogView(listViewLog);
            LogView  = new LogView(this, listViewLog);
            Menu     = new Menu(this, menuStrip); //ここでは、オブジェクトの生成のみ、menu.Initialize()は、listInitialize()の中で呼び出される
            DnsCache = new DnsCache();
            Wait     = new Wait();

            Ver = new Ver(); //バージョン管理

            //Java fix
            //RunModeの初期化
            if (mainForm == null)
            {
                RunMode = RunMode.Service; //サービス起動
            }
            else
            {
                if (Environment.GetCommandLineArgs().Length > 1)
                {
                    RunMode = RunMode.Remote; //リモートクライアント
                }
                else
                {
                    //サービス登録の状態を取得する
                    var setupService = new SetupService(this);
                    if (setupService.IsRegist)
                    {
                        RunMode = RunMode.NormalRegist; //サービス登録完了状態
                    }
                }
            }

            //Ver5.8.6 Java fix
            //OptionIni.Create(this); //インスタンスの初期化

            IniDb = new IniDb(ProgDir(), (RunMode == RunMode.Remote) ? "$remote" : "Option");

            MailBox = null;

            ListInitialize(); //サーバ再起動で、再度実行される初期化


            if (_isTest)
            {
                return;
            }

            //ウインドサイズの復元
            var path = string.Format("{0}\\BJD.ini", ProgDir());

            try
            {
                //ウインドウの外観を保存・復元(Viewより前に初期化する)
                WindowSize = new WindowSize(new Conf(ListOption.Get("Basic")), path);
                View.Read(WindowSize);
            }
            catch (IOException)
            {
                WindowSize = null;
                // 指定されたWindow情報保存ファイル(BJD.ini)にIOエラーが発生している
                _logger.Set(LogKind.Error, null, 9000022, path);
            }

            //TraceDlg = new TraceDlg(this, (mainForm != null) ? mainForm.getFrame() : null); //トレース表示
            TraceDlg = new TraceDlg(this); //トレース表示

            switch (RunMode)
            {
            case RunMode.Normal:
                MenuOnClick("StartStop_Start");     //メニュー選択イベント
                break;

            case RunMode.Remote:
                RemoteClient = new RemoteClient(this);
                RemoteClient.Start();
                break;

            //Java fix Ver5.8.3
            case RunMode.NormalRegist:
            case RunMode.Service:
                break;

            default:
                Util.RuntimeException("Kernel.defaultInitialize() not implement (RunMode)");
                break;
            }

            //Java fix Ver5.8.3
            View.SetColor();//ウインド色の初期化
        }