Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            try
            {
                Adk.Debug = AdkDebugFlags.Moderate;
                Adk.Initialize(SifVersion.LATEST, SIFVariant.SIF_AU, (int)SdoLibraryType.All);

                Chameleon agent;
                agent = new Chameleon();

                //  Start agent...
                agent.StartAgent(args);

                Console.WriteLine("Agent is running (Press Ctrl-C to stop)");
                sWaitMutex = new AdkConsoleWait();
                sWaitMutex.WaitForExit();

                //  Always shutdown the agent on exit
                agent.Shutdown(ProvisioningFlags.None);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// This method will run the SIF Agent. Only the first call to this method will be recognised; subsequent
 /// calls will be ignored.
 /// </summary>
 public void Run()
 {
     try
     {
         Initialize();
         Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType + " is running (press Ctrl-C to stop)...");
         AdkConsoleWait adkConsoleWait = new AdkConsoleWait();
         adkConsoleWait.Exiting += delegate { Shutdown(ProvisioningFlags.Unprovide); };
         adkConsoleWait.WaitForExit();
     }
     catch (AdkConfigException e)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Unable to find the associated configuration file for this SIF Agent.", e);
         }
         throw;
     }
     catch (AdkException e)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("ADK could not be initialised or error running the SIF Agent.", e);
         }
         throw;
     }
     catch (IOException e)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("IO error occurred.", e);
         }
         throw;
     }
     catch (Exception e)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("SIF Agent failed with an unexpected error.", e);
         }
         throw;
     }
     finally
     {
         Shutdown(ProvisioningFlags.Unprovide);
     }
 }
Exemplo n.º 3
0
        private static void Main(string[] args)
        {
            try
            {
                Adk.Debug = AdkDebugFlags.Detailed;
                Adk.Initialize();
                Chameleon agent;
                agent = new Chameleon();

                //  Start agent...
                agent.StartAgent(args);

                Console.WriteLine("Agent is running (Press Ctrl-C to stop)");
                sWaitMutex = new AdkConsoleWait();
                sWaitMutex.WaitForExit();

                //  Always shutdown the agent on exit
                agent.Shutdown(ProvisioningFlags.None);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }