Skip to content

Commit

Permalink
Upgrade project file to Visual Studio 2015
Browse files Browse the repository at this point in the history
Fixed typos and bugs
  • Loading branch information
marijnkampf committed Mar 2, 2016
1 parent 27e5b71 commit 3aa3fac
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 0 additions & 2 deletions RPS 4/Config.cs
Expand Up @@ -1058,8 +1058,6 @@ public enum Order { Random = 1, Sequential = 0 };
} else {
this.screensaver.showInfoOnMonitors("", true, false);
}
this.screensaver.fileNodes.purgeNotMatchingParentFolders(this.getPersistantString("folders"));
this.screensaver.fileNodes.resetFoldersQueue();
this.screensaver.fileNodes.restartBackgroundWorkerImageFolder();
}
}
Expand Down
6 changes: 4 additions & 2 deletions RPS 4/FileDatabase.cs
Expand Up @@ -307,7 +307,7 @@ class FileDatabase {
return r;
}

public int purgeNotMatchingParentFolders(List<string> folders, bool exactMatchFolders, List<string> excludedSubfolders) {
public int purgeNotMatchingParentFolders(ConcurrentQueue<string> folders, bool exactMatchFolders, List<string> excludedSubfolders) {
if (this.readOnly) return -1;

string match = "%";
Expand Down Expand Up @@ -432,10 +432,12 @@ class FileDatabase {
public bool renameFolderPaths(string oldPath, string newPath) {
if (this.readOnly) return false;
try {
SQLiteCommand command = new SQLiteCommand("UPDATE `FileNodes` SET `path` = replace(`path`, @oldPath, @newPath), `parentpath` = replace(`parentpath`, @oldPath, @newPath) WHERE `path` LIKE @oldPath;", this.dbConnector.connection);
SQLiteCommand command = new SQLiteCommand("UPDATE `FileNodes` SET `path` = replace(`path`, @oldPath, @newPath), `parentpath` = replace(`parentpath`, @oldPath, @newPath) WHERE `path` LIKE @searchPath;", this.dbConnector.connection);
command.Parameters.AddWithValue("@oldPath", oldPath);
command.Parameters.AddWithValue("@newPath", newPath);
command.Parameters.AddWithValue("@searchPath", oldPath + "%");
command.ExecuteNonQuery();
Console.WriteLine(DBConnector.ToReadableString(command));
this.filterOutOfDate += 5;
} catch (System.Data.SQLite.SQLiteException se) {
if (se.ErrorCode == DBConnector.DatabaseIsLocked) {
Expand Down
16 changes: 11 additions & 5 deletions RPS 4/FileNodes.cs
Expand Up @@ -72,9 +72,9 @@ public class FileNodes {
this.backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(runWorkerCompleted);

// Use local folders as this.folders is used in backgroundWorker
var folders = Utils.stringToList(Convert.ToString(this.config.getPersistant("folders")));
//var folders = Utils.stringToConcurrentQueue(Convert.ToString(this.config.getPersistant("folders")));
// Purge database in main thread rather, to avoid having to run database filter twice
this.purgeNotMatchingParentFolders(folders);
this.purgeNotMatchingParentFolders(this.folders);

this.backgroundWorker.RunWorkerAsync();
}
Expand All @@ -84,7 +84,12 @@ public class FileNodes {
this.nrFiles = 0;
this.nrFolders = 0;
this.nrUnprocessedMetadata = -1;

this.watchers.Clear();

this.folders = Utils.stringToConcurrentQueue(this.config.getPersistantString("folders"));
//this.screensaver.fileNodes.resetFoldersQueue();
if (this.screensaver.fileNodes != null) this.screensaver.fileNodes.purgeNotMatchingParentFolders(this.folders);
}
/*
void metadataShow(ImageMetadataStatus imageMetadata) {
Expand Down Expand Up @@ -160,7 +165,7 @@ public class FileNodes {
this.backgroundWorker.CancelAsync();
} else {
this.restartBackgroundWorker = false;

this.screensaver.fileNodes.resetFoldersQueue();
this.backgroundWorker.RunWorkerAsync();
}
}
Expand Down Expand Up @@ -571,10 +576,10 @@ public class FileNodes {
}

public int purgeNotMatchingParentFolders(string folders) {
return this.purgeNotMatchingParentFolders(Utils.stringToList(folders));
return this.purgeNotMatchingParentFolders(Utils.stringToConcurrentQueue(folders));
}

public int purgeNotMatchingParentFolders(List<string> folders) {
public int purgeNotMatchingParentFolders(ConcurrentQueue<string> folders) {
return this.fileDatabase.purgeNotMatchingParentFolders(folders, this.screensaver.config.getPersistantBool("excludeAllSubfolders"), Utils.stringToList(this.screensaver.config.getPersistantString("excludedSubfolders")));
}

Expand Down Expand Up @@ -694,6 +699,7 @@ public class FileNodes {
if ((e.Cancelled == true)) {
if (this.restartBackgroundWorker) {
this.restartBackgroundWorker = false;
this.screensaver.fileNodes.resetFoldersQueue();
this.backgroundWorker.RunWorkerAsync();
Debug.WriteLine("BackgroundWorker Restarted");
} else {
Expand Down
4 changes: 2 additions & 2 deletions RPS 4/Properties/AssemblyInfo.cs
Expand Up @@ -11,7 +11,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("www.abscreensavers.com")] // You are required to change this information if you publicly release your project
[assembly: AssemblyProduct("RPS 4")] // You are required to change this information if you publicly release your project
[assembly: AssemblyCopyright("Copyright © 2005-2015")]
[assembly: AssemblyCopyright("Copyright © 2005-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -34,4 +34,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("4.5.9.3")]
[assembly: AssemblyFileVersion("4.5.9.4")]
2 changes: 1 addition & 1 deletion RPS 4/data/config.html
Expand Up @@ -417,7 +417,7 @@ <h2>Change wallpaper</h2>
<div id="wallpaperChange">
<label for="wallpaperChangeRun"><input type="radio" id="wallpaperChangeRun" name="wallpaperChange" value="run" checked/>After each screensaver run</label>
<label for="wallpaperChangeDaily"><input type="radio" id="wallpaperChangeDaily" name="wallpaperChange" value="daily" />Daily</label>
<label for="wallpaperChangeNever"><input type="radio" id="wallpaperChangeNever" name="wallpaperChange" value="never" checked/>Never (Do not change wallaper)</label>
<label for="wallpaperChangeNever"><input type="radio" id="wallpaperChangeNever" name="wallpaperChange" value="never" checked/>Never (Do not change wallpaper)</label>
</div>
<h2>Fit wallpaper</h2>
<label for="wallpaperStretchSmall"><input type="checkbox" id="wallpaperStretchSmall"/> Stretch small wallpaper images</label>
Expand Down

0 comments on commit 3aa3fac

Please sign in to comment.