Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- using System.Net;
- using System.Net.Sockets;
- internal class Data
- {
- Dictionary<string, string> array = new Dictionary<string, string>();
- IEnumerable num = new string[] { "user", "password", "host", "port", "type" };
- IEnumerator key, value;
- internal string User, Password, Port, Host, Type;
- public virtual void Set(IEnumerable args)
- {
- key = num.GetEnumerator();
- value = args.GetEnumerator();
- while (key.MoveNext() && value.MoveNext())
- {
- array.Add(key.Current.ToString(), value.Current.ToString());
- };
- foreach (var item in array)
- {
- if (item.Key == "user") User = item.Value;
- switch (item.Key)
- {
- case "user": User = item.Value;
- break;
- case "password": Password = item.Value;
- break;
- case "host": Host = item.Value;
- break;
- case "port": Port = item.Value;
- break;
- case "type": Type = item.Value;
- break;
- };
- };
- }
- };
- class Config : Data
- {
- public override void Set(IEnumerable arg)
- {
- base.Set(arg);
- }
- unsafe public Config(ref IEnumerator arg, int i)
- {
- ArrayList list = new ArrayList();
- while (arg.MoveNext())
- {
- list.Add(arg.Current);
- };
- this.Set((IEnumerable)list);
- }
- };
- class Program
- {
- static List<Config> Config;
- static int Current;
- static byte[] data;
- static void Init(string[] args)
- {
- Config = new List<Config>();
- IEnumerator ie = args.GetEnumerator();
- Config.Add(new Config(ref ie, args.Length));
- ie = Config.GetEnumerator();
- while (ie.MoveNext()) ;
- Current = 0;
- }
- static void Main()
- {
- Init(new string[] { "sergylens", "dr15gera", "ftp.drivehq.com", "21", "FTP" });
- TcpClient client = new Connection(Config[Current].Host, Convert.ToInt32(Config[Current].Port)).GetTclClient();
- data = new byte[client.Available];
- string text = Encoding.UTF8.GetString(data);
- Console.WriteLine(text);
- }
- };
- class Connection
- {
- static TcpClient Connector;
- public Connection(string arg1, int arg2)
- {
- Connector = new TcpClient();
- Connector.Connect(arg1, arg2);
- }
- internal TcpClient GetTclClient()
- {
- return Connector;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement