//========================================================================== private OutlinerGUP() { this.TreeModes = new Dictionary<TreeView, TreeMode>(); this.currentPresets = new Dictionary<TreeView, OutlinerPreset>(); this.CommonNameFilter = new NameFilter(); }
public void Enabled_Get_ReturnsSearchStringNotEmpty() { NameFilter filter = new NameFilter(); Assert.IsFalse(filter.Enabled); filter.SearchString = "Test"; Assert.IsTrue(filter.Enabled); }
public void SearchString_Set_ChangesSearchString() { NameFilter filter = new NameFilter(); filter.SearchString = ""; Assert.AreEqual("", filter.SearchString); filter.SearchString = "t"; Assert.AreEqual("t", filter.SearchString); filter.SearchString = "*test"; Assert.AreEqual("*test", filter.SearchString); filter.SearchString = ""; Assert.AreEqual("", filter.SearchString); }
public void SearchString_Set_FiltersNodeByName() { NameFilter filter = new NameFilter(); IMaxNode node = CreateNodeWithName("Test"); filter.SearchString = ""; Assert.IsTrue(filter.ShowNode(node)); filter.SearchString = "T"; Assert.IsTrue(filter.ShowNode(node)); filter.SearchString = "Test"; Assert.IsTrue(filter.ShowNode(node)); filter.SearchString = "TestX"; Assert.IsFalse(filter.ShowNode(node)); filter.SearchString = "XTest"; Assert.IsFalse(filter.ShowNode(node)); }
public void Run() { OnTestStarted(EventArgs.Empty); Debug.WriteLine(string.Format("Running test {0}", _test.TestName)); try { TestName testName = _test.TestName; TestFilter filter = new NameFilter(testName); TestResult result = _test.Run(_listener, filter); var summ = new ResultSummarizer(result); Assert.AreEqual(1, summ.ResultCount); } catch (Exception e) { DynamoLogger.Instance.Log(e.Message); DynamoLogger.Instance.Log(string.Format("Failed to run test : {0}", _test.TestName)); } OnTestCompleted(EventArgs.Empty); }
internal sealed override IEnumerable <EventInfo> GetEventsCore(NameFilter filter, Type reflectedType) => throw null;
internal sealed override IEnumerable <RoType> GetNestedTypesCore(NameFilter filter) => _genericTypeDefinition.GetNestedTypesCore(filter);
public void NullFilter() { var nf = new NameFilter(null); Assert.IsTrue(nf.IsIncluded("o78i6bgv5rvu\\kj//&*")); }
internal sealed override IEnumerable <EventInfo> GetEventsCore(NameFilter filter, Type reflectedType) => Array.Empty <EventInfo>();
internal sealed override IEnumerable <FieldInfo> GetFieldsCore(NameFilter filter, Type reflectedType) => _genericTypeDefinition.SpecializeFields(filter, reflectedType, this);
public void CaseSensitive_Set_RaisesFilterChangedEvent() { NameFilter filter = new NameFilter(); AssertActionRaisesFilterChangedEvent(filter, () => filter.CaseSensitive = true); }
public void ValidFilter() { Assert.IsTrue(NameFilter.IsValidFilterExpression("a")); Assert.IsFalse(NameFilter.IsValidFilterExpression(@"\,)")); }
public void ToStringTest(string name) { Filter<ITestDescriptor> filter = new NameFilter<ITestDescriptor>(new EqualityFilter<string>(name)); Assert.AreEqual("Name(Equality('" + name + "'))", filter.ToString()); }
public void SearchString_UsingAsterisk_WorksCombinedWithUseWildcard() { NameFilter filter = new NameFilter(); filter.UseWildcard = true; IMaxNode node = CreateNodeWithName("LoremIpsum"); filter.SearchString = "rem*sum"; Assert.IsTrue(filter.ShowNode(node)); filter.SearchString = "*rem*sum"; Assert.IsTrue(filter.ShowNode(node)); }
public OverviewViewModel(TaskExecutionService taskExecutionService, PersistenceService persistenceService, WindowService windowService) { _taskExecutionService = taskExecutionService; _persistenceService = persistenceService; _windowService = windowService; // Setup collection view _collectionView = CollectionViewSource.GetDefaultView(Mods); // Commands ToggleExpandCommand = new RelayCommand <ModStatus>(ToggleExpand); ExpandCommand = new RelayCommand <ModStatus>(Expand); UnexpandCommand = new RelayCommand <ModStatus>(Unexpand); ClearFilters = new RelayCommand(() => NameFilter = GameFilter = null, () => NameFilter.IsNotBlank() || GameFilter.IsNotBlank()); AbortCommand = new RelayCommand <string>(Abort); OpenModPageCommand = new RelayCommand <string>(OpenModPage); VerifyCommand = new RelayCommand <string>(Verify); ReinstallCommand = new RelayCommand <string>(Reinstall); UninstallCommand = new RelayCommand <string>(Uninstall); // Events Localization.PropertyChanged += (sender, args) => { UpdateLocalization(); PopulateAll(); }; _taskExecutionService.TaskAddedToQueue += (sender, args) => PopulateEnqueuedMods(); _taskExecutionService.TaskStateChanged += (sender, args) => PopulateCurrent(); _taskExecutionService.TaskEnded += (sender, args) => { // If it was a verification task - notify of the result if (args.Task.Type == TaskType.Verify) { if (args.Success) { _windowService.ShowNotificationWindowAsync(Localization.Overview_VerifySuccessfulNotification).GetResult(); } else { _windowService.ShowErrorWindowAsync(Localization.Overview_VerifyUnsuccessfulNotification).GetResult(); } } RemoveModStatus(args.Task.ModID); PopulateInstalledMod(args.Task.ModID); }; _taskExecutionService.TaskAborted += (sender, args) => { RemoveModStatus(args.Task.ModID); PopulateInstalledMod(args.Task.ModID); }; _taskExecutionService.TaskRemovedFromQueue += (sender, args) => { RemoveModStatus(args.Task.ModID); PopulateInstalledMod(args.Task.ModID); }; // Initial population UpdateLocalization(); PopulateAll(); }
internal abstract IEnumerable <RoType> GetNestedTypesCore(NameFilter filter);
internal abstract IEnumerable <PropertyInfo> GetPropertiesCore(NameFilter filter, Type reflectedType);
internal sealed override IEnumerable <PropertyInfo> GetPropertiesCore(NameFilter filter, Type reflectedType) => throw null;
public void CaseSensitive_SetFalse_MakesSearchCaseInsensitive() { NameFilter filter = new NameFilter(); filter.CaseSensitive = false; IMaxNode node = CreateNodeWithName("Test"); filter.SearchString = "Test"; Assert.IsTrue(filter.ShowNode(node)); filter.SearchString = "test"; Assert.IsTrue(filter.ShowNode(node)); }
internal abstract IEnumerable <FieldInfo> GetFieldsCore(NameFilter filter, Type reflectedType);
public void UseWildcard_Set_RaisesFilterChangedEvent() { NameFilter filter = new NameFilter(); AssertActionRaisesFilterChangedEvent(filter, () => filter.UseWildcard = true); }
internal sealed override IEnumerable <RoType> GetNestedTypesCore(NameFilter filter) => Array.Empty <RoType>();
public void UseWildcard_SetTrue_ShowsNodesWithNameContainingSearchString() { NameFilter filter = new NameFilter(); filter.UseWildcard = true; IMaxNode node = CreateNodeWithName("Test"); filter.SearchString = "T"; Assert.IsTrue(filter.ShowNode(node)); filter.SearchString = "est"; Assert.IsTrue(filter.ShowNode(node)); filter.SearchString = "st"; Assert.IsTrue(filter.ShowNode(node)); filter.SearchString = "s"; Assert.IsTrue(filter.ShowNode(node)); }
// Low level support for the BindingFlag-driven enumerator apis. internal sealed override IEnumerable <ConstructorInfo> GetConstructorsCore(NameFilter filter) => _genericTypeDefinition.SpecializeConstructors(filter, this);
public void Constructor_SetsDefaultValues() { NameFilter filter = new NameFilter(); Assert.AreEqual(String.Empty, filter.SearchString); Assert.AreEqual(false, filter.CaseSensitive); }
internal sealed override IEnumerable <PropertyInfo> GetPropertiesCore(NameFilter filter, Type reflectedType) => _genericTypeDefinition.SpecializeProperties(filter, reflectedType, this);
internal abstract IEnumerable <MethodInfo> GetMethodsCore(NameFilter filter, Type reflectedType);
/// <summary> /// Initialise a new instance of <see cref = "PathFilter"></see>. /// </summary> /// <param name = "filter">The <see cref = "NameFilter">filter</see> expression to apply.</param> public IsolatedPathFilter(string filter) { nameFilter_ = new NameFilter(filter); }
public void SearchString_Set_RaisesFilterChangedEvent() { NameFilter filter = new NameFilter(); AssertActionRaisesFilterChangedEvent(filter, () => filter.SearchString = "Test"); }
void Run(string[] args) { bool recurse = false; string arg1 = null; string arg2 = null; string fileFilter = null; string dirFilter = null; bool verbose = false; bool restoreDates = false; bool restoreAttributes = false; bool progress = false; TimeSpan interval = TimeSpan.FromSeconds(1); bool createEmptyDirs = false; FastZip.Overwrite overwrite = FastZip.Overwrite.Always; FastZip.ConfirmOverwriteDelegate confirmOverwrite = null; Operation op = Operation.Unknown; int argCount = 0; for (int i = 0; i < args.Length; ++i) { if (args[i][0] == '-') { string option = args[i].Substring(1).ToLower(); string optArg = ""; int parameterIndex = option.IndexOf('='); if (parameterIndex >= 0) { if (parameterIndex < option.Length - 1) { optArg = option.Substring(parameterIndex + 1); } option = option.Substring(0, parameterIndex); } switch (option) { case "e": case "empty": createEmptyDirs = true; break; case "x": case "extract": if (op == Operation.Unknown) { op = Operation.Extract; } else { Console.WriteLine("Only one operation at a time is permitted"); op = Operation.Error; } break; case "c": case "create": if (op == Operation.Unknown) { op = Operation.Create; } else { Console.WriteLine("Only one operation at a time is permitted"); op = Operation.Error; } break; case "l": case "list": if (op == Operation.Unknown) { op = Operation.List; } else { Console.WriteLine("Only one operation at a time is permitted"); op = Operation.Error; } break; case "p": case "progress": progress = true; verbose = true; break; case "r": case "recurse": recurse = true; break; case "v": case "verbose": verbose = true; break; case "i": if (optArg.Length > 0) { interval = TimeSpan.FromSeconds(int.Parse(optArg)); } break; case "file": if (NameFilter.IsValidFilterExpression(optArg)) { fileFilter = optArg; } else { Console.WriteLine("File filter expression contains an invalid regular expression"); op = Operation.Error; } break; case "dir": if (NameFilter.IsValidFilterExpression(optArg)) { dirFilter = optArg; } else { Console.WriteLine("Path filter expression contains an invalid regular expression"); op = Operation.Error; } break; case "o": case "overwrite": switch (optArg) { case "always": overwrite = FastZip.Overwrite.Always; confirmOverwrite = null; break; case "never": overwrite = FastZip.Overwrite.Never; confirmOverwrite = null; break; case "prompt": overwrite = FastZip.Overwrite.Prompt; confirmOverwrite = new FastZip.ConfirmOverwriteDelegate(ConfirmOverwrite); break; default: Console.WriteLine("Invalid overwrite option"); op = Operation.Error; break; } break; case "oa": restoreAttributes = true; break; case "od": restoreDates = true; break; default: Console.WriteLine("Unknown option {0}", args[i]); op = Operation.Error; break; } } else if (arg1 == null) { arg1 = args[i]; ++argCount; } else if (arg2 == null) { arg2 = args[i]; ++argCount; } } FastZipEvents events = null; if (verbose) { events = new FastZipEvents(); //events.ProcessDirectory = new ProcessDirectoryHandler(ProcessDirectory); events.ProcessDirectory += new EventHandler <DirectoryEventArgs>(ProcessDirectory); events.ProcessFile = new ProcessFileHandler(ProcessFile); if (progress) { events.Progress = new ProgressHandler(ShowProgress); events.ProgressInterval = interval; } } var fastZip = new FastZip(events); fastZip.CreateEmptyDirectories = createEmptyDirs; fastZip.RestoreAttributesOnExtract = restoreAttributes; fastZip.RestoreDateTimeOnExtract = restoreDates; switch (op) { case Operation.Create: if (argCount == 2) { Console.WriteLine("Creating Zip"); fastZip.CreateZip(arg1, arg2, recurse, fileFilter, dirFilter); } else { Console.WriteLine("Invalid arguments"); } break; case Operation.Extract: if (argCount == 2) { Console.WriteLine("Extracting Zip"); fastZip.ExtractZip(arg1, arg2, overwrite, confirmOverwrite, fileFilter, dirFilter, restoreDates); } else { Console.WriteLine("zipfile and target directory not specified"); } break; case Operation.List: if (File.Exists(arg1)) { ListZipFile(arg1, fileFilter, dirFilter); } else if (Directory.Exists(arg1)) { ListFileSystem(arg1, recurse, fileFilter, dirFilter); } else { Console.WriteLine("No valid list file or directory"); } break; case Operation.Unknown: Console.WriteLine( "FastZip v0.5\n" + " Usage: FastZip {options} operation args\n" + "Operation Options: (only one permitted)\n" + " -x zipfile targetdir : Extract files from Zip\n" + " -c zipfile sourcedir : Create zip file\n" + " -l zipfile|dir : List elements\n" + "\n" + "Behavioural options:\n" + " -dir={dirFilter}\n" + " -file={fileFilter}\n" + " -e Process empty directories\n" + " -i Progress interval in seconds\n" + " -p Show file progress\n" + " -r Recurse directories\n" + " -v Verbose output\n" + " -oa Restore file attributes on extract\n" + " -ot Restore file date time on extract\n" + " -overwrite=prompt|always|never : Overwrite on extract handling\n" ); break; case Operation.Error: // Do nothing for now... break; } }
internal sealed override IEnumerable <ConstructorInfo> GetConstructorsCore(NameFilter filter) => Array.Empty <ConstructorInfo>();
// Low level support for the BindingFlag-driven enumerator apis. internal sealed override IEnumerable <ConstructorInfo> GetConstructorsCore(NameFilter filter) => throw null;
/// <summary> /// Initialize a new instance of <see cref="PathFilter"></see>. /// </summary> /// <param name="filter">The <see cref="NameFilter">filter</see> expression to apply.</param> public PathFilter(string filter) { nameFilter_ = new NameFilter(filter); }
internal sealed override IEnumerable <FieldInfo> GetFieldsCore(NameFilter filter, Type reflectedType) => throw null;
// Low level support for the BindingFlag-driven enumerator apis. These return members declared (not inherited) on the current // type, possibly doing case-sensitive/case-insensitive filtering on a supplied name. internal abstract IEnumerable <ConstructorInfo> GetConstructorsCore(NameFilter filter);
internal sealed override IEnumerable <RoType> GetNestedTypesCore(NameFilter filter) => throw null;
internal abstract IEnumerable <EventInfo> GetEventsCore(NameFilter filter, Type reflectedType);
internal sealed override IEnumerable <MethodInfo> GetMethodsCore(NameFilter filter, Type reflectedType) => Array.Empty <MethodInfo>();
public void SearchString_UsingAsterisk_WorksAsWildcard() { NameFilter filter = new NameFilter(); IMaxNode node = CreateNodeWithName("LoremIpsum"); filter.SearchString = "ipsum"; Assert.IsFalse(filter.ShowNode(node)); filter.SearchString = "*ipsum"; Assert.IsTrue(filter.ShowNode(node)); filter.SearchString = "Lor*sum"; Assert.IsTrue(filter.ShowNode(node)); }
private testcaseType RunTest(TestMethod t) { TestFilter filter = new NameFilter(t.TestName); var result = (t as TestMethod).Run(new TestListener(), filter); //result types //Ignored, Failure, NotRunnable, Error, Success var testCase = new testcaseType { name = t.TestName.Name, executed = result.Executed.ToString(), success = result.IsSuccess.ToString(), asserts = result.AssertCount.ToString(CultureInfo.InvariantCulture), time = result.Time.ToString(CultureInfo.InvariantCulture) }; switch (result.ResultState) { case ResultState.Cancelled: testCase.result = "Cancelled"; break; case ResultState.Error: var f = new failureType {message = result.Message, stacktrace = result.StackTrace}; testCase.Item = f; testCase.result = "Error"; break; case ResultState.Failure: var fail = new failureType {message = result.Message, stacktrace = result.StackTrace}; testCase.Item = fail; testCase.result = "Failure"; break; case ResultState.Ignored: testCase.result = "Ignored"; break; case ResultState.Inconclusive: testCase.result = "Inconclusive"; break; case ResultState.NotRunnable: testCase.result = "NotRunnable"; break; case ResultState.Skipped: testCase.result = "Skipped"; break; case ResultState.Success: testCase.result = "Success"; break; } return testCase; }
internal sealed override IEnumerable <PropertyInfo> GetPropertiesCore(NameFilter filter, Type reflectedType) => Array.Empty <PropertyInfo>();
private TestFilter MakeNameFilter( ITest[] tests ) { if ( tests == null || tests.Length == 0 ) return TestFilter.Empty; NameFilter nameFilter = new NameFilter(); foreach( ITest test in tests ) nameFilter.Add( test.TestName ); return nameFilter; }
void OnScanResult(IScanResult result) { Device.BeginInvokeOnMainThread(() => { var dev = this.Devices.FirstOrDefault(x => x.Uuid.Equals(result.Device.Uuid)); if (dev != null) { dev.TrySet(result); } else { if (string.IsNullOrEmpty(NameFilter) || (!string.IsNullOrEmpty(result.Device.Name) && result.Device.Name.ToLower().Contains(NameFilter.ToLower()))) { dev = new ScanResultViewModel(); dev.TrySet(result); this.Devices.Add(dev); } } }); }