Statistics
| Branch: | Revision:

root / trunk / Pithos.ShellExtensions / ShellStatusChecker.cs @ 7e26c075

History | View | Annotate | Download (1.5 kB)

1
// -----------------------------------------------------------------------
2
// <copyright file="ShellStatusChecker.cs" company="Microsoft">
3
// TODO: Update copyright text.
4
// </copyright>
5
// -----------------------------------------------------------------------
6

    
7
using System.ComponentModel.Composition;
8
using System.ServiceModel;
9
using Microsoft.Win32;
10
using Pithos.Interfaces;
11

    
12
namespace Pithos.ShellExtensions
13
{
14
    using System;
15
    using System.Collections.Generic;
16
    using System.Linq;
17
    using System.Text;
18

    
19
    /// <summary>
20
    /// TODO: Update summary.
21
    /// </summary>
22
    [Export(typeof(IStatusChecker))]
23
    public class ShellStatusChecker:IStatusChecker
24
    {
25
        [Import]
26
        public IPithosSettings Settings { get; set; }
27

    
28
        private static readonly log4net.ILog Log = log4net.LogManager.GetLogger("Pithos.ShellStatusChecker");
29

    
30
        public FileOverlayStatus GetFileOverlayStatus(string path)
31
        {
32

    
33
            try
34
            {
35
                using (var client = PithosHost.GetStatusClient())
36
                {
37
                    var status = client.GetStatus(path);
38
                    return status;
39
                }
40
            }
41
            catch (Exception exc)
42
            {
43
                Log.ErrorFormat("[ERROR] retrieving overlay status for {0}:\r{1}",path,exc);
44
                return FileOverlayStatus.Unversioned;
45
            }
46
        }
47

    
48
        //Not Used by the shell extensions
49
        public PithosStatus GetPithosStatus()
50
        {
51
            throw new NotSupportedException();
52
        }
53
    }
54
}