Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r260 - trunk/SVN_Notifier

svnnotifier
Discussion topic

Back to topic list

svn commit: r260 - trunk/SVN_Notifier

Reply

Author aleksejs
Full name Aleksejs V.
Date 2009-02-10 05:54:32 PST
Message Author: aleksejs
Date: 2009-02-10 05:54:31-0800
New Revision: 260

Modified:
   trunk/SVN_Notifier/MainForm.cs
   trunk/SVN_Notifier/S​ettingsProjectForm.c​s
   trunk/SVN_Notifier/SvnFolder.cs
   trunk/SVN_Notifier/SvnTools.cs
   trunk/SVN_Notifier/U​pdateLogsForm.cs

Log:
Refactoring

Modified: trunk/SVN_Notifier/MainForm.cs
Url: http://svnnotifier.t​igris.org/source/bro​wse/svnnotifier/trun​k/SVN_Notifier/MainF​orm.cs?view=diff​&pathrev=260&r1=​259&r2=260
====================​====================​====================​==================
--- trunk/SVN_Notifier/MainForm.cs (original)
+++ trunk/SVN_Notifier/MainForm.cs 2009-02-10 05:54:31-0800
@@ -715,16 +715,16 @@
         
         ////////////////////​////////////////////​////////////////////​////////////
         
- private Icon trayIcon_NeedUpdate;
- private Icon trayIcon_UpToDate;
- private Icon trayIcon_Unknown;
- private Icon trayIcon_Error;
+ private readonly Icon trayIcon_NeedUpdate;
+ private readonly Icon trayIcon_UpToDate;
+ private readonly Icon trayIcon_Unknown;
+ private readonly Icon trayIcon_Error;
         
         private SvnFolderCollection folders = new SvnFolderCollection();
- private Hashtable errorLog = new Hashtable ();
+ private readonly Hashtable errorLog = new Hashtable ();
         private bool reupdateStatus;
- private ManualResetEvent updateNotInProgress = new ManualResetEvent (true);
- private Queue forcedFolders = Queue.Synchronized (new Queue());
+ private readonly ManualResetEvent updateNotInProgress = new ManualResetEvent (true);
+ private readonly Queue forcedFolders = Queue.Synchronized (new Queue());
 
 
         public MainForm()
@@ -834,7 +834,7 @@
         private const int imageIndex_UpToDate_Modified = 4;
         private const int imageIndex_NeedUpdate_Modified = 5;
         
- private int GetFolderStatusImageIndex (SvnFolderStatus folderStatus)
+ private static int GetFolderStatusImageIndex (SvnFolderStatus folderStatus)
         {
             switch (folderStatus)
             {
@@ -866,11 +866,13 @@
 
         private void menuItemExportConfig_Click (object sender, EventArgs e)
         {
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.FileName = "SVN_Notifier.ini";
- sfd.Filter = "Ini files (*.ini)|*.ini|All files (*.*)|*.*";
- sfd.RestoreDirectory = true;
-
+ SaveFileDialog sfd = new SaveFileDialog
+ {
+ FileName = "SVN_Notifier.ini",
+ Filter = "Ini files (*.ini)|*.ini|All files (*.*)|*.*",
+ RestoreDirectory = true
+ };
+
             if (sfd.ShowDialog() == DialogResult.OK)
             {
                 try
@@ -887,9 +889,11 @@
 
         private void menuItemImportConfig_Click (object sender, EventArgs e)
         {
- OpenFileDialog ofd = new OpenFileDialog();
- ofd.Filter = "Ini files (*.ini)|*.ini|All files (*.*)|*.*";
- ofd.RestoreDirectory = true;
+ OpenFileDialog ofd = new OpenFileDialog
+ {
+ Filter = "Ini files (*.ini)|*.ini|All files (*.*)|*.*",
+ RestoreDirectory = true
+ };
 
             if (ofd.ShowDialog() == DialogResult.OK)
             {
@@ -1232,7 +1236,7 @@
         }
 
 
- private void UpdateContextMenuDefaultItem ()
+ private static void UpdateContextMenuDefaultItem ()
         {
         /* changeLogToolStripMe​nuItem.DefaultItem =
                 logToolStripMenuItem​.DefaultItem =
@@ -1589,7 +1593,7 @@
         
         ////////////////////​////////////////////​////////////////////​////////////////////​////
         
- private SvnFolderCollection newNonUpdatedFolders = new SvnFolderCollection();
+ private readonly SvnFolderCollection newNonUpdatedFolders = new SvnFolderCollection();
         private delegate void UpdateListViewMethod (SvnFolder folder, SvnFolderStatus folderStatus, DateTime statusTime);
         private delegate void SetStatusBarTextMethod (string text);
         private delegate void UpdateErrorLogMethod (string path, string error);
@@ -1599,7 +1603,7 @@
         internal static Thread statusThread;
         string firstBalloonPath;
         private bool formIsActive;
- private IntPtr currentProcessHandle = Process.GetCurrentPr​ocess().Handle;
+ private readonly IntPtr currentProcessHandle = Process.GetCurrentPr​ocess().Handle;
         private bool repeatInvoke;
 
         ////////////////////​////////////////////​////////////////////​////////////////////​////
@@ -1639,7 +1643,7 @@
         }
 
 
- private string ReadFromWeb (string url)
+ private static string ReadFromWeb (string url)
         {
             try
             {
@@ -1670,14 +1674,14 @@
         }
 
 
- private void ShowNoNewVersion()
+ private static void ShowNoNewVersion()
         {
             MessageBox.Show ("You are using latest version of SVN Notifier.",
                 "SVN Notifier", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
 
 
- private void ErrorCheckingForNewVersion()
+ private static void ErrorCheckingForNewVersion()
         {
             MessageBox.Show ("Can't check for new version!",
                 "SVN Notifier", MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -2112,10 +2116,10 @@
 
         ////////////////////​////////////////////​////////////////////​//////////////////
         
- private static int WM_QUERYENDSESSION = 0x11;
- private static int WM_ENDSESSION = 0x16;
+ private const int WM_QUERYENDSESSION = 0x11;
+ private const int WM_ENDSESSION = 0x16;
 
- private static bool sessionEndInProgress = false;
+ private static bool sessionEndInProgress;
 
 
         protected override void WndProc (ref Message m)
@@ -2138,14 +2142,17 @@
             {
                 if ((args.Length == 1) && (args[0] == "start")) // Used to start application during install
                 {
- ProcessStartInfo psi = new ProcessStartInfo (Application.ExecutablePath);
- psi.UseShellExecute = false;
- psi.WorkingDirectory = Path.GetDirectoryName (Application.ExecutablePath);
+ ProcessStartInfo psi = new ProcessStartInfo
+ {
+ FileName = Application.ExecutablePath,
+ UseShellExecute = false,
+ WorkingDirectory = Path.GetDirectoryName (Application.ExecutablePath)
+ };
                     Process.Start (psi);
                     return;
                 }
 
- string iniFileName = "SVN_Notifier.ini";
+ const string iniFileName = "SVN_Notifier.ini";
                 if (File.Exists (iniFileName))
                     Config.Init (iniFileName);
                 else

Modified: trunk/SVN_Notifier/S​ettingsProjectForm.c​s
Url: http://svnnotifier.t​igris.org/source/bro​wse/svnnotifier/trun​k/SVN_Notifier/Setti​ngsProjectForm.cs?vi​ew=diff&pathrev=​260&r1=259&r​2=260
====================​====================​====================​==================
--- trunk/SVN_Notifier/S​ettingsProjectForm.c​s (original)
+++ trunk/SVN_Notifier/S​ettingsProjectForm.c​s 2009-02-10 05:54:31-0800
@@ -19,7 +19,6 @@
 //
 
 using System.ComponentModel;
-using System.IO;
 using System.Windows.Forms;
 using Iae.Windows.Forms;
 

Modified: trunk/SVN_Notifier/SvnFolder.cs
Url: http://svnnotifier.t​igris.org/source/bro​wse/svnnotifier/trun​k/SVN_Notifier/SvnFo​lder.cs?view=diff​&pathrev=260&r1​=259&r2=260
====================​====================​====================​==================
--- trunk/SVN_Notifier/SvnFolder.cs (original)
+++ trunk/SVN_Notifier/SvnFolder.cs 2009-02-10 05:54:31-0800
@@ -85,10 +85,12 @@
         public static SvnFolder Deserialize (string s)
         {
             string[] p = s.Split ('|');
- SvnFolder f = new SvnFolder (p[0], (PathType) Int32.Parse (p[4]));
- f.ActiveStatusUpdateInterval = Int32.Parse (p[1]);
- f.IdleStatusUpdateInterval = Int32.Parse (p[2]);
- f.Disable = Boolean.Parse (p[3]);
+ SvnFolder f = new SvnFolder (p[0], (PathType) Int32.Parse (p[4]))
+ {
+ ActiveStatusUpdateInterval = Int32.Parse (p[1]),
+ IdleStatusUpdateInterval = Int32.Parse (p[2]),
+ Disable = Boolean.Parse (p[3])
+ };
             return f;
         }
 
@@ -125,24 +127,23 @@
 
         public int GetInterval (bool formIsActive)
         {
- if (ActiveStatusUpdateInterval < 0)
- return formIsActive ? Config.DefaultActive​StatusUpdateInterval​ : Config.DefaultIdleSt​atusUpdateInterval;
- else
- return formIsActive ? ActiveStatusUpdateInterval : IdleStatusUpdateInterval;
+ return ActiveStatusUpdateInterval < 0
+ ? (formIsActive ? Config.DefaultActive​StatusUpdateInterval​ : Config.DefaultIdleSt​atusUpdateInterval)
+ : (formIsActive ? ActiveStatusUpdateInterval : IdleStatusUpdateInterval);
         }
 
 
         private SvnFolderStatus status;
         private DateTime statusTime;
 
- internal int updateRevision = 0;
- internal int reviewedRevision = 0;
+ internal int updateRevision;
+ internal int reviewedRevision;
     }
 
 
     public class SvnFolderCollection: IEnumerable, ICloneable
     {
- private ArrayList list;
+ private readonly ArrayList list;
 
 
         public int Count

Modified: trunk/SVN_Notifier/SvnTools.cs
Url: http://svnnotifier.t​igris.org/source/bro​wse/svnnotifier/trun​k/SVN_Notifier/SvnTo​ols.cs?view=diff​&pathrev=260&r1=​259&r2=260
====================​====================​====================​==================
--- trunk/SVN_Notifier/SvnTools.cs (original)
+++ trunk/SVN_Notifier/SvnTools.cs 2009-02-10 05:54:31-0800
@@ -245,13 +245,15 @@
 
         private static ExecuteResult ExecuteProcess (string executionFile, string workingPath, string arguments, bool waitForExit, bool lowPriority)
         {
- ProcessStartInfo psi = new ProcessStartInfo();
- psi.FileName = executionFile;
- psi.Arguments = arguments;
- psi.CreateNoWindow = true;
- psi.UseShellExecute = false;
- psi.RedirectStandardOutput = true;
- psi.RedirectStandardError = true;
+ ProcessStartInfo psi = new ProcessStartInfo
+ {
+ FileName = executionFile,
+ Arguments = arguments,
+ CreateNoWindow = true,
+ UseShellExecute = false,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true
+ };
 
             ExecuteResult er = new ExecuteResult();
             er.process = Process.Start (psi);

Modified: trunk/SVN_Notifier/U​pdateLogsForm.cs
Url: http://svnnotifier.t​igris.org/source/bro​wse/svnnotifier/trun​k/SVN_Notifier/Updat​eLogsForm.cs?view=di​ff&pathrev=260​&r1=259&r2=260​
====================​====================​====================​==================
--- trunk/SVN_Notifier/U​pdateLogsForm.cs (original)
+++ trunk/SVN_Notifier/U​pdateLogsForm.cs 2009-02-10 05:54:31-0800
@@ -20,6 +20,7 @@
 
 using System;
 using System.Collections;
+using System.ComponentModel;
 using System.Drawing;
 using System.IO;
 using System.Runtime.InteropServices;
@@ -34,14 +35,14 @@
         /// <summary>
         /// Required designer variable.
         /// </summary>
- private System.Windows.Forms.Button btnLog;
- private System.Windows.Forms.Button btnOk;
- private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.Label labelResult;
- private System.Windows.Forms.ListView listViewLog;
- private System.Windows.Forms​.ColumnHeader columnAction;
- private System.Windows.Forms​.ColumnHeader columnPath;
- private System.ComponentModel.Container components = null;
+ private Button btnLog;
+ private Button btnOk;
+ private Button btnCancel;
+ private Label labelResult;
+ private ListView listViewLog;
+ private ColumnHeader columnAction;
+ private ColumnHeader columnPath;
+ private Container components;
 
         #endregion
 
@@ -175,6 +176,7 @@
         /// <summary>
         /// API Parameter Flags for PlaySound method
         /// </summary>
+ [Flags]
         public enum SND
         {
             SND_SYNC = 0x0000 ,/* play synchronously (default) */
@@ -192,14 +194,15 @@
             SND_APPLICATION = 0x0080 /* look for application specific association */
         }
 
- private Hashtable ht = new Hashtable ();
- private SvnFolderProcess folderProcess;
+ private readonly Hashtable ht = new Hashtable ();
+ private readonly SvnFolderProcess folderProcess;
 
 
- public UpdateLogsForm (SvnFolderProcess sfp)
+ public UpdateLogsForm (SvnFolderProcess sfp, Container components)
         {
             if (!sfp.isUpdateCommand) throw new ApplicationException();
             folderProcess = sfp;
+ this.components = components;
 
             InitializeComponent();
 
@@ -271,14 +274,13 @@
                         break;
                 }
 
- ListViewItem lvi = new ListViewItem (new string[] {action, path});
- lvi.ForeColor = color;
+ ListViewItem lvi = new ListViewItem (new[] {action, path}) {ForeColor = color};
                 listViewLog.Items.Add (lvi);
             }
 
             if (conflict)
             {
- ListViewItem lvi = new ListViewItem (new string[] {"Warning!", "One or more files are in a conflicted state."});
+ ListViewItem lvi = new ListViewItem (new[] {"Warning!", "One or more files are in a conflicted state."});
                 lvi.ForeColor = Color.Red;
                 listViewLog.Items.Add (lvi);
             }

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r260 - trunk/SVN_Notifier aleksejs Aleksejs V. 2009-02-10 05:54:32 PST
Messages per page: