Exemplo n.º 1
0
        public static void CheckConflicts(this TarFlags value)
        {
            var flagsFilter = TarFlags.Compress | TarFlags.Gzip;

            if ((value & flagsFilter) == flagsFilter)
            {
                throw new Exception("options --compress and --gzip can't be used together");
            }
        }
Exemplo n.º 2
0
 public static TarFlags SetOrClear(this TarFlags current, TarFlags value, bool add)
 {
     if (add)
     {
         return(current | value);
     }
     else
     {
         return(current & ~value);
     }
 }
Exemplo n.º 3
0
 public static IEnumerable <string> OptionsToString(this TarFlags value, OptionPreference preferLongNames = OptionPreference.Short)
 {
     // generator : SingleTaskEnumsGenerator
     CheckConflicts(value);
     // -z, --gzip: Filter the archive through gzip(1).
     if ((value & TarFlags.Gzip) != 0)
     {
         yield return(preferLongNames == OptionPreference.Long ? "--gzip" : "-z");
     }
     // -Z, --compress: Filter the archive through compress(1).
     if ((value & TarFlags.Compress) != 0)
     {
         yield return(preferLongNames == OptionPreference.Long ? "--compress" : "-Z");
     }
     // -v: Verbose
     if ((value & TarFlags.Verbose) != 0)
     {
         yield return("-v");
     }
 }