Beispiel #1
0
        public async Task <PersonalCloud> CreatePersonalCloud(string displayName, string nodedisplaryname)
        {
            var l  = loggerFactory.CreateLogger("PersonalCloud");
            var pc = new PersonalCloud(l, this, null)
            {
                Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture),
                UpdateTimeStamp = DateTime.UtcNow.ToFileTime(),
                NodeDisplayName = nodedisplaryname,
                DisplayName     = displayName,
            };

            using (var aes = Aes.Create())
            {
                aes.KeySize = 256;
                aes.GenerateKey();
                pc.MasterKey = aes.Key;
            }
            lock (_PersonalClouds)
            {
                _PersonalClouds.Add(pc);
            }
            SavePCList();

            EnsureWebServerStarted();
            await EnsureSSDPStarted().ConfigureAwait(false);

            await nodeDiscovery.RePublish(NodeId, ServerPort).ConfigureAwait(false);

            return(pc);
        }