public StackRepo(GitWorldStore store, Uri uri) { _store = store; OriginUrl = uri; var cleanPath = CleanPathDirName(uri.AbsolutePath); Root = store._rootPath.AppendPart(cleanPath); }
internal static StackRepo Parse(GitWorldStore store, XElement e) { var uri = new Uri((string)e.AttributeRequired(nameof(OriginUrl))); var pub = (bool?)e.Attribute(nameof(IsPublic)) ?? false; var r = new StackRepo(store, uri, pub, null); r._worlds.AddRange(e.Elements("Worlds").Elements(nameof(WorldInfo)).Select(eW => new WorldInfo(r, eW))); return(r); }
internal StackRepo(GitWorldStore store, Uri uri, bool isPublic, string branchName = null) : base(store.SecretKeyStore, uri, isPublic) { _store = store; BranchName = branchName ?? "master"; var cleanPath = CleanPathDirName(uri.AbsolutePath); Root = store._rootPath.AppendPart(cleanPath); _worlds = new List <WorldInfo>(); }
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 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)); }