Inheritance: PooledStream
        private void OpenConnection(Connection connection, string data, Action initializeCallback, Action<Exception> errorCallback)
        {
            var url = connection.Url + GetReceiveQueryString(connection, data);

            Action<HttpWebRequest> prepareRequest = PrepareRequest(connection);

            HttpHelper.GetAsync(url, request =>
            {
                prepareRequest(request);

                request.Accept = "text/event-stream";

                if (connection.MessageId != null)
                {
                    request.Headers["Last-Event-ID"] = connection.MessageId.ToString();
                }

            }).ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    errorCallback(task.Exception);
                }
                else
                {
                    // Get the reseponse stream and read it for messages
                    var stream = task.Result.GetResponseStream();
                    var reader = new AsyncStreamReader(stream, connection, initializeCallback, errorCallback);
                    reader.StartReading();

                    // Set the reader for this connection
                    connection.Items[ReaderKey] = reader;
                }
            });
        }
Ejemplo n.º 2
0
        public async Task SendIssueReportAsync(IssueReport report)
        {
            var appId = _propertyProvider.GetProperty("locco.github.appId");
            var accessToken = _propertyProvider.GetProperty("locco.github.token");
            var repoOwner = _propertyProvider.GetProperty("locco.github.owner");
            var repoName = _propertyProvider.GetProperty("locco.github.repository");

            // Support default proxy
            var proxy = WebRequest.DefaultWebProxy;
            var httpClient = new HttpClientAdapter(() => HttpMessageHandlerFactory.CreateDefault(proxy));
            var connection = new Connection(new ProductHeaderValue(appId), httpClient);

            if (proxy != null)
            {
                Log.Info(string.Format("Using proxy server '{0}' to connect to github!", proxy.GetProxy(new Uri("https://api.github.com/"))));
            }


            var client = new GitHubClient(connection)
            {
                Credentials = new Credentials(accessToken)
            };


            // Creates a new GitHub Issue
            var newIssue = new NewIssue(report.Title)
            {
                Body = MarkdownReportUtil.CompileBodyMarkdown(report, 220000),
            };
            newIssue.Labels.Add("bot");

            var issue = await client.Issue.Create(repoOwner, repoName, newIssue);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// When session has completed, log any error which occured and dispose resources. This is done asynchronously
        /// sincew we want to be able to start new session without previous to complete.
        /// </summary>
        private void HandleSessionAsynchronously(Task sessionTask, Connection connection, ISession session)
        {
            sessionTask.ContinueWith(f =>
            {
                if (f.IsFaulted)
                {
                    var exception = f.Exception.InnerException;

                    _log.LogException(new LogEvent()
                    {
                        LogLevel = LogLevel.Error,
                        EventType = LogEventType.Application,
                        Message = exception.Message,
                        RemoteEndpoint = connection.RemoteEndpoint,
                        SessionId = connection.SessionId,
                        Protocol = session.Protocol.ToString()
                    }, exception);
                }

                SessionManager.DecreaseSessionCount(session.Protocol);

                // Session has ended.
                connection.Dispose();
            });
       }
Ejemplo n.º 4
0
 public void Timeout()
 {
     // Had to pick a routable IP, but one that won't return packets... don't know of a better choice than this
     var connection = new Connection(new IPEndPoint(IPAddress.Parse("10.230.220.210"), 28015));
     connection.ConnectTimeout = TimeSpan.FromSeconds(1);
     connection.Connect();
 }
Ejemplo n.º 5
0
        // Receive incoming initial Connection messages from Clients...
        public static void AddToConnectionList(PacketHeader header, Connection connection, string Connection)
        {
            // Add incoming IP Address to HashSet list...
            ConnectionsList.Add(connection.ConnectionInfo.RemoteEndPoint.Address.ToString() + "|" + Connection);

            // Respond to sender that they are succesfully connected.
            connection.SendObject("Connected", "CONNECTED!");
            Console.WriteLine("\n" + connection.ConnectionInfo.RemoteEndPoint.Address.ToString() + " has CONNECTED!");

            // Send all active connections to all active connections for Client List.
            foreach (var item in NetworkComms.GetExistingConnection())
            {
                foreach (var items in ConnectionsList.Distinct())
                {
                    item.SendObject("Connection", items);
                }
            }

            /* Old method to create files on hard disk for testing the code...
               if (!File.Exists(ConnectionFilePath))
            {
                // Create a file to write to.
                using (StreamWriter sw = File.CreateText(ConnectionFilePath))
                {
                }
            }
            using (StreamWriter sw = File.AppendText(ConnectionFilePath))
            {
                sw.WriteLine(connection.ConnectionInfo.RemoteEndPoint.Address.ToString());
            } */
        }
Ejemplo n.º 6
0
        public async Task RunAsync()
        {
            _listener.Start();

            while (true)
            {
                TcpClient tcpClient = null;

                try
                {
                    tcpClient = await _listener.AcceptTcpClientAsync();
                }
                catch (ObjectDisposedException)
                {
                    // When TcpListener is stopped, outstanding calls to AcceptTcpClientAsync
                    // will throw an ObjectDisposedException. When this happens, it's time to 
                    // exit.
                    return;
                }


                var connection = new Connection(tcpClient, _cancellationTokenSource.Token);

                var session = _sessionFactory();

                var sessionTask = session.HandleConnection(connection);

                SessionManager.IncreaseSessionCount(session.Protocol);

                HandleSessionAsynchronously(sessionTask, connection, session);
            }
        }
		public RtspTunnel(int rtspPort, int imagePort, Connection<MonoBrick.EV3.Command,MonoBrick.EV3.Reply> ev3Connection){
			Running = false;
			RTSPPort = rtspPort;
			this.nxtConnection = null;
			this.ev3Connection = ev3Connection;
			this.hostImagePort = imagePort;
		}
Ejemplo n.º 8
0
 public void SetUp()
 {
     ConnectionArgs args = new ConnectionArgs("deltabot","irc.sventech.com");
     connection = new Connection( args );
     RegisterListeners();
     AssignLines();
 }
Ejemplo n.º 9
0
		protected override void HandleHttpRequest(Connection connection, HttpServerRequest request, HttpServerResponse response)
		{
			base.HandleHttpRequest(connection, request, response);

			if (response.ContentSource != ContentSource.ContentNone)
			{
				return;
			}

			if (request.Header.RequestType != "GET")
			{
				response.SendError(HttpStatusCode.BadRequest, String.Format("Request Type '{0}' not supported.", request.Header.RequestType));
				return;
			}

			String lPath = RootPath + request.Header.RequestPath.Replace('/', Path.DirectorySeparatorChar);
			if (lPath.IndexOf("..", StringComparison.Ordinal) != -1)
			{
				response.SendError(HttpStatusCode.Forbidden, String.Format("Bad Request: Path '{0}' contains '..' which is invalid.", lPath));
				return;
			}

			if (!File.Exists(lPath))
			{
				response.SendError(HttpStatusCode.NotFound, String.Format("File '{0}' not found.", lPath));
				return;
			}

			response.Header.ContentType = "text/html";
			response.ContentStream = new FileStream(lPath, FileMode.Open, FileAccess.Read, FileShare.Read);
			response.CloseStream = true; /* Response will close stream once it's been sent */
		}
Ejemplo n.º 10
0
        public GlobalChatBot(string nick)
        {
            /*if (!File.Exists("Sharkbite.Thresher.dll"))
            {
                Server.UseGlobalChat = false;
                Server.s.Log("[GlobalChat] The IRC dll was not found!");
                return;
            }*/
            server = "irc.geekshed.net";
            channel = "#MCForge";
            this.nick = nick.Replace(" ", "");
            connection = new Connection(new ConnectionArgs(nick, server), false, false);

            if (Server.UseGlobalChat)
            {
                // Regster events for incoming
                connection.Listener.OnNickError += new NickErrorEventHandler(Listener_OnNickError);
                connection.Listener.OnRegistered += new RegisteredEventHandler(Listener_OnRegistered);
                connection.Listener.OnPublic += new PublicMessageEventHandler(Listener_OnPublic);
                connection.Listener.OnJoin += new JoinEventHandler(Listener_OnJoin);
                connection.Listener.OnKick += new KickEventHandler(Listener_OnKick);
                connection.Listener.OnError += new ErrorMessageEventHandler(Listener_OnError);
                connection.Listener.OnDisconnected += new DisconnectedEventHandler(Listener_OnDisconnected);
            }
        }
Ejemplo n.º 11
0
        public User Register([FromBody] User user)
        {
            _conn = new Connection(_connectionString);
            _conn.OpenConnection();

            //Calculate MD5 hash
            MD5 md5 = MD5.Create();
            byte[] inputBytes = Encoding.ASCII.GetBytes(user.Username + user.PasswordHash + DateTime.Now);
            byte[] hash = md5.ComputeHash(inputBytes);
            StringBuilder tokenString = new StringBuilder();
            for (int i = 0; i < hash.Length; i++)
            {
                tokenString.Append(hash[i].ToString("X2"));
            }

            bool result = _conn.Register(user.Username, user.PasswordHash, tokenString.ToString());
            _conn.CloseConnection();
            if (result)
            {
                user.Token = tokenString.ToString();
                return user;
            }
            else
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Conflict));
            }
        }
        public IConnection Get(string clusterName)
        {
            if (DefaultSettings.Value == null)
                throw new ConfigurationErrorsException("No rethinkdb client configuration section located");

            foreach (ClusterElement cluster in DefaultSettings.Value.Clusters)
            {
                if (cluster.Name == clusterName)
                {
                    List<EndPoint> endpoints = new List<EndPoint>();
                    foreach (EndPointElement ep in cluster.EndPoints)
                    {
                        IPAddress ip;
                        if (IPAddress.TryParse(ep.Address, out ip))
                            endpoints.Add(new IPEndPoint(ip, ep.Port));
                        else
                            endpoints.Add(new DnsEndPoint(ep.Address, ep.Port));
                    }

                    var connection = new Connection(endpoints.ToArray());
                    if (!String.IsNullOrEmpty(cluster.AuthorizationKey))
                        connection.AuthorizationKey = cluster.AuthorizationKey;
                    return connection;
                }
            }

            throw new ArgumentException("Cluster name could not be found in configuration", "clusterName");
        }
Ejemplo n.º 13
0
 public void Update_Should_Update_A_Connection() 
 {
     _repository
          .Setup(it => it.Update(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<Boolean>(), It.IsAny<Int32>()))
          .Callback<String, String, Boolean, Int32>((name, connectionString, isActive, connectionId) => 
     { 
          var tConnection = _repositoryList.Find(x => x.ConnectionId==connectionId);
          tConnection.Name = name; 
          tConnection.ConnectionString = connectionString; 
          tConnection.IsActive = isActive; 
     });
     var tempConnection = _repositoryList.Find(x => x.ConnectionId==connectionId);
     var testConnection = new Connection {
          ConnectionId = tempConnection.ConnectionId, 
          Name = tempConnection.Name, 
          ConnectionString = tempConnection.ConnectionString, 
          IsActive = tempConnection.IsActive};
     
     //TODO change something on testConnection
     //testConnection.oldValue = newValue; 
     _target.Update(testConnection);
     //Assert.AreEqual(newValue, _repositoryList.Find(x => x.ConnectionId==1).oldValue);
     //TODO fail until we update the test above
     Assert.Fail();
 }
Ejemplo n.º 14
0
        protected override void InitializeClientHandshake(NetContext context, Connection conn)
        {
            var connection = (WebSocketConnection) conn;
            if (string.IsNullOrEmpty(connection.Host)) throw new InvalidOperationException("Host must be specified");
            if (string.IsNullOrEmpty(connection.RequestLine)) throw new InvalidOperationException("RequestLine must be specified");

            string key1 = CreateRandomKey(), key2 = CreateRandomKey();
            byte[] key3 = new byte[8];
            NetContext.GetRandomBytes(key3);

            StringBuilder req = new StringBuilder(connection.RequestLine).Append("\r\n" +
                                    "Upgrade: WebSocket\r\n" + // note casing!
                                    "Connection: Upgrade\r\n" +
                                    "Sec-WebSocket-Key1: ").Append(key1).Append("\r\n" +
                                    "Sec-WebSocket-Key2: ").Append(key2).Append("\r\n" +
                                    "Host: ").Append(connection.Host).Append("\r\n");
            if (!string.IsNullOrEmpty(connection.Origin))
                req.Append("Origin: ").Append(connection.Origin).Append("\r\n");
            if (!string.IsNullOrEmpty(connection.Protocol))
                req.Append("Sec-WebSocket-Protocol: ").Append(connection.Protocol).Append("\r\n");
            req.Append("\r\n");




            expectedSecurityResponse = WebSocketsProcessor_Hixie76_00.ComputeKey(key1, key2, key3);
            EnqueueFrame(context, new StringFrame(req.ToString(), Encoding.ASCII, false));
            EnqueueFrame(context, new BinaryFrame(key3));
            connection.PromptToSend(context);
        }
Ejemplo n.º 15
0
        public void OnAsyncAccepted(IAsyncResult result)
        {
            Socket nsock = _listener.EndAccept(result);

            lock (_free_connections)
            {
                // Occupy new slot.
                int pos = _free_connections.Count - 1;
                if (pos >= 0)
                {
                    int connection_id = _free_connections[pos];
                    _free_connections.RemoveAt(pos);

                    Connection c = new Connection();
                    c.socket = nsock;
                    c.recvbuf = new byte[4096];
                    c.conn = _handler.OnConnected(connection_id, c);
                    _connections[connection_id] = c;

                    nsock.BeginReceive(c.recvbuf, 0, c.recvbuf.Length, 0, OnAsyncReceive, connection_id);
                }
                else
                {
                    Console.WriteLine("Dropping connection because i am full");
                    nsock.Close();
                }
            }

            _listener.BeginAccept(OnAsyncAccepted, _listener);
        }
 internal void Associate(Connection connection)
 {
     lock (this.m_ConnectionList)
     {
         this.m_ConnectionList.Add(connection);
     }
 }
Ejemplo n.º 17
0
 public StreamManager (Connection serverConnection, TcpClient streamClient)
 {
     connection = serverConnection;
     updateThreadObject = new UpdateThread (this, streamClient);
     updateThread = new Thread (new ThreadStart (updateThreadObject.Main));
     updateThread.Start ();
 }
Ejemplo n.º 18
0
        public RemoteDeploymentManager(string serviceUrl)
        {
            serviceUrl = UrlUtility.EnsureTrailingSlash(serviceUrl);
            _client = HttpClientHelper.Create(serviceUrl);

            // Raise the event when data comes in
            _connection = new Connection(serviceUrl + "status");
            _connection.Received += data => {
                if (StatusChanged != null) {
                    var result = JsonConvert.DeserializeObject<DeployResult>(data);
                    StatusChanged(result);
                }
            };

            _connection.Error += exception => {
                // If we get a 404 back stop listening for changes
                WebException webException = exception as WebException;
                if (webException != null) {
                    var webResponse = (HttpWebResponse)webException.Response;
                    if (webResponse != null &&
                        webResponse.StatusCode == HttpStatusCode.NotFound) {
                        _connection.Stop();
                    }
                }
            };

            _connection.Closed += () => {
                Debug.WriteLine("SignalR connection to {0} was closed.", serviceUrl);
            };

            _connection.Start().Wait();
        }
Ejemplo n.º 19
0
 static async void server_ClientConnceted(object sender, Connection con)
 {
     con.DataReceived += con_DataReceived;
     StringBuilder sb = new StringBuilder();
     var sampleData = File.ReadAllText(@"C:\PersonalProjects\TinyWebSocket\TinyWebSocket.Host\sample.txt", Encoding.UTF8);
     await con.Send(sampleData);
 }
Ejemplo n.º 20
0
        public void HandleAn400()
        {
            var response = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent("errorMessage") };
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var httpClient = Substitute.For<IHttpClient>();
            httpClient.SendAsync(Arg.Any<HttpRequestMessage>()).Returns(Task.FromResult(response));
            var connection = new Connection(httpClient, DotNetLoggerFactory.Create, "http://test.com");
            var generatedException = false;

            try
            {
                connection.Send<string>(HttpMethod.Get, "/thisIsATest").Wait();
            }
            catch (AggregateException e)
            {
                var aggregatedException = e.Flatten();
                Assert.AreEqual(1, aggregatedException.InnerExceptions.Count);
                var httpError = aggregatedException.InnerExceptions.FirstOrDefault();
                Assert.IsInstanceOf<HttpError>(httpError);
                // ReSharper disable once PossibleNullReferenceException
                Assert.AreEqual("Status Code : BadRequest, with content: errorMessage", httpError.Message);
                generatedException = true;
            }

            if (!generatedException)
            {
                Assert.Fail("Send should have thrown an HttpError exception");
            }
        }
Ejemplo n.º 21
0
        public void HandleAnResponseWithDifferentContentType()
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent("errorMessage") };
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/text");
            var httpClient = Substitute.For<IHttpClient>();
            httpClient.SendAsync(Arg.Any<HttpRequestMessage>()).Returns(Task.FromResult(response));
            var connection = new Connection(httpClient, DotNetLoggerFactory.Create, "http://test.com");
            var generatedException = false;

            try
            {
                connection.Send<string>(HttpMethod.Get, "/thisIsATest").Wait();
            }
            catch (AggregateException e)
            {
                var aggregatedException = e.Flatten();
                Assert.AreEqual(1, aggregatedException.InnerExceptions.Count);
                var badResponseError = aggregatedException.InnerExceptions.FirstOrDefault();
                Assert.IsInstanceOf<BadResponseError>(badResponseError);
                Assert.IsNotNull(badResponseError);
                Assert.AreEqual("Response format isn't valid it should have been application/json but was application/text", badResponseError.Message);
                generatedException = true;
            }

            if (!generatedException)
            {
                Assert.Fail("Send should have thrown an HttpError exception");
            }
        }
Ejemplo n.º 22
0
        protected override void ProcessConnectionDisconnected(Connection<object> connection) {
            nodeStateQueueSemaphore.Wait();
            nodeStateQueue.Enqueue(TestNodeState.Disconnected);
            nodeStateQueueSemaphore.Release();

            nodeStateSemaphore.Release();
        }
Ejemplo n.º 23
0
        public GlobalChatBot(string nick)
        {
            /*if (!File.Exists("Sharkbite.Thresher.dll"))
            {
                Server.UseGlobalChat = false;
                Server.s.Log("[GlobalChat] The IRC dll was not found!");
                return;
            }*/
            try {
                using (WebClient wc = new WebClient()) {
                    string data = wc.DownloadString("http://server.mcforge.net/gcdata");
                    server = data.Split('&')[0];
                    channel = data.Split('&')[1];
                }
            }
            catch
            {
                server = "irc.mcforge.net";
                channel = "#GlobalChat";
            }
            this.nick = nick.Replace(" ", "");
            connection = new Connection(new ConnectionArgs(nick, server), false, false);

            if (Server.UseGlobalChat)
            {
                // Regster events for incoming
                connection.Listener.OnNickError += new NickErrorEventHandler(Listener_OnNickError);
                connection.Listener.OnRegistered += new RegisteredEventHandler(Listener_OnRegistered);
                connection.Listener.OnPublic += new PublicMessageEventHandler(Listener_OnPublic);
                connection.Listener.OnJoin += new JoinEventHandler(Listener_OnJoin);
                connection.Listener.OnKick += new KickEventHandler(Listener_OnKick);
                connection.Listener.OnError += new ErrorMessageEventHandler(Listener_OnError);
                connection.Listener.OnDisconnected += new DisconnectedEventHandler(Listener_OnDisconnected);
            }
        }
Ejemplo n.º 24
0
        public TwitchChatBot()
        {
            XDocument doc = XDocument.Load("twitch.config");
            XElement configElement = doc.Element("configuration");
            XElement serverElement = configElement.Element("Server");
            Credentials.Server = serverElement.Value;
            XElement channelElement = configElement.Element("Channel");
            Credentials.Channel = channelElement.Value;
            XElement nickElement = configElement.Element("Nick");
            Credentials.Nick = nickElement.Value;
            XElement passwordElement = configElement.Element("Password");
            Credentials.Password = passwordElement.Value;
            XElement commandsElement = configElement.Element("Commands");
            foreach(XElement commandElement in commandsElement.Elements())
            {
                commands.Add("!" + commandElement.Name.LocalName.ToLower(), commandElement.Value);
            }

            ConnectionArgs cargs = new ConnectionArgs(Credentials.Nick, Credentials.Server);
            cargs.Port = 6667;
            cargs.ServerPassword = Credentials.Password;

            connection = new Connection(cargs, false, false);

            connection.Listener.OnRegistered += new RegisteredEventHandler(OnRegistered);
            connection.Listener.OnJoin += new JoinEventHandler(OnJoin);
            connection.Listener.OnPublic += new PublicMessageEventHandler(OnPublic);
            //Listen for bot commands sent as private messages
            connection.Listener.OnPrivate += new PrivateMessageEventHandler(OnPrivate);
            //Listen for notification that an error has ocurred
            connection.Listener.OnError += new ErrorMessageEventHandler(OnError);

            //Listen for notification that we are no longer connected.
            connection.Listener.OnDisconnected += new DisconnectedEventHandler(OnDisconnected);
        }
Ejemplo n.º 25
0
 public static void RegisterConnection(Connection conn, Object key)
 {
     lock (ConnByReceiver)
     {
         ConnByReceiver[key] = conn;
         Console.WriteLine("Registered connection #{0} as {1}. Count: {2}",conn.ID,key, ConnByReceiver.Count);
     }
 }
 public static IEnumerable<OutgoingFileTransfer> GetAll(Connection conn)
 {
     foreach (Contact contact in conn.Roster.GetAllContacts ()) {
         DispatchManager dm = contact.DispatchManager;
         foreach (OutgoingFileTransfer ft in dm.GetAll <OutgoingFileTransfer> (contact)) {
             yield return ft;
         }
     }
 }
Ejemplo n.º 27
0
        public void ShouldNotConnectToWrongPort()
        {
            var connected = true;
            var connection = new Connection(new IPEndPoint(IPAddress.Loopback, 7777));
            connection.Connect((success) => { connected = success; _completion.Set(); });
            _completion.WaitOne();

            Assert.IsFalse(connected);
        }
Ejemplo n.º 28
0
        public void ShouldConnectToListener()
        {
            var connected = false;
            var connection = new Connection(new IPEndPoint(IPAddress.Loopback, 9999));
            connection.Connect((success) => { connected = success; _completion.Set(); });
            _completion.WaitOne();

            Assert.IsTrue(connected);
        }
Ejemplo n.º 29
0
        static void Main(string[] args)
        {
            //todo use mono.options https://www.nuget.org/packages/Mono.Options/
            if (args.Length < 5)
            {
                Console.WriteLine("YouTrack Release helper, marks a version as released and creates version numbers for follow up releases. Works with version numbers up to 3 digits");
                Console.WriteLine("");
                Console.WriteLine("Usage:");
                Console.WriteLine("  YouTrackRelease --server=<server> --username=<username> --password=<password> --project=<project> --version=<version>");
                Console.WriteLine("");
                Console.WriteLine("Options:");
                Console.WriteLine("  --server=<server>          Server address, ie http://youtrack.domain.com/youtrack");
                Console.WriteLine("  --username=<username>      User with admin role");
                Console.WriteLine("  --password=<password>      ");
                Console.WriteLine("  --project=<project>        ID of project being released");
                Console.WriteLine("  --version=<version>        The version number to be released (i.e 1.2.3)");
                return;
            }

            var server = GetArgNotNull(args, "--server");
            var username = GetArgNotNull(args, "--username");
            var password = GetArgNotNull(args, "--password");
            var projectId = GetArgNotNull(args, "--project");
            var version = GetArgNotNull(args, "--version");

            var uri = new Uri(server);
            Console.WriteLine("Connecting to server: {0}, {1}, {2}", uri, uri.Port, uri.AbsolutePath);

            var conn = new Connection(uri.Host, uri.Port, uri.Scheme == "https", uri.AbsolutePath);
            conn.Authenticate(username, password);

            var projectManagement = new ProjectManagement(conn);
            var project = projectManagement.GetProject(projectId);
            if (project == null)
                throw new Exception("Project does not exist");

            var existingVersions = projectManagement.GetVersions(project).Select((v) => v.Name);

            if (!existingVersions.Contains(version))
                throw new Exception("Version does not exist");

            Console.Out.WriteLine("Releasing version: {0}", version);
            projectManagement.UpdateVersion(project, new ProjectVersion { IsReleased = true, Name = version, ReleaseDate = JavaTimeNow() });

            var currentVersion = new VersionNumber(version);
            var nextVersions = currentVersion.GetNextReleaseVersions().Select((v) => v.ToString());

            var missingVersions = nextVersions.Where((v) => !existingVersions.Contains(v));
            foreach (var newVersion in missingVersions)
            {
                Console.Out.WriteLine("Adding version: {0}", newVersion);
                projectManagement.AddVersion(project, new ProjectVersion {IsReleased = false, Name = newVersion});
            }

            if (Debugger.IsAttached)
                Console.ReadLine();
        }
Ejemplo n.º 30
0
        protected override bool ProcessIncomingMessageAction(Connection<object> connection, Packet packet) {
            packetQueueSemaphore.Wait();
            this.packetQueue.Enqueue(packet);
            packetQueueSemaphore.Release();

            bufferSemaphore.Release();

            return true;
        }