Vixen
02b45cc4
csharp
public sealed class EditorUserStore

Where the editor keeps what belongs to the user rather than to the project.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Window arrangements, keybindings and the chosen theme are the user's, so they do not go in the project and are not checked in — two people sharing a repository do not share a window layout. Project settings are the other thing and live in ProjectSettings/, which is Vixen.Editor.Core's business.

⚠ It is handed a directory rather than finding one. Where a user's data lives is a platform question — %APPDATA%, ~/Library/Application Support, $XDG_CONFIG_HOME — and Vixen.Platform answers it. A store that called Environment.GetFolderPath would be one that could not be pointed at a temporary directory by a test, and one whose answer disagreed with the rest of the application's.

⚠ A read that fails returns null; a write that fails throws. A missing or unreadable layout means the default layout, which is a fine thing to happen at start-up in front of somebody who wanted to open a project. A write that silently did nothing would lose the arrangement they spent an afternoon on and say so at no point.

Fields and properties (7)

  • public const string LayoutExtension

    What a saved arrangement is called on disk.

  • public const string KeyMapFile

    The file the keymap's user overrides go in.

  • public const string PreferencesFile

    The file the shell's own preferences go in.

  • public const string PluginsFile

    The file recording which plugins the user has switched off.

  • public const string RecentProjectsFile

    The file listing the projects the editor has opened, newest first.

  • public const string CurrentLayout

    The arrangement the editor was left in.

  • public string Directory

    Where the files go.

Methods (9)

  • public EditorUserStore(string directory)

    Opens a store over a directory, which need not exist yet.

  • public string? Read(string name)

    Reads a file, or null if it is not there or cannot be read.

  • public void Write(string name, string text)

    Writes a file, creating the directory if it is not there.

  • public bool Delete(string name)

    Deletes a file.

  • public IReadOnlyList<string> Layouts()

    The named arrangements the user has saved, in name order.

  • public void SaveLayout(string name, string yaml)

    Saves an arrangement under a name.

  • public string? LoadLayout(string name)

    Reads a named arrangement back.

  • public bool DeleteLayout(string name)

    Forgets a named arrangement.

  • public static string FileFor(string name)

    What a named arrangement's file is called.

Used by (8)

  • EditorApplicationVixen.Editor.App
  • MilestoneE3TestsVixen.Editor.App.Tests
  • ProjectBrowserTestsVixen.Editor.App.Tests
  • ProjectHistoryVixen.Editor.App
  • ServiceTestsVixen.Editor.Ui.Tests
  • SettingsWindowTestsVixen.Editor.App.Tests
  • WindowPlacementVixen.Editor.Host
  • WindowPlacementTestsVixen.Editor.App.Tests