Beispiel #1
0
        private void runTests(Action onCompletion)
        {
            int actualStepCount = 0;

            CurrentTest.RunAllSteps(onCompletion, e => Logger.Log($@"Error on step: {e}"), s =>
            {
                if (!interactive || RunAllSteps.Value)
                {
                    return(false);
                }

                if (actualStepCount > 0)
                {
                    // stop once one actual step has been run.
                    return(true);
                }

                if (!(s is SetUpStepButton) && !(s is LabelStep))
                {
                    actualStepCount++;
                }

                return(false);
            });
        }
        private void compileFailed(Exception ex) => Schedule(() =>
        {
            Logger.Error(ex, "Error with dynamic compilation!");

            compilingNotice.FadeIn(100, Easing.OutQuint).Then().FadeOut(800, Easing.InQuint);
            compilingNotice.FadeColour(Color4.Red, 100);
        });
Beispiel #3
0
        /// <summary>
        /// A general purpose migration method to move the storage to a different location.
        /// <param name="newStorage">The target storage of the migration.</param>
        /// </summary>
        public virtual void Migrate(Storage newStorage)
        {
            var source      = new DirectoryInfo(GetFullPath("."));
            var destination = new DirectoryInfo(newStorage.GetFullPath("."));

            // using Uri is the easiest way to check equality and contains (https://stackoverflow.com/a/7710620)
            var sourceUri      = new Uri(source.FullName + Path.DirectorySeparatorChar);
            var destinationUri = new Uri(destination.FullName + Path.DirectorySeparatorChar);

            if (sourceUri == destinationUri)
            {
                throw new ArgumentException("Destination provided is already the current location", destination.FullName);
            }

            if (sourceUri.IsBaseOf(destinationUri))
            {
                throw new ArgumentException("Destination provided is inside the source", destination.FullName);
            }

            // ensure the new location has no files present, else hard abort
            if (destination.Exists)
            {
                if (destination.GetFiles().Length > 0 || destination.GetDirectories().Length > 0)
                {
                    throw new ArgumentException("Destination provided already has files or directories present", destination.FullName);
                }
            }

            CopyRecursive(source, destination);
            ChangeTargetStorage(newStorage);

            // This action could be breaked if delete old files fail.
            // we need to handle IOException for keep migration processes.
            try
            {
                DeleteRecursive(source);
            }
            catch (IOException error)
            {
                Logger.Error(error, "Cannot delete old storage files on migration process.", Framework.Logging.LoggingTarget.Database);
            }
        }
Beispiel #4
0
 internal UpdateLogger(osu.Framework.Logging.Logger logger)
 {
     this.logger = logger;
 }