Skip to content

Commit

Permalink
Branched from $/Liquesce/Liquesce-PhaseII to a version that support .…
Browse files Browse the repository at this point in the history
…Net 4.5 onwards
  • Loading branch information
smurfiv_cp authored and smurfiv_cp committed Dec 24, 2014
1 parent e1d365b commit 474bf91
Show file tree
Hide file tree
Showing 219 changed files with 17,239 additions and 10,359 deletions.
282 changes: 179 additions & 103 deletions Liquesce.sln

Large diffs are not rendered by default.

175 changes: 95 additions & 80 deletions Liquesce/AdvancedPropertiesDisplay.cs
Original file line number Diff line number Diff line change
@@ -1,120 +1,134 @@
using System;
#region Copyright (C)
// ---------------------------------------------------------------------------------------------------------------
// <copyright file="AdvancedPropertiesDisplay.cs" company="Smurf-IV">
//
// Copyright (C) 2010-2014 Simon Coghlan (Aka Smurf-IV)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
// <summary>
// Url: http://Liquesce.codeplex.com/
// Email: http://www.codeplex.com/site/users/view/smurfiv
// </summary>
// --------------------------------------------------------------------------------------------------------------------
#endregion

using System;
using System.ComponentModel;
using System.Drawing.Design;
using LiquesceFacade;
using NLog;

namespace Liquesce
{
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
// Needs to be global to allow the propertgrid reflector to the accessors
public class AdvancedPropertiesDisplay
{
private readonly ConfigDetails cd;

public AdvancedPropertiesDisplay(ConfigDetails cd)
{
if (cd != null)
{
ThreadCount = cd.ThreadCount;
LockTimeoutmSec = cd.LockTimeout;
DokanDebugMode = cd.DebugMode;
PluginMode = cd.PluginMode;
HoldOffMBytes = cd.HoldOffBufferBytes / (1024 * 1024);
BufferReadSizeKBytes = cd.BufferReadSize / 1024;
ServiceLogLevel = cd.ServiceLogLevel;
}
this.cd = cd;
}

private uint bufferReadSizeKBytes;

[DescriptionAttribute("The number of KBytes allocated to buffered file reading (4KB is the OS default!).\rRange 1 <-> 256"),
DisplayName("Buffer Read Size")
, CategoryAttribute("File")
[DescriptionAttribute("The number of MilliSecs to wait before the service attempts to start to 'Load' the mount point.\r" +
"Used to allow USB devices or network to become enabled before committing the mount space.\r" +
"Range 0 <-> 10000000"),
DisplayName("Delay Start in MilliSec")
, CategoryAttribute("Service")
]
public uint BufferReadSizeKBytes
[TypeConverter(typeof(NumericUpDownTypeConverter))]
[Editor(typeof(NumericUpDownTypeEditor), typeof(UITypeEditor)), MinMaxAttribute(0, 10000000, 500)]
public uint DelayStartMilliSec
{
get { return bufferReadSizeKBytes; }
set
{
if (value >= 1
&& value <= 256) bufferReadSizeKBytes = value;
}
get { return cd.DelayStartMilliSec; }
set { cd.DelayStartMilliSec = value; }
}

private ulong holdOffMBytes;

[DescriptionAttribute("Number of free MegaBytes to leave, before attempting to use another drive to write to.\rRange 1 <-> 1024000"),
DisplayName("Hold Off Buffer")
, CategoryAttribute("File")
[DescriptionAttribute("0 is automatic (Number of processing units * 2), use 1 for problem finding scenario's.\rRange 0 <-> 31"),
DisplayName("Thread Count")
, CategoryAttribute("CBFS")
]
public ulong HoldOffMBytes
[TypeConverter(typeof(NumericUpDownTypeConverter))]
[Editor(typeof(NumericUpDownTypeEditor), typeof(UITypeEditor)), MinMaxAttribute(0, 31)]
public ushort ThreadCount
{
get { return holdOffMBytes; }
set
{
if (value >= 1
&& value <= 1024000) holdOffMBytes = value;
}
get { return cd.ThreadCount; }
set { cd.ThreadCount = value; }
}

[DescriptionAttribute("Later on will allow Dokan Debug information to be captured into the Service log."),
DisplayName("Dokan Debug Mode")
, CategoryAttribute("Dokan")
[DescriptionAttribute("The amount of information that will be placed into the Log files.\r" +
"Trace means slower performance!\r." +
"Useful for creating bug reports - set Thread Count to 1 as well"),
DisplayName("Service Logging Level")
, CategoryAttribute("Service")
]
public bool DokanDebugMode { get; set; }

private int lockTimeoutmSec;
[TypeConverter(typeof(ServiceLogLevelValues))]
public string ServiceLogLevel
{
get { return cd.ServiceLogLevel; }
set { cd.ServiceLogLevel = value; }
}

[DescriptionAttribute("Useful if you are getting file overwrites in some applications that perform quick creation deletion / creation of files, and multiple threads - Can be set to -1 for infinite.\rRange -1 <-> 100000"),
DisplayName("File Lock Timeout (mSec)")
[DescriptionAttribute("Cache the file details. This will improve the speed of file discovery and opening.\r" +
"Range is 0 <-> 65535"),
DisplayName("File Detail cache seconds")
, CategoryAttribute("File")
]
public int LockTimeoutmSec
[TypeConverter(typeof(NumericUpDownTypeConverter))]
[Editor(typeof(NumericUpDownTypeEditor), typeof(UITypeEditor)), MinMaxAttribute(UInt16.MaxValue)]
public UInt16 CacheLifetimeSeconds
{
get { return lockTimeoutmSec; }
set
{
if (value >= -1
&& value <= 100000) lockTimeoutmSec = value;
}
get { return cd.CacheLifetimeSeconds; }
set { cd.CacheLifetimeSeconds = value; }
}

private ushort threadCount;

[DescriptionAttribute("0 is automatic, use 1 for problem finding scenario's.\rRange 0 <-> 32"),
DisplayName("Thread Count")
, CategoryAttribute("Dokan")
[DescriptionAttribute("The CBFS has caches that enable missing file details etc to not be routed through the service.\r" +
"This enables faster lookup's but has the draw back of never being able to find files that have been copied to the actual source drives.\r"+
"e.g. http://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_nonexistentfilescacheenabled.html"),
DisplayName("Use Internal Driver Caches")
, CategoryAttribute("File")
]
public ushort ThreadCount
[TypeConverter(typeof(bool))]
public bool UseInternalDriverCaches
{
get { return threadCount; }
set
{
if (value >= 0
&& value <= 32)
threadCount = value;
}
get { return cd.UseInternalDriverCaches; }
set { cd.UseInternalDriverCaches = value; }
}

[DescriptionAttribute("The amount of information that will be placed into the Log files (Trace means slower performance!)."),
DisplayName("Service Logging Level"),
TypeConverter(typeof(ServiceLogLevelValues))
, CategoryAttribute("Service")
]
public string ServiceLogLevel { get; set; }


[DescriptionAttribute("The allocation strategy how new files or folders are placed on the storage disks:\n" +
"folder = try to keep files together on one disk (classic behavior)\n" +
"priority = strict one disk after the other method\n" +
"balanced = balance the availabel space on all storage disks\n" +
"backup = balanced with a \"_backup\" folder to get a secure allocated backup"
),
DisplayName("Disk Allocation Mode")
[DescriptionAttribute("If true, then this attempts to perform in place renaming.\r" +
"If false, then renaming will also follow the priority rules and attempt to move files as if they are created anew.\r" +
"e.g. This means that if they exist on the last 2 drives, then via \'Priority\', they would all be moved to the first drive.\r" +
"But; there a few applications that perform a move to temporary location _before_ placing into the target (TeraCopy), these apps may produce variable results.\r"
),
// TODO: UseInplaceRenaming
DisplayName("Use Inplace File Renaming")
, CategoryAttribute("File")
]
public String PluginMode { get; set; }
[TypeConverter(typeof(bool))]
public bool UseInplaceRenaming
{
get { return cd.UseInplaceRenaming; }
set { cd.UseInplaceRenaming = value; }
}
}
// ReSharper restore UnusedMember.Global
// ReSharper restore MemberCanBePrivate.Global


public class ServiceLogLevelValues : StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
Expand All @@ -130,7 +144,8 @@ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)

public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(new[] { LogLevel.Warn.ToString(), LogLevel.Debug.ToString(), LogLevel.Trace.ToString() });
return new StandardValuesCollection(new[] { LogLevel.Fatal.Name, LogLevel.Error.Name, LogLevel.Warn.Name, LogLevel.Info.Name, LogLevel.Debug.Name, LogLevel.Trace.Name });
}
}

}
57 changes: 29 additions & 28 deletions Liquesce/App.config
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
<?xml version="1.0"?>
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Liquesce.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="Liquesce.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>

<!-- Stick the namespaces in .. this is supposed to allow the intellisense to work ;-) -->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true">
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true">
<variable name="LogDir" value="${specialfolder:folder=CommonApplicationData}/Liquesce/Logs"/>
<targets>
<target name="file" xsi:type="File"
layout="${longdate}[${threadid}][${threadname}] ${level:uppercase=true} ${logger}: ${message} ${exception:format=ToString}"
fileName="${LogDir}/Liquesce.log"
archiveFileName="${LogDir}/Liquesce.{#}.log"
archiveAboveSize="1048576"
archiveNumbering="Rolling"
maxArchiveFiles="5">
<target name="file" xsi:type="File" layout="${longdate}[${threadid}] ${level:uppercase=true} ${logger}: ${message} ${exception:format=ToString}" fileName="${LogDir}/Liquesce.log" archiveFileName="${LogDir}/Liquesce.{#}.log" archiveAboveSize="1048576" archiveNumbering="Rolling" maxArchiveFiles="5">
</target>
</targets>

<rules>
<logger name="*" minlevel="Debug" writeTo="file"/>
</rules>
</nlog>
<system.serviceModel>
<client>
<endpoint
name="LiquesceFacade"
address="net.tcp://localhost:41014/LiquesceFacade"
binding="netTcpBinding"
bindingConfiguration="tcp_Unsecured"
contract="LiquesceFacade.ILiquesce" />
</client>
<bindings>
<netTcpBinding>
<binding name="tcp_Unsecured">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
<userSettings>
<Liquesce.Properties.Settings>
<setting name="WindowLocation" serializeAs="String">
<value/>
</setting>
<setting name="UpdateRequired" serializeAs="String">
<value>True</value>
</setting>
<setting name="TailWindowLocation" serializeAs="String">
<value/>
</setting>
</Liquesce.Properties.Settings>
<Liquesce.Settings1>
<setting name="WindowLocation" serializeAs="String">
<value/>
</setting>
<setting name="UpdateRequired" serializeAs="String">
<value>True</value>
</setting>
</Liquesce.Settings1>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Loading

0 comments on commit 474bf91

Please sign in to comment.