コード例 #1
0
 private static void CommandInfo(ICommand cmdObj)
 {
     Console.WriteLine("\\ Name: " + cmdObj.Name);
     Console.Write(" |Author: "); ColorLine.WriteLineC(cmdObj.Author, Green);
     Console.Write(" |Type: "); ColorLine.WriteLineC(cmdObj.Type, Yellow);
     Console.Write(" |Command: "); ColorLine.WriteLineC(cmdObj.Cmd, Cyan);
     Console.Write(" `Description: " + cmdObj.Description + "\r\n");
     Console.WriteLine();
 }
コード例 #2
0
 internal void ReadyString()
 {
     ColorLine.WriteC(Environment.UserName, Green);
     ColorLine.WriteC("@", Magenta);
     //Console.Write("M:");
     ColorLine.WriteC(Environment.MachineName, Cyan);
     Console.Write(" Dir: ");
     ColorLine.WriteLineC(CurrentDirectory.FullName, Yellow);
     Console.Write("$> ");
 }
コード例 #3
0
        internal static bool IsURLExist(string url)
        {
            bool valid = false;

            try
            {
                WebRequest  req = WebRequest.Create(url);
                WebResponse res = req.GetResponse();
                res.Close();
                valid = true;
            }
            catch (WebException ex)
            {
                Console.Write(" =====> "); ColorLine.WriteLineC(" ### " + ex.Message, Red);
            }
            return(valid);
        }
コード例 #4
0
        public static void DoAGetRequest(string link, string nFileFix)
        {
            Uri uri = new Uri(link);

            // Construct HTTP request to get the file
            Console.Write("--- Dowloading: "); ColorLine.WriteLineC(Path.GetFileName(link), Yellow);
            using (WebClient client = new WebClient())
            {
                try
                {
                    // Specify that the DownloadFileCallback method gets called
                    // Specify a progress notification handler.
                    client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback);
                    // when the download completes.
                    //client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCallback);
                    client.DownloadFileAsync(new Uri(link), nFileFix);
                }
                catch (Exception ex) { /* Program.pL.Percent = -1; */ ColorLine.WriteLineC(" ### Error # \r\n" + ex.Message, Red); }
            }
        }