/// <summary> /// load settings from a file /// </summary> /// <param name="pathFile"></param> public void Load(string pathFile) { if (!File.Exists(pathFile)) { return; } XmlSerializer xmlSerializer = new XmlSerializer(typeof(DirectorySettings)); FileStream xmlFileStream = new FileStream(pathFile, FileMode.Open); DirectorySettings dirSettings = (DirectorySettings)xmlSerializer.Deserialize(xmlFileStream); xmlFileStream.Close(); this.xmlPath = dirSettings.xmlPath; this.coordXmlPath = dirSettings.coordXmlPath; this.interfaceFilePath = dirSettings.interfaceFilePath; this.pisaPath = dirSettings.pisaPath; this.pfamPath = dirSettings.pfamPath; this.pisaPath = dirSettings.pisaPath; this.piscesPath = dirSettings.piscesPath; this.fatcatPath = dirSettings.fatcatPath; this.siftsPath = dirSettings.siftsPath; this.seqFastaPath = dirSettings.seqFastaPath; this.protcidDbPath = dirSettings.protcidDbPath; this.baInterfaceDbPath = dirSettings.baInterfaceDbPath; this.alignmentDbPath = dirSettings.alignmentDbPath; this.pdbfamDbPath = dirSettings.pdbfamDbPath; this.psiblastPath = dirSettings.psiblastPath; this.seqFilePath = dirSettings.seqFilePath; this.hhPath = dirSettings.hhPath; this.hmmerPath = dirSettings.hmmerPath; }
/// <summary> /// save this settings to a file /// </summary> /// <param name="pathFile"></param> public void Save(string dirFile) { DirectorySettings dirSettings = this; XmlSerializer xmlSerializer = new XmlSerializer(typeof(DirectorySettings)); TextWriter pathWriter = new StreamWriter(dirFile); xmlSerializer.Serialize(pathWriter, dirSettings); pathWriter.Close(); }
/// <summary> /// load data file directories /// </summary> public static void LoadDirSettings() { if (!File.Exists(dirFile)) { throw new Exception("Directory setting file not exists."); } dirSettings = new DirectorySettings(); XmlSerializer xmlSerializer = new XmlSerializer(typeof(DirectorySettings)); FileStream settingStream = new FileStream(dirFile, FileMode.Open); dirSettings = (DirectorySettings)xmlSerializer.Deserialize(settingStream); settingStream.Close(); logWriter = new StreamWriter(logFile, true); }