Skip to content

Commit

Permalink
Disabled the Add/Remove Library features.
Browse files Browse the repository at this point in the history
  • Loading branch information
DjScribbles committed Aug 2, 2021
1 parent 0dc2b0a commit c16a425
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 48 deletions.
45 changes: 23 additions & 22 deletions GamePipe/ViewModel/RootSteamViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,28 +257,29 @@ public RelayCommand AddLibraryCommand

public void AddLibrary()
{
while (GamePipeLib.Utils.SteamDirParsingUtils.IsSteamOpen())
{
var msgBoxResult = System.Windows.MessageBox.Show("Please close Steam to continue.", "", System.Windows.MessageBoxButton.OKCancel, System.Windows.MessageBoxImage.Exclamation, System.Windows.MessageBoxResult.OK);
if (msgBoxResult != System.Windows.MessageBoxResult.OK)
return;
}

var dialog = new System.Windows.Forms.FolderBrowserDialog();
System.Windows.Forms.DialogResult result = dialog.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
var path = Path.GetFullPath(dialog.SelectedPath);
try
{
SteamRoot.Instance.AddLibrary(path);
}
catch (Exception ex)
{
GamePipeLib.Utils.Logging.Logger.Error("Library Addition failed due to exception:", ex);
System.Windows.MessageBox.Show("Library Addition failed due to exception:\n" + ex.Message, "", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Exclamation, System.Windows.MessageBoxResult.OK);
}
}
System.Windows.MessageBox.Show("This feature is currently disabled as Steam format has gotten more complex. Within Steam, open the Steam->Settings menu from the top left, select the Downloads category, and click the 'Steam Library Folders' button to manage your libraries.");
//while (GamePipeLib.Utils.SteamDirParsingUtils.IsSteamOpen())
//{
// var msgBoxResult = System.Windows.MessageBox.Show("Please close Steam to continue.", "", System.Windows.MessageBoxButton.OKCancel, System.Windows.MessageBoxImage.Exclamation, System.Windows.MessageBoxResult.OK);
// if (msgBoxResult != System.Windows.MessageBoxResult.OK)
// return;
//}

//var dialog = new System.Windows.Forms.FolderBrowserDialog();
//System.Windows.Forms.DialogResult result = dialog.ShowDialog();
//if (result == System.Windows.Forms.DialogResult.OK)
//{
// var path = Path.GetFullPath(dialog.SelectedPath);
// try
// {
// SteamRoot.Instance.AddLibrary(path);
// }
// catch (Exception ex)
// {
// GamePipeLib.Utils.Logging.Logger.Error("Library Addition failed due to exception:", ex);
// System.Windows.MessageBox.Show("Library Addition failed due to exception:\n" + ex.Message, "", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Exclamation, System.Windows.MessageBoxResult.OK);
// }
//}
}
#endregion //AddLibraryCommand

Expand Down
13 changes: 8 additions & 5 deletions GamePipe/ViewModel/SteamLibraryViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ public RelayCommand RemoveCommand

public void Remove()
{

try
{
if (Model is SteamArchive)
Expand All @@ -261,11 +262,13 @@ public void Remove()
}
else
{
var result = System.Windows.MessageBox.Show("Are you sure you want to remove this library from Game Pipe and Steam?\n\nNo files will be deleted, but any games it contains will no longer be playable.", "Remove Library?", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Exclamation, System.Windows.MessageBoxResult.No);
if (result == System.Windows.MessageBoxResult.Yes)
{
SteamRoot.Instance.RemoveLibrary(Model);
}
System.Windows.MessageBox.Show("This feature is currently disabled for non-Archive folders, as Steam format has gotten more complex. Within Steam, open the Steam->Settings menu from the top left, select the Downloads category, and click the 'Steam Library Folders' button to manage your libraries.");

//var result = System.Windows.MessageBox.Show("Are you sure you want to remove this library from Game Pipe and Steam?\n\nNo files will be deleted, but any games it contains will no longer be playable.", "Remove Library?", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Exclamation, System.Windows.MessageBoxResult.No);
//if (result == System.Windows.MessageBoxResult.Yes)
//{
// SteamRoot.Instance.RemoveLibrary(Model);
//}
}
}
catch (Exception ex)
Expand Down
42 changes: 21 additions & 21 deletions GamePipeLib/Model/Steam/Root.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,27 +204,27 @@ public void RemoveArchive(SteamArchive archive)
Properties.Settings.Default.Save();
_Libraries.Remove(archive);
}
public void AddLibrary(string path)
{
if (Directory.Exists(path) && !Properties.Settings.Default.Archives.Contains(path))
{
Utils.Logging.Logger.Info($"Adding library: {path}");
GamePipeLib.Utils.SteamDirParsingUtils.SetupNewSteamLibrary(path);
SteamRestartRequired = true;
var libraryDirectory = Path.Combine(path, "steamapps");
if (!Directory.Exists(libraryDirectory)) Directory.CreateDirectory(libraryDirectory);
_Libraries.Add(new SteamLibrary(libraryDirectory));
NotifyPropertyChanged("Libraries");
}
}
public void RemoveLibrary(SteamLibrary archive)
{
_Libraries.Remove(archive);
var path = archive.SteamDirectory;
if (path.EndsWith(@"\steamapps", StringComparison.OrdinalIgnoreCase))
path = path.Substring(0, path.Length - @"\steamapps".Length);
GamePipeLib.Utils.SteamDirParsingUtils.RemoveSteamLibrary(path);
}
//public void AddLibrary(string path)
//{
// if (Directory.Exists(path) && !Properties.Settings.Default.Archives.Contains(path))
// {
// Utils.Logging.Logger.Info($"Adding library: {path}");
// GamePipeLib.Utils.SteamDirParsingUtils.SetupNewSteamLibrary(path);
// SteamRestartRequired = true;
// var libraryDirectory = Path.Combine(path, "steamapps");
// if (!Directory.Exists(libraryDirectory)) Directory.CreateDirectory(libraryDirectory);
// _Libraries.Add(new SteamLibrary(libraryDirectory));
// NotifyPropertyChanged("Libraries");
// }
//}
//public void RemoveLibrary(SteamLibrary archive)
//{
// _Libraries.Remove(archive);
// var path = archive.SteamDirectory;
// if (path.EndsWith(@"\steamapps", StringComparison.OrdinalIgnoreCase))
// path = path.Substring(0, path.Length - @"\steamapps".Length);
// GamePipeLib.Utils.SteamDirParsingUtils.RemoveSteamLibrary(path);
//}

public void ScanWithDefender(string gameDir, string appId)
{
Expand Down

0 comments on commit c16a425

Please sign in to comment.