Exemplo n.º 1
0
 //Opens Console with the WPF Application to show the process
 public MainWindow()
 {
     InitializeComponent();
     AllocConsole();
     this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
     block        = new byte[BlockSize];
     time         = new msTimer();
 }
Exemplo n.º 2
0
        static int Main()
        {
            msTimer ms = new msTimer();

            ms.Start();
            Console.Write("{0}, {1}, {2} ", ms.ElapsedMicroseconds, ms.ElapsedTicks, ms.ElapsedTimeSpan);
            ms.Stop();
            return(0);
        }
Exemplo n.º 3
0
        //Downloading files from the repository
        void download(string filename)
        {
            int     totalBytes = 0;
            msTimer hrt        = new msTimer();

            try
            {
                hrt.Start();
                Stream strm      = channel.downLoadFile(filename);
                string rfilename = Path.Combine(SavePath, filename);
                if (!Directory.Exists(SavePath))
                {
                    Directory.CreateDirectory(SavePath);
                }
                using (var outputStream = new FileStream(rfilename, FileMode.Create))
                {
                    while (true)
                    {
                        int bytesRead = strm.Read(block, 0, BlockSize);
                        totalBytes += bytesRead;
                        if (bytesRead > 0)
                        {
                            outputStream.Write(block, 0, bytesRead);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                hrt.Stop();
                ulong time = hrt.ElapsedMicroseconds;
                Console.Write("\nReceived file \"{0}\" of {1} bytes in {2} microsec.", filename, totalBytes, time);
            }
            catch
            {
                Console.Write("\n");
            }
        }
Exemplo n.º 4
0
 public Repo()
 {
     block = new byte[BlockSize];
     hrt   = new msTimer();
 }