コード例 #1
0
    public async Task SyncData()
    {
        // Hasher.Clear(DataLocations.DataPath);
        IoHelpers.PurgeDirectory(DataLocations.MapsPath);
        IoHelpers.PurgeDirectory(DataLocations.TempPath);

        await PartyScraper.Run();

        await Get2016();
        await Get2019();

        File.Copy(DataLocations.Australia2019JsonPath, DataLocations.FutureAustraliaJsonPath);
        await StatesToCountryDownloader.RunFuture();

        await ProcessYear(DataLocations.Maps2016Path, electorates2016);
        await ProcessYear(DataLocations.Maps2019Path, electorates2019);
        await ProcessYear(DataLocations.MapsFuturePath, electoratesFuture);

        var electorates = await WriteElectoratesMetaData();

        IoHelpers.PurgeDirectoryRecursive(DataLocations.MapsDetail);
        foreach (var electorate in electorates)
        {
            var targetPath = Path.Combine(DataLocations.MapsDetail, $"{electorate.ShortName}.pdf");
            await Downloader.DownloadFile(targetPath, electorate.MapUrl);
        }

        foreach (var file in Directory.EnumerateFiles(DataLocations.MapsDetail))
        {
            var pngPath = await PdfToPng.Convert(file);

            File.Delete(file);

            CreatePortraitAndLandscape(pngPath);
        }

        WriteNamedCs(electorates);
        Export.ExportElectorates();
        // await Hasher.Create(DataLocations.DataPath);
        Zipper.ZipDir(DataLocations.MapsCuratedZipPath, DataLocations.MapsCuratedPath);
    }
コード例 #2
0
ファイル: Mode2D.cs プロジェクト: gviaud/OS-unity-5
 private void importPdf(string path)
 {
     PdfToPng converter = new PdfToPng();
     try
     {
         if (!Directory.Exists(Application.persistentDataPath + "/temp"))
             System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/temp");
         path = path.Replace("/", "\\");
         converter.DoTheJob(path, Application.persistentDataPath + "\\temp\\pdfToPng.png", 1, 1, 100, 100);
     }
     catch (UnityException e)
     {
         Debug.Log("error loading pdf file :" + e.ToString());
     }
     StartCoroutine(ContinueOpenFileStandalone(Application.persistentDataPath + "\\temp\\pdfToPng.png"));
 }
コード例 #3
0
    public Task ConvertSingle()
    {
        var fullPath = Path.GetFullPath("sample_electorate_map.pdf");

        return(PdfToPng.Convert(fullPath));
    }