/// <summary> /// Creates a directory that /// </summary> /// <param name="did">identity of the directory</param> /// <param name="files">initial files that the directory will contain</param> /// <param name="addRealFiles">files stored under the real path are added</param> public DirectoryContents(DirectoryIdentity did, List<FileContents> files = null) : this(did.Name, did.LocalPath, did.Description, files) { //nothing needed here }
public bool DelDirectory(Credentials c, MachineIdentity mid, DirectoryIdentity did) { throw new NotImplementedException(); }
public DirectoryIdentity(DirectoryIdentity did) : this(did.Name, did.LocalPath, did.Description) { //nothing needed here }
public DirectoryContents GetDirectoryWithFiles(Credentials c, MachineContents m, DirectoryIdentity d) { List<FileContents> filelist = new List<FileContents>(); m.Directories = GetDirList(c, m); d.Id = (from o in m.Directories where o.Name == d.Name select o.Id).Single(); var dc = new DirectoryContents(d); using (filesyncEntitiesNew context = new filesyncEntitiesNew()) { foreach (var x in (from f in context.Files join t in context.Types on f.type_id equals t.type_id where f.dir_id == d.Id select new { f, t.type_name })) { FileIdentity file = new FileIdentity(x.f.file_name, x.f.file_modified, x.f.file_uploaded, FileType.PlainText, x.f.file_size, x.f.file_hash); file.Content = x.f.content_id; file.Id = x.f.file_id; filelist.Add(new FileContents(file)); } } dc.Files = filelist; return dc; }
public DirectoryContents GetDirectoryWithFiles(Credentials c, MachineContents m, DirectoryIdentity d) { throw new NotImplementedException(); }
public DirectoryContents ReadDirectoryContents(DirectoryIdentity did, bool addFilesContents = false) { if (did.LocalPath == null || did.LocalPath.Equals(EmptyLocalPath)) return null; string[] filePaths = Directory.GetFiles(did.LocalPath); DirectoryContents d = new DirectoryContents(did, new List<FileContents>()); if (filePaths == null || filePaths.Length == 0) return null; foreach (string path in filePaths) { FileContents fc = ReadFileContents(path); d.Files.Add(fc); } return d; }
public bool DelFile(Credentials c, MachineIdentity m, DirectoryIdentity d, FileIdentity f) { throw new NotImplementedException(); }
public FileContents DownloadFile(IFileSyncModel connection, Credentials c, MachineIdentity m, DirectoryIdentity d, FileIdentity f) { throw new NotImplementedException(); }
public bool EraseDirectory(DirectoryIdentity d) { throw new NotImplementedException(); }
public bool SaveFile(FileContents f, DirectoryIdentity d) { throw new NotImplementedException(); }
public bool UploadFile(IFileSyncModel connection, Credentials c, MachineIdentity m, DirectoryIdentity d, FileContents f) { return connection.AddFile(c, new MachineContents(m), new DirectoryContents(d), f); }
public FileContents ReadFileContents(FileIdentity fid, DirectoryIdentity did) { return this.ReadFileContents(did.LocalPath + "\\" + fid.Name); }
/// <summary> /// Creates a directory that /// </summary> /// <param name="did">identity of the directory</param> /// <param name="files">initial files that the directory will contain</param> /// <param name="addRealFiles">files stored under the real path are added</param> public DirectoryContents(DirectoryIdentity did, List <FileContents> files = null) : this(did.Name, did.LocalPath, did.Description, files) { //nothing needed here }
public bool DelDirectory(Credentials c, MachineIdentity mid, DirectoryIdentity did) { var cl = new Ref.FileSyncModelClient(); cl.Abort(); throw new NotImplementedException(); }
public DirectoryContents GetDirectoryWithFiles(Credentials c, MachineContents m, DirectoryIdentity did) { var cl = new Ref.FileSyncModelClient(); try { DirectoryContents newD = new DirectoryContents(did); newD.Files = cl.GetFileList(c, m, newD); cl.Close(); if (newD == null) throw new ActionException("Received a null object.", ActionType.User); return newD; //DirectoryContents d = null; //d = cl.GetDirectoryWithFiles(c, m, did); //cl.Close(); //return d; } catch (ActionException ex) { cl.Abort(); throw new ActionException("Unable to download directory contents.", ActionType.Directory, MemeType.Fuuuuu, ex); } catch (Exception ex) { cl.Abort(); throw new ActionException("Error while downloading directory contents.", ActionType.Directory, MemeType.Fuuuuu, ex); } }
public DirectoryIdentity(DirectoryIdentity did) : this(did.Name, did.LocalPath, did.Description) { //nothing needed here }