Ejemplo n.º 1
0
 public Logo(LogoBuilder logoBuilder, ProjectInfo project, string key, XDocument svgWithTextDocument)
 {
     _LogoBuilder         = logoBuilder;
     _Project             = project;
     Key                  = key;
     _SvgWithTextDocument = svgWithTextDocument;
     _Lock                = new AsyncLock();
     _PngBitmaps          = new Dictionary <int, byte[]>();
 }
Ejemplo n.º 2
0
        public static async Task MainAsync(string cacheTo,
                                           string cacheFrom,
                                           string outputBaseDirectoryPath,
                                           bool clearOutputDirectory,
                                           string baseUri,
                                           string gitHubToken,
                                           string extraDataFile,
                                           string pngOptExecutable,
                                           bool gitCommit,
                                           string gitAuthor,
                                           bool gitPush)
        {
            SiteData _data;

            if (cacheFrom != null)
            {
                _data = Helpers.DeserializeData <SiteData>(cacheFrom);
            }
            else
            {
                _data = await DataFetcher.FetchDataAsync(gitHubToken, extraDataFile).ConfigureAwait(false);

                if (cacheTo != null)
                {
                    Helpers.SerializeData(cacheTo, _data);
                }
            }

            if (clearOutputDirectory)
            {
                foreach (var _fileSystemEntryPath in Directory.EnumerateFileSystemEntries(outputBaseDirectoryPath))
                {
                    if (Directory.Exists(_fileSystemEntryPath))
                    {
                        Directory.Delete(_fileSystemEntryPath, true);
                    }
                    else
                    {
                        File.Delete(_fileSystemEntryPath);
                    }
                }
            }

            var _logoBuilder = new LogoBuilder(pngOptExecutable);
            await SiteGenerator.GenerateSiteAsync(baseUri, _logoBuilder, _data, outputBaseDirectoryPath).ConfigureAwait(false);

            await SitePublisher.PublishSiteAsync(outputBaseDirectoryPath, gitCommit, gitAuthor, gitPush).ConfigureAwait(false);
        }
Ejemplo n.º 3
0
 public static async Task GenerateSiteAsync(string baseUri, LogoBuilder logoBuilder, SiteData data, string outputBaseDirectoryPath)
 {
     await new SiteGenerator(baseUri, logoBuilder)._GenerateSiteAsync(data, outputBaseDirectoryPath).ConfigureAwait(false);
 }
Ejemplo n.º 4
0
 private SiteGenerator(string baseUri, LogoBuilder logoBuilder)
 {
     _BaseUri     = baseUri;
     _LogoBuilder = logoBuilder;
 }