Ejemplo n.º 1
0
        public static void Save(BO.ProfileCollection profile)
        {
            string path = System.IO.Path.GetFullPath(".");

            using (System.IO.TextWriter tw = new System.IO.StreamWriter(string.Format(SAVE_PATH, path)))
                tw.Write(profile.ToXml());
        }
Ejemplo n.º 2
0
        public void Load()
        {
            IsLoaded = true;
            Profile  = new BO.ProfileCollection();
            string path = System.IO.Path.GetFullPath(".");

            foreach (string file in Directory.GetFiles(string.Format(SAVE_PATH, path), "*.host", SearchOption.AllDirectories))
            {
                using (TextReader sr = new StreamReader(file))
                    try
                    {
                        foreach (var profile in sr.FromXml <BO.ProfileCollection>())
                        {
                            Profile.Add(profile);
                        }
                    }
                    catch (Exception ex) {
                        OnLog(new BO.LogEventArgs(string.Format("Error loading Host Profile file: {0}\r\n{1}", file, ex.Message)));
                    }
            }
        }