Revision c28a075a trunk/Pithos.Core/PithosMonitor.cs

b/trunk/Pithos.Core/PithosMonitor.cs
48 48
        public WorkflowAgent WorkflowAgent { get; set; }
49 49
        
50 50
        [Import]
51
        public NetworkAgent NetworkAgent { get; set; }
52

  
51
        public NetworkAgent NetworkAgent { get; set; }        
53 52

  
54 53
        public string UserName { get; set; }
55 54
        public string ApiKey { get; set; }
......
79 78
            }
80 79
        }
81 80

  
82
        public string RootPath { get; set; }
81
        private string _rootPath;
82
        public string RootPath
83
        {
84
            get { return _rootPath; }
85
            set
86
            {
87
                _rootPath = value.ToLower();
88
            }
89
        }
83 90

  
84 91

  
85 92
        CancellationTokenSource _cancellationSource;
......
121 128
            StatusKeeper.BlockSize = _blockSize;
122 129
            
123 130
            StatusKeeper.StartProcessing(_cancellationSource.Token);
124
            IndexLocalFiles(RootPath);
125
            StartWatcherAgent(RootPath);
131
            IndexLocalFiles();
132
            StartWatcherAgent();
126 133

  
127 134
            StartNetworkAgent();
128 135

  
......
172 179
            return null;
173 180
        }
174 181

  
175
        private void IndexLocalFiles(string path)
182
        private void IndexLocalFiles()
176 183
        {
177 184
            StatusNotification.NotifyChange("Indexing Local Files",TraceLevel.Info);
178 185
            using (log4net.ThreadContext.Stacks["Monitor"].Push("Indexing local files"))
......
181 188
                try
182 189
                {
183 190
                    var fragmentsPath = Path.Combine(RootPath, FolderConstants.FragmentsFolder);
184
                    var directory = new DirectoryInfo(path);
191
                    var directory = new DirectoryInfo(RootPath);
185 192
                    var files =
186 193
                        from file in directory.EnumerateFiles("*", SearchOption.AllDirectories)
187 194
                        where !file.FullName.StartsWith(fragmentsPath, StringComparison.InvariantCultureIgnoreCase) &&
......
275 282
            NetworkAgent.AddAccount(_accountInfo);
276 283

  
277 284
            NetworkAgent.StatusNotification = StatusNotification;
278
            
279

  
285
                        
280 286
            NetworkAgent.Start();
281 287

  
282 288
            NetworkAgent.ProcessRemoteFiles();
......
307 313
       
308 314

  
309 315

  
310
        private void StartWatcherAgent(string path)
316
        private void StartWatcherAgent()
311 317
        {
318
            AgentLocator<FileAgent>.Register(FileAgent,RootPath);
319

  
312 320
            FileAgent.StatusKeeper = StatusKeeper;
313 321
            FileAgent.Workflow = Workflow;
314 322
            FileAgent.FragmentsPath = Path.Combine(RootPath, FolderConstants.FragmentsFolder);
315
            FileAgent.Start(_accountInfo,path);
323
            FileAgent.Start(_accountInfo, RootPath);
316 324
        }
317 325

  
318 326
        public void Stop()
319
        {          
327
        {
328
            AgentLocator<FileAgent>.Remove(RootPath);
329

  
320 330
            if (FileAgent!=null)
321 331
                FileAgent.Stop();
322 332
            FileAgent = null;

Also available in: Unified diff