static void LoadConsts() { if (!File.Exists(FILENAME)) { Consts.Add("PI".ToLower(), Math.PI); Consts.Add("My".ToLower(), 1234.4); Consts.Add("E".ToLower(), Math.E); } else { try { _nodes = SerializerHelper.XMLDeSerialize <ConstNodes>(FILENAME); } catch (Exception ex) { throw ex; } if (_nodes != null) { foreach (ConstNode n in _nodes.Nodes) { CreateConst(n.Name, n.Value); } } } }
static void LoadConsts() { if (!File.Exists(FILENAME)) { Consts.Add("PI".ToLower(), Math.PI); Consts.Add("My".ToLower(), 1234.4); Consts.Add("E".ToLower(), Math.E); } else { try { _nodes = SerializerHelper.XMLDeSerialize<ConstNodes>(FILENAME); } catch (Exception ex) { throw ex; } if (_nodes != null) { foreach (ConstNode n in _nodes.Nodes) { CreateConst(n.Name, n.Value); } } } }
public static void Dump() { try { ConstNode[] nodes = new ConstNode[_constsDic.Count]; int i = 0; foreach (KeyValuePair <string, double> pair in _constsDic) { nodes[i] = new ConstNode(); nodes[i].Name = pair.Key; nodes[i].Value = pair.Value; i++; } ConstNodes temp = new ConstNodes(); temp.Nodes = nodes; SerializerHelper.XMLSerialize(FILENAME, temp); } catch (Exception ex) { throw ex; } }
public static void Dump() { try { ConstNode[] nodes = new ConstNode[_constsDic.Count]; int i = 0; foreach (KeyValuePair<string, double> pair in _constsDic) { nodes[i] = new ConstNode(); nodes[i].Name = pair.Key; nodes[i].Value = pair.Value; i++; } ConstNodes temp = new ConstNodes(); temp.Nodes = nodes; SerializerHelper.XMLSerialize(FILENAME,temp); } catch (Exception ex) { throw ex; } }