本文整理汇总了C#中IFileReference类的典型用法代码示例。如果您正苦于以下问题:C# IFileReference类的具体用法?C# IFileReference怎么用?C# IFileReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFileReference类属于命名空间,在下文中一共展示了IFileReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSyncAction
public SyncAction GetSyncAction(string targetName, int syncPointId, IFileReference currentFileVersion, IFileReference newFileVersion)
{
if (m_FileReferenceComparer.Equals(currentFileVersion, newFileVersion))
{
return null;
}
if (currentFileVersion != null)
{
if (newFileVersion == null)
{
return SyncAction.CreateRemoveFileSyncAction(targetName, SyncActionState.Queued, syncPointId, currentFileVersion);
}
else
{
return SyncAction.CreateReplaceFileSyncAction(targetName, SyncActionState.Queued, syncPointId, currentFileVersion, newFileVersion);
}
}
else
{
if (newFileVersion != null)
{
return SyncAction.CreateAddFileSyncAction(targetName, SyncActionState.Queued, syncPointId, newFileVersion);
}
else
{
throw new InvalidOperationException();
}
}
}
示例2: CsvTableDataLoader
/// <summary>
/// Initializes a new instance of the <see cref="CsvTableDataLoader" /> class.
/// </summary>
/// <param name="file"> The file reference to the CSV file. </param>
/// <param name="table"> The metadata of the requested table. </param>
public CsvTableDataLoader(IFileReference file, TableDescription table)
: base(table)
{
// TODO: Constructor injection
this.valueConverter = new CsvValueConverter();
this.file = file;
}
示例3: Format
public Sample Format(IFileReference file, string languageClass = null)
{
var snippet = new Sample(file.Path){
Language = languageClass ?? "lang-" + Path.GetExtension(file.Path).Replace(".", "")
};
file.ReadContents(stream =>
{
using (var reader = new StreamReader(stream))
{
int lineNumber = 0;
string line;
while ((line = reader.ReadLine()) != null)
{
lineNumber++;
if (line.Contains(Samples.SAMPLE) || line.Contains(Samples.END))
{
snippet.Append(string.Empty, lineNumber);
}
else
{
snippet.Append(line, lineNumber);
}
}
}
});
return snippet;
}
示例4: FileByteTarget
/// <summary>
/// Initializes an instance of <see cref="FileByteTarget"/>.
/// </summary>
/// <param name="file"></param>
public FileByteTarget(IFileReference file)
{
_file = file;
_stream = _file.OpenWrite();
_endian = Endian.LocalMachine;
_writer = EndianBinaryWriter.Create(_stream, _endian);
_lock = new object();
}
示例5: Delete
/// <summary>
/// Delete the specified temporary file.
/// </summary>
/// <param name="file"></param>
public static void Delete(IFileReference file)
{
if (!file.IsTempFile)
{
throw new DicomIoException("Only temporary files should be removed through this operation.");
}
Instance.DeletePrivate(file);
}
示例6: TryResolveConflict
bool TryResolveConflict(ChangeGraphBuilder changeGraphBuilder, IMultiFileSystemHistoryService historyService, ConflictInfo conflict, out IFileReference resolved)
{
var graph = changeGraphBuilder.GetChangeGraphs(GetDiff(historyService, conflict)).Single();
var sinks = graph.GetSinks().ToArray();
return TryResolveConflict(sinks, out resolved);
}
示例7: Change
public Change(ChangeType type, IFileReference fromFile, IFileReference toFile)
{
AssertIsValidChange(type, fromFile, toFile);
AssertPathsAreEqual(fromFile, toFile);
Type = type;
FromVersion = fromFile;
ToVersion = toFile;
}
示例8: ManagedResource
/// <summary>
/// <paramref name="streamProvider"/> streamProvider callers will dispose result after use.
/// <paramref name="streamProvider"/> and <paramref name="fileReference"/> are mutually exclusive.
/// </summary>
internal ManagedResource(string name, bool isPublic, Func<Stream> streamProvider, IFileReference fileReference, uint offset)
{
Debug.Assert(streamProvider == null ^ fileReference == null);
_streamProvider = streamProvider;
_name = name;
_fileReference = fileReference;
_offset = offset;
_isPublic = isPublic;
}
示例9: AssertIsValidAddedChange
void AssertIsValidAddedChange(IFileReference fromFile, IFileReference toFile)
{
if (fromFile != null)
{
throw new ArgumentException($"{nameof(fromFile)} must be null for ChangeType {ChangeType.Added}", nameof(fromFile));
}
if (toFile == null)
{
throw new ArgumentNullException(nameof(toFile));
}
}
示例10: FileByteSource
public FileByteSource(IFileReference file)
{
_file = file;
_stream = _file.OpenRead();
_endian = Endian.LocalMachine;
_reader = EndianBinaryReader.Create(_stream, _endian);
_mark = 0;
_largeObjectSize = 64 * 1024;
_milestones = new Stack<long>();
_lock = new object();
}
示例11: SyncAction
public SyncAction(ChangeType type, IFileReference fromVersion, IFileReference toVersion, Guid id, string target, SyncActionState state, int syncPointId)
: base(type, fromVersion, toVersion)
{
if (syncPointId <= 0)
{
throw new ArgumentOutOfRangeException(nameof(syncPointId), "Id must be a positive integer");
}
this.Target = target;
this.Id = id;
this.State = state;
this.SyncPointId = syncPointId;
}
示例12: TryResolveConflict
protected override bool TryResolveConflict(IEnumerable<IFileReference> versions, out IFileReference resolvedVersion)
{
var containsMultipleItems = versions.Skip(1).Any();
if (containsMultipleItems)
{
resolvedVersion = null;
return false;
}
else
{
resolvedVersion = versions.Single();
return true;
}
}
示例13: AssertIsValidChange
void AssertIsValidChange(ChangeType type, IFileReference fromFile, IFileReference toFile)
{
switch (type)
{
case ChangeType.Added:
AssertIsValidAddedChange(fromFile, toFile);
break;
case ChangeType.Deleted:
AssertIsValidDeletedChange(fromFile, toFile);
break;
case ChangeType.Modified:
AssertIsValidModifiedChange(fromFile, toFile);
break;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
}
示例14: Equals
public bool Equals(IFileReference other)
{
if (other == null)
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return StringComparer.InvariantCultureIgnoreCase.Equals(this.Path, other.Path) &&
LastWriteTime == other.LastWriteTime &&
Length == other.Length;
}
示例15: Visit
/// <summary>
/// Performs some computation with the given file reference.
/// </summary>
public void Visit(IFileReference fileReference)
{
if (fileReference.FileName.Value.IndexOfAny(badPosixNameChars) > 0)
this.ReportError(MetadataError.NotPosixAssemblyName, fileReference, fileReference.FileName.Value);
if (fileReference.FileName.UniqueKeyIgnoringCase == this.validator.currentModule.ModuleName.UniqueKeyIgnoringCase)
this.ReportError(MetadataError.SelfReference, fileReference);
}