(ded4a3e0a) v0.9.0.7
This commit is contained in:
+48
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user