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;
                }
            }
        }
Exemple #2
0
        public static bool checkArrayLengthCorrect(int index, int length)
        {
            if (index + 1 > length - 1)
            {
                throw new Exception(UsageUtils.GetUsage());
            }

            return(true);
        }
        private void DoGet()
        {
            if (sourceUrl == null || String.IsNullOrEmpty(sourceUrl))
            {
                throw new Exception(UsageUtils.GetStringUnknownParameter(sourceUrl));
            }

            StringBuilder sb = new StringBuilder();

            var page = (new WebClient()).DownloadString(sourceUrl);

            PrintLogs(sb, sourceUrl, destUrl, page);
        }
        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];
                }
            }
        }