示例#1
0
            public void SetAvailability(SettingsKey key, InteractionTuning tuning, Availability.FlagField availability, bool set)
            {
                if ((mFlags & Flags.Availability) == Flags.None)
                {
                    mAvailability = tuning.Availability.mFlags;
                }

                mFlags |= Flags.Availability;

                if (set)
                {
                    mAvailability |= availability;
                }
                else
                {
                    mAvailability &= ~availability;
                }

                if (Retuner.StoreDefault(key, tuning))
                {
                    if (set)
                    {
                        tuning.Availability.AddFlags(availability);
                    }
                    else
                    {
                        tuning.Availability.RemoveFlags(availability);
                    }
                }
            }
示例#2
0
            public void Import(Persistence.Lookup settings)
            {
                mName = settings.GetString("Name");
                if (settings.Exists("Autonomous"))
                {
                    mAutonomous = settings.GetBool("Autonomous", false);
                    mFlags     |= Flags.Autonomous;
                }

                if (settings.Exists("UserDirected"))
                {
                    mUserDirected = settings.GetBool("UserDirected", false);
                    mFlags       |= Flags.UserDirected;
                }

                if (settings.Exists("AgeSpecies"))
                {
                    mAgeSpecies = settings.GetEnum <CASAGSAvailabilityFlags>("AgeSpecies", CASAGSAvailabilityFlags.None);
                    mFlags     |= Flags.AgeSpecies;

                    mAgeSpeciesList = null;
                }

                if (settings.Exists("Availability"))
                {
                    mAvailability = settings.GetEnum <Availability.FlagField>("Availability", Availability.FlagField.None);
                    mFlags       |= Flags.Availability;
                }

                if (settings.Exists("Advertised"))
                {
                    mAdvertisedOutputs.Clear();
                    ParseAdvertised(settings.GetStringList("Advertised"));
                }
            }
示例#3
0
 public ITUNSettings(ITUNSettings setting)
     : this(setting.mName)
 {
     mAutonomous        = setting.mAutonomous;
     mUserDirected      = setting.mUserDirected;
     mAgeSpecies        = setting.mAgeSpecies;
     mAvailability      = setting.mAvailability;
     mAdvertisedOutputs = new Dictionary <CommodityKind, float>(mAdvertisedOutputs);
     mFlags             = setting.mFlags;
 }
示例#4
0
            protected void SetAvailability(SettingsKey key, InteractionTuning tuning, Availability.FlagField availability)
            {
                mAvailability = availability;

                mFlags |= Flags.Availability;

                if (Retuner.StoreDefault(key, tuning))
                {
                    tuning.Availability.mFlags = mAvailability;
                }
            }
示例#5
0
            public ITUNSettings(string name, InteractionTuning tuning, bool isDefault)
                : this(name)
            {
                mAutonomous   = !tuning.HasFlags(InteractionTuning.FlagField.DisallowAutonomous);
                mUserDirected = !tuning.HasFlags(InteractionTuning.FlagField.DisallowUserDirected);
                mAgeSpecies   = tuning.Availability.AgeSpeciesAvailabilityFlags;
                mAvailability = tuning.Availability.mFlags;

                if (isDefault)
                {
                    mFlags = Flags.All;
                }
            }
示例#6
0
            public ITUNSettings(string name, XmlDbRow row)
                : this(name)
            {
                mFlags = Flags.None;

                if (row.Exists("Autonomous"))
                {
                    mAutonomous = row.GetBool("Autonomous");
                    mFlags     |= Flags.Autonomous;
                }

                if (row.Exists("UserDirected"))
                {
                    mUserDirected = row.GetBool("UserDirected");
                    mFlags       |= Flags.UserDirected;
                }

                if (row.Exists("AgeSpecies"))
                {
                    mAgeSpecies = row.GetEnum <CASAGSAvailabilityFlags>("AgeSpecies", CASAGSAvailabilityFlags.None);
                    if (mAgeSpecies == CASAGSAvailabilityFlags.None)
                    {
                        BooterLogger.AddError("Unknown AgeSpecies: " + row.GetString("AgeSpecies"));
                    }
                    else
                    {
                        mFlags |= Flags.AgeSpecies;

                        mAgeSpeciesList = null;
                    }
                }

                if (row.Exists("Availability"))
                {
                    mAvailability = row.GetEnum <Availability.FlagField>("Availability", Availability.FlagField.None);
                    if (mAvailability == Availability.FlagField.None)
                    {
                        BooterLogger.AddError("Unknown Availability: " + row.GetString("Availability"));
                    }
                    else
                    {
                        mFlags |= Flags.Availability;
                    }
                }

                if (row.Exists("Advertised"))
                {
                    ParseAdvertised(row.GetStringList("Advertised", ','));
                }
            }
示例#7
0
            public void Import(Persistence.Lookup settings)
            {
                mName = settings.GetString("Name");
                if (settings.Exists("Autonomous"))
                {
                    mAutonomous = settings.GetBool("Autonomous", false);
                    mFlags |= Flags.Autonomous;
                }

                if (settings.Exists("UserDirected"))
                {
                    mUserDirected = settings.GetBool("UserDirected", false);
                    mFlags |= Flags.UserDirected;
                }

                if (settings.Exists("AgeSpecies"))
                {
                    mAgeSpecies = settings.GetEnum<CASAGSAvailabilityFlags>("AgeSpecies", CASAGSAvailabilityFlags.None);
                    mFlags |= Flags.AgeSpecies;

                    mAgeSpeciesList = null;
                }

                if (settings.Exists("Availability"))
                {
                    mAvailability = settings.GetEnum<Availability.FlagField>("Availability", Availability.FlagField.None);
                    mFlags |= Flags.Availability;
                }

                if (settings.Exists("Advertised"))
                {
                    mAdvertisedOutputs.Clear();
                    ParseAdvertised(settings.GetStringList("Advertised"));
                }
            }
示例#8
0
            public bool HasAvailability(Availability.FlagField flag, out bool result)
            {
                result = ((mAvailability & flag) == flag);

                return((mFlags & Flags.Availability) != Flags.None);
            }
示例#9
0
            public ITUNSettings(string name, XmlDbRow row)
                : this(name)
            {
                mFlags = Flags.None;

                if (row.Exists("Autonomous"))
                {
                    mAutonomous = row.GetBool("Autonomous");
                    mFlags |= Flags.Autonomous;
                }

                if (row.Exists("UserDirected"))
                {
                    mUserDirected = row.GetBool("UserDirected");
                    mFlags |= Flags.UserDirected;
                }

                if (row.Exists("AgeSpecies"))
                {
                    mAgeSpecies = row.GetEnum<CASAGSAvailabilityFlags>("AgeSpecies", CASAGSAvailabilityFlags.None);
                    if (mAgeSpecies == CASAGSAvailabilityFlags.None)
                    {
                        BooterLogger.AddError("Unknown AgeSpecies: " + row.GetString("AgeSpecies"));
                    }
                    else
                    {
                        mFlags |= Flags.AgeSpecies;

                        mAgeSpeciesList = null;
                    }
                }

                if (row.Exists("Availability"))
                {
                    mAvailability = row.GetEnum<Availability.FlagField>("Availability", Availability.FlagField.None);
                    if (mAvailability == Availability.FlagField.None)
                    {
                        BooterLogger.AddError("Unknown Availability: " + row.GetString("Availability"));
                    }
                    else
                    {
                        mFlags |= Flags.Availability;
                    }
                }

                if (row.Exists("Advertised"))
                {
                    ParseAdvertised(row.GetStringList("Advertised", ','));
                }
            }
示例#10
0
 public ITUNSettings(ITUNSettings setting)
     : this(setting.mName)
 {
     mAutonomous = setting.mAutonomous;
     mUserDirected = setting.mUserDirected;
     mAgeSpecies = setting.mAgeSpecies;
     mAvailability = setting.mAvailability;
     mAdvertisedOutputs = new Dictionary<CommodityKind, float>(mAdvertisedOutputs);
     mFlags = setting.mFlags;
 }
示例#11
0
            public ITUNSettings(string name, InteractionTuning tuning, bool isDefault)
                : this(name)
            {
                mAutonomous = !tuning.HasFlags(InteractionTuning.FlagField.DisallowAutonomous);
                mUserDirected = !tuning.HasFlags(InteractionTuning.FlagField.DisallowUserDirected);
                mAgeSpecies = tuning.Availability.AgeSpeciesAvailabilityFlags;
                mAvailability = tuning.Availability.mFlags;

                if (isDefault)
                {
                    mFlags = Flags.All;
                }
            }
示例#12
0
            protected void SetAvailability(SettingsKey key, InteractionTuning tuning, Availability.FlagField availability)
            {
                mAvailability = availability;

                mFlags |= Flags.Availability;

                if (Retuner.StoreDefault(key, tuning))
                {
                    tuning.Availability.mFlags = mAvailability;
                }
            }
示例#13
0
            public void SetAvailability(SettingsKey key, InteractionTuning tuning, Availability.FlagField availability, bool set)
            {
                if ((mFlags & Flags.Availability) == Flags.None)
                {
                    mAvailability = tuning.Availability.mFlags;
                }

                mFlags |= Flags.Availability;

                if (set)
                {
                    mAvailability |= availability;
                }
                else
                {
                    mAvailability &= ~availability;
                }

                if (Retuner.StoreDefault(key, tuning))
                {
                    if (set)
                    {
                        tuning.Availability.AddFlags(availability);
                    }
                    else
                    {
                        tuning.Availability.RemoveFlags(availability);
                    }
                }
            }