//Except where stated all code and programs in this project are the copyright of Jim Blackler, 2008.
//jimblackler@gmail.com
//
//This is free software. Libraries and programs are distributed under the terms of the GNU Lesser
//General Public License. Please see the files COPYING and COPYING.LESSER.
using System;
using System.Collections.Generic;
using PersistentObjects;
using Microsoft.Win32;
using System.Windows.Forms;
namespace SVNWatch
{
///
/// Settings for the SVNWatch application
///
[Serializable]
public class Settings : Persistent
{
///
/// Default filename for the settings
///
public static string Filename()
{
return SettingsFilename("settings.bin");
}
///
/// The SVN Repositories currently being watched by the application
///
internal ICollection Repositories
{
get { return repositories; }
}
private List repositories = new List();
///
/// If 'true', when the application is minimised it does not appear on the task bar
/// but is shown as an icon in the system tray
///
public bool MinimiseToTray
{
get { return minimiseToTray; }
set { minimiseToTray = value; }
}
private bool minimiseToTray = true;
///
/// How frequently to scan each repository for changes
///
public TimeSpan ScanEvery
{
get
{
return scanEvery;
}
set
{
if (scanEvery != value)
{
scanEvery = value;
}
}
}
private TimeSpan scanEvery = TimeSpan.FromMinutes(5);
///
/// The amount of time to wait for an operation to complete before giving up
///
public TimeSpan TimeOut
{
get { return timeOut; }
set { timeOut = value; }
}
private TimeSpan timeOut = TimeSpan.FromSeconds(30);
///
/// Does the program start running automatically when the user logs in to Windows?
///
public bool RunOnStartup
{
get
{
RegistryKey autoStart = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("Run", true);
return Application.ExecutablePath.Equals(autoStart.GetValue("SVNWatch"));
}
set
{
// Open the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run registry key
RegistryKey autoStart = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("Run", true);
if (value)
{
autoStart.SetValue("SVNWatch", Application.ExecutablePath);
}
else
{
autoStart.DeleteValue("SVNWatch", false);
}
}
}
///
/// Current version. Alter to invalidate old saves.
///
/// The current version number.
public override int CurrentVersion()
{
return 5172;
}
}
}