示例#1
0
        public WCFSatelliteDeploymentAgent(IVariableProcessor variableProcessor, string endpoint, string login, string password, TimeSpan?openTimeoutSpan = null, TimeSpan?waitTimeout = null)
        {
            this.variableProcessor = variableProcessor;

            WSHttpBinding binding = new WSHttpBinding(SecurityMode.TransportWithMessageCredential);

            binding.MaxBufferPoolSize           = 1024 * 1024 * 10;
            binding.MaxReceivedMessageSize      = 1024 * 1024 * 10;
            binding.ReaderQuotas.MaxArrayLength = 1024 * 1024 * 10;

            binding.OpenTimeout    = openTimeoutSpan ?? new TimeSpan(0, 10, 0);
            binding.CloseTimeout   = openTimeoutSpan ?? new TimeSpan(0, 10, 0);
            binding.SendTimeout    = waitTimeout ?? new TimeSpan(3, 0, 0);
            binding.ReceiveTimeout = waitTimeout ?? new TimeSpan(3, 0, 0);

            binding.BypassProxyOnLocal = false;
            binding.UseDefaultWebProxy = true;

            binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;

            this.deploymentClient = new DeploymentServiceClient(binding, new EndpointAddress(new Uri(endpoint + "/DeploymentService")));
            this.deploymentClient.ClientCredentials.UserName.UserName = login;
            this.deploymentClient.ClientCredentials.UserName.Password = password;

            this.monitoringClient = new MonitoringServiceClient(binding, new EndpointAddress(new Uri(endpoint + "/MonitoringService")));
            this.monitoringClient.ClientCredentials.UserName.UserName = login;
            this.monitoringClient.ClientCredentials.UserName.Password = password;

            this.informationClient = new InformationServiceClient(binding, new EndpointAddress(new Uri(endpoint + "/InformationService")));
            this.informationClient.ClientCredentials.UserName.UserName = login;
            this.informationClient.ClientCredentials.UserName.Password = password;
        }
 public InformationController(InformationServiceClient service,
                              PlayerProfile profile,
                              PlayerStats stats,
                              List <GameInformation> gameList)
 {
     _service      = service;
     this.stats    = stats;
     this.profile  = profile;
     this.gameList = gameList;
 }
 public InformationController(InformationServiceClient service, 
         PlayerProfile profile, 
         PlayerStats stats, 
         List<GameInformation> gameList)
 {
     _service = service;
     this.stats = stats;
     this.profile = profile;
     this.gameList = gameList;
 }
示例#4
0
        static Program()
        {
            var profile = new PlayerProfile();
            var stats = new PlayerStats();
            var gameList = new List<GameInformation>();
            var gameService = new GameServiceClient();
            var infoService = new InformationServiceClient();
            var state = new BasicObservable<MatchState>(new MatchState());
            infoController = new InformationController(infoService, profile, stats, gameList);
            gameController = new GameController(gameService, state);

            infoController.GetGameList();
        }
示例#5
0
        static void Main()
        {
            try
            {
                const string hostname = "localhost";
                const string username = "******";
                const string password = "";

                ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;

                var client = new InformationServiceClient("BasicHttpBinding_InformationService",
                                                          string.Format("https://{0}:17778/SolarWinds/InformationService/v3/OrionBasic", hostname));
                client.ClientCredentials.UserName.UserName = username;
                client.ClientCredentials.UserName.Password = password;
                client.Open();

                var result  = client.QueryXml("SELECT TOP 1 AlertDefID, ActiveObject, ObjectType FROM Orion.AlertStatus WHERE Acknowledged=0 ORDER BY TriggerTimeStamp DESC RETURN XML AUTO", null);
                var result0 = client.QueryXml("SELECT N.Caption, N.Interfaces.Caption FROM Orion.Nodes N RETURN XML AUTO", null);
                var element = result.XPathSelectElement("//*[local-name()='AlertStatus']");

                var alert = new AlertInfo
                {
                    DefinitionId = element.ElementAnyNS("AlertDefID").Value,
                    ObjectType   = element.ElementAnyNS("ObjectType").Value,
                    ObjectId     = element.ElementAnyNS("ActiveObject").Value
                };

                var alerts = new[] { alert };

                var dcs = new DataContractSerializer(alerts.GetType());
                var doc = new XmlDocument();
                using (var writer = doc.CreateNavigator().AppendChild())
                {
                    dcs.WriteObject(writer, alerts);
                }

                var arguments = new ArrayOfXmlElement {
                    XDocument.Load(new XmlNodeReader(doc)).Root
                };
                var result2 = client.Invoke("Orion.AlertStatus", "Acknowledge", arguments);

                Console.Write(result2);

                client.Close();
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
        static Program()
        {
            var profile     = new PlayerProfile();
            var stats       = new PlayerStats();
            var gameList    = new List <GameInformation>();
            var gameService = new GameServiceClient();
            var infoService = new InformationServiceClient();
            var state       = new BasicObservable <MatchState>(new MatchState());

            infoController = new InformationController(infoService, profile, stats, gameList);
            gameController = new GameController(gameService, state);

            infoController.GetGameList();
        }
        private void btnServerCall_Click(object sender, EventArgs e)
        {
            informationServiceClient = new InformationServiceClient(binding, endPointAddress);
            UserInformation user = informationServiceClient.GetUserInfo(Convert.ToInt32 (this.cboUserId.Text));

            StringBuilder sb = new StringBuilder();
            if (user !=null) {
                if (user.UserName !=null){
                    sb.Append(user.UserName);
                        sb.Append(",");
                }
                if (user.Age !=null){
                    sb.Append(user.Age);
                }
                this.txtUserInformation.Text = sb.ToString();
            }
            else{
                this.txtUserInformation.Text = "No user information returned.";
            }
        }