public void データの無いDATの保存() { //setUp string fileName = "iniDbTestTmp"; //テンポラリファイル名 string progDir = Directory.GetCurrentDirectory(); string path = string.Format("{0}\\{1}.ini", progDir, fileName); IniDb sut = new IniDb(progDir, fileName); ListVal listVal = new ListVal(); var l = new ListVal(); l.Add(new OneVal("mimeExtension", "", Crlf.Nextline, new CtrlTextBox("Extension", 10))); l.Add(new OneVal("mimeType", "", Crlf.Nextline, new CtrlTextBox("MIME Type", 50))); var oneVal = new OneVal("mime", null, Crlf.Nextline, new CtrlDat("comment", l, 350, LangKind.Jp)); listVal.Add(oneVal); sut.Save("Basic", listVal); // nameTagは"Basic"で決め打ちされている //exercise var lines = File.ReadAllLines(path); string actual = lines[0]; //verify Assert.That(actual, Is.EqualTo("DAT=Basic\bmime=")); //tearDown sut.Delete(); }
public void listVal_add_OneVal_で初期化後saveして当該設定が保存されているかどうか(CtrlType ctrlType, Object value, string expected) { //setUp string fileName = "iniDbTestTmp"; //テンポラリファイル名 //string progDir = new File(".").getAbsoluteFile().getParent(); //カレントディレクトリ string progDir = Directory.GetCurrentDirectory(); string path = string.Format("{0}\\{1}.ini", progDir, fileName); IniDb sut = new IniDb(progDir, fileName); ListVal listVal = new ListVal(); listVal.Add(Assistance.createOneVal(ctrlType,value)); sut.Save("Basic", listVal); // nameTagは"Basic"で決め打ちされている //exercise var lines = File.ReadAllLines(path); string actual = lines[0]; //verify Assert.That(actual, Is.EqualTo(expected)); //tearDown sut.Delete(); }
//�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�̏����� }
//�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(�ۑ�)����Ȃ� } }
//値の設定 public void SetVal(IniDb iniDb, string name, object value) { var oneVal = ListVal.Search(name); if (oneVal == null) { Util.RuntimeException(string.Format("名前が見つかりません name={0}", name)); return; } //コントロールの値を変更 oneVal.OneCtrl.Write(value); //Ver6.0.0 oneVal.SetValue(value); //レジストリへ保存 Save(iniDb); }
//protected bool IsJp(){ // return _isJp; //} //レジストリへ保存 public void Save(IniDb iniDb) { iniDb.Save(NameTag, ListVal);//レジストリへ保存 }
//レジストリからの読み込み public void Read(IniDb iniDb) { iniDb.Read(NameTag, ListVal); }
public void Save(IniDb iniDb) { throw new NotImplementedException(); }
public void 設定ファイルにテキストでセットしてreadして当該設定が読み込めるかどうか(CtrlType ctrlType, string value, string regStr) { //setUp string fileName = "iniDbTestTmp"; //テンポラリファイル名 //string progDir = new File(".").getAbsoluteFile().getParent(); string progDir = Directory.GetCurrentDirectory(); string path = string.Format("{0}\\{1}.ini", progDir, fileName); IniDb sut = new IniDb(progDir, fileName); sut.Delete(); String expected = value; //exercise List<string> lines = new List<string>(); lines.Add(regStr); File.WriteAllLines(path,lines); ListVal listVal = new ListVal(); listVal.Add(Assistance.createOneVal(ctrlType, null)); sut.Read("Basic", listVal); // nameTagは"Basic"で決め打ちされている OneVal oneVal = listVal.Search("name"); string actual = oneVal.ToReg(false); //verify Assert.That(actual, Is.EqualTo(expected)); //TearDown sut.Delete(); }
//�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�̏����� }