static public eErrorType sendFile(XboxConsole console, string localName, string remoteName, bool createDir, bool onlyIfNewer) { if (console == null) { return(eErrorType.cNotConnected); } eErrorType res = eErrorType.c*K; try { if (createDir) { string path = remoteName; int i = path.LastIndexOf('\\'); if (i >= 0) { path = path.Substring(0, i); } createDirectory(console, path); } bool gotLocalDateTime = false; DateTime localDateTime = DateTime.Now; try { localDateTime = File.GetLastWriteTime(localName); gotLocalDateTime = true; } catch { } if (onlyIfNewer && gotLocalDateTime) { IXboxFile fileObject = null; try { fileObject = console.GetFileObject(remoteName); } catch { } if (fileObject != null) { DateTime remoteDateTime = (DateTime)fileObject.ChangeTime; if (localDateTime <= remoteDateTime) { return(res); } } } console.SendFile(localName, remoteName); } catch (Exception e) { res = errorCatch(e); } return(res); }
public bool FileExists(string filePath) { try { IXboxFile file = XboxUtils.GetFile(filePath); return(true); } catch (Exception) { XboxUtils.ErrorMessage(filePath + " does not exist."); return(false); } }
public static IXboxFile GetFile(string filePath) { if (!IsConnected()) { throw new Exception("Not connected to a console!"); } IXboxFile file = null; try { file = m_XboxConsole.GetFileObject(filePath); } catch (Exception) { throw new Exception(filePath + " does not exist!"); } return(file); }