예제 #1
0
   //==========================================================================

   private OutlinerGUP()
   {
      this.TreeModes = new Dictionary<TreeView, TreeMode>();
      this.currentPresets = new Dictionary<TreeView, OutlinerPreset>();

      this.CommonNameFilter = new NameFilter();
   }
예제 #2
0
   public void Enabled_Get_ReturnsSearchStringNotEmpty()
   {
      NameFilter filter = new NameFilter();
      Assert.IsFalse(filter.Enabled);

      filter.SearchString = "Test";
      Assert.IsTrue(filter.Enabled);
   }
예제 #3
0
   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);
   }
예제 #4
0
   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));
   }
예제 #5
0
        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);
        }
예제 #6
0
 internal sealed override IEnumerable <EventInfo> GetEventsCore(NameFilter filter, Type reflectedType) => throw null;
예제 #7
0
 internal sealed override IEnumerable <RoType> GetNestedTypesCore(NameFilter filter) => _genericTypeDefinition.GetNestedTypesCore(filter);
예제 #8
0
        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>();
예제 #10
0
 internal sealed override IEnumerable <FieldInfo> GetFieldsCore(NameFilter filter, Type reflectedType) => _genericTypeDefinition.SpecializeFields(filter, reflectedType, this);
예제 #11
0
 public void CaseSensitive_Set_RaisesFilterChangedEvent()
 {
    NameFilter filter = new NameFilter();
    AssertActionRaisesFilterChangedEvent(filter, () => filter.CaseSensitive = true);
 }
예제 #12
0
파일: Core.cs 프로젝트: sillsdev/WorldPad
 public void ValidFilter()
 {
     Assert.IsTrue(NameFilter.IsValidFilterExpression("a"));
     Assert.IsFalse(NameFilter.IsValidFilterExpression(@"\,)"));
 }
예제 #13
0
 public void ToStringTest(string name)
 {
     Filter<ITestDescriptor> filter = new NameFilter<ITestDescriptor>(new EqualityFilter<string>(name));
     Assert.AreEqual("Name(Equality('" + name + "'))", filter.ToString());
 }
예제 #14
0
   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));
   }
예제 #15
0
        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();
        }
예제 #16
0
 internal abstract IEnumerable <RoType> GetNestedTypesCore(NameFilter filter);
예제 #17
0
 internal abstract IEnumerable <PropertyInfo> GetPropertiesCore(NameFilter filter, Type reflectedType);
예제 #18
0
 internal sealed override IEnumerable <PropertyInfo> GetPropertiesCore(NameFilter filter, Type reflectedType) => throw null;
예제 #19
0
   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));
   }
예제 #20
0
 internal abstract IEnumerable <FieldInfo> GetFieldsCore(NameFilter filter, Type reflectedType);
예제 #21
0
 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>();
예제 #23
0
   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));
   }
예제 #24
0
 // Low level support for the BindingFlag-driven enumerator apis.
 internal sealed override IEnumerable <ConstructorInfo> GetConstructorsCore(NameFilter filter) => _genericTypeDefinition.SpecializeConstructors(filter, this);
예제 #25
0
 public void Constructor_SetsDefaultValues() 
 {
    NameFilter filter = new NameFilter();
    Assert.AreEqual(String.Empty, filter.SearchString);
    Assert.AreEqual(false, filter.CaseSensitive);
 }
예제 #26
0
 internal sealed override IEnumerable <PropertyInfo> GetPropertiesCore(NameFilter filter, Type reflectedType) => _genericTypeDefinition.SpecializeProperties(filter, reflectedType, this);
예제 #27
0
 internal abstract IEnumerable <MethodInfo> GetMethodsCore(NameFilter filter, Type reflectedType);
예제 #28
0
 /// <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);
 }
예제 #29
0
 public void SearchString_Set_RaisesFilterChangedEvent()
 {
    NameFilter filter = new NameFilter();
    AssertActionRaisesFilterChangedEvent(filter, () => filter.SearchString = "Test");
 }
예제 #30
0
    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;
        }
    }
예제 #31
0
 internal sealed override IEnumerable <ConstructorInfo> GetConstructorsCore(NameFilter filter) => Array.Empty <ConstructorInfo>();
예제 #32
0
 // Low level support for the BindingFlag-driven enumerator apis.
 internal sealed override IEnumerable <ConstructorInfo> GetConstructorsCore(NameFilter filter) => throw null;
예제 #33
0
파일: PathFilter.cs 프로젝트: avs009/gsf
		/// <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);
		}
예제 #34
0
 internal sealed override IEnumerable <FieldInfo> GetFieldsCore(NameFilter filter, Type reflectedType) => throw null;
예제 #35
0
 // 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);
예제 #36
0
 internal sealed override IEnumerable <RoType> GetNestedTypesCore(NameFilter filter) => throw null;
예제 #37
0
 internal abstract IEnumerable <EventInfo> GetEventsCore(NameFilter filter, Type reflectedType);
예제 #38
0
 internal sealed override IEnumerable <MethodInfo> GetMethodsCore(NameFilter filter, Type reflectedType) => Array.Empty <MethodInfo>();
예제 #39
0
   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));
   }
예제 #40
0
        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>();
예제 #42
0
        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);
                    }
                }
            });
        }