Revision cfed7823 trunk/Pithos.Core/PithosMonitor.cs

b/trunk/Pithos.Core/PithosMonitor.cs
44 44
        [Import]
45 45
        public ICloudClient CloudClient { get; set; }
46 46

  
47
        [Import]
48
        public ICloudClient CloudListeningClient { get; set; }
49

  
50 47
        public IStatusNotification StatusNotification { get; set; }
51 48

  
52 49
        [Import]
......
126 123
            CloudClient.AuthenticationUrl = this.AuthenticationUrl;
127 124
            CloudClient.Authenticate(UserName, ApiKey);
128 125

  
129
            var pithosContainers = new[] { TrashContainer,PithosContainer};
126
            //Create the two default containers if they are missing
127
            var pithosContainers = new List<string>{ TrashContainer,PithosContainer};
130 128
            foreach (var container in pithosContainers)
131
            {
132
                var info=CloudClient.GetContainerInfo(container);
129
            {                
130
                var info=CloudClient.GetContainerInfo(this.UserName, container);
133 131
                if (info == ContainerInfo.Empty)
134 132
                {
135
                    CloudClient.CreateContainer(container);
136
                    info = CloudClient.GetContainerInfo(container);
133
                    CloudClient.CreateContainer(this.UserName, container);
134
                    info = CloudClient.GetContainerInfo(this.UserName, container);
137 135
                }
138 136
                _blockSize = info.BlockSize;
139 137
                _blockHash = info.BlockHash;
140 138
            }
141 139

  
142
            var allContainers= CloudClient.ListContainers();
140
/*
141
            //Create folders for any other containers
142
            var allContainers = CloudClient.ListContainers();            
143
            pithosContainers.AddRange(new[]{"shared","others"});
144

  
143 145
            var extraContainers = from container in allContainers
144 146
                                  where !pithosContainers.Contains(container.Name.ToLower())
145
                                      select container;
147
                                  select container;
148
            
149
            foreach (var container in extraContainers)
150
            {
151
                var containerPath = Path.Combine(this.RootPath, container.Name);
152
                if (!Directory.Exists(containerPath))
153
                    Directory.CreateDirectory(containerPath);
154
            }
155
*/
146 156

  
147 157

  
148 158

  
......
297 307
            public override int GetHashCode(CloudAction obj)
298 308
            {
299 309
                var hash1 = (obj.LocalFile == null) ? int.MaxValue : obj.LocalFile.FullName.GetHashCode();
300
                var hash2 = (obj.CloudFile == null) ? int.MaxValue : (obj.CloudFile.Hash ?? obj.CloudFile.Name).GetHashCode();
310
                var hash2 = (obj.CloudFile == null) ? int.MaxValue : (obj.CloudFile.Hash ?? obj.CloudFile.Name??"").GetHashCode();
301 311
                var hash3 = obj.Action.GetHashCode();
302 312
                return hash1 ^ hash2 & hash3;
303 313
            }

Also available in: Unified diff