Пример #1
0
        static void Main(string[] args)
        {
            try
            {
                string localpath = args[0];
                string remote    = args[1];
                string remoteip  = remote.Split('@')[1];

                string remoteusername = remote.Split('@')[0].Split(':')[0];
                string remotepassword = remote.Split('@')[0].Split(':')[1];
                string remotepath     = args[2].Replace(':', '$');
                using (NetworkShareAccesser.Access(remoteip, remoteusername, remotepassword))
                {
                    DateTime start = DateTime.Now;
                    File.Copy(@localpath, @"\\" + remoteip + @"\" + @remotepath, true);
                    DateTime end = DateTime.Now;
                    Console.WriteLine("total time: " + (end - start).Seconds + " seconds");
                }
                Console.WriteLine("File copied");
            }
            catch (Exception e) {
                Console.WriteLine("args incorrect. use this format:");
                Console.WriteLine("path root:[email protected] remotepath");
                Console.WriteLine(e.Message);

                return;
            }
        }
Пример #2
0
        private static int ConnectWin(string remoteip, string remoteusername, string remotepassword)
        {
            var connect = new NetworkShareAccesser().TryConnect(remoteip, remoteusername, remotepassword);

            Console.WriteLine("Attempt Win Connect " + counterWin + ": " + remoteusername + ":" + remotepassword + "@" + remoteip + " - " + connect);
            connection con = new connection(remoteip, remoteusername, remotepassword, connect, "Windows");

            counterWin++;
            if (connect == 0)
            {
                ConnectWinSuccessList.Add(con);
            }
            else
            {
                ConnectWinErrorList.Add(con);
            }
            return(connect);
        }