测试代码
Tools服务类多平台实现
MAUI
public string CacheDirectory() => FileSystem.CacheDirectory;
public string AppDataDirectory() => FileSystem.AppDataDirectory;
其他平台
public string CacheDirectory() => AppDomain.CurrentDomain.BaseDirectory;
public string AppDataDirectory() => AppDomain.CurrentDomain.BaseDirectory;
测试界面
```
AppDataDirectory:
@Tools.AppDataDirectory()
CacheDirectory:
@Tools.CacheDirectory()
BaseDirectory:
@AppDomain.CurrentDomain.BaseDirectory
DynamicDirectory:
@AppDomain.CurrentDomain.DynamicDirectory
FriendlyName:
@AppDomain.CurrentDomain.FriendlyName
ApplicationBase:
@AppDomain.CurrentDomain.SetupInformation.ApplicationBase
TargetFrameworkName:
@AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName
Environment.SpecialFolder
LocalApplicationData:
@Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
ApplicationData:
@Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
MyDocuments:
@Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Personal:
@Environment.GetFolderPath(Environment.SpecialFolder.Personal)
Resources:
@Environment.GetFolderPath(Environment.SpecialFolder.Resources)
```
AppDataDirectory:
@Tools.AppDataDirectory()
CacheDirectory:
@Tools.CacheDirectory()
BaseDirectory:
@AppDomain.CurrentDomain.BaseDirectory
DynamicDirectory:
@AppDomain.CurrentDomain.DynamicDirectory
FriendlyName:
@AppDomain.CurrentDomain.FriendlyName
ApplicationBase:
@AppDomain.CurrentDomain.SetupInformation.ApplicationBase
TargetFrameworkName:
@AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName
Environment.SpecialFolder
LocalApplicationData:
@Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
ApplicationData:
@Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
MyDocuments:
@Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Personal:
@Environment.GetFolderPath(Environment.SpecialFolder.Personal)
Resources:
@Environment.GetFolderPath(Environment.SpecialFolder.Resources)
```