Changeset 377
- Timestamp:
- 05/12/08 23:44:26 (8 months ago)
- Location:
- TwitterIrcGateway
- Files:
-
- 2 modified
-
TwitterIrcGatewayCLI/Program.cs (modified) (5 diffs)
-
TwitterIrcGatewayCore/TwitterService.cs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
TwitterIrcGateway/TwitterIrcGatewayCLI/Program.cs
r376 r377 19 19 IPAddress bindAddress = IPAddress.Loopback; 20 20 Encoding encoding = Encoding.GetEncoding("ISO-2022-JP"); 21 IWebProxy proxy = WebProxy.GetDefaultProxy(); 21 22 22 23 CommandLineOptions options; … … 31 32 // Listening IP 32 33 if (!IPAddress.TryParse(options.BindAddress, out bindAddress)) 34 { 35 ShowUsage(); 36 return; 37 } 38 39 // Proxy 40 try 41 { 42 if (!String.IsNullOrEmpty(options.Proxy)) 43 proxy = new WebProxy(options.Proxy); 44 } 45 catch (UriFormatException) 33 46 { 34 47 ShowUsage(); … … 60 73 _server.BroadcastUpdateMessageIsNotice = options.BroadcastUpdateMessageIsNotice; 61 74 _server.SessionStartedRecieved += new EventHandler<SessionStartedEventArgs>(_server_SessionStartedRecieved); 62 _server.Proxy = new WebProxy(options.Proxy);75 _server.Proxy = proxy; 63 76 64 77 Console.WriteLine("Start TwitterIrcGateway Server v{0}", typeof(Server).Assembly.GetName().Version); … … 80 93 Console.WriteLine("[Configuration] ClientMessageWait: {0}", _server.ClientMessageWait); 81 94 Console.WriteLine("[Configuration] BroadcatUpdateMessageIsNotice: {0}", _server.BroadcastUpdateMessageIsNotice); 82 Console.WriteLine("[Configuration] Proxy: {0}", _server.Proxy);95 Console.WriteLine("[Configuration] Proxy: {0}", options.Proxy); 83 96 84 97 _server.Start(bindAddress, options.Port); … … 176 189 177 190 [DefaultValue("")] 178 [Description(" web proxy url")]191 [Description("HTTP proxy server URL (http://host:port)")] 179 192 public String Proxy { get; set; } 180 193 } -
TwitterIrcGateway/TwitterIrcGatewayCore/TwitterService.cs
r376 r377 17 17 public class TwitterService : IDisposable 18 18 { 19 private WebClient _webClient;19 //private WebClient _webClient; 20 20 private CredentialCache _credential; 21 private IWebProxy _proxy; 21 22 private String _userName; 22 23 private Boolean _cookieLoginMode = false; … … 36 37 _userName = userName; 37 38 38 _webClient = new PreAuthenticatedWebClient();39 _webClient = new WebClient();40 _webClient.Credentials = _credential;39 //_webClient = new PreAuthenticatedWebClient(); 40 //_webClient = new WebClient(); 41 //_webClient.Credentials = _credential; 41 42 } 42 43 … … 48 49 get 49 50 { 50 return _webClient.Proxy; 51 return _proxy; 52 //return _webClient.Proxy; 51 53 } 52 54 set 53 55 { 54 _webClient.Proxy = value; 56 _proxy = value; 57 //_webClient.Proxy = value; 55 58 } 56 59 } … … 373 376 public void Dispose() 374 377 { 375 if (_webClient != null)376 {377 _webClient.Dispose();378 _webClient = null;379 }378 //if (_webClient != null) 379 //{ 380 // _webClient.Dispose(); 381 // _webClient = null; 382 //} 380 383 } 381 384 … … 452 455 //webRequest.Credentials = _credential; 453 456 //webRequest.PreAuthenticate = true; 457 webRequest.Proxy = _proxy; 454 458 webRequest.Method = method; 455 459 webRequest.Accept = "text/xml, application/xml"; … … 535 539 httpRequest.Accept = "*/*"; 536 540 httpRequest.CookieContainer = new CookieContainer(); 541 httpRequest.Proxy = _proxy; 537 542 if (_cookies != null) 538 543 {
