private static PreFile attributesToPreFile(DirectoryInfo dir) { PreFile pf = new PreFile(); string sAtributos = ""; string sName = dir.Name.Replace("'", "''"); pf.setName(sName); pf.setSize(0); pf.setModified(dir.LastWriteTime); sAtributos += "[DIR]"; if (dir.Attributes == FileAttributes.Hidden) { sAtributos += "[HID]"; } if (dir.Attributes == FileAttributes.System) { sAtributos += "[SYS]"; } pf.setAttributes(sAtributos); pf.setOriginalPath(dir.FullName); pf.setDirectory(true); pf.setFormatedSize(MountBigSize(pf.getSize())); pf.setFormatedModified(pf.getModified().ToString("dd/MM/yyyy hh:mm:ss")); return(pf); }
private static PreFile attributesToPreFile(FileInfo file) { PreFile pf = new PreFile(); string sAtributos = ""; string sName = file.Name.Replace("'", "''"); pf.setName(sName); pf.setSize(file.Length); pf.setModified(file.LastWriteTime); sAtributos += "[ARQ]"; if (file.IsReadOnly) { sAtributos += "[ROL]"; } if (file.Attributes == FileAttributes.Hidden) { sAtributos += "[HID]"; } if (file.Attributes == FileAttributes.System) { sAtributos += "[SYS]"; } pf.setAttributes(sAtributos); pf.setOriginalPath(file.FullName); pf.setDirectory(false); pf.setFormatedSize(MountBigSize(pf.getSize())); pf.setFormatedModified(pf.getModified().ToString("dd/MM/yyyy hh:mm:ss")); return(pf); }