예제 #1
0
            /// <summary>
            /// Handles MD5HashesRequest message.
            /// </summary>
            /// <param name="context">Context.</param>
            private void HandleMD5HashesRequest(ClientContext context)
            {
                DebugEx.VerboseFormat("ServerScript.HandleMD5HashesRequest(context = {0})", context);

                List <byte[]> messages;

                context.mRevision = RevisionsCache.LockRevision(out context.mFiles, out messages);

                // TODO: Need to unlock revision in destructor

                if (messages.Count > 0)
                {
                    for (int i = 0; i < messages.Count; ++i)
                    {
                        if (!Server.Send(context.mConnectionId, messages[i]))
                        {
                            DebugEx.ErrorFormat("Failed to send MD5HashesResponse message");

                            context.state = ClientState.Disconnected;

                            return;
                        }
                    }

                    context.state = ClientState.Downloading;
                }
                else
                {
                    DebugEx.FatalFormat("Incorrect behaviour in HandleMD5HashesRequest");

                    context.state = ClientState.Disconnected;
                }
            }
예제 #2
0
        /// <summary>
        /// Checks for new revision.
        /// </summary>
        private static void CheckForNewRevision()
        {
            DebugEx.VeryVeryVerbose("RevisionChecker.CheckForNewRevision()");

            if (!File.Exists(sAppDir + "/Revisions/NewRevision/Lock"))
            {
                CalculateMD5InFolder(sAppDir + "/Revisions/NewRevision");

                ++sRevision;
                Directory.Move(sAppDir + "/Revisions/NewRevision", sAppDir + "/Revisions/" + sRevision.ToString());

                CreateNewRevisionFolder();

                RevisionsCache.OnNewRevision();

                DebugEx.DebugFormat("New revision: {0}", sRevision);
            }
        }