Пример #1
0
        private void Bootstrap(StartSyncParams @params)
        {
            var appState = this.bootstrapper.Container.Resolve<ApplicationState>();
            appState.StoreAccessData(@params.PersonalCard, @params.Password);

            var folderSettings = this.bootstrapper.Container.Resolve<FolderSettingsStorage>();
            folderSettings.SetDropboxCredentials(@params.DropboxCredentials);
            folderSettings.SetLocalFoldersSettings(new Folder("Source", @params.SourceDir), new List<Folder>());

            Console.WriteLine("Success!");
        }
Пример #2
0
        public override int Handle(ConfigureOptions command)
        {
            var validate = command.Validate();
            if (validate.Any())
            {
                foreach (var error in validate)
                {
                    Console.WriteLine("    " + error);
                }
                return 1;
            }

            var personalCard = TryBuildPersonalCard(command);
            if (personalCard == null) return 1;

            string password = null;
            if (personalCard.IsPrivateKeyEncrypted)
            {
                Console.WriteLine("    The private key file specified is encrypted. Please provide password:"******"    Wrong password");
                    return 1;
                }
            }

            var dropboxCredentials = ParseDropboxUri();
            if (dropboxCredentials == null)
            {
                return 1;
            }

            var @params = new StartSyncParams(
                personalCard,
                password,
                dropboxCredentials,
                command.SourceDirectory);

            this.Bootstrap(@params);

            return 0;
        }