public ProfileManager(string profileRootPath, ProfileCache profileCache)
 {
     _profileRootPath = profileRootPath;
     _profileCache = profileCache;
 }
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();

            var proxyServerConfiguration = new ProxyServerConfiguration()
                {
                    DumpHeaders = false,
                    DumpPostData = false,
                    DumpResponseData = false
                };

            if (args.Length > 0)
            {
                if (args.Length <= 3)
                {
                    var argRegHelp = new Regex(@"^(/|-)\?$");
                    var argRexH = new Regex("^(/|-)h$");
                    var argRexP = new Regex("^(/|-)p$");
                    var argRexR = new Regex("^(/|-)r$");

                    foreach (var s in args)
                    {
                        if (argRexH.IsMatch(s.ToLower()))
                        {
                            proxyServerConfiguration.DumpHeaders = true;
                        }
                        else if (argRexP.IsMatch(s.ToLower()))
                        {
                            proxyServerConfiguration.DumpPostData = true;
                        }
                        else if (argRexR.IsMatch(s.ToLower()))
                        {
                            proxyServerConfiguration.DumpResponseData = true;
                        }
                        else
                        {
                            PrintUsageInfo();
                            return;
                        }
                    }
                }
                else if (args.Length > 4)
                {
                    PrintUsageInfo();
                    return;
                }
            }

            var proxyCache = new ProxyCache();
            var profileCache = new ProfileCache();
            var profileManager = new ProfileManager(profileCache);
            var certificateGenerator = new CertificateGenerator();
            var certificateCache = new CertificateCache();
            var certificateManager = GetCertificateManager(proxyServerConfiguration, certificateGenerator, certificateCache);
            var proxyServer = new ProxyServer(proxyServerConfiguration, profileManager, proxyCache, certificateGenerator, certificateManager);

            if (proxyServer.Start())
            {
                Console.WriteLine("Server started on {0}:{1}...Press enter key to end", proxyServerConfiguration.ListeningIpInterface, proxyServerConfiguration.ListeningPort);
                Console.ReadLine();
                Console.WriteLine("Shutting down");
                proxyServer.Stop();
                Console.WriteLine("Server stopped...");
            }
            Console.WriteLine("Press enter to exit");
            Console.ReadLine();
        }
 public ProfileManager(ProfileCache profileCache)
     : this(ProfileRootPath, profileCache)
 {
 }