Esempio n. 1
0
        public void ModifyContent(int storeType, string client)
        {
            var store = new StoreFactory().CreateStore(storeType);

            store.Connect("username", "password");

            var content = store.ReadFile(client);

            // :
            store.SaveFile(client, content);
            store.Disconnect();
        }
Esempio n. 2
0
        public async Task Pull(StoreFactory factory, Func <string> idFactory, string remoteId)
        {
            var remote = remotes.SingleOrDefault(x => x.Id == remoteId);

            if (remote == null)
            {
                throw new InvalidOperationException(string.Format("Remote with id {0} was not found", remoteId));
            }

            var store = await factory.Connect(remote);

            Diff(idFactory, store.LoadItems().ToList());
        }
Esempio n. 3
0
        public async Task Push(StoreFactory factory, string remoteId)
        {
            var remote = remotes.SingleOrDefault(x => x.Id == remoteId);

            if (remote == null)
            {
                throw new InvalidOperationException(string.Format("Remote with id {0} was not found", remoteId));
            }

            var store = await factory.Connect(remote);

            foreach (var change in remote.Behind.ToList())
            {
                store.Apply((dynamic)change);
                Emit(new PushedToRemote(remote.Id, change.ChangeId));
            }
        }