* added options to exclude libraries for faster build times (DEBUG only)

* implemented getFileEntry to get information about a single file
* password activity is launched automatically if there are recent files
This commit is contained in:
Philipp Crocoll
2013-09-28 21:14:21 +02:00
parent 74acd19092
commit a44e8a9680
23 changed files with 2001 additions and 4720 deletions

View File

@@ -149,5 +149,11 @@ namespace keepass2android.Io
//TODO
throw new NotImplementedException();
}
public FileDescription GetFileDescription(IOConnectionInfo ioc)
{
//TODO
throw new NotImplementedException();
}
}
}

View File

@@ -431,6 +431,11 @@ namespace keepass2android.Io
return _cachedStorage.ListContents(ioc);
}
public FileDescription GetFileDescription(IOConnectionInfo ioc)
{
return _cachedStorage.GetFileDescription(ioc);
}
public string GetBaseVersionHash(IOConnectionInfo ioc)
{

View File

@@ -11,6 +11,7 @@ using Android.Runtime;
using Android.Views;
using Android.Widget;
using KeePassLib.Serialization;
#if !EXCLUDE_JAVAFILESTORAGE
using Keepass2android.Javafilestorage;
namespace keepass2android.Io
@@ -27,4 +28,5 @@ namespace keepass2android.Io
get { return "dropbox"; }
}
}
}
}
#endif

View File

@@ -73,5 +73,10 @@ namespace keepass2android.Io
{
throw new NotImplementedException();
}
public FileDescription GetFileDescription(IOConnectionInfo ioc)
{
throw new NotImplementedException();
}
}
}

View File

@@ -106,6 +106,11 @@ namespace keepass2android.Io
/// Lists the contents of the given path
/// </summary>
IEnumerable<FileDescription> ListContents(IOConnectionInfo ioc);
/// <summary>
/// returns the description of the given file
/// </summary>
FileDescription GetFileDescription(IOConnectionInfo ioc);
}
/// <summary>

View File

@@ -5,12 +5,15 @@ using System.Linq;
using Android.App;
using KeePassLib.Serialization;
using KeePassLib.Utility;
#if !EXCLUDE_JAVAFILESTORAGE
using Keepass2android.Javafilestorage;
#endif
using Exception = System.Exception;
using FileNotFoundException = Java.IO.FileNotFoundException;
namespace keepass2android.Io
{
#if !EXCLUDE_JAVAFILESTORAGE
public abstract class JavaFileStorage: IFileStorage
{
public IEnumerable<string> SupportedProtocols { get { yield return Protocol; } }
@@ -231,17 +234,7 @@ namespace keepass2android.Io
{
IList<JavaFileStorageFileEntry> entries = Jfs.ListFiles(IocToPath(ioc));
return entries.Select(
e => new FileDescription
{
CanRead = e.CanRead,
CanWrite = e.CanWrite,
IsDirectory = e.IsDirectory,
LastModified = JavaTimeToCSharp(e.LastModifiedTime),
Path = Protocol + "://" + e.Path,
SizeInBytes = e.SizeInBytes
}
);
return entries.Select(ConvertToFileDescription);
}
catch (FileNotFoundException e)
@@ -254,6 +247,35 @@ namespace keepass2android.Io
}
}
private FileDescription ConvertToFileDescription(JavaFileStorageFileEntry e)
{
return new FileDescription
{
CanRead = e.CanRead,
CanWrite = e.CanWrite,
IsDirectory = e.IsDirectory,
LastModified = JavaTimeToCSharp(e.LastModifiedTime),
Path = Protocol + "://" + e.Path,
SizeInBytes = e.SizeInBytes
};
}
public FileDescription GetFileDescription(IOConnectionInfo ioc)
{
try
{
return ConvertToFileDescription(Jfs.GetFileEntry(IocToPath(ioc)));
}
catch (FileNotFoundException e)
{
throw new System.IO.FileNotFoundException(e.Message, e);
}
catch (Java.Lang.Exception e)
{
throw LogAndConvertJavaException(e);
}
}
private DateTime JavaTimeToCSharp(long javatime)
{
//todo test
@@ -273,4 +295,5 @@ namespace keepass2android.Io
protected abstract string Protocol { get; }
}
#endif
}

View File

@@ -20,7 +20,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;EXCLUDE_JAVAFILESTORAGE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -93,7 +93,7 @@
<Compile Include="ProgressDialogStatusLogger.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JavaFileStorageBindings\JavaFileStorageBindings.csproj">
<ProjectReference Include="..\JavaFileStorageBindings\JavaFileStorageBindings.csproj" Condition="!$(DefineConstants.Contains('EXCLUDE_JAVAFILESTORAGE'))">
<Project>{48574278-4779-4b3a-a9e4-9cf1bc285d0b}</Project>
<Name>JavaFileStorageBindings</Name>
</ProjectReference>