Exemple #1
0
        /// <summary>
        /// Aggiorna il file delle impostazioni
        /// </summary>
        public void WriteSettings()
        {
            try
            {
                JObject jObject = new JObject
                {
                    { nameof(SessionTimeout), new JValue(SessionTimeout) },
                    { nameof(BrowserExtensionHelp), new JValue(BrowserExtensionHelp) },
                    { nameof(LocalNotification), new JValue(LocalNotification) },
                    { nameof(VersionSettings), new JValue(VersionSettings) },
                    { nameof(PushNotification), new JValue(PushNotification) },
                    { nameof(CloudPlatform), new JValue(CloudPlatform.ToString().ToLower()) },
                    { nameof(Access), new JValue(Access) },
                    { nameof(CheckPasswordFrequency), new JValue(CheckPasswordFrequency) },
                    { nameof(CheckPasswordStartDate),
                      new JValue(Newtonsoft.Json.JsonConvert.SerializeObject(CheckPasswordStartDate, dateTimeConverter)) },
                    { nameof(BackupFrequency), new JValue(BackupFrequency) },
                    { nameof(BackupStartDate),
                      new JValue(Newtonsoft.Json.JsonConvert.SerializeObject(BackupStartDate, dateTimeConverter)) },
                    { nameof(BackupHistory), new JValue(BackupHistory) }
                };

                File.WriteAllText(AppSettingsFileName, jObject.ToString(), Encoding.UTF8);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error occurred during the update of the App settings. Error: " + ex.Message);
                throw;
            }
        }
Exemple #2
0
        /// <summary>
        /// Removes forbidden characters from a platform ID.
        /// </summary>
        /// <param name="text">The <see cref="string"/> that may contain forbidden characters.</param>
        /// <param name="platform">Type of platform ID</param>
        /// <returns>A <see cref="string"/> free from forbidden characters.</returns>
        public static string RemoveForbiddenCharactersFromPlatformID(string text, CloudPlatform platform)
        {
            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (platform)
            {
            case CloudPlatform.iOS:
                return(string.IsNullOrEmpty(text) ? string.Empty : Regex.Replace(text, @"[^a-zA-Z0-9_.]", string.Empty));

            case CloudPlatform.GooglePlay:
                return(string.IsNullOrEmpty(text) ? string.Empty : Regex.Replace(text, @"[^a-zA-Z0-9-_]", string.Empty));

            default:
                throw new ArgumentOutOfRangeException("platform", platform, null);
            }
        }
        public static void ClassInit(TestContext context)
        {
            //Textures used don't matter, as none of them are initialized
            Player        = new Player(Vector2.Zero);
            PrivatePlayer = new PrivateObject(Player);
            Enemy         = new BaseEnemy(Vector2.Zero);
            PrivateEnemy  = new PrivateObject(Enemy);

            Platform             = new Platform(Vector2.Zero);
            PrivatePlatform      = new PrivateObject(Platform);
            SpikePlatform        = new SpikePlatform(Vector2.Zero);
            PrivateSpikePlatform = new PrivateObject(SpikePlatform);
            HorizontalPlatform   = new HorizontalPlatform(Vector2.Zero);
            PrivateHorizontal    = new PrivateObject(HorizontalPlatform);
            VerticalPlatform     = new VerticalPlatform(Vector2.Zero);
            PrivateVertical      = new PrivateObject(VerticalPlatform);
            IcePlatform          = new IcePlatform(Vector2.Zero);
            PrivateIcePlatform   = new PrivateObject(IcePlatform);
            CloudPlatform        = new CloudPlatform(Vector2.Zero);
            PrivateCloudPlatform = new PrivateObject(CloudPlatform);
        }