Exemplo n.º 1
0
        public async void RemoveCommandAction(object parameter)
        {
            CloudProvider provider = parameter as CloudProvider;

            if (provider != null && AllowRemoveProvider)
            {
                bool remove = true;
                if (provider.CheckIsInUse())
                {
                    remove = await App.Controller.MainPageInstance.DisplayAlert("Remove Provider",
                                                                                "This provider is currently in use by one of your vaults, removing the provider will also remove the local copy of the vault. Are you sure you want to remove it?",
                                                                                "Yes", "No");
                }
                if (remove)
                {
                    List <VaultIndex> matches = VaultIndexFile.Instance.Indexes.Where(vi => vi.Provider == provider.ID).ToList();
                    while (matches.Count > 0)
                    {
                        VaultIndexFile.Instance.RemoveFromVault(matches[0]);
                        matches.RemoveAt(0);
                    }
                    CloudProviders.Instance.RemoveProvider(provider.ID);

                    //Reload the vault index file
                    VaultIndexFile.Invalidate();
                    VaultIndexFile instance = VaultIndexFile.Instance;
                }
            }
        }
Exemplo n.º 2
0
        public void AcceptCommandAction(object parameter)
        {
            App.AppLogger.Logger.Log(devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.VerboseHigh | devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.Information, "Accept command invoked.");

            CloudProvider cloudProvider = null;

            switch (CloudStorageProviderType.AuthType)
            {
            case ProviderType.AuthenticationType.OAuth:
            {
                cloudProvider = CloudProviders.Instance.AddProvider(
                    ProviderType.AuthenticationType.OAuth,
                    _cloudStorageProvider.TypeName,
                    CloudStorageAccountUser.Email,
                    _accessToken,
                    true);
                break;
            }

            case ProviderType.AuthenticationType.Amazon:
            {
                cloudProvider = CloudProviders.Instance.AddProvider(
                    ProviderType.AuthenticationType.Amazon,
                    _cloudStorageProvider.TypeName,
                    _s3Config.AccessID,
                    _s3Config.ToString(),
                    true);
                break;
            }
            }
            DeselectProviderType();
            App.Controller.ClosePopup(cloudProvider);
        }
Exemplo n.º 3
0
        private async void AcceptAmazonCredsButton_Clicked(object sender, EventArgs e)
        {
            AmazonS3Config config = new AmazonS3Config(
                AccessID,
                SecretKey,
                Region.Name,
                BucketName,
                Path);
            Dictionary <string, string> createParams = config.ToDictionary();

            createParams.Add("ProviderKey", CloudStorageProviderType.Name);
            _cloudStorageProvider = CloudStorageProviderBase.Create(
                App.AppLogger.Logger,
                createParams);
            _cloudProvider = CloudProviders.Instance.AddProvider(
                ProviderType.AuthenticationType.Amazon,
                _cloudStorageProvider.TypeName,
                config.AccessID,
                config.ToString(),
                true);
            CloudProviderResponse <CloudStorageProviderUserBase> getAccountUserResponse = await _cloudStorageProvider.GetAccountUser();

            if (getAccountUserResponse.ResponseValue == CloudProviderResponse <CloudStorageProviderUserBase> .Response.Success)
            {
                CloudStorageAccountUser   = getAccountUserResponse.Result;
                IsAuthenticated           = true;
                AmazonCredInput.IsVisible = false;
            }
        }
Exemplo n.º 4
0
 public SolutionInfrastructure()
 {
     CloudProvider = CloudProviderEnum.AmazonWebServices;
     AbpFramework  = AbpFrameworkEnum.AspNetBoilerplate;
     Name          = CloudProvider.ToString();
     Description   = string.Empty;
 }
Exemplo n.º 5
0
        private void Init()
        {
            //RefreshImportFolders();

            ShokoService.CmdProcessorGeneral.OnQueueCountChangedEvent += CmdProcessorGeneral_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorGeneral.OnQueueStateChangedEvent += CmdProcessorGeneral_OnQueueStateChangedEvent;

            ShokoService.CmdProcessorHasher.OnQueueCountChangedEvent += CmdProcessorHasher_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorHasher.OnQueueStateChangedEvent += CmdProcessorHasher_OnQueueStateChangedEvent;

            ShokoService.CmdProcessorImages.OnQueueCountChangedEvent += CmdProcessorImages_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorImages.OnQueueStateChangedEvent += CmdProcessorImages_OnQueueStateChangedEvent;


            //Populate Cloud Providers
            foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
            {
                if (plugin.Name.Equals("Local File System", StringComparison.InvariantCultureIgnoreCase))
                {
                    CloudProvider p = new CloudProvider
                    {
                        Bitmap = plugin.Icon,
                        Name   = plugin.Name,
                        Plugin = plugin
                    };
                    CloudProviders.Add(p);
                }
            }
        }
Exemplo n.º 6
0
        private void Init()
        {
            //RefreshImportFolders();

            ShokoService.CmdProcessorGeneral.OnQueueCountChangedEvent += CmdProcessorGeneral_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorGeneral.OnQueueStateChangedEvent += CmdProcessorGeneral_OnQueueStateChangedEvent;

            ShokoService.CmdProcessorHasher.OnQueueCountChangedEvent += CmdProcessorHasher_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorHasher.OnQueueStateChangedEvent += CmdProcessorHasher_OnQueueStateChangedEvent;

            ShokoService.CmdProcessorImages.OnQueueCountChangedEvent += CmdProcessorImages_OnQueueCountChangedEvent;
            ShokoService.CmdProcessorImages.OnQueueStateChangedEvent += CmdProcessorImages_OnQueueStateChangedEvent;


            //Populate Cloud Providers
            foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
            {
                if (!plugin.Name.EqualsInvariantIgnoreCase("Local File System"))
                {
                    CloudProvider p = new CloudProvider
                    {
                        Bitmap = plugin.Icon,
                        Name   = plugin.Name,
                        Plugin = plugin
                    };
                    CloudProviders.Add(p);
                }
            }

            // TODO Hook into AniDBConnectionHandler
            //AniDBConnectionHandler.Instance.AniDBStateUpdate += OnAniDBStateUpdate;
        }
Exemplo n.º 7
0
 public FirstRunFinishEventArgs(
     FirstRun.FirstRunStage stage,
     Common.PasswordDerivationMode passwordDerivationMode,
     bool clipboardObfuscatorEnabled,
     bool autoSaveEnabled,
     Common.SyncMode syncMode,
     CloudProvider cloudProvider,
     ProviderType cloudStorageProviderType,
     CloudStorageProviderUserBase cloudStorageAccountUser,
     string name,
     string description,
     string masterPassphrase)
 {
     _stage = stage;
     _passwordDerivationMode     = passwordDerivationMode;
     _clipboardObfuscatorEnabled = clipboardObfuscatorEnabled;
     _autoSaveEnabled            = autoSaveEnabled;
     _syncMode                 = syncMode;
     _cloudProvider            = cloudProvider;
     _cloudStorageProviderType = cloudStorageProviderType;
     _cloudStorageAccountUser  = cloudStorageAccountUser;
     _name             = name;
     _description      = description;
     _masterPassphrase = masterPassphrase;
 }
Exemplo n.º 8
0
        public async Task CreateVirtualMachineAsync(CloudProvider provider,
                                                    string infrastructureName, VirtualMachineType dbType,
                                                    string name, Dictionary <string, string> options)
        {
            var parentDirectory = Helpers.Helpers.GetParentDirectory();
            var providerName    = Helpers.Helpers.GetProviderName(provider);

            var infrastructurePath = $"{parentDirectory}/{providerName}/{infrastructureName}";
            var fileName           = $"{infrastructurePath}/VirtualMachine/{name}.json";

            if (!Directory.Exists(infrastructurePath))
            {
                throw new Exception("Infrastructure does not exist");
            }
            else
            {
                if (File.Exists(fileName))
                {
                    throw new Exception("File exists with the same name");
                }
                else
                {
                    using (FileStream fs = File.Create(fileName, 1024))
                    {
                        byte[] info = new UTF8Encoding(true).GetBytes(Helpers.Helpers.ConvertDictionaryToJson(options));
                        await fs.WriteAsync(info, 0, info.Length);
                    }
                }
            }
        }
Exemplo n.º 9
0
        public object Get(GetOneUsers request)
        {
            List <WebOneUser> result = new List <WebOneUser>();

            var context = TepWebContext.GetWebContext(PagePrivileges.AdminOnly);

            try {
                context.Open();
                context.LogInfo(this, string.Format("/one/user GET ProviderId='{0}'", request.ProviderId));
                int provId = (request.ProviderId != 0 ? request.ProviderId : context.GetConfigIntegerValue("One-default-provider"));
                OneCloudProvider oneCloud = (OneCloudProvider)CloudProvider.FromId(context, provId);
                USER_POOL        pool     = oneCloud.XmlRpc.UserGetPoolInfo();
                foreach (object u in pool.Items)
                {
                    if (u is USER_POOLUSER)
                    {
                        USER_POOLUSER oneuser = u as USER_POOLUSER;
                        WebOneUser    wu      = new WebOneUser {
                            Id = oneuser.ID, Name = oneuser.NAME, Password = oneuser.PASSWORD, AuthDriver = oneuser.AUTH_DRIVER
                        };
                        result.Add(wu);
                    }
                }
                context.Close();
            } catch (Exception e) {
                context.LogError(this, e.Message, e);
                context.Close();
                throw e;
            }
            return(result);
        }
Exemplo n.º 10
0
        private void Init(string connectionString, CloudProvider provider)
        {
            var catalog = new DirectoryCatalog(".");
            var container = new CompositionContainer(catalog);
            container.ComposeExportedValue<string>(connectionString);
            _provider = container.GetExportedValue<IStorageProvider>(provider.ToString());

        }
 public IActionResult OptimizedExperimentsResults([Required] CloudProvider hostProvider,
                                                  [Required] CloudProvider benchmarkProvider,
                                                  [Required] int experimentLength,
                                                  [Required] int concurrentUsers,
                                                  [Required] decimal maxCost)
 {
     return(ViewComponent(typeof(OptimisedBenchmarkExperimentResultsViewComponent), new { hostProvider, benchmarkProvider, experimentLength, concurrentUsers, maxCost }));
 }
Exemplo n.º 12
0
        private bool ProviderExists(CloudProvider provider)
        {
            var providerName    = Helpers.Helpers.GetProviderName(provider);
            var parentDirectory = Helpers.Helpers.GetParentDirectory();
            var targetPath      = $"{parentDirectory}/{providerName}";

            return(Directory.Exists(targetPath));
        }
Exemplo n.º 13
0
        private void Init(string connectionString, CloudProvider provider)
        {
            var catalog   = new DirectoryCatalog(".");
            var container = new CompositionContainer(catalog);

            container.ComposeExportedValue <string>(connectionString);
            _provider = container.GetExportedValue <IStorageProvider>(provider.ToString());
        }
Exemplo n.º 14
0
        public Task CreateProvider(CloudProvider provider)
        {
            var providerName    = Helpers.Helpers.GetProviderName(provider);
            var parentDirectory = Helpers.Helpers.GetParentDirectory();
            var targetPath      = $"{parentDirectory}/{providerName}";

            return(Task.Run(() => { Directory.CreateDirectory(targetPath); }));
        }
Exemplo n.º 15
0
            public static CloudProvider FromId(IfyContext context, int id)
            {
                EntityType    entityType = EntityType.GetEntityType(typeof(CloudProvider));
                CloudProvider result     = (CloudProvider)entityType.GetEntityInstanceFromId(context, id);

                result.Id = id;
                result.Load();
                return(result);
            }
Exemplo n.º 16
0
        public void Save(string url, string containerName, string blobContent)
        {
            var cloudProvider = new CloudProvider();
            var connection    = cloudProvider.Connect(url);
            var token         = connection.GetAuthToken();
            var container     = cloudProvider.GetContainer(token, containerName);
            var blobPath      = cloudProvider.SaveBlob(container, blobContent);

            System.Console.WriteLine($"Blob saved in {blobPath}");
        }
Exemplo n.º 17
0
 public void TestInitialize()
 {
     factories = Substitute.For<Factories>();
     providerFactory = Substitute.For<CloudProviderFactory>();
     provider = Substitute.For<CloudProvider>();
     providerFactory.Create().Returns(provider);
     exportAndImport = Substitute.For<ExportAndImport>();
     settings = new Settings { CloudToken = "foo" };
     factories.Settings.Returns(settings);
     sut = new CloudImpl(providerFactory, factories, exportAndImport);
 }
        private async Task ListFilesFromProvider()
        {
            IEnumerable <CloudProvider> providers = CloudProviders.Instance.Providers.Where(cp => cp.ID == _providerID);

            if (providers.Any())
            {
                CloudStorageProviderBase storageProvider = null;
                CloudProvider            provider        = providers.First();
                switch (provider.AuthType)
                {
                case ProviderType.AuthenticationType.OAuth:
                {
                    string providerKey = (string)((App)App.Current).GetProviderValue(_providerID, "ProviderKey");
                    string accessToken = ((App)App.Current).GetCredential(_providerID);
                    Dictionary <string, string> createParams = new Dictionary <string, string>();
                    createParams.Add("AuthType", "OAuth");
                    createParams.Add("ProviderKey", providerKey);
                    createParams.Add("AccessToken", accessToken);
                    storageProvider = CloudStorageProviderBase.Create(
                        App.AppLogger.Logger,
                        createParams);
                    break;
                }

                case ProviderType.AuthenticationType.Amazon:
                {
                    string         providerKey  = (string)((App)App.Current).GetProviderValue(_providerID, "ProviderKey");
                    string         secret       = ((App)App.Current).GetCredential(_providerID);
                    JObject        s3ConfigJSON = JObject.Parse(secret);
                    AmazonS3Config s3Config     = AmazonS3Config.FromJSON(s3ConfigJSON);
                    Dictionary <string, string> createParams = s3Config.ToDictionary();
                    createParams.Add("ProviderKey", providerKey);
                    storageProvider = CloudStorageProviderBase.Create(
                        App.AppLogger.Logger,
                        createParams);
                    break;
                }

                default:
                {
                    throw new NotSupportedException(String.Format("Cloud provider authentication type '{0}' is not supported.", provider.AuthType));
                }
                }

                CloudProviderResponse <List <CloudStorageProviderFileBase> > response = await storageProvider.ListFiles();

                if (response.ResponseValue == CloudProviderResponse <List <CloudStorageProviderFileBase> > .Response.Success)
                {
                    CreateTreeNodes(response.Result);
                }
            }
        }
Exemplo n.º 19
0
 private void ClearSelectedProvider(bool deselectItem)
 {
     if (_selectedCloudProvider != null)
     {
         _selectedCloudProvider.IsSelected = false;
         _selectedCloudProvider            = null;
         if (deselectItem)
         {
             CloudProvidersList providerList = View.FindByName <CloudProvidersList>("CloudProvidersList");
             providerList.DeSelect();
         }
     }
 }
Exemplo n.º 20
0
        public async Task <List <BenchMarkResult> > GetBenchMarkResultsAsync(CloudProvider cloudProvider,
                                                                             HostEnvironment hostingEnvironment, Runtime runtime, DateTime afterDate)
        {
            var results = await _dbContext.BenchMarkResult
                          .Where(result => result.CloudProvider == cloudProvider)
                          .Where(result => result.HostingEnvironment == hostingEnvironment)
                          .Where(result => result.Runtime == runtime)
                          .Where(result => result.CreatedAt.Date >= afterDate.Date)
                          .OrderByDescending(result => result.CreatedAt)
                          .ToListAsync();

            return(results);
        }
Exemplo n.º 21
0
 public FirstRunFinishEventArgs(
     Common.PasswordDerivationMode passwordDerivationMode,
     bool clipboardObfuscatorEnabled,
     bool autoSaveEnabled,
     Common.SyncMode syncMode,
     CloudProvider cloudProvider,
     ProviderType cloudStorageProviderType,
     CloudStorageProviderUserBase cloudStorageAccountUser,
     string name,
     string description,
     string masterPassphrase) :
     this(FirstRun.FirstRunStage.FullSetup, passwordDerivationMode, clipboardObfuscatorEnabled, autoSaveEnabled, syncMode, cloudProvider, cloudStorageProviderType, cloudStorageAccountUser, name, description, masterPassphrase)
 {
 }
Exemplo n.º 22
0
        public async Task<ICloudProviderAdapter> GetCloudProvider(CloudProvider cloudProvider)
        {
            ICloudProviderAdapter retVal = null;

            if (cloudProvider == CloudProvider.SkyDrive)
                retVal = new SkyDriveClient(_cache);
            else if (cloudProvider == CloudProvider.Dropbox)
                retVal = new DropboxClient(_cache);
            else
                 throw new ArgumentException("Invalid cloud provider");
            

            await retVal.Activate();
            return retVal;
        }
Exemplo n.º 23
0
        private static void SelectedProviderChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CloudProvidersList list = (CloudProvidersList)bindable;

            if (oldValue != null)
            {
                CloudProvider oldProvider = (CloudProvider)oldValue;
                oldProvider.IsSelected = false;
            }
            if (newValue != null)
            {
                CloudProvider newProvider = (CloudProvider)newValue;
                newProvider.IsSelected = true;
            }
        }
Exemplo n.º 24
0
        public static string GetProviderName(CloudProvider provider)
        {
            var providerName = "";

            switch (provider)
            {
            case CloudProvider.Igs:
                providerName = "IGS";
                break;

            default:
                throw new Exception("Provider not configured");
            }

            return(providerName);
        }
Exemplo n.º 25
0
        public Task DeleteVirtualMachineFolder(CloudProvider provider, string infrastructureName)
        {
            var parentDirectory    = Helpers.Helpers.GetParentDirectory();
            var providerName       = Helpers.Helpers.GetProviderName(provider);
            var infrastructurePath = $"{parentDirectory}/{providerName}/{infrastructureName}";
            var fileName           = $"{infrastructurePath}/VirtualMachine";

            if (Directory.Exists(fileName))
            {
                return(Task.Run(() => { Directory.Delete(fileName, true); }));
            }
            else
            {
                throw new Exception("File does not exist");
            }
        }
Exemplo n.º 26
0
        public Task DeleteDatabaseFileAsync(CloudProvider provider, string infrastructureName, string name)
        {
            var parentDirectory    = Helpers.Helpers.GetParentDirectory();
            var providerName       = Helpers.Helpers.GetProviderName(provider);
            var infrastructurePath = $"{parentDirectory}/{providerName}/{infrastructureName}";
            var fileName           = $"{infrastructurePath}/Databases/{name}.json";

            if (File.Exists(fileName))
            {
                return(Task.Run(() => { Directory.Delete(fileName, true); }));
            }
            else
            {
                throw new Exception("File does not exist");
            }
        }
Exemplo n.º 27
0
        public object GetProviderValue(
            string id,
            string key)
        {
            IEnumerable <CloudProvider> providers = CloudProviders.Instance.Providers.Where(cp => cp.ID == id);

            if (providers.Any())
            {
                CloudProvider provider = providers.First();
                Dictionary <string, object> dictionary = provider.ToDictionary();
                return(dictionary[key]);
            }
            else
            {
                return(String.Empty);
            }
        }
Exemplo n.º 28
0
        private void Init()
        {
            //RefreshImportFolders();

            Queue.Instance.Subscribe((cmd) =>
            {
                if (cmd.WorkType == WorkTypes.Image)
                {
                    ImagesQueueState = cmd;
                }
                else if (cmd.WorkType == WorkTypes.Hashing)
                {
                    HasherQueueState = cmd;
                }
                else
                {
                    GeneralQueueState = cmd;
                }
            });

            Observable.Interval(TimeSpan.FromSeconds(1)).Subscribe((_) =>
            {
                if (Repo.Instance != null)
                {
                    ImagesQueueCount  = Queue.Instance.GetCommandCount(WorkTypes.AniDB);
                    HasherQueueCount  = Queue.Instance.GetCommandCount(WorkTypes.Hashing);
                    GeneralQueueCount = Queue.Instance.GetCommandCount() - ImagesQueueCount - HasherQueueCount;
                }
            });

            //Populate Cloud Providers
            foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
            {
                if (!plugin.Name.Equals("Local File System", StringComparison.InvariantCultureIgnoreCase))
                {
                    CloudProvider p = new CloudProvider
                    {
                        Bitmap = plugin.Icon,
                        Name   = plugin.Name,
                        Plugin = plugin
                    };
                    CloudProviders.Add(p);
                }
            }
        }
Exemplo n.º 29
0
        public object Get(GetOneCurrentUser request)
        {
            WebOneUser result = new WebOneUser();

            var context = TepWebContext.GetWebContext(PagePrivileges.UserView);

            try {
                context.Open();
                context.LogInfo(this, string.Format("/one/user/current GET ProviderId='{0}'", request.ProviderId));
                int    provId   = (request.ProviderId != 0 ? request.ProviderId : context.GetConfigIntegerValue("One-default-provider"));
                User   user     = User.FromId(context, context.UserId);
                string username = user.Email;
                try{
                    CloudUser usercloud = CloudUser.FromIdAndProvider(context, context.UserId, provId);
                    if (!String.IsNullOrEmpty(usercloud.CloudUsername))
                    {
                        username = usercloud.CloudUsername;
                    }
                }catch (Exception) {}

                OneCloudProvider oneCloud = (OneCloudProvider)CloudProvider.FromId(context, provId);
                USER_POOL        pool     = oneCloud.XmlRpc.UserGetPoolInfo();
                foreach (object u in pool.Items)
                {
                    if (u is USER_POOLUSER)
                    {
                        USER_POOLUSER oneuser = u as USER_POOLUSER;
                        if (oneuser.NAME == username)
                        {
                            result = new WebOneUser {
                                Id = oneuser.ID, Name = oneuser.NAME, Password = oneuser.PASSWORD, AuthDriver = oneuser.AUTH_DRIVER
                            };
                            break;
                        }
                    }
                }

                context.Close();
            } catch (Exception e) {
                context.LogError(this, e.Message, e);
                context.Close();
                throw e;
            }
            return(result);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            CloudProvider.Init(new EverliveProviderSettings()
            {
                UseHttps = ConnectionSettings.EverliveUseHttps, ApiKey = ConnectionSettings.TelerikAppId, UserType = typeof(CustomUser)
            });

            // Analytics initialization
            if (ConnectionSettings.AnalyticsProjectKey != "your-analytics-project-key-here" || String.IsNullOrEmpty(ConnectionSettings.AnalyticsProjectKey))
            {
                Analytics = AnalyticsMonitorFactory.CreateMonitor(ConnectionSettings.AnalyticsProjectKey);
            }
        }
        public static CloudProviderSettings GetInstance(CloudProvider provider)
        {
            switch (provider)
            {
            case CloudProvider.AliCloud:
                AliCloudProviderSettings settings = new AliCloudProviderSettings();
                return(settings);

            case CloudProvider.GCP:
                GCPProviderSettings gcpSettings = new GCPProviderSettings();
                return(gcpSettings);

            default:
                CloudProviderSettings defaultSettings = new CloudProviderSettings();
                defaultSettings.provider = provider;
                return(defaultSettings);
            }
        }
Exemplo n.º 32
0
        public object Put(UpdateOneUser request)
        {
            bool result;
            var  context = TepWebContext.GetWebContext(PagePrivileges.UserView);

            try {
                context.Open();
                context.LogInfo(this, string.Format("/one/user PUT ProviderId='{0}',Id='{1}'", request.ProviderId, request.Id));
                int provId = (request.ProviderId != 0 ? request.ProviderId : context.GetConfigIntegerValue("One-default-provider"));
                OneCloudProvider oneCloud = (OneCloudProvider)CloudProvider.FromId(context, provId);
                result = oneCloud.XmlRpc.UserUpdatePassword(Int32.Parse(request.Id), request.Password);
                context.Close();
            } catch (Exception e) {
                context.LogError(this, e.Message, e);
                context.Close();
                throw e;
            }
            return(result);
        }
Exemplo n.º 33
0
        private void Init()
        {
            //RefreshImportFolders();

            ShokoService.CmdProcessorGeneral.OnQueueCountChangedEvent +=
                new Commands.CommandProcessorGeneral.QueueCountChangedHandler(
                    CmdProcessorGeneral_OnQueueCountChangedEvent);
            ShokoService.CmdProcessorGeneral.OnQueueStateChangedEvent +=
                new Commands.CommandProcessorGeneral.QueueStateChangedHandler(
                    CmdProcessorGeneral_OnQueueStateChangedEvent);

            ShokoService.CmdProcessorHasher.OnQueueCountChangedEvent +=
                new Commands.CommandProcessorHasher.QueueCountChangedHandler(
                    CmdProcessorHasher_OnQueueCountChangedEvent);
            ShokoService.CmdProcessorHasher.OnQueueStateChangedEvent +=
                new Commands.CommandProcessorHasher.QueueStateChangedHandler(
                    CmdProcessorHasher_OnQueueStateChangedEvent);

            ShokoService.CmdProcessorImages.OnQueueCountChangedEvent +=
                new Commands.CommandProcessorImages.QueueCountChangedHandler(
                    CmdProcessorImages_OnQueueCountChangedEvent);
            ShokoService.CmdProcessorImages.OnQueueStateChangedEvent +=
                new Commands.CommandProcessorImages.QueueStateChangedHandler(
                    CmdProcessorImages_OnQueueStateChangedEvent);


            //Populate Cloud Providers
            foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
            {
                if (plugin.Name != "Local File System")
                {
                    CloudProvider p = new CloudProvider
                    {
                        Bitmap = plugin.CreateIconImage(),
                        Name   = plugin.Name,
                        Plugin = plugin
                    };
                    CloudProviders.Add(p);
                }
            }
        }
 public void TestInitialize()
 {
     factories = Substitute.For<Factories>();
     cloudProviderFactory = Substitute.For<CloudProviderFactory>();
     cloudProvider = Substitute.For<CloudProvider>();
     cloudProviderFactory.Create().Returns(cloudProvider);
     settings = new Settings();
     factories.Settings.Returns(settings);
     vibration = Substitute.For<Vibration>();
     cloud = Substitute.For<Cloud>();
     messageDialog = Substitute.For<MessageDialog>();
     cloudMessages = new Fixture().Create<CloudMessages>();
     workerFactory = new BackgroundWorkerSyncFactory();
     sut = new ExportAndImportViewModel(factories, cloudProviderFactory, vibration, cloud, messageDialog,
         cloudMessages, workerFactory);
     cloudProvider.GetAcquiredToken().Returns(new CloudToken { Secret = "foo", Token = "bar" });
     cloudProvider.GetTokenAcquiringUrl(ExportAndImportViewModel.TOKEN_ACQUIRING_CALLBACK_URL).Returns("go");
     cloud.ListImports().Returns(new List<string>());
     navigatedTo = string.Empty;
     sut.NavigateInBrowser += (_, url) => { navigatedTo = url; };
 }
Exemplo n.º 35
0
 private void CreateProvider()
 {
     provider = providerFactory.Create();
 }
 private void ActivateExportToCloud(BrowserIsNavigatingHint browserIsNavigatingHint)
 {
     var worker = workerFactory.CreateVerbose();
     var url = string.Empty;
     worker.DoWork += delegate
     {
         cloudProvider = cloudProviderFactory.Create();
         url = CatchedGetTokenAcquiringUrl(url);
     };
     worker.RunWorkerCompleted += delegate
     {
         if (url != string.Empty)
         {
             OnNavigateInBrowser(url);
             BrowserVisible = true;
         }
         IsBusy = false;
     };
     IsBusy = true;
     worker.RunWorkerAsync();
     this.browserIsNavigatingHint = browserIsNavigatingHint;
 }
Exemplo n.º 37
0
        private void Init()
        {
            //RefreshImportFolders();

            JMMService.CmdProcessorGeneral.OnQueueCountChangedEvent +=
                new Commands.CommandProcessorGeneral.QueueCountChangedHandler(
                    CmdProcessorGeneral_OnQueueCountChangedEvent);
            JMMService.CmdProcessorGeneral.OnQueueStateChangedEvent +=
                new Commands.CommandProcessorGeneral.QueueStateChangedHandler(
                    CmdProcessorGeneral_OnQueueStateChangedEvent);

            JMMService.CmdProcessorHasher.OnQueueCountChangedEvent +=
                new Commands.CommandProcessorHasher.QueueCountChangedHandler(CmdProcessorHasher_OnQueueCountChangedEvent);
            JMMService.CmdProcessorHasher.OnQueueStateChangedEvent +=
                new Commands.CommandProcessorHasher.QueueStateChangedHandler(CmdProcessorHasher_OnQueueStateChangedEvent);

            JMMService.CmdProcessorImages.OnQueueCountChangedEvent +=
                new Commands.CommandProcessorImages.QueueCountChangedHandler(CmdProcessorImages_OnQueueCountChangedEvent);
            JMMService.CmdProcessorImages.OnQueueStateChangedEvent +=
                new Commands.CommandProcessorImages.QueueStateChangedHandler(CmdProcessorImages_OnQueueStateChangedEvent);

            //Populate Cloud Providers
            foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
            {
                if (plugin.Name != "Local File System")
                {
                    CloudProvider p = new CloudProvider
                    {
                        Icon = plugin.CreateIconImage(),
                        Name = plugin.Name,
                        Plugin = plugin
                    };
                    CloudProviders.Add(p);
                }
            }
        }
Exemplo n.º 38
0
 public StorageClient(string connectionString, CloudProvider provider)
 {
     Init(connectionString, provider);
 }