예제 #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[]>();
 }
예제 #2
0
파일: Program.cs 프로젝트: Nerven/Self
        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);
        }
예제 #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);
 }
예제 #4
0
 private SiteGenerator(string baseUri, LogoBuilder logoBuilder)
 {
     _BaseUri     = baseUri;
     _LogoBuilder = logoBuilder;
 }