When selective sync is disabled only owned files are synchronized. Shared files are not synchronized.
Folders (not their contents) are synchronized even when selective sync is disabled
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="Auto"/>
<RowDefinition />
</Grid.RowDefinitions>
<Label Content="Server" Grid.Column="0" Grid.Row="0" Margin="0,5" HorizontalAlignment="Left"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
- <TextBox Name="CurrentAccount_RootPath" Margin="1,5,5,-30" HorizontalAlignment="Stretch" IsReadOnly="True" ToolTip="{Binding CurrentAccount.RootPath}" Height="61" TextWrapping="WrapWithOverflow" />
+ <TextBox Name="CurrentAccount_RootPath" Margin="5" HorizontalAlignment="Stretch" IsReadOnly="True" ToolTip="{Binding CurrentAccount.RootPath}" Height="61" TextWrapping="WrapWithOverflow" />
</Grid>
- <CheckBox Name="CurrentAccount_IsActive" Content="Account is Active" Grid.Row="6" Margin="6,66,230,6" Grid.ColumnSpan="2" />
- <Button Name="SelectiveSyncFolders" Content="Selective Sync" Width="100" Style="{StaticResource ButtonStyle}" Grid.Row="6" Margin="12,40,0,24" Grid.Column="1" />
- <Button Name="MoveAccountFolder" Content="Move ..." Margin="20,40,234,24" Grid.Row="6" Grid.Column="1" Width="100"/>
- <Button Name="ClearAccountCache" Content="Clear Cache" Margin="245,40,9,24" Grid.Row="6" Grid.Column="1" Width="100" />
- <CheckBox Name="Selective_IsActive" Content="Enable Selective Sync" Grid.Row="6" Margin="132,66,80,6" Grid.Column="2" Grid.ColumnSpan="2" IsChecked="False" />
+ <StackPanel Orientation="Horizontal" Grid.Row="6" Grid.Column="1">
+ <Button Name="SelectiveSyncFolders" Content="Selective Sync" Width="100" Style="{StaticResource ButtonStyle}" />
+ <Button Name="MoveAccountFolder" Content="Move ..." Width="100" Style="{StaticResource ButtonStyle}"/>
+ <Button Name="ClearAccountCache" Content="Clear Cache" Width="100" Style="{StaticResource ButtonStyle}"/>
+ </StackPanel>
+ <CheckBox Name="CurrentAccount_IsActive" Content="Account is Active" Grid.Row="7" Grid.Column="1" />
</Grid>
</GroupBox>
//var monitor = Shell.Monitors[CurrentAccount.AccountKey];\r
\r
\r
- var model = new SelectiveSynchViewModel(/*monitor,*/_events,CurrentAccount.Account,CurrentAccount.ApiKey);\r
+ var model = new SelectiveSynchViewModel(_events,CurrentAccount.Account,CurrentAccount.ApiKey); \r
if (_windowManager.ShowDialog(model) == true)\r
{\r
\r
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:4.0.30319.431
+// Runtime Version:4.0.30319.530
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute(@"
- <ArrayOfServerSettings xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
- <ServerSettings>
- <ServerUri>https://pithos.okeanos.grnet.gr</ServerUri>
- <LoginUri>https://pithos.okeanos.grnet.gr/login</LoginUri>
- <LogoutUri>https://accounts.okeanos.grnet.gr/im/logout</LogoutUri>
- </ServerSettings>
- <ServerSettings>
- <ServerUri>https://pithos.dev.grnet.gr</ServerUri>
- <LoginUri>https://pithos.dev.grnet.gr/login</LoginUri>
- <LogoutUri>https://pithos.dev.grnet.gr/im/logout</LogoutUri>
- </ServerSettings>
- </ArrayOfServerSettings>
- ")]
+ [global::System.Configuration.DefaultSettingValueAttribute(@"<?xml version=""1.0"" encoding=""utf-16""?>
+<ArrayOfServerSettings xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
+ <ServerSettings>
+<ServerName>Pithos Production</ServerName>
+ <ServerUri>https://pithos.okeanos.grnet.gr</ServerUri>
+ <LoginUri>https://pithos.okeanos.grnet.gr/login</LoginUri>
+ <LogoutUri>https://accounts.okeanos.grnet.gr/im/logout</LogoutUri>
+ </ServerSettings>
+ <ServerSettings>
+<ServerName>Pithos Development</ServerName>
+ <ServerUri>https://pithos.dev.grnet.gr</ServerUri>
+ <LoginUri>https://pithos.dev.grnet.gr/login</LoginUri>
+ <LogoutUri>https://pithos.dev.grnet.gr/im/logout</LogoutUri>
+ </ServerSettings>
+</ArrayOfServerSettings>")]
public global::Pithos.Interfaces.ServersCollection Servers {
get {
return ((global::Pithos.Interfaces.ServersCollection)(this["Servers"]));
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="Servers" Type="Pithos.Interfaces.ServersCollection" Scope="Application">
- <Value Profile="(Default)">
- <ArrayOfServerSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <ServerSettings>
- <ServerUri>https://pithos.okeanos.grnet.gr</ServerUri>
- <LoginUri>https://pithos.okeanos.grnet.gr/login</LoginUri>
- <LogoutUri>https://accounts.okeanos.grnet.gr/im/logout</LogoutUri>
- </ServerSettings>
- <ServerSettings>
- <ServerUri>https://pithos.dev.grnet.gr</ServerUri>
- <LoginUri>https://pithos.dev.grnet.gr/login</LoginUri>
- <LogoutUri>https://pithos.dev.grnet.gr/im/logout</LogoutUri>
- </ServerSettings>
- </ArrayOfServerSettings>
- </Value>
+ <Value Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
+<ArrayOfServerSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <ServerSettings>
+<ServerName>Pithos Production</ServerName>
+ <ServerUri>https://pithos.okeanos.grnet.gr</ServerUri>
+ <LoginUri>https://pithos.okeanos.grnet.gr/login</LoginUri>
+ <LogoutUri>https://accounts.okeanos.grnet.gr/im/logout</LogoutUri>
+ </ServerSettings>
+ <ServerSettings>
+<ServerName>Pithos Development</ServerName>
+ <ServerUri>https://pithos.dev.grnet.gr</ServerUri>
+ <LoginUri>https://pithos.dev.grnet.gr/login</LoginUri>
+ <LogoutUri>https://pithos.dev.grnet.gr/im/logout</LogoutUri>
+ </ServerSettings>
+</ArrayOfServerSettings></Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
{
public class SelectiveSynchChanges
{
+ public bool Enabled { get; set; }
public Uri[] Uris { get; set; }
public AccountSettings Account { get; set; }
public Uri[] Added { get; set; }
</Window.Resources>
- <Grid>
+ <extToolkit:BusyIndicator Name="IsBusy" BusyContent="Retrieving folders ..." DisplayAfter="0">
+ <Grid>
<Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
- <extToolkit:BusyIndicator Name="IsBusy" Grid.Row="0" BusyContent="Retrieving folders ..." DisplayAfter="0">
- <TreeView Name="RootNodes" Margin="5"
- ItemContainerStyle="{StaticResource TreeItemStyle}"
- ItemTemplate="{StaticResource CheckboxStyle}">
- </TreeView>
- </extToolkit:BusyIndicator>
- <StackPanel Grid.Row="1">
+ <CheckBox x:Name="IsEnabled" Content="Enable Selective Syncing" Margin="5" Grid.Row="0"/>
+ <TreeView Name="RootNodes" Margin="5" Grid.Row="1"
+ ItemContainerStyle="{StaticResource TreeItemStyle}"
+ ItemTemplate="{StaticResource CheckboxStyle}"
+ IsEnabled="{Binding IsEnabled}" >
+ </TreeView>
+ <StackPanel Grid.Row="2">
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right">
<Button Name="SaveChanges" Content="OK" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}"/>
<Button Name="RejectChanges" Content="Cancel" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}"/>
</StackPanel>
</StackPanel>
</Grid>
+ </extToolkit:BusyIndicator>
</Window>
//_monitor = monitor;\r
_events = events;\r
_apiKey = apiKey;\r
+ IsEnabled = account.SelectiveSyncEnabled;\r
TaskEx.Run(LoadRootNode);\r
}\r
\r
where record.Removed && record.Uri != null\r
select record.Uri).ToArray();\r
//TODO: Include Uris for the containers as well\r
- _events.Publish(new SelectiveSynchChanges{Account=Account,Uris=uris,Added=added,Removed=removed});\r
+ _events.Publish(new SelectiveSynchChanges{Enabled=IsEnabled, Account=Account,Uris=uris,Added=added,Removed=removed});\r
\r
\r
\r
TryClose(true);\r
}\r
\r
- \r
+ private bool _isEnabled;\r
+ public bool IsEnabled\r
+ {\r
+ get { return _isEnabled; }\r
+ set\r
+ {\r
+ _isEnabled = value;\r
+ NotifyOfPropertyChange(()=>IsEnabled);\r
+ }\r
+ }\r
+\r
private void SaveSettings(IEnumerable<Uri> uris)\r
{\r
var selections = uris.Select(uri => uri.ToString()).ToArray();\r
-\r
+ Account.SelectiveSyncEnabled = IsEnabled;\r
Account.SelectiveFolders.Clear();\r
Account.SelectiveFolders.AddRange(selections);\r
Settings.Default.Save(); \r
PithosMonitor monitor;
if (Monitors.TryGetValue(message.Account.AccountKey, out monitor))
{
+ monitor.Selectives.SetIsSelectiveEnabled(message.Account.AccountKey, message.Enabled);
monitor.SetSelectivePaths(message.Uris, message.Added, message.Removed);
}
#endregion\r
using System.Collections.Concurrent;\r
using System.Diagnostics.Contracts;\r
+using System.IO;\r
using Pithos.Interfaces;\r
using System;\r
using System.Collections.Generic;\r
using System.Linq;\r
+using Pithos.Network;\r
\r
namespace Pithos.Core.Agents\r
{\r
&& target.IsAtOrBelow(root);\r
}\r
\r
+ public static bool IsSharedTo(this string targetPath,AccountInfo account)\r
+ {\r
+ var othersFolder = Path.Combine(account.AccountPath, FolderConstants.OthersFolder);\r
+ var isShared = targetPath.IsAtOrBelow(othersFolder);\r
+ return isShared;\r
+\r
+ }\r
+\r
/// <summary>\r
/// Checkes whether a file path is below a root path\r
/// </summary>\r
SelectivePaths = new ConcurrentDictionary<Uri, List<string>>();\r
}\r
\r
+ readonly Dictionary<Uri, bool> _selectiveEnabled = new Dictionary<Uri, bool>();\r
+\r
+/*\r
+ public void SetIsSelectiveEnabled(AccountInfo account,bool value)\r
+ {\r
+ _selectiveEnabled[account.AccountKey]=value;\r
+ }\r
+*/\r
+\r
+ public void SetIsSelectiveEnabled(Uri accountKey,bool value)\r
+ {\r
+ _selectiveEnabled[accountKey]=value;\r
+ }\r
+/*\r
+\r
+ public bool IsSelectiveEnabled(AccountInfo account)\r
+ {\r
+ bool isEnabled;\r
+ _selectiveEnabled.TryGetValue(account.AccountKey, out isEnabled);\r
+ return isEnabled;\r
+ }\r
+*/\r
+\r
+ public bool IsSelectiveEnabled(Uri accountKey)\r
+ {\r
+ bool isEnabled;\r
+ _selectiveEnabled.TryGetValue(accountKey, out isEnabled);\r
+ return isEnabled;\r
+ }\r
+\r
+\r
public void SetSelectedUris(AccountInfo account,List<Uri> uris)\r
{\r
SelectiveUris[account.AccountKey] = uris;\r
\r
public bool IsSelected(ObjectInfo info)\r
{\r
+ //Shared folders should NOT be synced if selective syncing is disabled\r
+ var isShared = info.IsShared;\r
+ var selectiveEnabled = IsSelectiveEnabled(info.AccountKey);\r
+ if (!selectiveEnabled)\r
+ return !isShared;\r
+\r
List<Uri> filterUris;\r
return !SelectiveUris.TryGetValue(info.AccountKey, out filterUris) \r
|| filterUris.Count ==0\r
\r
public bool IsSelected(AccountInfo account,FileSystemInfo info)\r
{\r
+ if (info is DirectoryInfo)\r
+ return true;\r
return IsSelected(account,info.FullName);\r
}\r
\r
public bool IsSelected(AccountInfo account, string fullPath)\r
{\r
+ if (Directory.Exists(fullPath))\r
+ return true;\r
+\r
+ //Shared folders should NOT be synced if selective syncing is disabled\r
+ var isShared = fullPath.IsSharedTo(account);\r
+ var selectiveEnabled = IsSelectiveEnabled(account.AccountKey);\r
+ if (!selectiveEnabled)\r
+ return !isShared;\r
+\r
List<string> paths;\r
return !SelectivePaths.TryGetValue(account.AccountKey, out paths)\r
|| paths.Count == 0\r
if (fileInfo.Extension.Equals("ignore", StringComparison.InvariantCultureIgnoreCase))\r
return;\r
\r
- if (Selectives.IsSelected(action.AccountInfo, fileInfo))\r
+ if (!Selectives.IsSelected(action.AccountInfo, fileInfo))\r
return;\r
\r
//Try to load the action's local state, if it is empty\r
public string ServerUrl { get; set; }
- private StringCollection _selectiveFolders = new StringCollection();
-
public bool IsExpired { get; set; }
+ public bool SelectiveSyncEnabled { get; set; }
+
+ private StringCollection _selectiveFolders = new StringCollection();
+
public StringCollection SelectiveFolders
{
get { return _selectiveFolders; }
public class ServerSettings
{
+ public string ServerName { get; set; }
public string ServerUri { get; set; }
public string LoginUri { get; set; }
public string LogoutUri { get; set; }
PreviousHash = previous.Hash;
return this;
}
+
+ public bool IsShared
+ {
+ get
+ {
+ var isShared = !Uri.ToString().StartsWith(StorageUri.ToString());
+ return isShared;
+ }
+ }
}
}
\ No newline at end of file