本文整理汇总了C#中IFolder类的典型用法代码示例。如果您正苦于以下问题:C# IFolder类的具体用法?C# IFolder怎么用?C# IFolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFolder类属于命名空间,在下文中一共展示了IFolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DescendantsCrawler
/// <summary>
/// Initializes a new instance of the <see cref="DescendantsCrawler"/> class.
/// </summary>
/// <param name="queue">Sync Event Queue.</param>
/// <param name="remoteFolder">Remote folder.</param>
/// <param name="localFolder">Local folder.</param>
/// <param name="storage">Meta data storage.</param>
/// <param name="filter">Aggregated filter.</param>
/// <param name="activityListener">Activity listner.</param>
public DescendantsCrawler(
ISyncEventQueue queue,
IFolder remoteFolder,
IDirectoryInfo localFolder,
IMetaDataStorage storage,
IFilterAggregator filter,
IActivityListener activityListener,
IIgnoredEntitiesStorage ignoredStorage)
: base(queue)
{
if (remoteFolder == null) {
throw new ArgumentNullException("remoteFolder");
}
if (localFolder == null) {
throw new ArgumentNullException("localFolder");
}
if (storage == null) {
throw new ArgumentNullException("storage");
}
if (filter == null) {
throw new ArgumentNullException("filter");
}
if (activityListener == null) {
throw new ArgumentNullException("activityListener");
}
this.activityListener = activityListener;
this.treebuilder = new DescendantsTreeBuilder(storage, remoteFolder, localFolder, filter, ignoredStorage);
this.eventGenerator = new CrawlEventGenerator(storage);
this.notifier = new CrawlEventNotifier(queue);
}
示例2: With
public NodeTreeParserConfig With(IFolder folder)
{
this.folders.Add(folder);
this.locators.Add(new LinkedTextLocator(folder));
return this;
}
示例3: _EnsureFolderExistsAsync
private static async Task<IFolder> _EnsureFolderExistsAsync(string name, IFolder parent)
{
if (parent == null) throw new ArgumentNullException("parent");
return
await
parent.CreateFolderAsync(name, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
}
示例4: MessageListCommand
/// <summary>
/// Create a new MessageListCommand for the specified folder
/// </summary>
/// <param name="folder"></param>
/// <param name="callback"></param>
public MessageListCommand(IFolder folder, CommandDataReceivedCallback callback)
: base(callback)
{
_parameterObjs.Add(folder);
CommandString = String.Format("UID SEARCH all");
}
示例5: Start
/// <summary>
/// Search for messages within the specified folders. The NewMessageRequestCompleted event will be fired once for each folder.
/// </summary>
/// <param name="folders"></param>
public void Start(IFolder[] folders)
{
foreach (IFolder folder in folders)
{
Start(folder);
}
}
示例6: UploadRandomDocumentTo
private static void UploadRandomDocumentTo(IFolder folder)
{
string filename = "file_" + Guid.NewGuid() + ".bin";
//byte[] content = UTF8Encoding.UTF8.GetBytes("Hello World!");
int sizeInMb = 40;
byte[] data = new byte[sizeInMb * 1024 * 1024];
Random rng = new Random();
rng.NextBytes(data);
IDictionary<string, object> properties = new Dictionary<string, object>();
properties[PropertyIds.Name] = filename;
properties[PropertyIds.ObjectTypeId] = "cmis:document";
ContentStream contentStream = new ContentStream();
contentStream.FileName = filename;
contentStream.MimeType = "application/octet-stream";
contentStream.Length = data.Length;
contentStream.Stream = new MemoryStream(data);
Console.Write("Uploading " + filename + " ... ");
folder.CreateDocument(properties, contentStream, null);
Console.WriteLine(" Done.");
contentStream.Stream.Close();
contentStream.Stream.Dispose();
}
示例7: CopyMessageRequest
/// <summary>
/// Initializes a new instance of the <see cref="MoveMessageRequest"/> class.
/// </summary>
/// <param name="message">The messagy to copy.</param>
/// <param name="destFolder">The destination folder.</param>
/// <param name="callback">The callback to call when copy operation is completed.</param>
public CopyMessageRequest(IMessage message, IFolder destFolder, RequestCompletedCallback callback)
: base(callback)
{
PreCommand = new SelectFolderCommand(message.Folder, null);
Command = new CopyMessageCommand(message, destFolder, null);
ProcessorType = typeof(CopyMessageProcessor);
}
示例8: CrawlSync
/// <summary>
/// Synchronize by checking all folders/files one-by-one.
/// This strategy is used if the CMIS server does not support the ChangeLog feature.
///
/// for all remote folders:
/// if exists locally:
/// recurse
/// else
/// if in database:
/// delete recursively from server // if BIDIRECTIONAL
/// else
/// download recursively
/// for all remote files:
/// if exists locally:
/// if remote is more recent than local:
/// download
/// else
/// upload // if BIDIRECTIONAL
/// else:
/// if in database:
/// delete from server // if BIDIRECTIONAL
/// else
/// download
/// for all local files:
/// if not present remotely:
/// if in database:
/// delete
/// else:
/// upload // if BIDIRECTIONAL
/// else:
/// if has changed locally:
/// upload // if BIDIRECTIONAL
/// for all local folders:
/// if not present remotely:
/// if in database:
/// delete recursively from local
/// else:
/// upload recursively // if BIDIRECTIONAL
/// </summary>
private void CrawlSync(IFolder remoteFolder, string localFolder)
{
sleepWhileSuspended();
// Lists of files/folders, to delete those that have been removed on the server.
IList remoteFiles = new ArrayList();
IList remoteSubfolders = new ArrayList();
try
{
// Crawl remote children.
// Logger.LogInfo("Sync", String.Format("Crawl remote folder {0}", this.remoteFolderPath));
CrawlRemote(remoteFolder, localFolder, remoteFiles, remoteSubfolders);
// Crawl local files.
// Logger.LogInfo("Sync", String.Format("Crawl local files in the local folder {0}", localFolder));
CrawlLocalFiles(localFolder, remoteFolder, remoteFiles);
// Crawl local folders.
// Logger.LogInfo("Sync", String.Format("Crawl local folder {0}", localFolder));
CrawlLocalFolders(localFolder, remoteFolder, remoteSubfolders);
}
catch (CmisBaseException e)
{
ProcessRecoverableException("Could not crawl folder: " + remoteFolder.Path, e);
}
}
示例9: DeleteFolderRequest
public DeleteFolderRequest(IFolder folder, RequestCompletedCallback callback)
: base(callback)
{
/*
* Process for deleting a folder:
* the IMAP spec states that deleting a folder should NOT delete any sub folders.
* So in that case we must rename any and all sub folders to include the name of the
* parent folder that is being deleted. for example:
*
* INBOX/Sub1/SubSub1
* /SubSub2
* /SubSub3
*
* if we delete Sub1, Sub1's sub folders become:
*
* INBOX/Sub1_SubSub1
* INBOX/Sub1_SubSub2
* INBOX/Sub1_SubSub3
*
* This request is ONLY for deleting the folder on the server. A higher level construct
* is needed to facilitate the renaming of sub folders.
*
* */
Command = new DeleteFolderCommand(folder, null);
ProcessorType = typeof (DeleteFolderProcessor);
}
示例10: MoveAsync
public static Task MoveAsync( this IFile file, IFolder destinationFolder )
{
Arg.NotNull( file, nameof( file ) );
Arg.NotNull( destinationFolder, nameof( destinationFolder ) );
Contract.Ensures( Contract.Result<Task>() != null );
return file.MoveAsync( destinationFolder, file.Name );
}
示例11: MessageListRequest
/// <summary>
/// Retreives the list of message UIDs for the specified folder from the server.
/// </summary>
/// <param name="folder"></param>
/// <param name="callback"></param>
public MessageListRequest(IFolder folder, RequestCompletedCallback callback)
: base(callback)
{
PreCommand = new ExamineFolderCommand(folder, null);
Command = new MessageListCommand(folder, null);
ProcessorType = typeof (MessageListProcessor);
}
示例12: SearchRequest
public SearchRequest(IFolder folder, SearchCriteria criteria, RequestCompletedCallback callback)
: base(callback)
{
PreCommand = new SelectFolderCommand(folder, null);
Command = new SearchCommand(criteria, null);
ProcessorType = typeof (SearchProcessor);
}
示例13: CreateFolderCommand
public CreateFolderCommand(string folderName, IFolder parentFolder, CommandDataReceivedCallback callback)
: base(callback)
{
System.Text.StringBuilder b = new System.Text.StringBuilder(folderName);
for (int i = 0; i < b.Length; ++i)
{
if (b[i] == '+')
b[i] = '&';
else if (b[i] == '&')
b[i] = '+';
}
folderName = b.ToString();
byte[] utf7String = System.Text.Encoding.UTF7.GetBytes(folderName);
folderName = System.Text.Encoding.ASCII.GetString(utf7String);
folderName = folderName.Replace('/', ',').Replace('+', '&');
string fullFolder = parentFolder != null
? String.Format("{0}/{1}", parentFolder.FullEncodedPath, folderName)
: folderName;
fullFolder = fullFolder.Replace("\"", "");
_parameters.Add(fullFolder);
CommandString = String.Format("CREATE \"{0}\"", fullFolder);
}
示例14: ValidateFileNames
public bool ValidateFileNames(string folderName, IFolder folder, IScriptBaseObject thisLevelRootObject, out IEnumerable<FilenameInfo> duplicates)
{
log.Info("Validating generated files.");
List<FilenameInfo> generatedPaths = new List<FilenameInfo>();
ValidateFileNames(generatedPaths, folder, thisLevelRootObject, folderName);
Dictionary<string, FilenameInfo> generatedPathSet = new Dictionary<string, FilenameInfo>();
HashSet<FilenameInfo> tempduplicates = new HashSet<FilenameInfo>();
foreach (var path in generatedPaths)
{
if (generatedPathSet.ContainsKey(path.ProcessedFilename) == false)
{
generatedPathSet.Add(path.ProcessedFilename, path);
}
else
{
tempduplicates.Add(generatedPathSet[path.ProcessedFilename]);
tempduplicates.Add(path);
}
}
if (tempduplicates.Count > 0)
{
duplicates = tempduplicates;
return false;
}
duplicates = new List<FilenameInfo>();
return true;
}
示例15: SelectFolderCommand
/// <summary>
/// Create a new SelectFolderCommand for the specified folder
/// </summary>
/// <param name="folder"></param>
/// <param name="callback"></param>
public SelectFolderCommand(IFolder folder, CommandDataReceivedCallback callback)
: base(callback)
{
_parameters.Add(folder.FullPath);
_parameterObjs.Add(folder);
CommandString = String.Format("SELECT \"{0}\"", Parameters);
}