Beispiel #1
0
        private static void ReadyPatchConnection()
        {
            if (m_PatchCon != null)
            {
                m_PatchCon.PatchArrived -= new PatchServerConnection.PatchArrivedDelegate(OnPatchArrived);
                m_PatchCon.Disconnected -= new PatchServerConnection.DisconnectedDelegate(OnDisconnected);
                m_PatchCon.ConnectionReady -= new EventHandler(OnConnectionReady);
                m_PatchCon.ClientIsCurrent -= new EventHandler(OnClientIsCurrent);
                m_PatchCon.PatchStreamProgress -= new PatchServerConnection.PatchStreamProgressDelegate(OnPatchStreamProgress);
                m_PatchCon.PatchNotesArrived -= new PatchServerConnection.PatchNotesDelegate(m_PatchCon_PatchNotesArrived);
                m_PatchCon.SocketConnectionConcluded -= new Action<IClientConnection, bool, string>(m_PatchCon_SocketConnectionConcluded);
            }

            m_PatchCon = new PatchServerConnection(ConfigHelper.GetStringConfig("BlockingMode", "FALSE").ToLower() == "true");
            m_PatchCon.PatchNotesArrived += new PatchServerConnection.PatchNotesDelegate(m_PatchCon_PatchNotesArrived);
            m_PatchCon.SocketConnectionConcluded += new Action<IClientConnection, bool, string>(m_PatchCon_SocketConnectionConcluded);
            m_PatchCon.PatchArrived += new PatchServerConnection.PatchArrivedDelegate(OnPatchArrived);
            m_PatchCon.Disconnected += new PatchServerConnection.DisconnectedDelegate(OnDisconnected);
            m_PatchCon.ConnectionReady += new EventHandler(OnConnectionReady);
            m_PatchCon.ClientIsCurrent += new EventHandler(OnClientIsCurrent);
            m_PatchCon.PatchStreamProgress += new PatchServerConnection.PatchStreamProgressDelegate(OnPatchStreamProgress);
        }
Beispiel #2
0
 private static void OnPatchStreamProgress(PatchServerConnection con, string patchFile, long curDownload, long totalDownload)
 {
     if (PatchDownloadProgress != null)
     {
         PatchDownloadProgress(patchFile, curDownload, totalDownload);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Fires when the patch server has been disconnected for any reason
 /// </summary>
 /// <param name="con">the connection that was severed</param>
 /// <param name="msg">a message that might indicate what happened</param>
 private static void OnDisconnected(PatchServerConnection con, string msg)
 {
     AddMsg("Connection closed. " + msg);
     Log.LogMsg("Connection closed.\r\n" + msg);
     ReadyPatchConnection();
 }
Beispiel #4
0
 /// <summary>
 /// Fires when the PatchServerConnection has downloaded a patch file
 /// </summary>
 /// <param name="con">the connection that downloaded the patch</param>
 /// <param name="version">the version that the patch will bring us to, once applied</param>
 /// <param name="path">the full path, on the local disk, to the patch file</param>
 private static void OnPatchArrived(PatchServerConnection con, long fileLength, string fileName)
 {
     Log.LogMsg("Got patch " + Path.GetFileName(fileName) + " .");
     AddMsg("Got patch " + Path.GetFileName(fileName) + " .");
     if (PatchArrived != null)
     {
         PatchArrived(fileName, fileLength);
     }
     con.KillConnection("Patch downloaded.");
     Patcher.ProcessPatch(fileName, false);
 }
Beispiel #5
0
 static void m_PatchCon_PatchNotesArrived(PatchServerConnection con, string notes)
 {
     if (!m_MasterNotesArrived && PatchNotesArrived != null)
     {
         m_MasterNotesArrived = true;
         PatchNotesArrived(notes);
     }
 }