Statistics
| Branch: | Revision:

root / trunk / Pithos.ShellExtensions / TestStatusChecker.cs @ b5061ac8

History | View | Annotate | Download (1.3 kB)

1
using System;
2
using System.ComponentModel.Composition;
3
using System.Diagnostics;
4
using System.Diagnostics.Contracts;
5
using System.IO;
6
using Pithos.Interfaces;
7
using Pithos.ShellExtensions.Test;
8

    
9
namespace Pithos.ShellExtensions
10
{
11
    //[Export(typeof(IStatusChecker))]
12
    public class TestStatusChecker:IStatusChecker
13
    {
14
        
15
        private IPithosSettings Settings=new TestPithosSettings();
16

    
17
        private readonly string[] _states = {"Normal", "Modified", "Conflict","Synch"};
18

    
19
        public FileOverlayStatus GetFileOverlayStatus(string path)
20
        {
21
            if (String.IsNullOrWhiteSpace(path))
22
                throw new ArgumentNullException("Empty path");
23

    
24
            var pithosPath = Settings.PithosPath;
25
            if (path.StartsWith(pithosPath,true,null))
26
            {
27
                var fileName = Path.GetFileName(path);
28
                if (String.IsNullOrWhiteSpace(fileName))
29
                    return FileOverlayStatus.Normal;
30

    
31
                var status = Char.ConvertToUtf32(fileName, 0)%4;
32
                return (FileOverlayStatus)status;
33
            }
34
            return FileOverlayStatus.Unversioned;
35
        }
36

    
37

    
38
        //Not Used by the shell extensions
39
        public PithosStatus GetPithosStatus()
40
        {
41
            throw new NotSupportedException();
42
        }
43
    }
44
}