public bool Add(Item item) { Console.WriteLine("Add " + item.HDDPath); Console.WriteLine("As " + item.FullName); TVariant arg = new TVariant(); FileSystem.ExecCmdVar( String.Format("{0} {1};{2}", "add", item.HDDPath, item.Directory), ref arg); GetLastError(arg); return arg.AsBool(); }
public bool Extract(Item item, string newFileName) { Console.WriteLine("Extract " + item.FullName); Console.WriteLine("To " + newFileName); TVariant arg = new TVariant(); FileSystem.ExecCmdVar( String.Format("{0} {1};{2}", "extract", item.FullName, newFileName), ref arg); GetLastError(arg); return arg.AsBool(); }
private void GetLastError(TVariant arg) { if (arg.AsBool()) { LastError = ""; return; } LastError = MarshalUtils.MarshalString((pnt, length) => { FileSystem.ExecCmdStr("last_error", pnt, out length); return length; }); Console.WriteLine(LastError); }
public bool Save(string fileName) { if (Path.HasExtension(fileName)) fileName = Path.ChangeExtension(fileName, ".dcp"); else fileName += ".dcp"; Console.WriteLine("Save as " + fileName); TVariant arg = new TVariant(); FileSystem.ExecCmdVar( String.Format("{0} {1}", "save", fileName), ref arg); GetLastError(arg); return arg.AsBool(); }
public bool Remove(Item item) { Console.WriteLine("Remove " + item.FullName); TVariant arg = new TVariant(); FileSystem.ExecCmdVar( String.Format("{0} {1}", "remove", item.FullName), ref arg); GetLastError(arg); return arg.AsBool(); }
public bool Open(string fileName) { Console.WriteLine("Open " + fileName); TVariant arg = new TVariant(); FileSystem.ExecCmdVar( String.Format("{0} {1}", "open", fileName), ref arg); GetLastError(arg); return arg.AsBool(); }