|
|
|
@ -111,26 +111,26 @@ public partial class PackageCardViewModel : ProgressViewModel
|
|
|
|
|
if (!settingsManager.IsLibraryDirSet) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
IsSharedModelSymlink = Package.PreferredSharedFolderMethod == SharedFolderMethod.Symlink; |
|
|
|
|
IsSharedModelConfig = |
|
|
|
|
Package.PreferredSharedFolderMethod == SharedFolderMethod.Configuration; |
|
|
|
|
IsSharedModelDisabled = Package.PreferredSharedFolderMethod == SharedFolderMethod.None; |
|
|
|
|
|
|
|
|
|
if (Package.PreferredSharedFolderMethod == null) |
|
|
|
|
// Migrate old packages with no preferred shared folder method |
|
|
|
|
if (Package.PreferredSharedFolderMethod is null) |
|
|
|
|
{ |
|
|
|
|
var basePackage = packageFactory[Package.PackageName!]; |
|
|
|
|
switch (basePackage?.RecommendedSharedFolderMethod) |
|
|
|
|
var basePackage = packageFactory[Package.PackageName!]!; |
|
|
|
|
Package.PreferredSharedFolderMethod = basePackage.RecommendedSharedFolderMethod; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch (Package.PreferredSharedFolderMethod) |
|
|
|
|
{ |
|
|
|
|
case SharedFolderMethod.Symlink: |
|
|
|
|
IsSharedModelSymlink = true; |
|
|
|
|
break; |
|
|
|
|
case SharedFolderMethod.Configuration: |
|
|
|
|
IsSharedModelConfig = true; |
|
|
|
|
break; |
|
|
|
|
case SharedFolderMethod.Symlink: |
|
|
|
|
IsSharedModelSymlink = true; |
|
|
|
|
break; |
|
|
|
|
case SharedFolderMethod.None: |
|
|
|
|
IsSharedModelDisabled = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
default: |
|
|
|
|
throw new ArgumentOutOfRangeException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IsUpdateAvailable = await HasUpdate(); |
|
|
|
@ -368,32 +368,36 @@ public partial class PackageCardViewModel : ProgressViewModel
|
|
|
|
|
if (oldValue == newValue) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
var basePackage = packageFactory[Package!.PackageName]; |
|
|
|
|
if (newValue != Package!.PreferredSharedFolderMethod is SharedFolderMethod.Symlink) |
|
|
|
|
{ |
|
|
|
|
if (!newValue) |
|
|
|
|
{ |
|
|
|
|
var basePackage = packageFactory[Package!.PackageName!]; |
|
|
|
|
basePackage!.RemoveModelFolderLinks(Package.FullPath!, SharedFolderMethod.Symlink); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
basePackage!.SetupModelFolders(Package.FullPath!, SharedFolderMethod.Symlink); |
|
|
|
|
settingsManager.Transaction( |
|
|
|
|
s => |
|
|
|
|
s.InstalledPackages.First(x => x.Id == Package.Id).PreferredSharedFolderMethod = |
|
|
|
|
SharedFolderMethod.Symlink |
|
|
|
|
); |
|
|
|
|
using var st = settingsManager.BeginTransaction(); |
|
|
|
|
Package.PreferredSharedFolderMethod = SharedFolderMethod.Symlink; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (newValue) |
|
|
|
|
{ |
|
|
|
|
IsSharedModelConfig = false; |
|
|
|
|
IsSharedModelDisabled = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
partial void OnIsSharedModelConfigChanged(bool oldValue, bool newValue) |
|
|
|
|
{ |
|
|
|
|
if (oldValue == newValue) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
var basePackage = packageFactory[Package!.PackageName]; |
|
|
|
|
if (newValue != Package!.PreferredSharedFolderMethod is SharedFolderMethod.Configuration) |
|
|
|
|
{ |
|
|
|
|
if (!newValue) |
|
|
|
|
{ |
|
|
|
|
var basePackage = packageFactory[Package!.PackageName!]; |
|
|
|
|
basePackage!.RemoveModelFolderLinks( |
|
|
|
|
Package.FullPath!, |
|
|
|
|
SharedFolderMethod.Configuration |
|
|
|
@ -401,32 +405,29 @@ public partial class PackageCardViewModel : ProgressViewModel
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
basePackage!.SetupModelFolders(Package.FullPath!, SharedFolderMethod.Configuration); |
|
|
|
|
settingsManager.Transaction( |
|
|
|
|
s => |
|
|
|
|
s.InstalledPackages.First(x => x.Id == Package.Id).PreferredSharedFolderMethod = |
|
|
|
|
SharedFolderMethod.Configuration |
|
|
|
|
); |
|
|
|
|
using var st = settingsManager.BeginTransaction(); |
|
|
|
|
Package.PreferredSharedFolderMethod = SharedFolderMethod.Configuration; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (newValue) |
|
|
|
|
{ |
|
|
|
|
IsSharedModelSymlink = false; |
|
|
|
|
IsSharedModelDisabled = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
partial void OnIsSharedModelDisabledChanged(bool oldValue, bool newValue) |
|
|
|
|
partial void OnIsSharedModelDisabledChanged(bool value) |
|
|
|
|
{ |
|
|
|
|
if (oldValue == newValue) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
if (!newValue) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
settingsManager.Transaction( |
|
|
|
|
s => |
|
|
|
|
s.InstalledPackages.First(x => x.Id == Package!.Id).PreferredSharedFolderMethod = |
|
|
|
|
SharedFolderMethod.None |
|
|
|
|
); |
|
|
|
|
if (value) |
|
|
|
|
{ |
|
|
|
|
if (Package!.PreferredSharedFolderMethod is not SharedFolderMethod.None) |
|
|
|
|
{ |
|
|
|
|
using var st = settingsManager.BeginTransaction(); |
|
|
|
|
Package.PreferredSharedFolderMethod = SharedFolderMethod.None; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IsSharedModelSymlink = false; |
|
|
|
|
IsSharedModelConfig = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|