public PickTargetOutputTypeWindow(Window owner, OutputTargetSectionViewModel viewModel) : base(owner) { InitializeComponent(); Title = "Select type"; DataContext = this; IOutputTargetViewModel libraryVm = viewModel.Targets.First(vm => vm.Type == OutputTargetType.Library); if(libraryVm.IsAutoGenerated) { Targets = new OutputTargetType[] { OutputTargetType.Library, OutputTargetType.Binary, OutputTargetType.Benchmark, OutputTargetType.Test, OutputTargetType.Example }; } else { Targets = new OutputTargetType[] { OutputTargetType.Binary, OutputTargetType.Benchmark, OutputTargetType.Test, OutputTargetType.Example }; } SelectedTarget = Targets[0]; }
public static bool DefaultTest(this OutputTargetType type) { switch (type) { default: return(true); case OutputTargetType.Benchmark: return(false); } }
public static bool DefaultDoctest(this OutputTargetType type) { switch (type) { default: return(false); case OutputTargetType.Library: return(true); } }
public static bool DefaultBench(this OutputTargetType type) { switch (type) { default: return(true); case OutputTargetType.Test: case OutputTargetType.Example: return(false); } }
public static string DefaultPath(this OutputTargetType type, string name) { switch (type) { case OutputTargetType.Library: return(String.Format(@"src\{0}.rs", name)); case OutputTargetType.Binary: return(String.Format(@"src\{0}.rs", name)); case OutputTargetType.Benchmark: return(String.Format(@"benches\{0}.rs", name)); case OutputTargetType.Test: return(String.Format(@"tests\{0}.rs", name)); case OutputTargetType.Example: return(String.Format(@"examples\{0}.rs", name)); } throw new ArgumentException(null, "type"); }
public static string ToTypeString(this OutputTargetType type) { switch (type) { case OutputTargetType.Library: return("lib"); case OutputTargetType.Binary: return("bin"); case OutputTargetType.Benchmark: return("bench"); case OutputTargetType.Test: return("test"); case OutputTargetType.Example: return("example"); } throw new ArgumentException(null, "type"); }
static OutputTarget GetOutputTarget(IReadOnlyList<OutputTarget> targets, OutputTargetType type, string name) { return targets.First(t => t.Type == type && t.Name == name); }
protected object GetOutputTarget(OutputTargetType targetType) { return(null); }
public OutputTarget(OutputTargetType type) { Type = type; Handle = null; }
public static bool DefaultHarness(this OutputTargetType _) { return(true); }
public static bool DefaultPlugin(this OutputTargetType _) { return(false); }