コード例 #1
0
        void AddFile(WorkspaceDirectoryInfo NewWorkspaceDir, StreamFileInfo StreamFile)
        {
            // Create a new file for this workspace
            WorkspaceFileInfo WorkspaceFile = new WorkspaceFileInfo(NewWorkspaceDir, StreamFile.Name, StreamFile.ContentId);

            NewWorkspaceDir.NameToFile.Add(StreamFile.Name, WorkspaceFile);

            // Try to add it to the cache
            TrackedFileInfo TrackedFile;

            if (ContentIdToTrackedFile.TryGetValue(StreamFile.ContentId, out TrackedFile))
            {
                if (FilesToMove.TryAdd(TrackedFile, new WorkspaceFileToMove(StreamFile, TrackedFile, WorkspaceFile)))
                {
                    WorkspaceFile.SetMetadata(TrackedFile.Length, TrackedFile.LastModifiedTicks, TrackedFile.bReadOnly);
                }
                else
                {
                    FilesToCopy.Add(new WorkspaceFileToCopy(StreamFile, FilesToMove[TrackedFile].WorkspaceFile, WorkspaceFile));
                }
            }
            else
            {
                WorkspaceFileInfo SourceWorkspaceFile;
                if (ContentIdToWorkspaceFile.TryGetValue(StreamFile.ContentId, out SourceWorkspaceFile))
                {
                    FilesToCopy.Add(new WorkspaceFileToCopy(StreamFile, SourceWorkspaceFile, WorkspaceFile));
                }
                else
                {
                    FilesToSync.Add(new WorkspaceFileToSync(StreamFile, WorkspaceFile));
                }
            }
        }
コード例 #2
0
 void RemoveFile(WorkspaceFileInfo WorkspaceFile)
 {
     if (ContentIdToTrackedFile.ContainsKey(WorkspaceFile.ContentId) || !FilesToMove.TryAdd(WorkspaceFile.ContentId, WorkspaceFile))
     {
         FilesToDelete.Add(WorkspaceFile);
     }
 }
コード例 #3
0
        public void Read(BinaryReader Reader)
        {
            WorkspaceFileInfo[] Files = new WorkspaceFileInfo[Reader.ReadInt32()];
            for (int Idx = 0; Idx < Files.Length; Idx++)
            {
                Files[Idx] = new WorkspaceFileInfo(this, Reader);
            }
            NameToFile = Files.ToDictionary(x => x.Name, x => x, StringComparer.Ordinal);

            int NumSubDirectories = Reader.ReadInt32();

            for (int Idx = 0; Idx < NumSubDirectories; Idx++)
            {
                WorkspaceDirectoryInfo SubDirectory = new WorkspaceDirectoryInfo(this, Reader.ReadString());
                SubDirectory.Read(Reader);
                NameToSubDirectory[SubDirectory.Name] = SubDirectory;
            }
        }
コード例 #4
0
 public WorkspaceFileToSync(StreamFileInfo StreamFile, WorkspaceFileInfo WorkspaceFile)
 {
     this.StreamFile    = StreamFile;
     this.WorkspaceFile = WorkspaceFile;
 }
コード例 #5
0
 public WorkspaceFileToCopy(StreamFileInfo StreamFile, WorkspaceFileInfo SourceWorkspaceFile, WorkspaceFileInfo TargetWorkspaceFile)
 {
     this.StreamFile          = StreamFile;
     this.SourceWorkspaceFile = SourceWorkspaceFile;
     this.TargetWorkspaceFile = TargetWorkspaceFile;
 }
コード例 #6
0
 public WorkspaceFileToMove(StreamFileInfo StreamFile, TrackedFileInfo TrackedFile, WorkspaceFileInfo WorkspaceFile)
 {
     this.StreamFile    = StreamFile;
     this.TrackedFile   = TrackedFile;
     this.WorkspaceFile = WorkspaceFile;
 }