/// <summary> /// Read UserDataSet from xml file. /// </summary> /// <param name='fileName'>File name.</param> /// <param name='dictionaryURI'>Path.</param> /// <returns>The read UserDataSet.</returns> public static UserDataSet Deserialize(String fileName, String dictionaryURI) { Stream stream = File.OpenRead(fileName); BinaryFormatter formatter = new BinaryFormatter(); UserDataSet userDataSet = (UserDataSet)formatter.Deserialize(stream); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\Factors.bin"); FactorList allFactors = ((FactorList)formatter.Deserialize(stream)); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\FactorTrees.bin"); FactorTreeNodeList factorTrees = ((FactorTreeNodeList)formatter.Deserialize(stream)); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\SpeciesFactQualities.bin"); SpeciesFactQualityList speciesFactQualities = ((SpeciesFactQualityList)formatter.Deserialize(stream)); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\Periods.bin"); PeriodList periods = ((PeriodList)formatter.Deserialize(stream)); stream.Close(); PeriodManager.InitialisePeriods(periods); SpeciesFactManager.InitialiseSpeciesFactQualities(speciesFactQualities); FactorManager.InitialiseAllFactors(allFactors, factorTrees); SpeciesFactManager.InitAutomatedCalculations(userDataSet.SpeciesFacts); return(userDataSet); }