public bool Initialize() { var config = ConfigurationStorage.Load(); var protocol = config.GetPlatformDeepLinkingProtocols(SupportedPlatforms.Windows, true).FirstOrDefault(); if (protocol == null || string.IsNullOrEmpty(protocol.Scheme)) { return(false); } var fromSteam = _steamBuild; var steamAppId = config.SteamId; try { var key = Registry.CurrentUser.OpenSubKey("Software", true); var classes = key.OpenSubKey("Classes", true); if (classes == null) { return(false); } foreach (var activationProtocol in config.GetPlatformDeepLinkingProtocols(SupportedPlatforms.Windows, true)) { SetProtocol(classes, activationProtocol.Scheme, fromSteam, steamAppId); } } catch (Exception e) { Debug.LogException(e); return(false); } return(true); }
private static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; Application.ThreadException += UnhandledThreadExceptionHandler; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (args != null && args.Length == 1) { if (args[0] == "/configuration") { Application.Run(new DeviceConfiguratorWindow()); return; } if (args[0] == "/updater") { Application.Run(new FirmwareUpdaterWindow(null, new FirmwareLoader(new FirmwareEncoder()))); return; } if (args[0] == "/monitor") { var configurationStorage = new ConfigurationStorage(); var configuration = configurationStorage.TryLoad(Paths.SettingsFile) ?? new ApplicationConfiguration(); Application.Run(new DeviceMonitorWindow(configuration, new USBConnector(), new COMConnector())); configurationStorage.Save(Paths.SettingsFile, configuration); return; } } Application.Run(new MainWindow(args)); }
internal InternalUpgrader(StorageType storageType, ConfigurationStorage configurationStorage, DocumentsStorage documentsStorage, ServerStore serverStore) { _storageType = storageType; _configurationStorage = configurationStorage; _documentsStorage = documentsStorage; _serverStore = serverStore; }
private void SaveData() { _config.DisplayName = _displayName; _config.SteamId = _steamId; ConfigurationStorage.Save(_config); _config = null; }
public void Load_should_restore_empty_configuration_from_an_nonExisted_file() { Assert.IsFalse(File.Exists(filePath), "File should not exist"); var storage = new ConfigurationStorage(filePath); var configuration = storage.Load(); Assert.IsTrue(configuration.Account == string.Empty); Assert.IsTrue(configuration.Token == string.Empty); }
public void Load_should_restore_empty_configuration_from_an_empty_file() { File.Create(filePath).Close(); var storage = new ConfigurationStorage(filePath); var configuration = storage.Load(); Assert.IsTrue(configuration.Account == string.Empty); Assert.IsTrue(configuration.Token == string.Empty); }
public ConfigController() { IConfigurationStorage dataStore = new ConfigurationStorage( ConfigurationManager.ConnectionStrings["ConfigurationStorage"].ConnectionString, new DefaultConsoleLogger() ); _dataStore = dataStore; //add this into your global configuration and then you can remove camel-object-formatter.js //HttpConfiguration config = GlobalConfiguration.Configuration; //config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver(); //config.Formatters.JsonFormatter.UseDataContractJsonSerializer = false; }
public void SaveToDataStore(IEnumerable <SectionMigrated> sections) { try { using (ConfigurationStorage storage = new ConfigurationStorage(this._connectionString, new DefaultConsoleLogger())) { Database.SetInitializer(new CreateDatabaseIfNotExists <InAnotherCastleContext>()); foreach (var section in sections) { ConfigurationSaveResults currentResults = null; var addResults = currentResults = storage.AddConfigurationSection(new ConfigurationNew() { JSONSchema = section.JsonDetails.Schema, Name = section.SectionName, SystemName = null, //TODO, XML = section.XmlDetails.RawData, XMLSchema = section.XmlDetails.Schema }); if (addResults.Successful) { if (addResults.Record.JSON != section.JsonDetails.RawData) { var updateResults = currentResults = storage.UpdateConfigurationSectionJson(new ConfigurationUpdate() { Id = addResults.Record.Id, Value = section.JsonDetails.RawData }); } } if (!currentResults.Successful) { throw new MigrationException( "Validation issues occurred while put the migrated configuration into the data store: " + String.Join("\n", currentResults.Errors.Select(e => e.Code.ToString() + ":" + e.Message) ) , null); } } } } catch (SqlException sqlException) { throw new MigrationException("Sql exception occurred while put the migrated configuration into the data store", sqlException); } }
public void Save_should_store_configuration_to_a_new_file() { Assert.IsFalse(File.Exists(filePath), "File should not be existed"); var configuration = new Configuration { Account = "account", Token = "token" }; var storage = new ConfigurationStorage(filePath); storage.Save(configuration); Assert.IsTrue(File.Exists(filePath), "File should be existed"); var fileData = File.ReadAllBytes(filePath); Assert.IsTrue(fileData != null && fileData.Length > 0, "File should not be empty"); }
private static bool TryInitializeContextFromSavedConfiguration(ConfigurationStorage configurationStorage) { var initialized = configurationStorage.InitializeFromConfiguration(out Exception exception); if (initialized || exception == null) return initialized; StarFisherConsole.Instance.WriteLine(); StarFisherConsole.Instance.WriteLine( @"Failed to load saved configuration. You will need to re-run the initialization workflow."); StarFisherConsole.Instance.WriteLine(); StarFisherConsole.Instance.PrintException(exception); return false; }
public void Load_should_restore_configuration_from_a_file() { var configuration = new Configuration { Account = "account", Token = "token" }; var storage = new ConfigurationStorage(filePath); storage.Save(configuration); var storage2 = new ConfigurationStorage(filePath); var configuration2 = storage2.Load(); Assert.AreEqual(configuration.Account, configuration2.Account); Assert.AreEqual(configuration.Token, configuration2.Token); }
private static void InitializeApplication(ConfigurationStorage configurationStorage, IGlobalAddressList globalAddressList) { if (TryInitializeContextFromSavedConfiguration(configurationStorage)) return; do { StarFisherConsole.Instance.WriteLine(); StarFisherConsole.Instance.WriteLine(@"You must complete StarFisher's initial set-up to continue."); StarFisherConsole.Instance.WriteLine(); var initializationCommand = new InitializeApplicationMenuItemCommand(StarFisherContext.Instance, globalAddressList, configurationStorage); initializationCommand.Run(); } while (!StarFisherContext.Instance.IsInitialized); }
public PaperModel(SecureString walletPrivateKey) { this.walletPrivateKey = walletPrivateKey ?? throw new ArgumentNullException(nameof(walletPrivateKey)); string qrText = walletPrivateKey.GetString(); ShowQR(qrText); this.OpenConfigButton = new TextButtonModel((b) => Process.Start(ConfigurationStorage.GetDirectory())) { Content = "Open configs" }; this.CopyWalletKeyButton = new TextButtonModel((b) => Clipboard.SetText(walletPrivateKey.GetString())) { Content = "Copy seed" }; }
private void EnsureConfiguration() { if (_config != null) { if (_platformsWithCustomData.Count == 0) { foreach (SupportedPlatforms value in Enum.GetValues(typeof(SupportedPlatforms))) { _platformsWithCustomData.Add(value, _config.GetPlatformDeepLinkingProtocols(value) != null || _config.GetPlatformDomainProtocols(value) != null); } } return; } _config = ConfigurationStorage.Load(); SetupVariables(); }
private static void Main(string[] args) { /* TODO: * 1. Changes from PX and Verity fallout */ var excelFileFactory = new ExcelFileFactory(); var mailMergeFactory = new MailMergeFactory(excelFileFactory); var globalAddressList = GetGlobalAddressList(); var configurationStorage = new ConfigurationStorage(); InitializeApplication(configurationStorage, globalAddressList); var emailFactory = new EmailFactory(StarFisherContext.Instance, excelFileFactory, mailMergeFactory); var memoHelper = new StarAwardsMemoHelper(excelFileFactory, mailMergeFactory); var menuItemCommands = new List<IMenuItemCommand> { new LoadNominationsFromSnapshotMenuItemCommand(StarFisherContext.Instance), new LoadNominationsFromSurveyExportMenuItemCommand(StarFisherContext.Instance), new FixNomineesMenuItemCommand(StarFisherContext.Instance, globalAddressList), new FixNomineeWriteUpsMenuItemCommand(StarFisherContext.Instance), new DisqualifyNomineesMenuItemCommand(StarFisherContext.Instance), new RemoveNominationMenuItemCommand(StarFisherContext.Instance), new CreateHumanResourceNomineeValidationEmailMenuItemCommand(StarFisherContext.Instance, emailFactory), new CreateAwardVotingKeyMenuItemCommand(StarFisherContext.Instance, excelFileFactory), new CreateAwardVotingGuideMenuItemCommand(StarFisherContext.Instance, mailMergeFactory), new CreateVotingSurveyEmailsMenuItemCommand(StarFisherContext.Instance, emailFactory), new CreateVotingKeyEmailMenuItemCommand(StarFisherContext.Instance, emailFactory), new CreateLuncheonInviteeListEmailMenuItemCommand(StarFisherContext.Instance, emailFactory), new SendNominationNotificationEmailsMenuItemCommand(StarFisherContext.Instance, mailMergeFactory), new SelectAwardWinnerMenuItemCommand(StarFisherContext.Instance), new UnselectAwardWinnerMenuItemCommand(StarFisherContext.Instance), new CreateCertificateEmailMenuItemCommand(StarFisherContext.Instance, emailFactory), new CreateStarAwardsMemoArtifactsMenuItemCommand(StarFisherContext.Instance, memoHelper), new InitializeApplicationMenuItemCommand(StarFisherContext.Instance, globalAddressList, configurationStorage), new ExitCommand(StarFisherContext.Instance) }; var topLevelMenu = new TopLevelMenuCommand(StarFisherContext.Instance, menuItemCommands); topLevelMenu.Run(); }
public bool Initialize() { try { var config = ConfigurationStorage.Load(); var protocol = config.GetPlatformDeepLinkingProtocols(SupportedPlatforms.Linux, true).FirstOrDefault(); if (protocol == null) { return(false); } _scheme = protocol.Scheme; var activationProtocol = protocol.Scheme; var fromSteam = _steamBuild; var steamAppId = fromSteam ? config.SteamId : string.Empty; var home = Environment.GetEnvironmentVariable("HOME"); const string mimeTypePrefix = "x-scheme-handler/"; var mimeType = mimeTypePrefix + activationProtocol; var desktopFilename = activationProtocol + ".desktop"; var desktopFile = home + LocalAppDir + desktopFilename; var mimeapps = home + LocalAppDir + "mimeapps.list"; HandleMimefile(mimeType, desktopFilename, mimeapps); HandleDesktopFile(activationProtocol, desktopFile, steamAppId); SetupMimeType(activationProtocol); return(true); } catch (Exception e) { UnityEngine.Debug.Log("Linux Provider " + e); return(false); } }
public void Save_should_store_configuration_to_an_existing_file() { File.Create(filePath).Close(); var lastModification = File.GetLastWriteTimeUtc(filePath); // saving of the file wondoes not happen very quickly // without this delay file is modified too quickly and time difference cannot be taken Thread.Sleep(10); var configuration = new Configuration { Account = "account", Token = "token" }; var storage = new ConfigurationStorage(filePath); storage.Save(configuration); var anotherLastModification = File.GetLastWriteTimeUtc(filePath); Assert.IsTrue(DateTime.Compare(anotherLastModification, lastModification) > 0, "Last modification date should be greater after configuration is saved"); }
public static Func <Transaction, Transaction, int, bool> Upgrader(StorageType storageType, ConfigurationStorage configurationStorage, DocumentsStorage documentsStorage) { return((readTx, writeTx, currentVersion) => { var name = $"Raven.Server.Storage.Schema.Updates.{storageType.ToString()}.From{currentVersion}"; var schemaUpdateType = typeof(SchemaUpgrader).Assembly.GetType(name); if (schemaUpdateType == null) { return false; } var schemaUpdate = (ISchemaUpdate)Activator.CreateInstance(schemaUpdateType); return schemaUpdate.Update(new UpdateStep { ReadTx = readTx, WriteTx = writeTx, ConfigurationStorage = configurationStorage, DocumentsStorage = documentsStorage, }); }); }
public override void OnInspectorGUI() { QuartersInit quartersInit = (QuartersInit)target; EditorGUILayout.LabelField($"Quarters Unity SDK - Version {QuartersInit.SDK_VERSION}"); if (GUILayout.Button("Open App Dashboard")) { Application.OpenURL(quartersInit.DASHBOARD_URL); } if (GUILayout.Button("My Apps")) { Application.OpenURL(quartersInit.POQ_APPS_URL); } EditorGUILayout.Space(); base.DrawDefaultInspector(); if (GUILayout.Button("Save")) { AppLinkingConfiguration config = new AppLinkingConfiguration(); config.DisplayName = "Quarters SDK"; config.DeepLinkingProtocols = new List <LinkInformation>(); LinkInformation linkInformation = new LinkInformation(); linkInformation.Scheme = "https"; linkInformation.Host = $"{quartersInit.APP_UNIQUE_IDENTIFIER}.games.poq.gg"; config.DeepLinkingProtocols.Add(linkInformation); ConfigurationStorage.Save(config); Debug.Log("Saved Quarters SDK Config"); } }
public void Setup() { _sut = new ConfigurationStorage("mongodb://*****:*****@devdbsmon028blq.yoox.net:27017/admin?readPreference=primary"); }
public SystemUnderTest WithConfiguration(StoredConfiguration configurations) { ConfigurationStorage.Has(configurations); return(this); }
static Publisher() { _configuration = new ConfigurationStorage(); }
public static ConfigurationStorage GetInstance() { return(_instance ?? (_instance = new ConfigurationStorage())); }
public RecipesController(IMapper mapper, IRecipesDatabaseSettings settings) { _mapper = mapper; _dbSettings = settings; ConfigurationStorage.GetConfigurationStorage().Settings = settings; }
private void Initialize() { SystemConfiguration = new ConfigurationStorage(this); UserPermissionsOperator = new OvertestUserPermissionsOperator(this); }
public static UpgraderDelegate Upgrader(StorageType storageType, ConfigurationStorage configurationStorage, DocumentsStorage documentsStorage) { var upgrade = new InternalUpgrader(storageType, configurationStorage, documentsStorage); return(upgrade.Upgrade); }
static Consumer() { configurationStorage = new ConfigurationStorage(); }