Example #1
0
            internal void ParentMoved(string o, string n)
            {
                DirectoryInfo a    = new DirectoryInfo(o);
                DirectoryInfo b    = new DirectoryInfo(n);
                var           path = m_target.Transformed(x => FileSystem.PathToFrom(x, a), x => FileSystem.PathToFrom(x.File, a));

                var newPath = Path.Combine(b.FullName.Only().Concat(path.Skip(1).Select(d => d.Name)).Concat(m_target.Transformed(x => x.Name, x => x.File.Name).Only()).ToArray());

                m_target.Do(x => m_target = x, x => x.GotMoved(new FileInfo(newPath)));
            }
Example #2
0
        private SimpleUndoPair InnerSetLocalizationAction(Id <LocalizedText> guid, Either <LocalizationElement, Null> newValue, Either <LocalizationElement, Null> oldValue)
        {
            object change = new object();

            return(new SimpleUndoPair
            {
                Redo = () =>
                {
                    newValue.Do(a => m_data.SetLocalized(guid, a), b => m_data.ClearLocaliation(guid));
                    m_currentChanges.Add(change);
                    m_file.Change();
                },
                Undo = () =>
                {
                    oldValue.Do(a => m_data.SetLocalized(guid, a), b => m_data.ClearLocaliation(guid));
                    m_currentChanges.Remove(change);
                    m_file.Change();
                },
            });
        }