Esempio n. 1
0
        public bool add_data_source(db_settings ds)
        {
            recent_sources data = JsonFile <recent_sources> .Load(sources_file_location);

            if (null != ds && ds.validate())
            {
                int t = -1;

                for (int i = 0; i < data.sources.Count; i++)
                {
                    if (data.sources[i].name == ds.name)
                    {
                        t = i;
                    }
                }
                if (-1 != t)
                {
                    data.sources.RemoveAt(t);                                   //old entry.. remove it
                }
                data.sources.Add(ds);                                           //its anew entry
                data.Save(sources_file_location);
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public recent_sources remove_data_source(db_settings ds)
        {
            recent_sources data = JsonFile <recent_sources> .Load(sources_file_location);

            if (null != ds)
            {
                int t = -1;

                for (int i = 0; i < data.sources.Count; i++)
                {
                    if (data.sources[i].name == ds.name)
                    {
                        t = i;
                    }
                }
                if (-1 != t)
                {
                    data.sources.RemoveAt(t);
                    data.Save(sources_file_location);
                }
            }
            return(data);
        }