GDEDriveHelper() { SetCertValidation(); oauth = new GDEOAuth(); oauth.Init(); _spreadSheetLinks = new Dictionary <string, Dictionary <string, string> >(); _spreadSheetNames = new List <string>(); ResetCertValidation(); }
GDEDriveHelper() { SetCertValidation(); oauth = new GDEOAuth(); oauth.Init(); _spreadSheetLinks = new Dictionary<string, Dictionary<string,string>>(); _spreadSheetNames = new List<string>(); ResetCertValidation(); }
public void GetSpreadsheetList() { SetCertValidation(); oauth.Init(); string url = FILE_QUERY + "&" + ACCESS_TOKEN + oauth.AccessToken; WWW req = new WWW(url); while (!req.isDone) { ; } ResetCertValidation(); if (string.IsNullOrEmpty(req.error)) { Dictionary <string, object> response = Json.Deserialize(req.text) as Dictionary <string, object>; List <object> items = response["items"] as List <object>; _spreadSheetLinks.Clear(); _spreadSheetNames.Clear(); foreach (var item in items) { Dictionary <string, object> itemData = item as Dictionary <string, object>; Dictionary <string, object> labels = itemData["labels"] as Dictionary <string, object>; string mimeType = itemData["mimeType"].ToString(); string fileName = itemData["title"].ToString(); string fileUrl = string.Empty; string fileId = itemData["id"].ToString(); if (!mimeType.Contains("spreadsheet") || Convert.ToBoolean(labels["trashed"])) { continue; } if (itemData.ContainsKey("exportLinks")) { Dictionary <string, object> exportLinks = itemData["exportLinks"] as Dictionary <string, object>; foreach (var pair in exportLinks) { if (pair.Value.ToString().Contains("xlsx")) { fileUrl = pair.Value.ToString(); } } } else if (itemData.ContainsKey("downloadUrl")) { fileUrl = itemData["downloadUrl"].ToString(); } else { fileUrl = string.Empty; } try { if (!_spreadSheetNames.Contains(fileName)) { _spreadSheetNames.Add(fileName); var metadata = new Dictionary <string, string>(); metadata.Add("url", fileUrl); metadata.Add("id", fileId); _spreadSheetLinks.Add(fileName, metadata); } } catch (Exception ex) { Debug.LogWarning(ex.ToString()); } } } else { Debug.Log(req.error); } }