()
| 8 | public void Shutdown () {} |
| 9 | |
| 10 | public void Step() |
| 11 | { |
| 12 | UI.WindowBegin("Settings", ref windowPose); |
| 13 | if (UI.Button("Open")) |
| 14 | { |
| 15 | /// :CodeSample: Platform.FilePicker Platform.ReadFile |
| 16 | /// ### Read Custom Files |
| 17 | Platform.FilePicker(PickerMode.Open, file => { |
| 18 | // On some platforms (like UWP), you may encounter permission |
| 19 | // issues when trying to read or write to an arbitrary file. |
| 20 | // |
| 21 | // StereoKit's `Platform.FilePicker` and `Platform.ReadFile` |
| 22 | // work together to avoid this permission issue, where the |
| 23 | // FilePicker will grant permission to the ReadFile method. |
| 24 | // C#'s built-in `File.ReadAllText` would fail on UWP here. |
| 25 | if (Platform.ReadFile(file, out string text)) |
| 26 | Log.Info(text); |
| 27 | }, null, ".txt"); |
| 28 | /// :End: |
| 29 | } |
| 30 | |
| 31 | if (UI.Button("Save")) |
| 32 | { |
| 33 | /// :CodeSample: Platform.FilePicker Platform.WriteFile |
| 34 | /// ### Write Custom Files |
| 35 | Platform.FilePicker(PickerMode.Save, file => { |
| 36 | // On some platforms (like UWP), you may encounter permission |
| 37 | // issues when trying to read or write to an arbitrary file. |
| 38 | // |
| 39 | // StereoKit's `Platform.FilePicker` and `Platform.WriteFile` |
| 40 | // work together to avoid this permission issue, where the |
| 41 | // FilePicker will grant permission to the WriteFile method. |
| 42 | // C#'s built-in `File.WriteAllText` would fail on UWP here. |
| 43 | Platform.WriteFile(file, "Text for the file.\n- Thanks!"); |
| 44 | }, null, ".txt"); |
| 45 | /// :End: |
| 46 | } |
| 47 | UI.WindowEnd(); |
| 48 | } |
| 49 | } |
nothing calls this directly
no test coverage detected