Exemplo n.º 1
0
        public RepositoryListItem(RepositoryListView view, SharpSvn.Remote.ISvnRepositoryListItem listItem, SvnOrigin dirOrigin, IFileIconMapper iconMapper)
            : base(view)
        {
            if (listItem == null)
            {
                throw new ArgumentNullException("listItem");
            }
            else if (dirOrigin == null)
            {
                throw new ArgumentNullException("dirOrigin");
            }

            SvnDirEntry entry    = listItem.Entry;
            Uri         entryUri = listItem.Uri;

            _entry  = entry;
            _origin = new SvnOrigin(entryUri, dirOrigin);

            string name = SvnTools.GetFileName(entryUri);

            bool isFile = (entry.NodeKind == SvnNodeKind.File);

            string extension = isFile ? Path.GetExtension(name) : "";

            if (iconMapper != null)
            {
                if (isFile)
                {
                    ImageIndex = iconMapper.GetIconForExtension(extension);
                }
                else
                {
                    ImageIndex = iconMapper.DirectoryIcon;
                }
            }

            SvnLockInfo      lockInfo = null;
            SvnListEventArgs lea      = listItem as SvnListEventArgs;

            if (lea != null)
            {
                lockInfo = lea.Lock;
            }

            SetValues(
                name,
                IsFolder ? RepositoryStrings.ExplorerDirectoryName : view.Context.GetService <IFileIconMapper>().GetFileType(extension),
                entry.Revision.ToString(),
                entry.Author,
                IsFolder ? "" : entry.FileSize.ToString(),
                entry.Time.ToLocalTime().ToString("g"),
                (lockInfo != null) ? lockInfo.Owner : "");
        }
Exemplo n.º 2
0
        public RepositoryListItem(RepositoryListView view, SharpSvn.Remote.ISvnRepositoryListItem listItem, SvnOrigin dirOrigin, IFileIconMapper iconMapper)
            : base(view)
        {
            if (listItem == null)
                throw new ArgumentNullException("listItem");
            else if (dirOrigin == null)
                throw new ArgumentNullException("dirOrigin");

            SvnDirEntry entry = listItem.Entry;
            Uri entryUri = listItem.Uri;

            _entry = entry;
            _origin = new SvnOrigin(entryUri, dirOrigin);

            string name = SvnTools.GetFileName(entryUri);

            bool isFile = (entry.NodeKind == SvnNodeKind.File);

            string extension = isFile ? Path.GetExtension(name) : "";

            if (iconMapper != null)
            {
                if (isFile)
                    ImageIndex = iconMapper.GetIconForExtension(extension);
                else
                {
                    ImageIndex = iconMapper.DirectoryIcon;
                }
            }

            SvnLockInfo lockInfo = null;
            SvnListEventArgs lea = listItem as SvnListEventArgs;
            if (lea != null)
                lockInfo = lea.Lock;

            SetValues(
                name,
                IsFolder ? RepositoryStrings.ExplorerDirectoryName : view.Context.GetService<IFileIconMapper>().GetFileType(extension),
                entry.Revision.ToString(),
                entry.Author,
                IsFolder ? "" : entry.FileSize.ToString(),
                entry.Time.ToLocalTime().ToString("g"),
                (lockInfo != null) ? lockInfo.Owner : "");
        }
Exemplo n.º 3
0
            public void Match(SvnDirEntry ent)
            {
                Assert.That(ent.Revision, Is.EqualTo(this.createdRevision),
                            "CreatedRevision differs");
                Assert.That(ent.FileSize, Is.EqualTo(this.size),
                            "Size differs");

                // strip off time portion
                DateTime entryTime = ent.Time.ToLocalTime();

                entryTime = entryTime - entryTime.TimeOfDay;

                long delta = Math.Abs(this.time.Ticks - entryTime.Ticks);

                Assert.That(delta < TICKS_PER_MINUTE,
                            "Time differs: " + this.time + " vs " +
                            entryTime + " Delta is " + delta);
                Assert.That(ent.Author, Is.EqualTo(this.author), "Last author differs");
            }
Exemplo n.º 4
0
            public void Match(SvnDirEntry ent)
            {
                Assert.That(ent.Revision, Is.EqualTo(this.createdRevision),
                    "CreatedRevision differs");
                Assert.That(ent.FileSize, Is.EqualTo(this.size),
                    "Size differs");

                // strip off time portion
                DateTime entryTime = ent.Time.ToLocalTime();
                entryTime = entryTime - entryTime.TimeOfDay;

                long delta = Math.Abs(this.time.Ticks - entryTime.Ticks);
                Assert.That(delta < TICKS_PER_MINUTE,
                    "Time differs: " + this.time + " vs " +
                    entryTime + " Delta is " + delta);
                Assert.That(ent.Author, Is.EqualTo(this.author), "Last author differs");
            }