90 lines
2.3 KiB
C#
90 lines
2.3 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: CarotDAV.SimpleResourceInfo
|
|
// Assembly: CarotDAV, Version=1.13.2.18337, Culture=neutral, PublicKeyToken=null
|
|
// MVID: C31F2651-A4A8-4D09-916A-8C6106F5E7C8
|
|
// Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\CarotDAV.exe
|
|
|
|
using Rei.Fs;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
|
|
namespace CarotDAV
|
|
{
|
|
[DebuggerDisplay("{DebuggerString}")]
|
|
[Serializable]
|
|
public class SimpleResourceInfo : ICloneable
|
|
{
|
|
public string Name;
|
|
public long Size;
|
|
public DateTime LastModifiedTime;
|
|
public bool IsCollection;
|
|
|
|
public SimpleResourceInfo()
|
|
{
|
|
this.Name = (string) null;
|
|
}
|
|
|
|
public SimpleResourceInfo(string name, long size, DateTime lastmodified, bool iscollection)
|
|
{
|
|
this.Name = name;
|
|
this.Size = size;
|
|
this.LastModifiedTime = lastmodified;
|
|
this.IsCollection = iscollection;
|
|
}
|
|
|
|
public SimpleResourceInfo(ResourceInfo ri)
|
|
{
|
|
this.Name = ri.Id.ToString();
|
|
this.Size = ri.Size;
|
|
this.LastModifiedTime = ri.LastModifiedTime;
|
|
this.IsCollection = ri.IsCollection;
|
|
}
|
|
|
|
public string DebuggerString
|
|
{
|
|
get
|
|
{
|
|
return this.ToString();
|
|
}
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string str1 = "";
|
|
string str2 = this.Name != null ? str1 + this.Name : str1 + "Noname";
|
|
return (!this.IsCollection ? str2 + " <FILE> " : str2 + " <COLL> ") + this.Size.ToString();
|
|
}
|
|
|
|
public object Clone()
|
|
{
|
|
return (object) (SimpleResourceInfo) this.MemberwiseClone();
|
|
}
|
|
|
|
public static SimpleResourceInfo CreateLocalFileInfo(string path)
|
|
{
|
|
if (File.Exists(path))
|
|
{
|
|
FileInfo fileInfo = new FileInfo(path);
|
|
return new SimpleResourceInfo()
|
|
{
|
|
Name = path,
|
|
Size = fileInfo.Length,
|
|
LastModifiedTime = fileInfo.LastWriteTime,
|
|
IsCollection = false
|
|
};
|
|
}
|
|
if (!Directory.Exists(path))
|
|
return (SimpleResourceInfo) null;
|
|
DirectoryInfo directoryInfo = new DirectoryInfo(path);
|
|
return new SimpleResourceInfo()
|
|
{
|
|
Name = path,
|
|
Size = 0,
|
|
LastModifiedTime = directoryInfo.LastWriteTime,
|
|
IsCollection = true
|
|
};
|
|
}
|
|
}
|
|
}
|