Ejemplo n.º 1
0
        private static LocationCollection GetCollection()
        {
            try
            {
                XmlSerializer ser = new XmlSerializer(typeof(LocationCollection));

                if (File.Exists(LocationsFilePath))
                {
                    FileStream         st   = File.OpenRead(LocationsFilePath);
                    LocationCollection locs = ser.Deserialize(st) as LocationCollection;
                    st.Close();
                    return(locs);
                }
            }catch {}
            return(null);
        }
Ejemplo n.º 2
0
        static void SaveLocations()
        {
            LocationCollection locs = new LocationCollection();

            locs.Locations = (from c in _FileLocations select c.Value).ToArray <FileLocation>();
            if (locs.Locations == null)
            {
                locs.Locations = new FileLocation[] { }
            }
            ;

            File.WriteAllText(LocationsFilePath, "");
            FileStream str = File.OpenWrite(LocationsFilePath);

            Serializer.Serialize(str, locs);
            str.Close();
        }

        void _WriteLine(string st)
        {
            _TracerWriter.WriteLine(st);
        }

        void _WriteException(Exception e, string st = null)
        {
            if (st != null)
            {
                WriteLine(st);
            }
            WriteLine(e.Message);
            WriteLine("Exception Type : " + e.GetType().Name);
            string[] arr = e.StackTrace.Split(new char[] { '\n' });

            foreach (string str in arr)
            {
                WriteLine(str.Replace('\r', ' '));
            }
        }
    }