28 lines
730 B
C#
28 lines
730 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.IO;
|
|
|
|
namespace SystemX.Net.Platform.Common.Util
|
|
{
|
|
public class CwdChanger : IDisposable
|
|
{
|
|
protected string m_strBackupDirectory = null;
|
|
|
|
public CwdChanger() : this(null) { }
|
|
public CwdChanger(string strTargetDirectory/*=null*/)
|
|
{
|
|
m_strBackupDirectory = Directory.GetCurrentDirectory();
|
|
if (!String.IsNullOrEmpty(strTargetDirectory))
|
|
Directory.SetCurrentDirectory(strTargetDirectory);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Directory.SetCurrentDirectory(m_strBackupDirectory);
|
|
}
|
|
}
|
|
}
|