public FileInfoDataSource() { //String ITEM_CONTENT = String.Format("Item Content: {0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}", // "Curabitur class aliquam vestibulum nam curae maecenas sed integer cras phasellus suspendisse quisque donec dis praesent accumsan bibendum pellentesque condimentum adipiscing etiam consequat vivamus dictumst aliquam duis convallis scelerisque est parturient ullamcorper aliquet fusce suspendisse nunc hac eleifend amet blandit facilisi condimentum commodo scelerisque faucibus aenean ullamcorper ante mauris dignissim consectetuer nullam lorem vestibulum habitant conubia elementum pellentesque morbi facilisis arcu sollicitudin diam cubilia aptent vestibulum auctor eget dapibus pellentesque inceptos leo egestas interdum nulla consectetuer suspendisse adipiscing pellentesque proin lobortis sollicitudin augue elit mus congue fermentum parturient fringilla euismod feugiat."); _successGroup = new FileInfoDataGroup("SuccessGroup", "SUCCESSFULL ", "Successfully Shredded Files ", null, //"Assets/DarkGray.png", "List of successfully shredded files."); this.AllGroups.Add(_successGroup); //var item = new FileInfoDataItem("FILE NAME", // "FILE NAME", // "", // null, // "", // "FULL PATH", // _successGroup); //_successGroup.Items.Add(item); _errorGroup = new FileInfoDataGroup("ErrorGroup", "FAILED", "Not-Shredded Files ", null, // imageOrig "List of files that were not shredded, or were only partially shredded. "); this.AllGroups.Add(_errorGroup); }
public static async Task<FileInfoDataItem> Create(StorageFile file, String uniqueId, Image image, FileInfoDataGroup group) { try { var obj = new FileInfoDataItem(file, uniqueId, image, group); if (file != null) { obj.FileName = file.Name; if (!string.IsNullOrEmpty(ItemsPage.Current.TopFolder.Path)) { int topFolderLen = ItemsPage.Current.TopFolder.Path.Length; int lastSepIdx = file.Path.LastIndexOf('\\'); Debug.Assert(lastSepIdx >= 0 && lastSepIdx < file.Path.Length && lastSepIdx >= topFolderLen); if (lastSepIdx >= 0 && lastSepIdx < file.Path.Length && lastSepIdx > topFolderLen) obj.SubPath += file.Path.Substring(topFolderLen + 1, lastSepIdx - topFolderLen - 1); } else { int idx = !string.IsNullOrEmpty(ItemsPage.Current.TopFolder.Name) ? file.Path.IndexOf(ItemsPage.Current.TopFolder.Name, StringComparison.OrdinalIgnoreCase) : -1; if (idx >= 0) { int idxSubPath = idx + ItemsPage.Current.TopFolder.Name.Length + 1; int idxFileName = Math.Max(file.Path.LastIndexOf("\\"), 0); if (idxFileName > idxSubPath) obj.SubPath += file.Path.Substring(idxSubPath, idxFileName - idxSubPath); } else { idx = file.Path.LastIndexOf("\\"); if (idx > 0) obj.SubPath = file.Path.Substring(0, idx); else obj.SubPath = file.Path; } } BasicProperties props = await file.GetBasicPropertiesAsync(); if (props != null) { obj.Size = Util.SizeToString(props.Size, "B"); ItemsPage.Current.IncrTotalBytes(props.Size); } obj.DateModified = Util.DateTime_ToString(props.DateModified, Util.EDateTimeFormat.G); obj.Extension = file.FileType; obj.ContentType = file.ContentType; #if DEBUG { string ext = (file.FileType == String.Empty) ? "EMPTY" : file.FileType; string contyp = (file.ContentType == String.Empty) ? "EMPTY" : file.ContentType; if (!ItemsPage.Current._ExtContyp.ContainsKey(ext)) { //Debug.WriteLine(ext + " - " + contyp); ItemsPage.Current._ExtContyp.Add(ext, contyp); } //else if (file.FileType == String.Empty) // Debug.WriteLine(ext + " - " + contyp); //if (!ItemsPage.Current._ContypExt.ContainsKey(contType)) //{ // Debug.WriteLine(contType + " - " + ext); // ItemsPage.Current._ContypExt.Add(contType, ext); //} //else if (file.ContentType == String.Empty) // Debug.WriteLine(contType + " - " + ext); } #endif } return obj; } catch (Exception ex) { Debug.WriteLine(ex.ToString()); return null; } }
public FileInfoDataItem(StorageFile file, String uniqueId, Image image, FileInfoDataGroup group) : base(file, uniqueId, image) { this._content = ""; //content; this._group = group; }