Exemple #1
0
        public void Start(EncryptionSettingsProto encryptionSettings)
        {
            EncryptionOperation encryptionOperation;

            lock (Locker)
            {
                if (Cache.Get <EncryptionOperation>(GetCacheKey()) != null)
                {
                    return;
                }
                TokenSource         = new CancellationTokenSource();
                encryptionOperation = FactoryOperation.CreateOperation(encryptionSettings);
                Cache.Insert(GetCacheKey(), encryptionOperation, DateTime.MaxValue);
            }

            var task = new Task(encryptionOperation.RunJob, TokenSource.Token, TaskCreationOptions.LongRunning);

            task.ConfigureAwait(false)
            .GetAwaiter()
            .OnCompleted(() =>
            {
                lock (Locker)
                {
                    Cache.Remove(GetCacheKey());
                }
            });

            task.Start();
        }
 public void Init(EncryptionSettingsProto encryptionSettingsProto, string id)
 {
     Id = id;
     EncryptionSettings = new EncryptionSettings(encryptionSettingsProto);
     IsEncryption       = EncryptionSettings.Status == EncryprtionStatus.EncryptionStarted;
     ServerRootPath     = encryptionSettingsProto.ServerRootPath;
 }
Exemple #3
0
        public EncryptionOperation CreateOperation(EncryptionSettingsProto encryptionSettings)
        {
            var item = ServiceProvider.GetService <EncryptionOperation>();

            item.Init(encryptionSettings);
            return(item);
        }
        public void Start(EncryptionSettingsProto encryptionSettings)
        {
            EncryptionOperation encryptionOperation;

            lock (Locker)
            {
                if (Queue.GetTask <EncryptionOperation>(GetCacheId()) != null)
                {
                    return;
                }
                encryptionOperation = FactoryOperation.CreateOperation(encryptionSettings, GetCacheId());
                Queue.QueueTask(encryptionOperation);
            }
        }
 public void StartEncryption(EncryptionSettingsProto encryptionSettings)
 {
     EncryptionWorker.Start(encryptionSettings);
 }
Exemple #6
0
 public EncryptionSettings(EncryptionSettingsProto encryptionSettingsProto)
 {
     Password    = encryptionSettingsProto.Password;
     Status      = encryptionSettingsProto.Status;
     NotifyUsers = encryptionSettingsProto.NotifyUsers;
 }
 public void Start(EncryptionSettingsProto encryptionSettingsProto)
 {
     NotifySetting.Publish(encryptionSettingsProto, CacheNotifyAction.Insert);
 }