public IList <Color> GetFlagColors(Nationality nationality)
        {
            IFlag flag = FLAGS[nationality];

            flag = flag ?? new DefaultFlag();
            return(flag.Colors);
        }
Exemple #2
0
        private bool ReadFlag(PropertyInfo pi, out object value)
        {
            value = null;
            FlagAttribute fa = pi.GetCustomAttribute <FlagAttribute>( );

            if (fa == null)
            {
                return(false);
            }

            IFlag flag = _spec.Flags.FirstOrDefault(f => f.Name.Equals(fa.Name));

            if (flag == null)
            {
                throw new Exception(
                          $"property {pi.Name} has no corresponding {nameof( IFlag )} with name {fa.Name}");
            }

            if (pi.PropertyType.IsAssignableFrom(typeof(bool)))
            {
                value = _pr.IsSet(flag);
                return(true);
            }

            throw new Exception(
                      $"flag property {pi.Name} should be assignable from bool but is of type {pi.PropertyType}");
        }
    // A componenet that will make us follow our carrier
    //IMoveWith moveWith;

    void Awake()
    {
        // Find other flag
        otherFlag = (IFlag)GameObject.FindGameObjectWithTag("Flag").GetComponent(typeof(IFlag));

        // Set the component that's supposed to move us
        //moveWith = (IMoveWith) GetComponent (typeof (IMoveWith));

        // Find the game component
    }
Exemple #4
0
        public IFlag GetFlag(string propertyName)
        {
            IFlag flag = GetItem(propertyName) as IFlag;

            if (flag == null)
            {
                throw new Exception($"no flag mapped to property {propertyName}");
            }

            return(flag);
        }
Exemple #5
0
        private void PrintFlag(IFlag flag)
        {
            List <IArgument> args = flag.Arguments.ToList( );

            Indent(2);
            _writer.Write(Spec.Config.FlagPrefix( ));
            _writer.Write(flag.Name);

            Indent(1);
            PrintArgumentLine(args);
            _writer.WriteLine( );

            if (!string.IsNullOrEmpty(flag.Description))
            {
                Indent(15);
                _writer.WriteLine(flag.Description);
            }

            foreach (IArgument arg in args)
            {
                PrintArgument(arg, true);
            }
        }
Exemple #6
0
 /// <summary>
 /// Adds the provided flag to the collection.
 /// </summary>
 /// <param name="flag"></param>
 public void Add(IFlag flag)
 {
     List.Add(flag);
 }
Exemple #7
0
 this T @this, IFlag flg,
 string[] args, int i, string fragment,
 string part, int pos, bool lookAhead)
Exemple #8
0
 public FFMPEGCommand AddFlag(IFlag flag)
 {
     Flags.Add(flag);
     return(this);
 }