/// <summary> /// DeSerialize. /// </summary> /// <param name="parms"></param> /// <returns></returns> public static Parameters DeSerialize(string parms) { FileStream parameterReader = null; try { XmlSerializer serializer = new XmlSerializer(typeof(Parameters)); parameterReader = new FileStream(parms, FileMode.Open); if (parameterReader.Length == 0) throw new FileLoadException(); Parameters p = new Parameters(); return p = (Parameters)serializer.Deserialize(parameterReader); } finally { if (parameterReader != null) parameterReader.Close(); } }
/// <summary> /// btnAnal_Click - Does the actual analysis. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAnal_Click(object sender, System.EventArgs e) { // User Defined parameters. Parameters parms = new Parameters(); m_parametersPathname = (tbANAFile.Text.Split('.'))[0] + ".prm"; parms.Marker.Ambiguity = AmbiguityMarker[0]; parms.RootDelimiter.OpenDelimiter = OpenDelimiter[0]; parms.RootDelimiter.CloseDelimiter = CloseDelimiter[0]; parms.Marker.Decomposition = AffixSeparator[0]; for (int i = 0; i < chBxCategories.CheckedItems.Count; i++) parms.Categories.Add(new Category(chBxCategories.CheckedItems[i].ToString())); parms.Serialize(m_parametersPathname); Close(); }