Esempio n. 1
0
        public static bool GetSettingsBool(TypeSettings typeSettings)
        {
            string temp = "";

            if (CrossSettings.IsSupported)
            {
                temp = CrossSettings.Current.GetValueOrDefault(typeSettings.ToString(), string.Empty);
            }

            // Par défaut : false
            if (string.IsNullOrEmpty(temp))
            {
                return(false);
            }

            bool ret = false;

            try {
                ret = bool.Parse(temp);
            }
            catch {
            }

            return(ret);
        }
Esempio n. 2
0
        public static DateTime GetSettingsDate(TypeSettings typeSettings)
        {
            string temp = "";

            if (CrossSettings.IsSupported)
            {
                temp = CrossSettings.Current.GetValueOrDefault(typeSettings.ToString(), string.Empty);
            }

            // Par défaut : minval
            if (string.IsNullOrEmpty(temp))
            {
                return(DateTime.MinValue);
            }

            DateTime ret = DateTime.MinValue;

            try
            {
                ret = DateTime.Parse(temp);
            }
            catch
            {
            }

            return(ret);
        }
Esempio n. 3
0
 /// <summary>
 /// Adds the custom setting.
 /// </summary>
 /// <param name="setting">The setting.</param>
 protected void AddCustomSetting(Setting setting)
 {
     if (!SettingKeys.Contains(setting.Key))
     {
         SettingKeys.Add(setting.Key);
         TypeSettings.Add(setting);
     }
 }
Esempio n. 4
0
 public static string GetSettings(TypeSettings typeSettings)
 {
     /*if (CrossSettings.IsSupported)
      *  return CrossSettings.Current.GetValueOrDefault(typeSettings.ToString(), string.Empty);
      * else
      *  return "";*/
     return(GetSettings(typeSettings.ToString()));
 }
Esempio n. 5
0
        /// <summary>
        /// Fetches the item settings.
        /// </summary>
        protected override void FetchTypeSettings()
        {
            base.FetchTypeSettings();

            for (int i = 0; i <= _defaultsettings.Count - 1; i++)
            {
                if (!TypeSettings.ContainsKey(_defaultsettings[i].Key))
                {
                    TypeSettings.Add(_defaultsettings[i].Key, _defaultsettings[i]);
                }
            }
        }
Esempio n. 6
0
        private void ShowTypeProperties(GameObjectType gameObjectType)
        {
            if (gameObjectType == null)
            {
                return;
            }

            using (TypeSettings typeSettings = new TypeSettings())
            {
                typeSettings.Type = gameObjectType;
                typeSettings.ShowDialog();
                Refresh();
            }
        }
        /// <summary>
        /// Initializes the legacy serializtion types.
        /// </summary>
        /// <param name="typeSettings">The type settings.</param>
        /// <param name="isLegacySerializationSupported">if set to <c>true</c> indicates that legacy serialization supported.</param>
        internal void InitializeLegacySerializtionTypes(TypeSettings typeSettings, bool isLegacySerializationSupported)
        {
            legacySerializationTypes = new List <short>();

            if (isLegacySerializationSupported)
            {
                try
                {
                    legacySerializationTypes.Add(typeSettings.TypeSettingCollection[MOOD_STATUS_2_TYPE_NAME].TypeId);
                }
                catch
                {
                    // no need to do anything if MOOD_STATUS_2_TYPE_NAME is not found in TypeSettingCollection
                }
            }
        }
        /// <summary>
        /// Initializes the legacy serializtion types.
        /// </summary>
        /// <param name="typeSettings">The type settings.</param>
        /// <param name="isLegacySerializationSupported">if set to <c>true</c> indicates that legacy serialization supported.</param>
        internal void InitializeLegacySerializtionTypes(TypeSettings typeSettings, bool isLegacySerializationSupported)
        {
            legacySerializationTypes = new List<short>();

            if (isLegacySerializationSupported)
            {
                try
                {
                    legacySerializationTypes.Add(typeSettings.TypeSettingCollection[MOOD_STATUS_2_TYPE_NAME].TypeId);
                }
                catch
                {
                    // no need to do anything if MOOD_STATUS_2_TYPE_NAME is not found in TypeSettingCollection                
                }                
            }
        }
        private NodeGroup[] GenerateGroupsByTypeId(TypeSettings typeSettings)
        {
            NodeGroup[] groups = new NodeGroup[typeSettings.MaxTypeId + 1];
            for (short typeId = 1; typeId <= typeSettings.MaxTypeId; typeId++)
            {
                string groupName = typeSettings.TypeSettingCollection.GetGroupNameForId(typeId);
                if (string.IsNullOrEmpty(groupName) || !Contains(groupName))
                {
                    groups[typeId] = null;
                }
                else
                {
                    groups[typeId] = this[groupName];
                }
            }

            return(groups);
        }
Esempio n. 10
0
        public void CreateSubfolders()
        {
            if (!this.CanOpenDestination)
            {
                return;
            }

            foreach (var type in TypeSettings.Where(type => type.Enabled))
            {
                try
                {
                    Directory.CreateDirectory(Path.Combine(this.Location, type.Type));
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("AudibleNotifications: Failed to create folder {0} for type {1}; reason: {2}.", Path.Combine(this.Location, type.Type), type.Type, ex.Message);
                }
            }
        }
Esempio n. 11
0
 public static void SetSettings(TypeSettings typeSettings, DateTime value)
 {
     CrossSettings.Current.AddOrUpdateValue(typeSettings.ToString(), value.ToString());
 }
Esempio n. 12
0
 public static void SetSettings(TypeSettings typeSettings, string value)
 {
     //CrossSettings.Current.AddOrUpdateValue(typeSettings.ToString(), value);
     SetSettings(typeSettings.ToString(), value);
 }
Esempio n. 13
0
        internal static RelayNodeConfig GetRelayNodeConfig(XmlNode section)
        {
            //XPathNavigator nav = section.CreateNavigator();
            XmlSerializer ser = new XmlSerializer(typeof(RelayNodeConfig));
            object        configurationObject;

            configurationObject = ser.Deserialize(new XmlNodeReader(section));
            RelayNodeConfig typedConfig = configurationObject as RelayNodeConfig;

            System.Configuration.Configuration confFile = GetConfigurationFile();

            string basePath = confFile.FilePath;

            if (typedConfig != null)
            {
                #region Get Sub Configs
                foreach (XmlNode node in section.ChildNodes)
                {
                    switch (node.Name)
                    {
                    case "RelayComponents":
                        RelayComponents comps = GetSourcedObject <RelayComponents>(basePath, node);
                        if (comps != null)
                        {
                            typedConfig.RelayComponents = comps.RelayComponentCollection;
                        }
                        else
                        {
                            if (log.IsErrorEnabled)
                            {
                                log.Error("No relay component config found.");
                            }
                        }
                        break;

                    case "TypeSettings":
                        TypeSettings typeSettings = GetSourcedObject <TypeSettings>(basePath, node);
                        if (typeSettings.TypeSettingCollection.Count == 0)
                        {
                            // attempt custom load
                            typeSettings = TypeSettingsConfigLoader.Load(basePath, node);
                        }
                        typedConfig.TypeSettings = typeSettings;

                        break;

                    case "RelayNodeMapping":
                        RelayNodeMapping nodeMapping = GetSourcedObject <RelayNodeMapping>(basePath, node);
                        typedConfig.RelayNodeMapping = nodeMapping;
                        break;

                    case "TransportSettings":
                        TransportSettings transportSettings = GetSourcedObject <TransportSettings>(basePath, node);
                        typedConfig.TransportSettings = transportSettings;
                        break;
                    }
                }
                #endregion

                if (System.Web.HttpContext.Current == null)                 //not a web project, doesn't apply
                {
                    WatchConfigFiles();
                }
                else
                {
                    SectionInformation info = confFile.GetSection(RelayNodeSectionHandler.ConfigSectionName).SectionInformation;
                    if (!info.RestartOnExternalChanges)
                    {
                        WatchConfigFiles();
                    }
                }
            }

            return(typedConfig);
        }
 public TypeConstraintStandard(Type targetType, TypeSettings settings, bool allowAbstract, bool allowObsolete) : base(targetType)
 {
     Settings      = settings;
     AllowAbstract = allowAbstract;
     AllowObsolete = allowObsolete;
 }