root / trunk / Pithos.Core / WorkflowState.cs @ 92740b03
History | View | Annotate | Download (3.7 kB)
1 | 255f5f86 | Panagiotis Kanavos | #region |
---|---|---|---|
2 | 255f5f86 | Panagiotis Kanavos | /* ----------------------------------------------------------------------- |
3 | 255f5f86 | Panagiotis Kanavos | * <copyright file="WorkflowState.cs" company="GRNet"> |
4 | 255f5f86 | Panagiotis Kanavos | * |
5 | 255f5f86 | Panagiotis Kanavos | * Copyright 2011-2012 GRNET S.A. All rights reserved. |
6 | 255f5f86 | Panagiotis Kanavos | * |
7 | 255f5f86 | Panagiotis Kanavos | * Redistribution and use in source and binary forms, with or |
8 | 255f5f86 | Panagiotis Kanavos | * without modification, are permitted provided that the following |
9 | 255f5f86 | Panagiotis Kanavos | * conditions are met: |
10 | 255f5f86 | Panagiotis Kanavos | * |
11 | 255f5f86 | Panagiotis Kanavos | * 1. Redistributions of source code must retain the above |
12 | 255f5f86 | Panagiotis Kanavos | * copyright notice, this list of conditions and the following |
13 | 255f5f86 | Panagiotis Kanavos | * disclaimer. |
14 | 255f5f86 | Panagiotis Kanavos | * |
15 | 255f5f86 | Panagiotis Kanavos | * 2. Redistributions in binary form must reproduce the above |
16 | 255f5f86 | Panagiotis Kanavos | * copyright notice, this list of conditions and the following |
17 | 255f5f86 | Panagiotis Kanavos | * disclaimer in the documentation and/or other materials |
18 | 255f5f86 | Panagiotis Kanavos | * provided with the distribution. |
19 | 255f5f86 | Panagiotis Kanavos | * |
20 | 255f5f86 | Panagiotis Kanavos | * |
21 | 255f5f86 | Panagiotis Kanavos | * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
22 | 255f5f86 | Panagiotis Kanavos | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
23 | 255f5f86 | Panagiotis Kanavos | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
24 | 255f5f86 | Panagiotis Kanavos | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
25 | 255f5f86 | Panagiotis Kanavos | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
26 | 255f5f86 | Panagiotis Kanavos | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
27 | 255f5f86 | Panagiotis Kanavos | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
28 | 255f5f86 | Panagiotis Kanavos | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
29 | 255f5f86 | Panagiotis Kanavos | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | 255f5f86 | Panagiotis Kanavos | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
31 | 255f5f86 | Panagiotis Kanavos | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
32 | 255f5f86 | Panagiotis Kanavos | * POSSIBILITY OF SUCH DAMAGE. |
33 | 255f5f86 | Panagiotis Kanavos | * |
34 | 255f5f86 | Panagiotis Kanavos | * The views and conclusions contained in the software and |
35 | 255f5f86 | Panagiotis Kanavos | * documentation are those of the authors and should not be |
36 | 255f5f86 | Panagiotis Kanavos | * interpreted as representing official policies, either expressed |
37 | 255f5f86 | Panagiotis Kanavos | * or implied, of GRNET S.A. |
38 | 255f5f86 | Panagiotis Kanavos | * </copyright> |
39 | 255f5f86 | Panagiotis Kanavos | * ----------------------------------------------------------------------- |
40 | 255f5f86 | Panagiotis Kanavos | */ |
41 | 255f5f86 | Panagiotis Kanavos | #endregion |
42 | 255f5f86 | Panagiotis Kanavos | using System; |
43 | d78cbf09 | Panagiotis Kanavos | using System.Collections.Generic; |
44 | 174bbb6e | Panagiotis Kanavos | using System.Diagnostics.Contracts; |
45 | d78cbf09 | Panagiotis Kanavos | using System.IO; |
46 | d78cbf09 | Panagiotis Kanavos | using System.Linq; |
47 | d78cbf09 | Panagiotis Kanavos | using System.Text; |
48 | 4ec636f6 | Panagiotis Kanavos | using Pithos.Interfaces; |
49 | c53aa229 | Panagiotis Kanavos | using Pithos.Network; |
50 | d78cbf09 | Panagiotis Kanavos | |
51 | d78cbf09 | Panagiotis Kanavos | namespace Pithos.Core |
52 | d78cbf09 | Panagiotis Kanavos | { |
53 | 9c4346c9 | Panagiotis Kanavos | public class WorkflowState |
54 | d78cbf09 | Panagiotis Kanavos | { |
55 | c53aa229 | Panagiotis Kanavos | public AccountInfo AccountInfo { get; set; } |
56 | c53aa229 | Panagiotis Kanavos | |
57 | d78cbf09 | Panagiotis Kanavos | public string Path { get; set; } |
58 | d78cbf09 | Panagiotis Kanavos | public string FileName { get; set; } |
59 | d78cbf09 | Panagiotis Kanavos | |
60 | d78cbf09 | Panagiotis Kanavos | public string OldPath { get; set; } |
61 | d78cbf09 | Panagiotis Kanavos | public string OldFileName{ get; set; } |
62 | d78cbf09 | Panagiotis Kanavos | |
63 | d78cbf09 | Panagiotis Kanavos | public WatcherChangeTypes TriggeringChange { get; set; } |
64 | d78cbf09 | Panagiotis Kanavos | public FileStatus Status { get; set; } |
65 | d78cbf09 | Panagiotis Kanavos | |
66 | d78cbf09 | Panagiotis Kanavos | public bool Skip { get; set; } |
67 | d78cbf09 | Panagiotis Kanavos | |
68 | 174bbb6e | Panagiotis Kanavos | public string Hash { get; set; } |
69 | d78cbf09 | Panagiotis Kanavos | public string LastUpdateHash { get; set; } |
70 | 174bbb6e | Panagiotis Kanavos | public string ShortHash { get; set; } |
71 | c53aa229 | Panagiotis Kanavos | |
72 | 1bfc38f1 | Panagiotis Kanavos | /* |
73 | c53aa229 | Panagiotis Kanavos | public WorkflowState(AccountInfo accountInfo) |
74 | c53aa229 | Panagiotis Kanavos | { |
75 | c53aa229 | Panagiotis Kanavos | AccountInfo = accountInfo; |
76 | c53aa229 | Panagiotis Kanavos | } |
77 | 1bfc38f1 | Panagiotis Kanavos | */ |
78 | 1bfc38f1 | Panagiotis Kanavos | |
79 | 1bfc38f1 | Panagiotis Kanavos | public WorkflowState() |
80 | 1bfc38f1 | Panagiotis Kanavos | { |
81 | 1bfc38f1 | Panagiotis Kanavos | |
82 | 1bfc38f1 | Panagiotis Kanavos | } |
83 | 4ec636f6 | Panagiotis Kanavos | |
84 | 4ec636f6 | Panagiotis Kanavos | public WorkflowState(AccountInfo accountInfo, FileState state) |
85 | 4ec636f6 | Panagiotis Kanavos | { |
86 | 174bbb6e | Panagiotis Kanavos | if (accountInfo==null) |
87 | 174bbb6e | Panagiotis Kanavos | throw new ArgumentNullException("accountInfo"); |
88 | 174bbb6e | Panagiotis Kanavos | if (state==null) |
89 | 174bbb6e | Panagiotis Kanavos | throw new ArgumentNullException("state"); |
90 | 174bbb6e | Panagiotis Kanavos | Contract.EndContractBlock(); |
91 | 174bbb6e | Panagiotis Kanavos | |
92 | 4ec636f6 | Panagiotis Kanavos | AccountInfo = accountInfo; |
93 | 4ec636f6 | Panagiotis Kanavos | Path = state.FilePath.ToLower(); |
94 | 4ec636f6 | Panagiotis Kanavos | FileName = System.IO.Path.GetFileName(state.FilePath).ToLower(); |
95 | 4ec636f6 | Panagiotis Kanavos | Hash = state.Checksum; |
96 | 174bbb6e | Panagiotis Kanavos | ShortHash = state.ShortHash; |
97 | 4ec636f6 | Panagiotis Kanavos | Status = state.OverlayStatus == FileOverlayStatus.Unversioned |
98 | 4ec636f6 | Panagiotis Kanavos | ? FileStatus.Created |
99 | 4ec636f6 | Panagiotis Kanavos | : state.FileStatus; |
100 | 4ec636f6 | Panagiotis Kanavos | TriggeringChange = |
101 | 4ec636f6 | Panagiotis Kanavos | state.OverlayStatus == FileOverlayStatus.Unversioned |
102 | 4ec636f6 | Panagiotis Kanavos | ? WatcherChangeTypes.Created |
103 | 4ec636f6 | Panagiotis Kanavos | : WatcherChangeTypes.Changed; |
104 | 4ec636f6 | Panagiotis Kanavos | } |
105 | 4ec636f6 | Panagiotis Kanavos | |
106 | d78cbf09 | Panagiotis Kanavos | } |
107 | d78cbf09 | Panagiotis Kanavos | } |