Exemple #1
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);
 }
 /// <summary>
 /// Initializes a new plugin manager.
 /// </summary>
 /// <param name="registry">The registry of plugins.</param>
 /// <param name="baseProvider">The base service provider.</param>
 /// <param name="commandRegister">Command registerer.</param>
 /// <param name="defaultBranchName">The default branch name (typically "develop"). Must not be null or empty.</param>
 public GitPluginManager(GitPluginRegistry registry, ISimpleServiceContainer baseProvider, CommandRegister commandRegister, string defaultBranchName)
 {
     if (String.IsNullOrWhiteSpace(defaultBranchName))
     {
         throw new ArgumentNullException(nameof(defaultBranchName));
     }
     ServiceContainer   = new SimpleServiceContainer(baseProvider);
     _defaultBranchName = defaultBranchName;
     _commandRegister   = commandRegister ?? throw new ArgumentNullException(nameof(commandRegister));
     Registry           = registry;
     _plugins           = new PluginCollection <IGitPlugin>(this, null);
     _branches          = new Branches(this);
 }
Exemple #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);
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new <see cref="FileSystem"/> on a physical root path.
 /// </summary>
 /// <param name="rootPath">Physical root path.</param>
 /// <param name="commandRegister">Command register.</param>
 /// <param name="sp">Optional base services.</param>
 public FileSystem(
     string rootPath,
     CommandRegister commandRegister,
     SecretKeyStore secretKeyStore,
     IServiceProvider sp)
 {
     Root             = new NormalizedPath(Path.GetFullPath(rootPath));
     _commandRegister = commandRegister;
     _secretKeyStore  = secretKeyStore;
     _protoGits       = new List <ProtoGitFolder>();
     _gits            = new List <GitFolder>();
     ServiceContainer = new SimpleServiceContainer(sp);
     ServiceContainer.Add(this);
     ServiceContainer.Add <IFileProvider>(this);
 }
Exemple #5
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(
     GitWorldStore 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));
 }