Ejemplo n.º 1
0
 // Token: 0x06001EA5 RID: 7845 RVA: 0x0008AE9D File Offset: 0x0008909D
 public static void RunAsConsole(ReplayServiceBase service)
 {
     Console.WriteLine("Starting...");
     service.OnStartInternal(null);
     Console.WriteLine("Started. Type ENTER to stop.");
     Console.ReadLine();
     Console.WriteLine("Stopping...");
     service.OnStopInternal();
     Console.WriteLine("Stopped");
 }
Ejemplo n.º 2
0
 // Token: 0x06001EA3 RID: 7843 RVA: 0x0008ACE0 File Offset: 0x00088EE0
 public static void Run(ReplayServiceBase service)
 {
     if (service == null)
     {
         throw new ArgumentException(ReplayStrings.NoServices);
     }
     ReplayServiceBase.Run(new ReplayServiceBase[]
     {
         service
     });
 }
Ejemplo n.º 3
0
        // Token: 0x06001EA4 RID: 7844 RVA: 0x0008AD14 File Offset: 0x00088F14
        public static void Run(ReplayServiceBase[] services)
        {
            if (services == null || services.Length == 0)
            {
                throw new ArgumentException(ReplayStrings.NoServices);
            }
            IntPtr intPtr = Marshal.AllocHGlobal((IntPtr)((services.Length + 1) * Marshal.SizeOf(typeof(NativeMethods.SERVICE_TABLE_ENTRY))));

            NativeMethods.SERVICE_TABLE_ENTRY[] array = new NativeMethods.SERVICE_TABLE_ENTRY[services.Length];
            bool   multipleServices = services.Length > 1;
            IntPtr ptr = (IntPtr)0;

            for (int i = 0; i < services.Length; i++)
            {
                services[i].Initialize(multipleServices);
                array[i] = services[i].GetEntry();
                ptr      = (IntPtr)((long)intPtr + (long)(Marshal.SizeOf(typeof(NativeMethods.SERVICE_TABLE_ENTRY)) * i));
                Marshal.StructureToPtr(array[i], ptr, true);
            }
            NativeMethods.SERVICE_TABLE_ENTRY service_TABLE_ENTRY = new NativeMethods.SERVICE_TABLE_ENTRY();
            service_TABLE_ENTRY.callback = null;
            service_TABLE_ENTRY.name     = (IntPtr)0;
            ptr = (IntPtr)((long)intPtr + (long)(Marshal.SizeOf(typeof(NativeMethods.SERVICE_TABLE_ENTRY)) * services.Length));
            Marshal.StructureToPtr(service_TABLE_ENTRY, ptr, true);
            bool   flag = NativeMethods.StartServiceCtrlDispatcher(intPtr);
            string text = "";

            if (!flag)
            {
                text = new Win32Exception().Message;
                string text2 = ReplayStrings.CantStartFromCommandLine;
                if (Environment.UserInteractive)
                {
                    string title = ReplayStrings.CantStartFromCommandLineTitle;
                    ReplayServiceBase.LateBoundMessageBoxShow(text2, title);
                }
                else
                {
                    Console.WriteLine(text2);
                }
            }
            foreach (ReplayServiceBase replayServiceBase in services)
            {
                replayServiceBase.Dispose();
                if (!flag)
                {
                    ReplayEventLogConstants.Tuple_StartFailed.LogEvent(null, new object[]
                    {
                        text
                    });
                }
            }
        }