Beispiel #1
0
        public bool Move(FileInfo path, Func <bool> replace)
        {
            var oldFile = File;

            if (path.Exists)
            {
                if (replace())
                {
                    path.Delete();
                }
                else
                {
                    return(false);
                }
            }

            var stream = m_upToDateFile.Migrate();

            m_upToDateFile.Dispose();
            System.IO.File.Move(oldFile.FullName, path.FullName);
            m_upToDateFile              = new UpToDateFile(stream, path, s => { });
            m_upToDateFile.FileChanged += () => FileModifiedExternally.Execute();
            m_upToDateFile.FileDeleted += () => FileDeletedExternally.Execute();
            Moved.Execute(oldFile, File);
            return(true);
        }
Beispiel #2
0
        public void SaveAs(FileInfo path)
        {
            var oldPath = File;

            m_upToDateFile.Dispose();
            m_upToDateFile              = new UpToDateFile(new MemoryStream(), path, m_saveTo);
            m_upToDateFile.FileChanged += () => FileModifiedExternally.Execute();
            m_upToDateFile.FileDeleted += () => FileDeletedExternally.Execute();
            Save();
            Moved.Execute(oldPath, File);
        }