Changeset 102

Show
Ignore:
Timestamp:
03/01/07 02:27:41 (2 years ago)
Author:
tulloss2
Message:

fixed updating so that it will propagate correctly. Fixed adding directories dialog so it appears instantaneous. Fixed server connection discrepancy when server is connected to in the middle of an update.

There still exists a file modify date problem where every song updates itself thinking that it was last modified in the 70s

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dmp/trunk/server/dataserver/metadata.cs

    r92 r102  
    298298            ArrayList directories = ListDirectories(); 
    299299 
    300             //Update Revision 
    301             TimeSpan unixTime = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 
    302             lock (revLock) 
    303             { 
    304                 revision = (int) unixTime.TotalSeconds; 
    305                 Monitor.PulseAll(revLock); 
    306             } 
    307  
    308300            dbCon.Open(); 
    309301            IDbTransaction dbTrans = dbCon.BeginTransaction(); 
     
    342334            dbTrans.Commit(); 
    343335            dbCon.Close(); 
     336 
     337            //Update Revision 
     338            TimeSpan unixTime = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 
     339            lock (revLock) 
     340            { 
     341                revision = (int)unixTime.TotalSeconds; 
     342                Monitor.PulseAll(revLock); 
     343            } 
    344344 
    345345            return null; 
     
    852852        public int WaitForUpdate(int oldRevision) 
    853853        { 
     854            Console.WriteLine("Old Revision: {0}", oldRevision); 
    854855            while (revision == oldRevision) 
    855856            { 
    856857                lock (revLock) 
    857858                { 
     859                    Console.WriteLine("Waiting for Update"); 
    858860                    Monitor.Wait(revLock); 
     861                    Console.WriteLine("Woke up, checking to see if update occurred..."); 
    859862                } 
    860863            } 
     864            Console.WriteLine("Found new revision: {0}", revision); 
    861865            return revision; 
    862866        } 
  • dmp/trunk/server/server-windows-gui/OptionsMenu.Designer.cs

    r79 r102  
    151151            this.updateProgress.Name = "updateProgress"; 
    152152            this.updateProgress.Size = new System.Drawing.Size(172, 23); 
    153             this.updateProgress.Style = System.Windows.Forms.ProgressBarStyle.Continuous
     153            this.updateProgress.Style = System.Windows.Forms.ProgressBarStyle.Marquee
    154154            this.updateProgress.TabIndex = 10; 
    155155            this.updateProgress.Visible = false; 
  • dmp/trunk/server/server-windows-gui/OptionsMenu.cs

    r79 r102  
    77using System.Text; 
    88using System.Windows.Forms; 
     9using System.Threading; 
    910using DMP.Server.Properties; 
    1011using DMP.Server; 
     
    2627 
    2728            //Register callbacks to update progress bar 
    28             Server.Metadata.progressMax = UpdateProgressMax; 
    29             Server.Metadata.progressTitle = UpdateProgressTitle; 
    30             Server.Metadata.progressUpdate = updateProgress.PerformStep; 
    31             Server.Metadata.progressReset = ResetProgress; 
     29            //Server.Metadata.progressMax = UpdateProgressMax; 
     30            //Server.Metadata.progressTitle = UpdateProgressTitle; 
     31            //Server.Metadata.progressUpdate = updateProgress.PerformStep; 
     32            //Server.Metadata.progressReset = ResetProgress; 
    3233        } 
    3334 
     
    5758            foreach (string path in directoryList.Items) 
    5859                DMP.Server.ServerObject.AddDirectory(path); 
    59             //Put progress bar in 
    60             directoryList.Height = directoryList.Height - 38; 
    61             updateProgress.Visible = true; 
    62             addSongLabel.Visible = true; 
    63             addSongLabel.Update(); //Apparently needs redrawn 
    6460 
    65             //Actually do the update scan 
    66             ServerObject.UpdateMusic(); 
     61            //Actually do the update scan (in a new thread) 
     62            ThreadPool.QueueUserWorkItem(ServerObject.UpdateMusic); 
    6763 
    6864            //Close the dialog (illusion of responsiveness) 
  • dmp/trunk/server/server-windows-gui/Service.cs

    r93 r102  
    9898            //To run as a service, you need to install first, which is a pain in the ass. 
    9999                        //System.ServiceProcess.ServiceBase.Run(ServicesToRun); 
     100            Application.EnableVisualStyles(); 
    100101            Application.Run(); 
    101102            theService.DMPServer.StopServer(); 
  • dmp/trunk/server/server.cs

    r87 r102  
    106106        } 
    107107 
    108         public static Error UpdateMusic(
     108        public static void UpdateMusic(object o
    109109        { 
    110110            Metadata theData = new Metadata(); 
    111             return theData.UpdateMusic(); 
     111            theData.UpdateMusic(); 
    112112        } 
    113113    }