public static async Task Main(string[] args) { if (args.Length > 0) { try { _context = Enum.Parse <ServicesEnum>(args[0]); _searchArea = args.Length > 1 ? args[1] : null; InitializeNotifier(args.Length > 2 ? args[2] : null); switch (_context) { case ServicesEnum.candilib: { await ProcessCandilib(); break; } case ServicesEnum.wedding: { await ProcessWedding(); break; } case ServicesEnum.vaccin: { await ProcessVaccin(); break; } } } catch (System.Exception ex) { _notifier.Notify(Status.Error, string.Empty, ex.Message); } } }
private void Initialize(int port, ServicesEnum service) { this._port = port; this._service = service; this._enabled = true; _serverThread = new Thread(this.Listen); _serverThread.Start(); }
/// <summary> /// Call this to start the web server /// </summary> public static void StartWebServer(ServicesEnum service) { _service = service; if (_mainLoop != null && !_mainLoop.IsCompleted) { return; //Already started } _mainLoop = MainLoop(); }
private static void ProcessTypeCode(ServicesEnum _service_enum, string urlparam) { var acess_link = HttpUtility.ParseQueryString(urlparam); // string token = acess_link.Get("access_token"); // string type = acess_link.Get("token_type"); string code = acess_link.Get("/callback?code"); Wrapper.events.Trigger("EventHandlerLoginAuth", new EventHandlerLoginAuth(code)); }
public EmailNotifier(ServicesEnum context, string emailSender, string emailSenderPassword, string emailReceiver, string defaultEmailReceiver) { _context = context; _emailSender = emailSender; _emailSenderPassword = emailSenderPassword; _emailReceiver = emailReceiver ?? defaultEmailReceiver; _defaultEmailReceiver = defaultEmailReceiver; }
/// <summary> /// Para cada Service é destinado uma fileinfo com o nome do enum Service /// </summary> /// <param name="servicesEnum">Enum Service</param> /// <returns>FileInfo Service</returns> protected FileInfo FileService(ServicesEnum servicesEnum) { string _path = DirectoryInfo.FullName + servicesEnum + ".gercrip"; if (!File.Exists(_path)) { File.Create(_path).Close(); } return(new FileInfo(_path)); }
/// <summary> /// Construct server with given port. /// </summary> /// <param name="path">Directory path to serve.</param> /// <param name="port">Port of the server.</param> /// <param name="local">Indicates whether this is loopback only server</param> public SimpleHTTPServer(ServicesEnum service, bool local, bool custom, List <string> customPrefixes) { this.localMode = local; this.custom = custom; this._service = service; this.customPrefixes = customPrefixes; TcpListener l = new TcpListener(IPAddress.Loopback, 0); l.Start(); int port = ((IPEndPoint)l.LocalEndpoint).Port; l.Stop(); this.Initialize(port, service); }
public static string GetServiceUrl(ServicesEnum serviceType) { switch (serviceType) { case ServicesEnum.Facebook: return(""); break; case ServicesEnum.Youtube: return(""); break; } return(""); }
private void ProcessTypeRequest(ServicesEnum _service_enum, HttpListenerRequest req) { var acess_link = HttpUtility.ParseQueryString(req.Url.Query); switch (_service_enum) { case ServicesEnum.Twitch: //Debug.WriteLine("Link" + req.Url.Query.ToString()); //string token = acess_link.Get("access_token"); //string type = acess_link.Get("token_type"); //Globals.events.Trigger("TwitchEventHandlerLoginOauth", new EventHandlerLoginAuth(token, type)); break; case ServicesEnum.Default: Debug.WriteLine("Link default" + acess_link); break; } }
/// <summary> /// Construct server with given port. /// </summary> /// <param name="path">Directory path to serve.</param> /// <param name="port">Port of the server.</param> public SimpleHTTPServer(int _port, ServicesEnum service) { this.Initialize(_port, service); }