コード例 #1
0
        /// <inheritdoc />
        protected override async Task InitControllers(Task chatTask, ReattachInformation reattachInfo, CancellationToken cancellationToken)
        {
            try
            {
                await base.InitControllers(chatTask, reattachInfo, cancellationToken).ConfigureAwait(false);
            }
            finally
            {
                // Then we move it back and apply the symlink
                if (directoryHardLinked)
                {
                    Logger.LogTrace("Unhardlinking compile job...");
                    Server?.Suspend();
                    await GameIOManager.MoveDirectory(
                        ActiveSwappable.Directory,
                        ActiveSwappable.CompileJob.DirectoryName.ToString(),
                        default)
                    .ConfigureAwait(false);

                    directoryHardLinked = false;
                }
            }

            if (reattachInfo != null)
            {
                Logger.LogTrace("Skipping symlink due to reattach");
                return;
            }

            Logger.LogTrace("Symlinking compile job...");
            await ActiveSwappable.MakeActive(cancellationToken).ConfigureAwait(false);

            Server.Resume();
        }
コード例 #2
0
        /// <inheritdoc />
        protected override async Task InitControllers(Task chatTask, ReattachInformation reattachInfo, CancellationToken cancellationToken)
        {
            try
            {
                await base.InitControllers(chatTask, reattachInfo, cancellationToken).ConfigureAwait(false);
            }
            finally
            {
                // Then we move it back and apply the symlink
                if (hardLinkedDmb != null)
                {
                    try
                    {
                        Logger.LogTrace("Unhardlinking compile job...");
                        Server?.Suspend();
                        var hardLink         = hardLinkedDmb.Directory;
                        var originalPosition = hardLinkedDmb.CompileJob.DirectoryName.ToString();
                        await GameIOManager.MoveDirectory(
                            hardLink,
                            originalPosition,
                            default)
                        .ConfigureAwait(false);
                    }
                    catch (Exception ex)
                    {
                        Logger.LogError(
                            ex,
                            "Failed to un-hard link compile job #{0} ({1})",
                            hardLinkedDmb.CompileJob.Id,
                            hardLinkedDmb.CompileJob.DirectoryName);
                    }

                    hardLinkedDmb = null;
                }
            }

            if (reattachInfo != null)
            {
                Logger.LogTrace("Skipping symlink due to reattach");
                return;
            }

            Logger.LogTrace("Symlinking compile job...");
            await ActiveSwappable.MakeActive(cancellationToken).ConfigureAwait(false);

            Server.Resume();
        }
コード例 #3
0
 /// <summary>
 /// Create the initial link to the live game directory using <see cref="ActiveSwappable"/>.
 /// </summary>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
 /// <returns>A <see cref="Task"/> representing the running operation.</returns>
 protected virtual Task InitialLink(CancellationToken cancellationToken)
 {
     Logger.LogTrace("Symlinking compile job...");
     return(ActiveSwappable.MakeActive(cancellationToken));
 }