当前位置: 首页>>代码示例>>C#>>正文


C# IFileReference类代码示例

本文整理汇总了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();
                }
            }
        }
开发者ID:ap0llo,项目名称:SyncTool,代码行数:30,代码来源:SyncActionFactory.cs

示例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;
 }
开发者ID:DeadlyEmbrace,项目名称:effort,代码行数:12,代码来源:CsvTableDataLoader.cs

示例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;
        }
开发者ID:storyteller,项目名称:Storyteller,代码行数:33,代码来源:CodeFormatter.cs

示例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();
 }
开发者ID:aerik,项目名称:fo-dicom,代码行数:12,代码来源:FileByteTarget.cs

示例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);
 }
开发者ID:aerik,项目名称:fo-dicom,代码行数:12,代码来源:TemporaryFileRemover.cs

示例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);
        }
开发者ID:ap0llo,项目名称:SyncTool,代码行数:8,代码来源:ConflictResolverBase.cs

示例7: Change

        public Change(ChangeType type, IFileReference fromFile, IFileReference toFile)
        {
            AssertIsValidChange(type, fromFile, toFile);
            AssertPathsAreEqual(fromFile, toFile);

            Type = type;
            FromVersion = fromFile;
            ToVersion = toFile;
        }
开发者ID:ap0llo,项目名称:SyncTool,代码行数:9,代码来源:Change.cs

示例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;
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:14,代码来源:ManagedResource.cs

示例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));
     }
 }
开发者ID:ap0llo,项目名称:SyncTool,代码行数:11,代码来源:Change.cs

示例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();
        }
开发者ID:GMZ,项目名称:fo-dicom,代码行数:13,代码来源:FileByteSource.cs

示例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;
 }
开发者ID:ap0llo,项目名称:SyncTool,代码行数:13,代码来源:SyncAction.cs

示例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;
            }
        }
开发者ID:ap0llo,项目名称:SyncTool,代码行数:15,代码来源:SimpleConflictResolver.cs

示例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);
     }
 }
开发者ID:ap0llo,项目名称:SyncTool,代码行数:17,代码来源:Change.cs

示例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;            
        }
开发者ID:ap0llo,项目名称:SyncTool,代码行数:17,代码来源:FileReference.cs

示例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);
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:10,代码来源:Validator.cs


注:本文中的IFileReference类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。