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); }
/// <summary> /// Processes the given intent, loading files passed using content resolver. /// </summary> /// <param name="intent">intent to process</param> private void ProcessIntent(Intent intent) { try { if (intent.DataString != null && intent.DataString.StartsWith(Shared.Model.AppResourceUri.DefaultScheme)) { Core.App.OpenAppResourceUri(intent.DataString); return; } var helper = new IntentFilterHelper(this.ContentResolver); string filename = Path.GetFileName(helper.GetFilenameFromIntent(intent)); if (filename == null) { return; } var stream = helper.GetStreamFromIntent(intent); if (stream != null) { Core.App.RunOnUiThread(async() => await OpenFileHelper.OpenFileAsync(stream, filename)); } } catch (Exception) { // ignore errors } }
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); }
protected virtual void OnOpenRecentAsClick(PathEventArgs e) { if (e is null) { throw new ArgumentNullException(nameof(e)); } OpenRecentAsClick?.Invoke(this, e); OpenFileHelper?.OpenFileAs(e.Path); }
public static Map Load(string filename) { string json = ""; using (System.IO.Stream stream = OpenFileHelper.OpenFileForRead(SavePath, filename)) { byte[] _data = new byte[stream.Length]; stream.Read(_data, 0, (int)stream.Length); json = System.Text.Encoding.UTF8.GetString(_data); } return(LoadMap(json)); }
/// <summary> /// Called when a file associated with the UWP app is opened. /// </summary> /// <param name="args">file activation event args</param> protected override void OnFileActivated(FileActivatedEventArgs args) { this.SetupRootFrame(args, null); if (args.Files.Count > 0) { var file = args.Files[0] as StorageFile; Core.App.RunOnUiThread(async() => { using var stream = await file.OpenStreamForReadAsync(); await OpenFileHelper.OpenFileAsync(stream, file.Name); }); } }
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); }
/// <summary> /// Called when a file is dropped onto the main page /// </summary> /// <param name="sender">sender object</param> /// <param name="args">event args</param> private async void OnDrop(object sender, DragEventArgs args) { if (args.DataView.Contains(StandardDataFormats.StorageItems)) { var items = await args.DataView.GetStorageItemsAsync(); if (items.Count > 0) { var file = items[0] as StorageFile; Core.App.RunOnUiThread(async() => { using var stream = await file.OpenStreamForReadAsync(); await OpenFileHelper.OpenFileAsync(stream, file.Name); }); } } }
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); }
private void ChangelogBtnClick(object sender, EventArgs e) { OpenFileHelper.TryOpenFile(Path.GetFullPath("ChangeLog.txt"), this); }
private void GithubBtnClick(object sender, EventArgs e) { OpenFileHelper.TryOpenFile("https://github.com/JetStream96/QSimPlanner", this); }
private void SiteBtnClick(object sender, EventArgs e) { OpenFileHelper.TryOpenFile("https://qsimplan.wordpress.com/", this); }
private void LicenseBtnClick(object sender, EventArgs e) { OpenFileHelper.TryOpenFile(Path.GetFullPath("LICENSE.txt"), this); }
protected virtual void OnOpenFileAsClick(EventArgs e) { OpenFileAsClick?.Invoke(this, e); OpenFileHelper?.OpenFileAs(); }