Esempio n. 1
0
 /// <summary>
 /// Initializes a new WorldSelector that exposes a <see cref="CurrentWorld"/>.
 /// </summary>
 /// <param name="store">The world store.</param>
 /// <param name="commandRegister">The command register.</param>
 /// <param name="factory">The factory for XTypedObjects.</param>
 /// <param name="userKeyStore">The user key store.</param>
 /// <param name="appLife">Simple application lifetime controller.</param>
 public WorldSelector(WorldStore store, CommandRegister commandRegister, XTypedFactory factory, SecretKeyStore userKeyStore, IBasicApplicationLifetime appLife)
 {
     Store         = store ?? throw new ArgumentNullException(nameof(store));
     _command      = commandRegister ?? throw new ArgumentNullException(nameof(commandRegister));
     _userKeyStore = userKeyStore ?? throw new ArgumentNullException(nameof(userKeyStore));
     _appLife      = appLife ?? throw new ArgumentNullException(nameof(appLife));
     _factory      = factory ?? throw new ArgumentNullException(nameof(factory));
     commandRegister.Register(this);
     _existingCommands = new HashSet <ICommandHandler>(commandRegister.GetAllCommands(false));
 }
Esempio n. 2
0
 public UserHost(IBasicApplicationLifetime lifetime, NormalizedPath userHostPath)
 {
     Directory.CreateDirectory(userHostPath);
     ApplicationLifetime  = lifetime;
     CommandRegister      = new CommandRegister();
     _xTypedObjectfactory = new XTypedFactory();
     UserKeyVault         = new UserKeyVault(userHostPath);
     _worldMapping        = new SimpleWorldLocalMapping(userHostPath.AppendPart("WorldLocalMapping.txt"));
     _store        = new GitWorldStore(userHostPath, _worldMapping, UserKeyVault.KeyStore, CommandRegister);
     WorldSelector = new WorldSelector(_store, CommandRegister, _xTypedObjectfactory, UserKeyVault.KeyStore, lifetime);
     CommandRegister.Register(this);
 }
Esempio n. 3
0
 public GitWorldStore(
     NormalizedPath userHostPath,
     SimpleWorldLocalMapping mapping,
     SecretKeyStore keyStore,
     CommandRegister commandRegister)
     : base(mapping)
 {
     _rootPath               = userHostPath;
     SecretKeyStore          = keyStore;
     StacksFilePath          = userHostPath.AppendPart("Stacks.xml");
     _stackRepos             = new List <StackRepo>();
     mapping.MappingChanged += Mapping_MappingChanged;
     commandRegister.Register(this);
 }