예제 #1
0
        // locks the server (async)
        private void LockServer(DelegateTransfer callback)
        {
            try
            {
                // create local lockfile
                if (!File.Exists(localPath + lockFile))
                {
                    File.Create(localPath + lockFile);
                }
            }
            catch (Exception e)
            {
                ErrorLog.Add(this, e.Message);
                callback(false);
                return;
            }

            // try to upload the lockfile
            TransferFile file = new TransferFile(lockFile);

            fileTransfer.UploadFileAsync(file, false, remotePath, localPath,
                                         delegate(FileTransferResult result)
            {
                serverLock = (result == FileTransferResult.Success);
                callback(serverLock);
            });
        }