예제 #1
0
 public ProxyControl(ProxySetup setup)
 {
     Setup     = setup;
     Links     = new List <NetIOLinkServer>();
     Providers = new List <NetIOProviderServer>();
     Users     = new SortedDictionary <uint, UserProxy>();
     Roles     = new SortedDictionary <uint, UserProxy>();
 }
예제 #2
0
파일: Program.cs 프로젝트: zcmrp/MProxy
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: ");
                Console.WriteLine("Windows: MProxy.exe Conf.xml");
                Console.WriteLine("Linux: mono MProxy.exe Conf.xml");
                return;
            }
            XmlSerializer serializer = new XmlSerializer(typeof(ProxySetupXml));

            if (!File.Exists(args[0]))
            {
                Console.WriteLine("Configuration file not found");
            }
            ProxyControl ctrl = null;

            using (StreamReader reader = new StreamReader(args[0]))
            {
                ProxySetupXml xml   = (ProxySetupXml)serializer.Deserialize(reader);
                ProxySetup    setup = new ProxySetup();
                if (!setup.Set(xml))
                {
                    Console.WriteLine("Bad format in file");
                    return;
                }
                ctrl = new ProxyControl(setup);
                ctrl.Run();
            }
            while (true)
            {
                int id = UnixSignal.WaitAny(Signals);
                if (id >= 0 && id < Signals.Length)
                {
                    return;
                }
            }
        }