|
@@ -1,4 +1,7 @@
|
|
|
-namespace PixiEditor.Extensions.WasmRuntime.Api;
|
|
|
+using PixiEditor.Extensions.Metadata;
|
|
|
+using PixiEditor.Extensions.WasmRuntime.Utilities;
|
|
|
+
|
|
|
+namespace PixiEditor.Extensions.WasmRuntime.Api;
|
|
|
|
|
|
internal class PreferencesApi : ApiGroupHandler
|
|
|
{
|
|
@@ -11,120 +14,130 @@ internal class PreferencesApi : ApiGroupHandler
|
|
|
[ApiFunction("update_preference_int")]
|
|
|
public void UpdatePreference(string name, int value)
|
|
|
{
|
|
|
- Api.Preferences.UpdatePreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, false);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("update_preference_bool")]
|
|
|
public void UpdatePreference(string name, bool value)
|
|
|
{
|
|
|
- Api.Preferences.UpdatePreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, false);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("update_preference_string")]
|
|
|
public void UpdatePreference(string name, string value)
|
|
|
{
|
|
|
- Api.Preferences.UpdatePreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, false);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("update_preference_float")]
|
|
|
public void UpdatePreference(string name, float value)
|
|
|
{
|
|
|
- Api.Preferences.UpdatePreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, false);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("update_preference_double")]
|
|
|
public void UpdatePreference(string name, double value)
|
|
|
{
|
|
|
- Api.Preferences.UpdatePreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, false);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("update_local_preference_int")]
|
|
|
public void UpdateLocalPreference(string name, int value)
|
|
|
{
|
|
|
- Api.Preferences.UpdateLocalPreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, true);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("update_local_preference_bool")]
|
|
|
public void UpdateLocalPreference(string name, bool value)
|
|
|
{
|
|
|
- Api.Preferences.UpdateLocalPreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, true);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("update_local_preference_string")]
|
|
|
public void UpdateLocalPreference(string name, string value)
|
|
|
{
|
|
|
- Api.Preferences.UpdateLocalPreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, true);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("update_local_preference_float")]
|
|
|
public void UpdateLocalPreference(string name, float value)
|
|
|
{
|
|
|
- Api.Preferences.UpdateLocalPreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, true);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("update_local_preference_double")]
|
|
|
public void UpdateLocalPreference(string name, double value)
|
|
|
{
|
|
|
- Api.Preferences.UpdateLocalPreference(name, value);
|
|
|
+ PreferencesUtility.UpdateExtensionPreference(Extension, name, value, true);
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_preference_int")]
|
|
|
public int GetPreference(string name, int fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, false);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_preference_bool")]
|
|
|
public bool GetPreference(string name, bool fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, false);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_preference_string")]
|
|
|
public string GetPreference(string name, string fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, false);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_preference_float")]
|
|
|
public float GetPreference(string name, float fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, false);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_preference_double")]
|
|
|
public double GetPreference(string name, double fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, false);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_local_preference_int")]
|
|
|
public int GetLocalPreference(string name, int fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetLocalPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, true);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_local_preference_bool")]
|
|
|
public bool GetLocalPreference(string name, bool fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetLocalPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, true);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_local_preference_string")]
|
|
|
public string GetLocalPreference(string name, string fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetLocalPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, true);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_local_preference_float")]
|
|
|
public float GetLocalPreference(string name, float fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetLocalPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, true);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
[ApiFunction("get_local_preference_double")]
|
|
|
public double GetLocalPreference(string name, double fallbackValue)
|
|
|
{
|
|
|
- return Api.Preferences.GetLocalPreference(name, fallbackValue);
|
|
|
+ var result = PreferencesUtility.GetPreference(Extension, name, fallbackValue, true);
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|