Exemple #1
0
        static void Main(string[] args)
        {
            TraceFileHelper.SetupLogging();
            Trace.Listeners.Add(new ConsoleTraceListener());

            using (var host = new NancyHost(new Uri("http://localhost:8990")))
            {
                host.Start();
                TraceFileHelper.Info("Started webserver");

                if (Type.GetType("Mono.Runtime") != null)
                {
                    // on mono, processes will usually run as daemons - this allows you to listen
                    // for termination signals (ctrl+c, shutdown, etc) and finalize correctly
                    UnixSignal.WaitAny(new[] {
                        new UnixSignal(Signum.SIGINT),
                        new UnixSignal(Signum.SIGTERM),
                        new UnixSignal(Signum.SIGQUIT),
                        new UnixSignal(Signum.SIGHUP)
                    });
                }
                else
                {
                    Console.ReadKey();
                }

                TraceFileHelper.Info("Stopping webserver");
                host.Stop();
            }
        }
Exemple #2
0
        private BaseResponse EmailInUse(DynamicDictionary _parameters)
        {
            HydrantWikiManager  hwm      = new HydrantWikiManager();
            IsAvailableResponse response = new IsAvailableResponse {
                Available = false, Success = true
            };

            string email = _parameters["email"];

            if (email != null)
            {
                User user = hwm.GetUserByEmail(UserSources.HydrantWiki, email);

                TraceFileHelper.Info("Check if email in use ({0})", email);

                if (user == null)
                {
                    response.Available = true;
                }
            }

            return(response);
        }
Exemple #3
0
        private BaseResponse IsAvailable(DynamicDictionary _parameters)
        {
            HydrantWikiManager  hwm      = new HydrantWikiManager();
            IsAvailableResponse response = new IsAvailableResponse {
                Available = false, Success = true
            };

            string username = _parameters["username"];

            if (username != null)
            {
                User user = hwm.GetUser(UserSources.HydrantWiki, username);

                TraceFileHelper.Info("Check if username exists ({0})", username);

                if (user == null)
                {
                    response.Available = true;
                }
            }

            return(response);
        }
Exemple #4
0
 public void LogInfo(Guid _userGuid, string _message)
 {
     TraceFileHelper.Info(_message + "|UserGuid - {0}", _userGuid);
 }