(ded4a3e0a) v0.9.0.7

This commit is contained in:
Joonas Rikkonen
2019-06-25 16:00:44 +03:00
parent e5ae622c77
commit 4a51db77b5
1777 changed files with 421528 additions and 917 deletions
@@ -0,0 +1,48 @@
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System.IO;
namespace MonoGame.Tools.Pipeline
{
public partial class PipelineController
{
private class MoveAction : IProjectAction
{
private IProjectItem _item;
private readonly PipelineController _con;
private string _oldname, _newname;
public MoveAction(IProjectItem item, string newname)
{
_con = PipelineController.Instance;
_oldname = Path.GetFileName(item.OriginalPath);
_newname = newname;
_item = item;
}
public bool Do()
{
_con.View.RemoveTreeItem(_item);
var folder = Path.GetDirectoryName(_item.DestinationPath);
_item.DestinationPath = Path.Combine(folder, _newname).Replace('\\', '/');
_con.View.AddTreeItem(_item);
_con.ProjectDirty = true;
return true;
}
public bool Undo()
{
_con.View.RemoveTreeItem(_item);
var folder = Path.GetDirectoryName(_item.DestinationPath);
_item.DestinationPath = Path.Combine(folder, _oldname).Replace('\\', '/');
_con.View.AddTreeItem(_item);
_con.ProjectDirty = true;
return true;
}
}
}
}