Esempio n. 1
0
        public bool Move(FileInfo newPath, Func <bool> replace)
        {
            var oldFile = File;

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

            var stream = m_upToDateFile.Migrate();

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

            m_upToDateFile.Dispose();
            using (MemoryStream m = new MemoryStream())
            {
                m_upToDateFile = new UpToDateFile(m, path, m_saveTo, m_backEnd);
            }
            m_upToDateFile.FileChanged += () => FileModifiedExternally.Execute();
            m_upToDateFile.FileDeleted += () => FileDeletedExternally.Execute();
            Save();
            Moved.Execute(new Changed <FileInfo>(oldPath, File));
        }