Пример #1
0
 public static void SetOutput(TextWriter anOutput)
 {
     _out = null;
     if (anOutput != null)
     {
         _out = new WrapperTextWriter(anOutput);
     }
 }
Пример #2
0
 public static void SetOutput(Application anApp)
 {
     _out = null;
     if (anApp != null)
     {
         _out = new WrapperApplication(anApp);
     }
 }
 public PlaybackControl(IUPnP sink)
 {
     UPnPSink = sink;
     Player = new MPlayerWrapper();
     PlayQueueHandler = new PlayqueueHandler();
     XMLconverter = new XMLReader1();
     SubscribeToWrapper();
     SubscribeToSink();
 }
Пример #4
0
 private static void Output(IWrapper wrapper, IMatchResult results)
 {
     Console.WriteLine(wrapper.GetType().Name);
     foreach (var item in wrapper.AvailableProperties)
     {
         Console.WriteLine("{0} -> {1}",
             item,
             results.getValue(item));
     }
 }
Пример #5
0
        private void wrapTest(
            int id,
            byte[]  kek,
            byte[]  iv,
            byte[]  input,
            byte[]  output)
        {
            try
            {
                IWrapper wrapper = WrapperUtilities.GetWrapper("DESedeWrap");

                KeyParameter desEdeKey = new DesEdeParameters(kek);
                wrapper.Init(true, new ParametersWithIV(desEdeKey, iv));

                try
                {
//					byte[] cText = wrapper.Wrap(new SecretKeySpec(input, "DESEDE"));
                    byte[] cText = wrapper.Wrap(input, 0, input.Length);

                    if (!Arrays.AreEqual(cText, output))
                    {
                        Fail("failed wrap test " + id + " expected "
                             + Hex.ToHexString(output) + " got " + Hex.ToHexString(cText));
                    }
                }
                catch (Exception e)
                {
                    Fail("failed wrap test exception " + e.ToString());
                }

                wrapper.Init(false, desEdeKey);

                try
                {
//					Key pText = wrapper.unwrap(output, "DESede", IBufferedCipher.SECRET_KEY);
                    byte[] pText = wrapper.Unwrap(output, 0, output.Length);
//					if (!Arrays.AreEqual(pText.getEncoded(), input))
                    if (!Arrays.AreEqual(pText, input))
                    {
                        Fail("failed unwrap test " + id + " expected "
                             + Hex.ToHexString(input) + " got "
                             + Hex.ToHexString(pText));
                    }
                }
                catch (Exception e)
                {
                    Fail("failed unwrap test exception " + e.ToString());
                }
            }
            catch (Exception ex)
            {
                Fail("failed exception " + ex.ToString());
            }
        }
Пример #6
0
        public void WrapAll_EmptyCollection_CountZero()
        {
            Person[] people = new Person[] {};

            IWrapper wrapper    = WrapperBuilder.WithServer("http://api.example.com").Build();
            var      collection = wrapper.WrapAll <Person>(people);

            collection.Meta["count"] = 0;

            Assert.That(collection.Data.Count(), Is.EqualTo(0));
        }
Пример #7
0
        public void WrapAll_SmallCollection_CountMatches()
        {
            Person[] people = { _person1, _person2 };

            IWrapper wrapper    = WrapperBuilder.WithServer("http://api.example.com").Build();
            var      collection = wrapper.WrapAll <Person>(people);

            collection.Meta["count"] = people.Length;

            Assert.That(collection.Data.Count(), Is.EqualTo(2));
        }
Пример #8
0
        public static IWrapper <TWrapper> OuterJoin <TWrapper>(this IWrapper <TWrapper> command, ITableSource table, IDbFragment <bool> on)
            where TWrapper : IWrapper <JoinClause>
        {
            Check.IsNotNull(command, nameof(command));
            Check.IsNotNull(table, nameof(table));
            Check.IsNotNull(on, nameof(on));

            command.Value.Value.Add("outer join", table, on);

            return(command);
        }
Пример #9
0
        public virtual bool IsMouseOver()
        {
            IWrapper wrapper = GetWrapper();

            if (wrapper is IWrapper)
            {
                return(AbsoluteBounds.Contains(wrapper.CurrentMousePosition));
            }

            return(false);
        }
        public AnswerOptionService(WrapperAnswerOption wrap)
        {
            wrapper = wrap;
            var config = new MapperConfiguration(x =>
            {
                x.CreateMap <AnswerOptionDTO, AnswerOption>();
                x.CreateMap <AnswerOption, AnswerOptionDTO>();
            });

            mapper = config.CreateMapper();
        }
Пример #11
0
		public RecipientInfo Generate(KeyParameter contentEncryptionKey, SecureRandom random)
		{
			byte[] keyBytes = contentEncryptionKey.GetKey();

			IWrapper keyWrapper = Helper.CreateWrapper(keyEncryptionAlgorithm.ObjectID.Id);
			keyWrapper.Init(true, new ParametersWithRandom(keyEncryptionKey, random));
        	Asn1OctetString encryptedKey = new DerOctetString(
				keyWrapper.Wrap(keyBytes, 0, keyBytes.Length));

			return new RecipientInfo(new KekRecipientInfo(kekIdentifier, keyEncryptionAlgorithm, encryptedKey));
		}
 /// <summary>
 /// Constructor. Creates Audio Player Wrapper, XMLreader and XMLwriter and subscribes to wrapper and UPnP Sink
 /// </summary>
 /// <param name="sink">UPnP Sink</param>
 /// <param name="pqhandl">Playqueue Handler</param>
 public PlaybackControl(IUPnP sink, IPlayqueueHandler pqhandl)
 {
     UPnPSink = sink;
     Player = new MPlayerWrapper();
     PlayQueueHandler = pqhandl;
     XMLconverter = new XMLReader.XMLReader();
     wr = new XMLWriter();
     SubscribeToWrapper();
     SubscribeToSink();
     _TransportState = "STOPPED";
 }
Пример #13
0
        public TeacherService(WrapperTeacher wrap)
        {
            wrapper = wrap;
            var config = new MapperConfiguration(x =>
            {
                x.CreateMap <TeacherDTO, Teasher>();
                x.CreateMap <Teasher, TeacherDTO>();
            });

            mapper = config.CreateMapper();
        }
        public override void Select(string name, string itemName, IWrapper <SqlServerQueryCommand> childQuery, IDbFragment value)
        {
            childQuery
            .ForJsonPath()
            .Select(value)
            .As(itemName);

            //childQuery.Select(DbFunctions.Coalesce(SqlServerDbFunctions.JsonAgg(expression), SqlServerDbFunctions.Cast("[]", new JsonColumnType())));

            command.Select(db.Functions.JsonQuery(db.Functions.Coalesce(childQuery.Value, "[]".DbValue()))).As(name);
        }
Пример #15
0
        protected void UnRegisterComplex <TModelWrapper>(IWrapper <TModelWrapper> wrapper)
            where TModelWrapper : class, IBaseEntity
        {
            if (wrapper == null || !_trackingObjects.Contains(wrapper))
            {
                return;
            }

            _trackingObjects.Remove(wrapper);
            wrapper.PropertyChanged -= TrackingObjectOnPropertyChanged;
        }
Пример #16
0
        public IKeyUnwrapper <TWrapParam> CreateKeyUnwrapper(TWrapParam parameters)
        {
            if (CryptoServicesRegistrar.IsInApprovedOnlyMode())
            {
                throw new CryptoUnapprovedOperationError("Attempt to create unapproved key unwrapper in approved only mode");
            }

            IWrapper wrapper = ProviderUtils.CreateWrapper(name, parameters.Algorithm.Mode, parameters.IsUsingInverseFunction, false, engineProvider);

            return(new KeyUnwrapperImpl <TWrapParam>(parameters, wrapper));
        }
Пример #17
0
 public static void ProfileOverride(IWrapper wrapper, IDataValidator validator)
 {
     string[] profileIds = { "12280", "17779", "17470", "18092" };
     using (var data = wrapper.Pipeline.CreateFlowData())
     {
         data.AddEvidence("header.user-agent", "some user agent")
         .AddEvidence("query.51D_ProfileIds", string.Join("|", profileIds))
         .Process();
         validator.ValidateProfileIds(data, profileIds);
     }
 }
Пример #18
0
        public static IWrapper <T> Set <T, TSetter>(this IWrapper <T> command, IDbFragment <TSetter> lhs, IDbFragment <TSetter> rhs)
            where T : IWrapper <UpdateClause>
        {
            Check.IsNotNull(command, nameof(command));
            Check.IsNotNull(lhs, nameof(lhs));
            Check.IsNotNull(rhs, nameof(rhs));

            command.Value.Value.Add(lhs, rhs);

            return(command);
        }
Пример #19
0
        public static IWrapper <T> Set <T, TSetter>(this IWrapper <T> command, IDbFragment <TSetter> lhs, TSetter?rhs)
            where T : IWrapper <UpdateClause>
            where TSetter : struct
        {
            Check.IsNotNull(command, nameof(command));
            Check.IsNotNull(lhs, nameof(lhs));

            command.Value.Value.Add(lhs, new ConstantValue(rhs));

            return(command);
        }
Пример #20
0
        /// <summary>ASP.NET Core version of setting up IoC and builders.</summary>
        /// <param name="mode">Always use ReCreate to recreate the IoC container before each test.</param>
        /// <param name="webHostBuilder">The ASP.NET Core web host builder from production code, overridden with mocks using .ConfigureTestServices().</param>
        /// <param name="iocContainerFactory">Creates the IoC container, such as e.g. 'provider => new IocContainer(provider)'.</param>
        /// <remarks>The passed in web host builder is used to create a <c>TestHost</c>.
        /// A client is created and can be accessed through <c>GetHttpClient()</c>.
        /// The test host instance is disposed as the first step of initialisation.</remarks>
        public static void Initialize(CleanContextMode mode, Func <IWebHostBuilder> webHostBuilder, Func <IServiceProvider, IIocContainer> iocContainerFactory) =>
        ContextBuilderFactory.Initialize(mode, () =>
        {
            _wrapped?.DisposeAndRemove();

            var testServer = new TestServer(webHostBuilder());
            _wrapped       = new Wrapper(testServer, testServer.CreateClient());
            IServiceProvider serviceProvider = testServer.Host.Services;

            return(iocContainerFactory(serviceProvider));
        });
Пример #21
0
        public static IWrapper <TWrapper> Union <TWrapper, T>(this IWrapper <TWrapper> command, SqlServerQueryBase <T> select)
            where TWrapper : IWrapper <UnionClause>
        {
            Check.IsNotNull(command, nameof(command));
            Check.IsNotNull(select, nameof(select));

            command.Value.Value.Method = "union";
            command.Value.Value.Select = select;

            return(command);
        }
Пример #22
0
        /// <summary>ASP.NET Core version of setting up IoC and builders.</summary>
        /// <param name="mode">Always use ReCreate to recreate the IoC container before each test.</param>
        /// <param name="factoryFactory">The factory used to create a WebApplicationFactory&lt;T&gt; instance.</param>
        /// <param name="iocContainerFactory">Creates the IoC container, such as e.g. 'provider => new IocContainer(provider)'.</param>
        /// <typeparam name="T">The Startup class of the unit under test.</typeparam>
        public static void Initialize <T>(CleanContextMode mode, Func <WebApplicationFactory <T> > factoryFactory, Func <IServiceProvider, IIocContainer> iocContainerFactory) where T : class =>
        ContextBuilderFactory.Initialize(mode, () =>
        {
            _wrapped?.DisposeAndRemove();

            var factory = new FactoryWrapper <T>(factoryFactory);
            _wrapped    = factory;
            IServiceProvider serviceProvider = factory.GetFactory()?.Services;

            return(iocContainerFactory(serviceProvider));
        });
Пример #23
0
        public static IWrapper <TWrapper> ExceptAll <TWrapper, T>(this IWrapper <TWrapper> command, PostgresQueryBase <T> select)
            where TWrapper : IWrapper <UnionClause>
        {
            Check.IsNotNull(command, nameof(command));
            Check.IsNotNull(select, nameof(select));

            command.Value.Value.Method = "except all";
            command.Value.Value.Select = select;

            return(command);
        }
Пример #24
0
        public Watcher([NotNull] IWrapper wrapper,
                       [NotNull] ISubject <DateTime> started)
        {
            Guard.ArgumentNotNull(wrapper,
                                  nameof(wrapper));
            Guard.ArgumentNotNull(started,
                                  nameof(started));

            _wrapper         = wrapper;
            _startedWatching = started;
        }
Пример #25
0
        public void Stop_ForIsListeningFalse_DoesNotCallWatcherStop(
            Watcher sut,
            [Freeze] IWrapper wrapper)
        {
            wrapper.Status
            .Returns(Status.Created);

            sut.Stop();

            wrapper.DidNotReceive()
            .Stop();
        }
Пример #26
0
        public void Start_ForIsListeningTrue_DoesNotCallWatcherStart(
            Watcher sut,
            [Freeze] IWrapper wrapper)
        {
            wrapper.Status
            .Returns(Status.Started);

            sut.Start();

            wrapper.DidNotReceive()
            .Start();
        }
Пример #27
0
        public void Stop_ForIsListeningTrue_CallsWatcherStop(
            Watcher sut,
            [Freeze] IWrapper wrapper)
        {
            wrapper.Status
            .Returns(Status.Started);

            sut.Stop();

            wrapper.Received()
            .Stop();
        }
        public AnswerOptionService()
        {
            wrapper = new WrapperAnswerOption(new TestModel());
            var config = new MapperConfiguration(x =>
            {
                x.CreateMap <AnswerOptionDTO, AnswerOption>();
                x.CreateMap <AnswerOption, AnswerOptionDTO>();
            }
                                                 );

            mapper = config.CreateMapper();
        }
Пример #29
0
        public UIMenu(IPlatoHelper helper, IWrapper menu)
            :  base(0, 0, Game1.viewport.Width, Game1.viewport.Height, false)
        {
#if ANDROID
#else
            LastUIZoom = Game1.options.desiredUIScale;
            Game1.options.desiredUIScale = Game1.options.desiredBaseZoomLevel;
#endif
            Helper = helper;
            Menu   = menu;
            Helper.ModHelper.Events.GameLoop.UpdateTicked += ResetZoom;
        }
Пример #30
0
        private KeyParameter UnwrapSessionKey(
            string wrapAlg,
            KeyParameter agreedKey)
        {
            byte[] encKeyOctets = encryptedKey.GetOctets();

            IWrapper keyCipher = WrapperUtilities.GetWrapper(wrapAlg);

            keyCipher.Init(false, agreedKey);
            byte[] sKeyBytes = keyCipher.Unwrap(encKeyOctets, 0, encKeyOctets.Length);
            return(ParameterUtilities.CreateKeyParameter(GetContentAlgorithmName(), sKeyBytes));
        }
Пример #31
0
        public void Start_ForIsListeningFalse_CallsWatcherStart(
            Watcher sut,
            [Freeze] IWrapper wrapper)
        {
            wrapper.Status
            .Returns(Status.Created);

            sut.Start();

            wrapper.Received()
            .Start();
        }
Пример #32
0
        public void Start_ForIsListeningFalse_PublishesStarted(
            Watcher sut,
            [Freeze] IWrapper wrapper,
            [Freeze] ISubject <DateTime> subject)
        {
            wrapper.Status
            .Returns(Status.Created);

            sut.Start();

            subject.OnNext(Arg.Any <DateTime>());
        }
Пример #33
0
        public TeacherService()
        {
            wrapper = new WrapperTeacher(new TestModel());
            var config = new MapperConfiguration(x =>
            {
                x.CreateMap <TeacherDTO, Teasher>();
                x.CreateMap <Teasher, TeacherDTO>();
            }
                                                 );

            mapper = config.CreateMapper();
        }
Пример #34
0
        public QuestionService()
        {
            wrapper = new WrapperQuestion(new TestModel());
            var config = new MapperConfiguration(x =>
            {
                x.CreateMap <QuestionDTO, Question>();
                x.CreateMap <Question, QuestionDTO>();
            }
                                                 );

            mapper = config.CreateMapper();
        }
 public void Register(IWrapper Child)
 {
     if (disposed)
     {
         throw new ObjectDisposedException("Cannot register children after disposing");
     }
     if (children == null)
     {
         children = new List <IWrapper>();
     }
     children.Add(Child);
 }
Пример #36
0
        public void TextReady(IWrapper sender)
        {
            lock (_currentLines)
            {
                _currentLine = new StringBuilder(_wrapper.GetCurrentLine());

                ConsoleString[] strings = sender.GetText();
                foreach (ConsoleString str in strings)
                {
                    _currentLines.Add(str);
                }
            }
            ProcessText();
        }
Пример #37
0
 public DXGUI()
 {
     InitializeComponent();
     _currentLine = new StringBuilder();
     _prevLines.Add("");
     _currentInput = new StringBuilder();
     _currentInputLocation = 0;
     _graphics = new WrapperGraphics(this);
     _graphics.AddLine(new ConsoleString("Welcome to the DirectX Console Wrapper!", Color.FromArgb(255, 63, 63)));
     _graphics.AddLine(new ConsoleString("Use Ctrl-(Up/Down/Home/End) :: PageUp/PageDown :: MouseWheel for navigation.", Color.FromArgb(255, 127, 0)));
     _graphics.AddLine(new ConsoleString("ConsoleWrapper Copyright (c) Tom Mitchell 2007-2008", Color.FromArgb(255, 255, 0)));
     _graphics.AddLine(new ConsoleString(" "));
     _wrapper = new WrapperShell();
     _wrapper.AddListener(this);
 }
Пример #38
0
        public MainForm( Options options, IWrapper wrapper )
        {
            InitializeComponent();
            m_Options   = options;
            cmbBackend.DisplayMember  = "Name";
            cmbLanguage.DisplayMember = "Name";

            List<ILanguage> languages = new List<ILanguage>();
            languages.Add(new HLSLLanguage());
            languages.Add(new GLSLLanguage());
            m_Languages = languages;

            foreach (ILanguage l in m_Languages)
                cmbLanguage.Items.Add(l);

            cmbLanguage.SelectedIndex = 0;

            m_Wrapper = wrapper;
            CreateBackends(options);

            txtCode.AllowDrop = true;
            txtCode.DragEnter +=
                delegate( object sender, DragEventArgs args )
                {
                    if (args.Data.GetDataPresent(DataFormats.FileDrop))
                        args.Effect = DragDropEffects.Move;
                    else
                        args.Effect = DragDropEffects.None;
                };

            txtCode.DragDrop +=
                delegate(object sender, DragEventArgs args)
                {
                    if (args.Data.GetDataPresent(DataFormats.FileDrop))
                    {
                        string[] paths = args.Data.GetData(DataFormats.FileDrop) as string[];
                        OpenFile(paths[0]);
                    }
                };
        }
Пример #39
0
 /// <summary>
 /// gets an instance of the wrapper,
 /// runs initialization method,
 /// enables movement control for the AXIS_Robot and homes the robot
 /// </summary>
 public Robot()
 {
     // Initialize and set settings
     _serialStk = new SerialSTK();
     _wrapper = Wrapper.getInstance();
     initialization();
     _wrapper.controlWrapped(Wrapper.enumAxisSettings.AXIS_ROBOT, true);
     movementlock = new Semaphore(1,1);
     cubeAtConveyorBelt = true;
     _wrapper.watchMotionWrapped(dgateMovementStopped, dgateMovementStarted);
     _wrapper.watchDigitalInputWrapped(dgateWatchDigitalInput);
 }
Пример #40
0
 public GLSLOptimizerBackend(IWrapper wrapper)
 {
     foreach( GLSLOptimizer.Target t in Enum.GetValues(typeof(GLSLOptimizer.Target)))
         m_Optimizers.Add( t, wrapper.CreateGLSLOptimizer(t));
 }
Пример #41
0
		private void doTestChecksum(
			byte[]		kek,
			byte[]		iv,
			byte[]		block,
			IWrapper	wrapper)
		{
			encryptBlock(kek, iv, block);

			try
			{
				wrapper.Unwrap(block, 0, block.Length);

				Fail("bad checksum not detected");
			}
			catch (InvalidCipherTextException e)
			{
				if (!e.Message.Equals("wrapped key fails checksum"))
				{
					Fail("wrong exception");
				}
			}
		}
Пример #42
0
        public void WrapperFinished(IWrapper sender)
        {
            lock (_wrappers)
            {
                _wrappers.Remove(sender);
            }

            if (_wrappers.Count == 0)
            {
                _currentLine = _currentDirectory.FullName + "> ";
            }
        }
Пример #43
0
        public void TextReady(IWrapper sender)
        {
            //_currentLine = new StringBuilder(_wrapper.GetCurrentLine());

            ConsoleString[] strings = sender.GetText();

            lock (_availableLines)
            {
                foreach (ConsoleString str in strings)
                {
                    _availableLines.Add(str);
                }
            }

            _currentLine = sender.GetCurrentLine();

            StartAlertListeners();
        }
Пример #44
0
 /// <summary>
 ///     FileDataAccess
 /// </summary>
 /// <param name="wrapper"></param>
 public FileDataAccess(IWrapper wrapper)
 {
     _wrapper = wrapper;
 }
Пример #45
0
 public static void ResetOutput()
 {
     _out = new WrapperTextWriter(Console.Out);
 }
Пример #46
0
 public Application(IWrapper thirdPartyLibraryWrapper)
 {
     this.thirdPartyLibraryWrapper = thirdPartyLibraryWrapper;
 }
Пример #47
0
 public GLSlangBackend( IWrapper wrapper )
 {
     m_Compiler = wrapper.CreateGLSlangCompiler();
     m_Config = m_Compiler.CreateDefaultConfig();
 }
Пример #48
0
 /// <summary>
 /// Using multiple threads loops through the useragents in the file
 /// provided perform a match with the data set provided passing
 /// control back to the method provided for further processing.
 /// </summary>
 /// <param name="provider"></param>
 /// <param name="userAgents"></param>
 /// <param name="method"></param>
 /// <returns>Counts for each of the methods used</returns>
 internal static Results DetectLoopMultiThreaded(IWrapper provider, IEnumerable<string> userAgents, ProcessMatch method, object state)
 {
     var results = new Results();
     Parallel.ForEach(userAgents, line =>
     {
         try
         {
             using (var match = provider.Match(line.Trim()))
             {
                 method(results, match, state);
             }
             Interlocked.Increment(ref results.Count);
         }
         catch(AccessViolationException ex)
         {
             Console.WriteLine(line);
             Console.WriteLine(ex.Message);
             Console.WriteLine(ex.StackTrace);
         }
     });
     ReportTime(results);
     return results;
 }
Пример #49
0
 private void DXGUI_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode.Equals(Keys.Enter) || e.KeyCode.Equals(Keys.Return))
     {
         _prevLines.Insert(_prevLines.Count - 1, _currentInput.ToString());
         _prevLineNum = _prevLines.Count - 1;
         _wrapper.SendLine(_currentInput.ToString(), ConsoleString.StringType.Input);
         _currentInput = new StringBuilder();
         _currentInputLocation = 0;
     }
     else if (e.KeyCode.Equals(Keys.Back))
     {
         if (_currentInput.Length > 0 && _currentInputLocation > 0)
         {
             _currentInput.Remove(_currentInputLocation - 1, 1);
             _currentInputLocation--;
             UpdateCurrentLine();
         }
     }
     else if (e.KeyCode.Equals(Keys.Delete))
     {
         if (_currentInput.Length > 0 && _currentInputLocation < _currentInput.Length)
         {
             _currentInput.Remove(_currentInputLocation, 1);
             UpdateCurrentLine();
         }
     }
     else if (e.KeyCode.Equals(Keys.Left))
     {
         if (_currentInputLocation > 0)
         {
             _currentInputLocation--;
             UpdateCurrentLine();
         }
     }
     else if (e.KeyCode.Equals(Keys.Right))
     {
         if (_currentInputLocation < _currentInput.Length)
         {
             _currentInputLocation++;
             UpdateCurrentLine();
         }
     }
     else if (e.Control && e.KeyCode.Equals(Keys.Home))
     {
         _graphics.MoveViewHome();
     }
     else if (e.Control && e.KeyCode.Equals(Keys.End))
     {
         _graphics.MoveViewEnd();
     }
     else if (e.KeyCode.Equals(Keys.Home))
     {
         _currentInputLocation = 0;
         UpdateCurrentLine();
     }
     else if (e.KeyCode.Equals(Keys.End))
     {
         _currentInputLocation = _currentInput.Length;
         UpdateCurrentLine();
     }
     else if (e.Control && e.KeyCode.Equals(Keys.Up))
     {
         _graphics.MoveView(-2);
     }
     else if (e.Control && e.KeyCode.Equals(Keys.Down))
     {
         _graphics.MoveView(2);
     }
     else if (e.KeyCode.Equals(Keys.Up))
     {
         _prevLineNum--;
         _prevLineNum = Math.Max(0, _prevLineNum);
         _currentInput = new StringBuilder(_prevLines[_prevLineNum]);
         _currentInputLocation = _currentInput.Length;
         _graphics.CurrentLine.Text = CurrentLineWithCaret();
     }
     else if (e.KeyCode.Equals(Keys.Down))
     {
         _prevLineNum++;
         _prevLineNum = Math.Min(_prevLines.Count - 1, _prevLineNum);
         _currentInput = new StringBuilder(_prevLines[_prevLineNum]);
         _currentInputLocation = _currentInput.Length;
         _graphics.CurrentLine.Text = CurrentLineWithCaret();
     }
     else if (e.KeyCode.Equals(Keys.PageUp))
     {
         _graphics.MoveView(-30);
     }
     else if (e.KeyCode.Equals(Keys.PageDown))
     {
         _graphics.MoveView(30);
     }
     else if (e.Control && e.KeyCode.Equals(Keys.C))
     {
         DirectoryInfo currentDirectory = ((WrapperShell)_wrapper).CurrentDirectory;
         _wrapper.Dispose();
         _wrapper = new WrapperShell(currentDirectory);
         _wrapper.AddListener(this);
     }
 }
Пример #50
0
 /// <summary>
 /// In a single thread loops through the useragents in the file
 /// provided perform a match with the data set provided passing
 /// control back to the method provided for further processing.
 /// </summary>
 /// <param name="provider"></param>
 /// <param name="userAgents"></param>
 /// <param name="method"></param>
 /// <returns>Counts for each of the methods used</returns>
 internal static Results DetectLoopSingleThreaded(IWrapper provider, IEnumerable<string> userAgents, ProcessMatch method, object state)
 {
     var results = new Results();
     foreach (var line in userAgents)
     {
         try
         {
             using (var match = provider.Match(line.Trim()))
             {
                 method(results, match, state);
             }
         }
         catch (AccessViolationException ex)
         {
             Console.WriteLine(line);
             Console.WriteLine(ex.Message);
             Console.WriteLine(ex.StackTrace);
         }
         results.Count++;
     }
     ReportTime(results);
     return results;
 }
Пример #51
0
 public void WrapperFinished(IWrapper sender)
 {
     WrapperFinished();
 }