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"); } }
public static TarFlags SetOrClear(this TarFlags current, TarFlags value, bool add) { if (add) { return(current | value); } else { return(current & ~value); } }
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"); } }