public List <T> StartUpdate()
        {
            Foo <T> foo = this.file.Read <T>();

            if (foo == null)
            {
                foo = FooHelper.Create <T>();
            }
            return(foo.data);
        }
Пример #2
0
        public bool Save <T>(List <T> data)
        {
            Foo <T> foo = this.Read <T>();

            if (foo == null)
            {
                foo = FooHelper.Create <T>();
            }

            foo.data = data;
            return(this.Save <T>(foo));
        }
        public bool Commit(List <T> items)
        {
            Foo <T> foo = this.file.Read <T>();

            if (foo == null)
            {
                foo = FooHelper.Create <T>();
            }
            foo.data = items;
            //this.file.Save<T>(foo.data);
            this.file.Save <T>(foo);
            return(true);
        }
        public int Insert(T item)
        {
            Foo <T> foo = this.file.Read <T>();

            if (foo == null)
            {
                foo = FooHelper.Create <T>();
            }

            this.ProcessAttributes(foo._header, item);
            foo.data.Add(item);
            this.file.Save <T>(foo);
            return(1);
        }
Пример #5
0
        public int Insert(List <T> list)
        {
            Foo <T> foo = this.file.Read <T>();

            if (foo == null)
            {
                foo = FooHelper.Create <T>();
            }

            foreach (T current in list)
            {
                foo.data.Add(current);
            }
            this.file.Save <T>(foo);
            return(1);
        }
        public bool ChangeHeader(string version, string title, string descriptor)
        {
            Foo <T> foo = null;

            try
            {
                foo = this.file.Read <T>();
            }
            catch (Exception ex)
            {
                foo = null;
            }
            if (foo == null)
            {
                foo      = FooHelper.Create <T>();
                foo.data = new List <T>();
            }
            foo._header.version    = version;
            foo._header.title      = title;
            foo._header.descriptor = descriptor;
            this.file.Save <T>(foo);
            return(true);
        }