コード例 #1
0
        public static void Main(string[] args)
        {
            var exportPath = new DirectoryInfo(AssemblyHelper.EntryAssemblyDirectory) // $repository_path$/fa2cs/bin/$release$/$runtime$/
                             .Parent                                                  // $repository_path$/fa2cs/bin/$release$/
                             .Parent                                                  // $repository_path$/fa2cs/bin/
                             .Parent                                                  // $repository_path$/fa2cs/
                             .Parent                                                  // $repository_path$/
                             .FullName;

            var importPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "icons.json");

            if (!File.Exists(importPath))
            {
                throw new InvalidOperationException($"fa2cs cannot generate the C# class as the 'icons.json' metadata was not found on the desktop.\n" +
                                                    $"Expected location is: {importPath}");
            }

            var parser = new MetaDataParser();
            var icons  = parser.Parse(importPath, out var version);

            WriteCode(exportPath, icons, version);

            WriteReadme(exportPath, version);

            OpenFileHelper.OpenAndSelect(exportPath);
        }
コード例 #2
0
        public static async Task Main(string[] args)
        {
            var exportPath = AssemblyHelper.EntryAssemblyDirectory;

            if (args != null && args.Any())
            {
                exportPath = args.First();
            }

            var outputPath = Path.Combine(exportPath, "md2cs-output");

            if (Directory.Exists(outputPath))
            {
                Directory.Delete(outputPath, true);
            }

            Directory.CreateDirectory(outputPath);

            var downloader = new MaterialDesignDownloader();
            var codeWriter = new CodeWriter();

            var icons = await downloader.DownloadIconCodes(Endpoint);

            var code = codeWriter.Write(icons);

            File.WriteAllText(Path.Combine(exportPath, "MaterialDesignIcons.cs"), code);

            OpenFileHelper.OpenAndSelect(exportPath);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Wenfengcheng/fa2cs
        public static async Task Main(string[] args)
        {
            var downloader = new FontAwesomeDownloader();
            var writer     = new CodeWriter();

            var result = await downloader.DownloadIconCodes();

            var code = writer.Write(result);

            var outputFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), FontAwesomeIconsFileName);

            File.WriteAllText(outputFilePath, code);

            OpenFileHelper.OpenAndSelect(outputFilePath);
        }
コード例 #4
0
        public static async Task Main(string[] args)
        {
            var exportPath = AssemblyHelper.EntryAssemblyDirectory;

            if (args != null && args.Any())
            {
                exportPath = args.First();
            }

            var outputPath = Path.Combine(exportPath, "fa2cs-output");

            if (Directory.Exists(outputPath))
            {
                Directory.Delete(outputPath, true);
            }

            Directory.CreateDirectory(outputPath);

            var downloader = new FontAwesomeDownloader();
            var codeWriter = new CodeWriter();

            var icons = await downloader.DownloadIconCodes(Endpoint);

            var code = codeWriter.Write(icons);

            var codeFiles = new List <string>()
            {
                code,
                ResourcesHelper.ReadResourceContent("AssemblyInfoTemplate.txt"),
            };

            AssemblyEmitter.EmitAssembly(codeFiles, outputPath);

            File.WriteAllText(Path.Combine(outputPath, "readme.txt"), ResourcesHelper.ReadResourceContent("readme.txt"));
            File.WriteAllText(Path.Combine(exportPath, "FontAwesomeIcons.cs"), code);

            OpenFileHelper.OpenAndSelect(exportPath);
        }