Exemplo n.º 1
0
        ReleaseEntry readBundledReleasesFile()
        {
            var release = fileSystem.GetFileInfo(Path.Combine(currentAssemblyDir, "RELEASES"));

            if (!release.Exists)
            {
                UserError.Throw("This installer is incorrectly configured, please contact the author",
                                new FileNotFoundException(release.FullName));
                return(null);
            }

            ReleaseEntry ret;

            try {
                var fileText = fileSystem
                               .GetFile(release.FullName)
                               .ReadAllText(release.FullName, Encoding.UTF8);
                ret = ReleaseEntry
                      .ParseReleaseFile(fileText)
                      .Where(x => !x.IsDelta)
                      .OrderByDescending(x => x.Version)
                      .First();
            } catch (Exception ex) {
                this.Log().ErrorException("Couldn't read bundled RELEASES file", ex);
                UserError.Throw("This installer is incorrectly configured, please contact the author", ex);
                return(null);
            }

            return(ret);
        }
        ReleaseEntry readBundledReleasesFile()
        {
            var release = fileSystem.GetFileInfo(Path.Combine(currentAssemblyDir, "RELEASES"));

            if (!release.Exists)
            {
                UserError.Throw("This installer is incorrectly configured, please contact the author",
                                new FileNotFoundException(release.FullName));
                return(null);
            }

            ReleaseEntry ret;

            try {
                var fileText = fileSystem
                               .GetFile(release.FullName)
                               .ReadAllText(release.FullName, Encoding.UTF8);

                ret = ReleaseEntry
                      .ParseReleaseFile(fileText)
                      .Where(x => !x.IsDelta)
                      .OrderByDescending(x => x.Version)
                      .First();
            } catch (Exception ex) {
                this.Log().ErrorException("Couldn't read bundled RELEASES file", ex);
                UserError.Throw("This installer is incorrectly configured, please contact the author", ex);
                return(null);
            }

            // now set the logger to the found package name
            RxApp.LoggerFactory = _ => new FileLogger(ret.PackageName)
            {
                Level = ReactiveUIMicro.LogLevel.Info
            };
            ReactiveUIMicro.RxApp.ConfigureFileLogging(ret.PackageName); // HACK: we can do better than this later

            return(ret);
        }