private static void Process(RequestRaw raw)
 {
     if (raw.ServiceName == typeof(LocateSourceFileService).Name)
     {
         LocateSourceFileServiceRq rq = ApiDeserializer.Deserialize <LocateSourceFileServiceRq>(raw.Request);
         LocateSourceFileServiceRs rs = (new LocateSourceFileService()).Run(rq);
         WriteResponse(JsonConvert.SerializeObject(rs));
     }
     else if (raw.ServiceName == typeof(LocateSourceFileByFileIdentifierService).Name)
     {
         LocateSourceFileByFileIdentifierServiceRq rq = ApiDeserializer.Deserialize <LocateSourceFileByFileIdentifierServiceRq>(raw.Request);
         LocateSourceFileByFileIdentifierServiceRs rs = (new LocateSourceFileByFileIdentifierService()).Run(rq);
         WriteResponse(JsonConvert.SerializeObject(rs));
     }
     else if (raw.ServiceName == typeof(OpenGitLogService).Name)
     {
         OpenGitLogServiceRq rq = ApiDeserializer.Deserialize <OpenGitLogServiceRq>(raw.Request);
         OpenGitLogServiceRs rs = (new OpenGitLogService()).Run(rq);
         WriteResponse(JsonConvert.SerializeObject(rs));
     }
     else
     {
         WriteResponse(JsonConvert.SerializeObject(new { Error = "Service " + raw.ServiceName + " is not implemented." }));
     }
 }
        static void Main(string[] args)
        {
            // Start
            var linkTimeLocal = Assembly.GetExecutingAssembly().GetLinkerDateTime();

            log.Info("Started ChromeNativeMessaging. Build at: " + linkTimeLocal);

            // Error handling
            AppDomain.CurrentDomain.UnhandledException
                += delegate(object sender, UnhandledExceptionEventArgs _args)
                {
                Exception e = (Exception)_args.ExceptionObject;
                log.Error(e.Message, e);
                Environment.Exit(1);
                };

            // Read input
            string input = OpenStandardStreamIn();

            log.Info("Standard Stream In: " + input + ' ' + (string.IsNullOrEmpty(input) ? "(EMPTY)" : "(NOT EMPTY)"));

            if (string.IsNullOrEmpty(input))
            {
                WriteResponse(JsonConvert.SerializeObject(new { Error = "Expecting none-empty input from stdin." }));
            }
            else
            {
                RequestRaw raw = JsonConvert.DeserializeObject <RequestRaw>(input);
                Process(raw);
            }

            Environment.Exit(0);
        }