Revision 5e31048f trunk/Pithos.Core/Agents/NetworkAgent.cs

b/trunk/Pithos.Core/Agents/NetworkAgent.cs
21 21
    {
22 22
        private Agent<CloudAction> _agent;
23 23

  
24

  
24 25
        [Import]
25 26
        public IStatusKeeper StatusKeeper { get; set; }
26 27
        
......
97 98
                            await DownloadCloudFile(accountInfo,  cloudFile,downloadPath);
98 99
                            break;
99 100
                        case CloudActionType.DeleteCloud:
100
                            DeleteCloudFile(accountInfo, cloudFile, cloudFile.Name);
101
                            DeleteCloudFile(accountInfo, cloudFile);
101 102
                            break;
102 103
                        case CloudActionType.RenameCloud:
103 104
                            var moveAction = (CloudMoveAction)action;
......
249 250
            _agent.Post(cloudAction);
250 251
        }
251 252

  
252
        class ObjectInfoByNameComparer:IEqualityComparer<ObjectInfo>
253
       /* class ObjectInfoByNameComparer:IEqualityComparer<ObjectInfo>
253 254
        {
254 255
            public bool Equals(ObjectInfo x, ObjectInfo y)
255 256
            {
......
260 261
            {
261 262
                return obj.Name.ToLower().GetHashCode();
262 263
            }
263
        }
264
        }*/
264 265

  
265 266
        
266 267

  
......
388 389
                            Post(message);
389 390
                        }
390 391

  
391
                        //Report the number of new files
392
                        var remoteCount = distinctActions.Count(action=>
393
                            action.Action==CloudActionType.DownloadUnconditional);
394
/*
395
                        if ( remoteCount > 0)
396
                            StatusNotification.NotifyChange(String.Format("Processing {0} new files", remoteCount));
397
*/
392
                        /*                        //Report the number of new files
393
                                                var remoteCount = distinctActions.Count(action=>
394
                                                    action.Action==CloudActionType.DownloadUnconditional);
395

  
396
                                                if ( remoteCount > 0)
397
                                                    StatusNotification.NotifyChange(String.Format("Processing {0} new files", remoteCount));
398
                        */
398 399

  
399 400
                        Log.Info("[LISTENER] End Processing");                        
400 401
                    }
......
519 520
            NativeMethods.RaiseChangeNotification(newFilePath);
520 521
        }
521 522

  
522
        private void DeleteCloudFile(AccountInfo accountInfo, ObjectInfo cloudFile,string fileName)
523
        private void DeleteCloudFile(AccountInfo accountInfo, ObjectInfo cloudFile)
523 524
        {
524 525
            if (accountInfo == null)
525 526
                throw new ArgumentNullException("accountInfo");
526 527
            if (cloudFile==null)
527 528
                throw new ArgumentNullException("cloudFile");
528 529

  
529
            if (String.IsNullOrWhiteSpace(fileName))
530
                throw new ArgumentNullException("fileName");
531
            if (Path.IsPathRooted(fileName))
532
                throw new ArgumentException("The fileName should not be rooted","fileName");
533 530
            if (String.IsNullOrWhiteSpace(cloudFile.Container))
534 531
                throw new ArgumentException("Invalid container", "cloudFile");
535 532
            Contract.EndContractBlock();
......
538 535

  
539 536
            using ( log4net.ThreadContext.Stacks["DeleteCloudFile"].Push("Delete"))
540 537
            {
541
                var info = fileAgent.GetFileInfo(fileName);
538
                var fileName= cloudFile.RelativeUrlToFilePath(accountInfo.UserName);
539
                var info = fileAgent.GetFileInfo(fileName);                
542 540
                var fullPath = info.FullName.ToLower();
541

  
543 542
                this.StatusKeeper.SetFileOverlayStatus(fullPath, FileOverlayStatus.Modified);
544 543

  
545 544
                var account = cloudFile.Account ?? accountInfo.UserName;
546 545
                var container = cloudFile.Container ;//?? FolderConstants.PithosContainer;
547 546

  
548 547
                var client = new CloudFilesClient(accountInfo);
549
                client.DeleteObject(account, container, fileName);
548
                client.DeleteObject(account, container, cloudFile.Name);
550 549

  
551 550
                this.StatusKeeper.ClearFileStatus(fullPath);
552 551
            }

Also available in: Unified diff