private static SwiftFileInfo ParseSwiftFileObject(String fileObj) { SwiftFileInfo sfi = new SwiftFileInfo(); String[] tokens = fileObj.Split(",".ToCharArray()); foreach (String token in tokens) { String tmpToken = token; tmpToken = tmpToken.Replace("\"", ""); tmpToken = tmpToken.Replace(" ", ""); tmpToken = tmpToken.Replace("{", ""); tmpToken = tmpToken.Replace("[", ""); String[] keyVal = tmpToken.Split(':'); if (keyVal[0].Equals("hash")) sfi.hash = keyVal[1]; else if (keyVal[0].Equals("last_modified")) sfi.last_modified = keyVal[1]; else if (keyVal[0].Equals("bytes")) sfi.bytes = keyVal[1]; else if (keyVal[0].Equals("name")) sfi.name = keyVal[1]; else if (keyVal[0].Equals("content_type")) sfi.content_type = keyVal[1]; } return sfi; }
private static List <string> ParseSwiftFileObjectAsString(String fileObj) { SwiftFileInfo sfi = new SwiftFileInfo(); String[] tokens = fileObj.Split(",".ToCharArray()); List <string> l_return = new List <string>(); foreach (String token in tokens) { String tmpToken = token; tmpToken = tmpToken.Replace("\"", ""); //tmpToken = tmpToken.Replace(" ", ""); tmpToken = tmpToken.Replace("{", ""); tmpToken = tmpToken.Replace("[", ""); String[] keyVal = tmpToken.Split(':'); if (keyVal[0].Trim().Replace(" ", "").Equals("hash")) { sfi.hash = keyVal[1]; } else if (keyVal[0].Trim().Replace(" ", "").Equals("last_modified")) { sfi.last_modified = keyVal[1]; } else if (keyVal[0].Trim().Replace(" ", "").Equals("bytes")) { sfi.bytes = keyVal[1]; } else if (keyVal[0].Trim().Replace(" ", "").Equals("name")) { sfi.name = keyVal[1]; } else if (keyVal[0].Trim().Replace(" ", "").Equals("content_type")) { sfi.content_type = keyVal[1]; } } return(l_return); }