Esempio n. 1
0
		public WebGet (string[] args)
		{
			try {
				// Tester le tableau d'arguments
				if (args.Length == 0) {
					Console.WriteLine (UsageUtils.GetUsage ());
				}

				switch (args [0]) {

				case "get":
					new GetTask (args);
					break;

				case "test":
					new TestTask (args);
					break;

				default:
					Console.WriteLine (UsageUtils.GetStringUnknownParameter (args [0]));
					break;
				}

			} catch (Exception e) {
				Console.WriteLine ("ERROR");
				Console.WriteLine (e);
			}
		}
Esempio n. 2
0
        private void InitializeAttributes(string[] args)
        {
            // Récupèration des arguments
            for (int i = 0; i <= args.Length - 1; i++)
            {
                if (args[i] == null || String.IsNullOrEmpty(args[i]))
                {
                    throw new Exception(UsageUtils.GetUsage());
                }

                if (args[i] == "-url")
                {
                    ArrayUtils.checkArrayLengthCorrect(i, args.Length);
                    sourceUrl = args[i + 1];
                }
                else if (args[i] == "-times")
                {
                    ArrayUtils.checkArrayLengthCorrect(i, args.Length);
                    time = Int32.Parse(args[i + 1]);
                }
                else if (args[i] == "-avg")
                {
                    isAvg = true;
                }
            }
        }
Esempio n. 3
0
        public static bool checkArrayLengthCorrect(int index, int length)
        {
            if (index + 1 > length - 1)
            {
                throw new Exception(UsageUtils.GetUsage());
            }

            return(true);
        }
Esempio n. 4
0
        private void InitializeAttributes(string[] args)
        {
            for (int i = 0; i <= args.Length - 1; i++)
            {
                if (args[i] == null || String.IsNullOrEmpty(args[i]))
                {
                    throw new Exception(UsageUtils.GetUsage());
                }

                if (args[i] == "-url")
                {
                    ArrayUtils.checkArrayLengthCorrect(i, args.Length);
                    sourceUrl = args[i + 1];
                }
                else if (args[i] == "-save")
                {
                    ArrayUtils.checkArrayLengthCorrect(i, args.Length);
                    destUrl = args[i + 1];
                }
            }
        }