protected override void OnStart(string[] args)
        {
            if (args.Length < 2)
                return;
            Login = args[0];
            Password = args[1];

            var file = new StreamWriter(new FileStream("monitisagent.log",
             System.IO.FileMode.Append));
            try
            {
                file.Write("Starting service");
                var a = new Authentication(Login, Password, null);
                var mon = new MonitisClrMethodInfoAnalizer(a);
                var processor = new ClrActionsProcessor();
                _agent = new Agent(mon, processor);
                file.Write("Started service");
            }
            catch (Exception ex)
            {

                file.Write(ex.ToString());

                throw;
            }
            finally
            {
                file.Close();
            }
        }
        private void LoginToMonitis()
        {
            try
            {
                if (String.IsNullOrEmpty(LogintextBox.Text))
                {
                    MessageBox.Show("Monitis Account Login is empty.");
                    return;
                }
                if (String.IsNullOrEmpty(PasswordtextBox.Text))
                {
                    MessageBox.Show("Monitis Account Password is empty.");
                    return;
                }

                var auth = new Authentication();
                auth.Authenticate(LogintextBox.Text, PasswordtextBox.Text, OutputType.XML);
                DialogResult = DialogResult.Yes;
            }
            catch (Exception ex)
            {
                if (ex.Message == "Invalid username or password")
                {
                    MessageBox.Show("Invalid username or password");
                }
                else
                {
                    MessageBox.Show("Can not connect to Monitis Server");
                }
            }
        }
 public MonitisClrMethodInfoAnalizer(Authentication authentification)
 {
     _monitor = new CustomMonitor();
     _monitor.SetAuthenticationParams(authentification);
     _agent = new CustomUserAgent();
     _agent.SetAuthenticationParams(authentification);
 }
 static void Main(string[] args)
 {
     try
     {
         log4net.Config.XmlConfigurator.Configure();
         Log.Info("Starting");
         Environment.SetEnvironmentVariable("COR_ENABLE_PROFILING", "1", EnvironmentVariableTarget.User);
         Environment.SetEnvironmentVariable("COR_PROFILER", "{71EDB19D-4F69-4A2C-A2F5-BE783F543A7E}",
                                            EnvironmentVariableTarget.User);
         var a = new Authentication(Login, Password, null);
         var analizer = new MonitisClrMethodInfoAnalizer(a);
         var agent = new Agent(analizer, new ClrActionsProcessor());
         System.Console.ReadKey();
         agent.Stop();
         Environment.SetEnvironmentVariable("COR_ENABLE_PROFILING", "0", EnvironmentVariableTarget.User);
         Log.Info("Ending");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
 public SubAccount(Authentication authentication)
     : base(authentication)
 {
 }
 public ExternalMonitor(Authentication authentication)
     : base(authentication)
 {
 }
 private void InitMonitisProfiler()
 {
     var a = new Authentication(Login, Password, null);
     var mon = new MonitisClrMethodInfoAnalizer(a);
     var processor = new ClrActionsProcessor();
     processor.MessageRecievedEvent += processor_MessageRecievedEvent;
     _agent = new Agent(mon, processor);
 }
 /// <summary>
 /// Set apiKey, secretKey and authToken
 /// </summary>
 /// <param name="authentication"></param>
 public void SetAuthenticationParams(Authentication authentication)
 {
     apiKey = authentication.apiKey;
     secretKey = authentication.secretKey;
     authToken = authentication.authToken;
 }
 public APIObject(Authentication authentication)
 {
     SetAuthenticationParams(authentication);
 }
 public Contact(Authentication authentication)
     : base(authentication)
 {
 }
 protected BaseMonitor(Authentication authentication)
     : base(authentication)
 {
 }
 public Layout(Authentication authentication)
     : base(authentication)
 {
 }