Example #1
0
 private WorksheetEntry GetWorksheetEntry(SpreadsheetEntry entry, int day)
 {
     WorksheetFeed wsFeed = entry.Worksheets;
     WorksheetEntry res = null;
     res = wsFeed.Entries[day] as WorksheetEntry;
     return res;
 }
Example #2
0
        public Roster()
        {
            spreadsheet = GDriveManager.getSpreadsheet(Constants.ROSTER_URI);
            logger.Info("Spreadsheet " + spreadsheet.Title.Text + " loaded.");

            loadRoster();
        }
        public void LoadSpreadSheet(string spreadSheetId)
        {
            SpreadsheetQuery query = new SpreadsheetQuery();
              query.Uri = new Uri("https://spreadsheets.google.com/feeds/spreadsheets/private/full/" + spreadSheetId);

              SpreadsheetFeed feed = service.Query(query);
              spreadSheetEntry = (SpreadsheetEntry)feed.Entries[0];
        }
        private CellFeed GetCellFeed(SpreadsheetsService service, SpreadsheetEntry spEntry)
        {
            WorksheetFeed wsFeed = spEntry.Worksheets;
            WorksheetEntry wsEntry = (WorksheetEntry)wsFeed.Entries[0];

            AtomLink wLink = wsEntry.Links.FindService(GDataSpreadsheetsNameTable.CellRel, null);

            CellQuery cellQuery = new CellQuery(wLink.HRef.ToString());
            CellFeed cellFeed = service.Query(cellQuery);

            return cellFeed;
        }
        public StatusReporter()
        {
            this.service = new SpreadsheetsService("Seeker");
            this.service.setUserCredentials(username, password);

            XmlTextReader reader = new XmlTextReader(@"\\cob-hds-1\compression\QC\QCing\otherFiles\SpreadSheetDictionary.xml");

            this.spreadsheets = new Dictionary<string, string>();
            string key = "";
            string value = "";
            while (reader.Read())
            {
                switch (reader.NodeType)
                {

                    case XmlNodeType.Text:// Display text
                        Console.Write(reader.Name);

                        key = reader.Value;
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Text)
                            {
                                value = reader.Value;
                                break;
                            }
                        }
                        if (value != "")
                        {
                            if (!this.spreadsheets.ContainsKey(key))
                            {
                                this.spreadsheets.Add(key, value);
                            }
                        }
                        break;
                }
            }

            SpreadsheetQuery query = new SpreadsheetQuery();
            this.allSheets = this.service.Query(query);

            for (int i = 0; i < allSheets.Entries.Count; i++)
            {
                if (this.allSheets.Entries[i].AlternateUri.Content.Contains("0AnSESHA7JsTFdFFBNjZ1U3JzdEFXdlZOa0dhQXJNMEE"))
                {
                    this.ReportSpreadSheet = (SpreadsheetEntry)allSheets.Entries[i];
                }
                if (this.allSheets.Entries[i].AlternateUri.Content.Contains("0AnSESHA7JsTFdDBGUWtqRVJVbEFFYVlaUmZnRTBaVWc"))
                {
                    this.failSheet = (SpreadsheetEntry)allSheets.Entries[i];
                }
            }
        }
        public Google2uAccountWorkbook(SpreadsheetEntry in_spreadsheet, Service in_service)
        {
            Workbook = in_spreadsheet;
            WorkbookName = in_spreadsheet.Title.Text;
            _Service = in_service;

            foreach (var link in in_spreadsheet.Links.Where(in_link => in_link.Rel.Equals("alternate", StringComparison.OrdinalIgnoreCase)))
            {
                WorkbookUrl = link.HRef.ToString();
                break;
            }
            Worksheets = new List<Google2uWorksheet>();
        }
Example #7
0
        public WorksheetEntry GetCurrentWorksheet(SpreadsheetEntry spreadsheet)
        {
            var currentDate = String.Format("{0} {1}", DateTime.Now.ToString("MMMM", CultureInfo.InvariantCulture),
                                               DateTime.Now.ToString("yyyy", CultureInfo.InvariantCulture));

            var wsFeed = spreadsheet.Worksheets;

            foreach (WorksheetEntry entry in wsFeed.Entries.Cast<WorksheetEntry>().Where(entry => entry.Title.Text.Equals(currentDate)))
                return entry;

            Debug.WriteLine("Worksheet not found.");
            return null;
        }
Example #8
0
		public void Authenticate( string refreshToken, string spreadsheetName )
		{
			var authorizationUrl = OAuthUtil.CreateOAuth2AuthorizationUrl( oAuthParams );

			Console.WriteLine( authorizationUrl );

			/*if( !string.IsNullOrEmpty( accessCode ) )
			{
				oAuthParams.AccessCode = accessCode;
			}*/

			if( !string.IsNullOrEmpty( refreshToken ) )
			{
				oAuthParams.RefreshToken = refreshToken;

				OAuthUtil.RefreshAccessToken( oAuthParams );
			}
			else
			{
				OAuthUtil.GetAccessToken( oAuthParams );
			}

			var accessToken = oAuthParams.AccessToken;
			var requestFactory = new GOAuth2RequestFactory( null, applicationName, oAuthParams );

			_spreadsheetsService.RequestFactory = requestFactory;

			var spreadsheetFeed = _spreadsheetsService.Query( new SpreadsheetQuery() );

			_spreadsheetEntries.Clear();

			foreach( var entry in spreadsheetFeed.Entries )
			{
				var spreadsheetEntry = entry as SpreadsheetEntry;

				if( spreadsheetEntry == null )
				{
					continue;
				}

				_spreadsheetEntries.Add( spreadsheetEntry );

				if( spreadsheetName.Equals( spreadsheetEntry.Title.Text ) )
				{
					_currentEntry = spreadsheetEntry;
				}
			}
		}
Example #9
0
        /// <summary>
        /// Prints a list of all worksheets in the specified spreadsheet.
        /// </summary>
        /// <param name="service">an authenticated SpreadsheetsService object</param>
        /// <param name="entry">the spreadsheet whose worksheets are to be retrieved</param>
        private static void PrintAllWorksheets(SpreadsheetsService service,
            SpreadsheetEntry entry)
        {
            AtomLink link = entry.Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null);

            WorksheetQuery query = new WorksheetQuery(link.HRef.ToString());
            WorksheetFeed feed = service.Query(query);

            Console.WriteLine("Worksheets in " + entry.Title.Text + ":");
            foreach (WorksheetEntry worksheet in feed.Entries)
            {
                allWorksheets.Add(worksheet);
                Console.WriteLine("  " + worksheet.Title.Text);
            }
            Console.WriteLine();
        }
Example #10
0
        public static ListFeed getListFeedQuery(SpreadsheetEntry spreadsheet, string worksheetName, string query)
        {
            WorksheetFeed wsFeed = spreadsheet.Worksheets;

            WorksheetEntry worksheet = (WorksheetEntry)wsFeed.Entries.ToList().Find((AtomEntry e) => e.Title.Text.Equals(worksheetName, StringComparison.InvariantCultureIgnoreCase));

            // Define the URL to request the list feed of the worksheet.
            AtomLink listFeedLink = worksheet.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);

            // Fetch the list feed of the worksheet.
            ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString());

            if (query != null && !"".Equals(query)) {
                listQuery.SpreadsheetQuery = query;
            }

            return GDriveManager.getService().Query(listQuery);
        }
    private List<DatablockDetectionInfo> ParseSpreadsheet(SpreadsheetEntry spreadsheet)
    {
        WorksheetFeed wsFeed = spreadsheet.Worksheets;

        if (wsFeed.Entries.Count == 0)
            return null;

        var worksheet = (WorksheetEntry) wsFeed.Entries[0];

        if (worksheet.Rows < 2)
            return null;

        // Define the URL to request the list feed of the worksheet.
        AtomLink listFeedLink = worksheet.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);

        // Fetch the list feed of the worksheet.
        var listQuery = new ListQuery(listFeedLink.HRef.ToString());
        ListFeed listFeed = sheetsAPI.Service.Query(listQuery);

        var headers = new List<string>();
        spreadsheetRows = listFeed.Entries;
        nameColumnIndex = -1;

        var row = (ListEntry) spreadsheetRows[0];
        for (int index = 0; index < row.Elements.Count; index++)
        {
            ListEntry.Custom element = row.Elements[index];

            if (element.LocalName.Equals("name", StringComparison.OrdinalIgnoreCase))
                nameColumnIndex = index;

            headers.Add(element.LocalName);
        }

        List<DatablockDetectionInfo> datablockTypes = AutoDetectDatablockType(headers);
        if (datablockTypes == null)
        {
            Debug.Log("Unable to auto detect datablock type");
            return null;
        }

        return datablockTypes;
    }
Example #12
0
        public WorksheetEntry CreateWorksheet(SpreadsheetEntry spreadsheet, string name)
        {
            var numberOfDays = (uint)DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);

            var wsFeed = spreadsheet.Worksheets;

            var worksheet = new WorksheetEntry(2, numberOfDays) { Title = { Text = name } };
            worksheet = _service.Insert(wsFeed, worksheet);

            //Insert First Line
            var cellQuery = new CellQuery(worksheet.CellFeedLink);
            var cellFeed = _service.Query(cellQuery);

            for (var i = 1; i <= numberOfDays; i++)
            {
                cellFeed.Insert(new CellEntry(1, (uint)i, i.ToString(CultureInfo.InvariantCulture)));
            }
            return worksheet;
        }
        public WorksheetEntry RedoWorksheet(SpreadsheetEntry spreadsheet, string worksheetName, List<string> headerNames)
        {
            var createdTempWorksheet = false;

            if (spreadsheet.Worksheets.Entries.Count <= 1)
            {
                _spreadsheetFacade.CreateWorksheet(spreadsheet, "Temp", 1, 1);
                createdTempWorksheet = true;
            }

            _spreadsheetFacade.DeleteWorksheet(spreadsheet, worksheetName); //TODO: fazer backup
            _spreadsheetFacade.CreateWorksheet(spreadsheet, worksheetName, 1, (uint)headerNames.Count);

            if (createdTempWorksheet)
                _spreadsheetFacade.DeleteWorksheet(spreadsheet, "Temp");

            var worksheet = _spreadsheetFacade.GetWorksheet(spreadsheet, worksheetName);
            _spreadsheetFacade.CreateHeader(worksheet, headerNames);
            return worksheet;
        }
Example #14
0
        //returns the first worksheet entry matching the specified name, or the first one in the sheet if no name is specified.
        public static WorksheetEntry findWorksheetByName(string worksheet, SpreadsheetEntry spreadsheet)
        {
            WorksheetFeed wsFeed = spreadsheet.Worksheets;
            WorksheetEntry worksheetEntry = null;
            if (String.IsNullOrEmpty(worksheet)) //if no worksheet specified, use the first
            {
                worksheetEntry = (WorksheetEntry)wsFeed.Entries[0];
            }
            else
            {
                foreach (WorksheetEntry entry in wsFeed.Entries)
                {

                    if (entry.Title.Text.Equals(worksheet)) //find first matching worksheet
                    {
                        worksheetEntry = entry;
                        break;
                    }

                }
            }
            return worksheetEntry;
        }
Example #15
0
        /// <summary>
        /// Get Worksheets in the given <paramref name="spreadsheet"/>.
        /// </summary>
        /// <param name="spreadsheet">The <typeparamref name="Google.GData.Spreadsheets.SpreadsheetEntry" /> from which the worksheets should be returned.</param>
        /// <returns>Returns a <typeparamref name="Google.GData.Spreadsheets.WorksheetEntry" /> array.</returns>
        public virtual WorksheetEntry[] GetWorksheets(SpreadsheetEntry spreadsheet)
        {
            if (spreadsheet == null)
            {
                spreadsheet = GetSpreadsheets()[0];
            }

            var result = new WorksheetEntry[spreadsheet.Worksheets.Entries.Count];
            spreadsheet.Worksheets.Entries.CopyTo(result, 0);
            return result;
        }
Example #16
0
 /// <summary>
 /// Get Spreadsheets accessible by the user. Can be filtered with <paramref name="title"/>.
 /// </summary>
 /// <param name="title">Filters the accessible spreadsheets. (optional)</param>
 /// <returns>Returns a <typeparamref name="Google.GData.Spreadsheets.SpreadsheetEntry" /> array.</returns>
 public virtual SpreadsheetEntry[] GetSpreadsheets(string title = null)
 {
     var query = new SpreadsheetQuery();
     if (title != null)
     {
         query.Title = title;
     }
     SpreadsheetFeed feed = this.service.Query(query);
     // Have to use this "dirty" workaround...
     var result = new SpreadsheetEntry[feed.Entries.Count];
     feed.Entries.CopyTo(result, 0);
     return result;
 }
Example #17
0
        public void reloadLog(string log)
        {
            PropertyManager.getManager().setProperty("lootLogURI", log);

            spreadsheet = GDriveManager.getSpreadsheet(log);
            logger.Info("Spreadsheet " + spreadsheet.Title.Text + " loaded.");

            loadEvents();
            loadArmorTypes();
            loadLogFeed();

            logURI = log;
        }
        private void GetWins(SpreadsheetsService service, SpreadsheetEntry entry, WorksheetFeed wsFeed, List<Player> Players)
        {
            int cellID = 0;
            List<CellFeed> cellFeeds = DoCellQuery(service, wsFeed, 2, 3, 3);

            for (int i = 0; i < cellFeeds.Count; i++)
            {
                CellFeed currentCellFeed = cellFeeds[i];

                if (currentCellFeed != null)
                {
                    foreach (CellEntry cell in currentCellFeed.Entries)
                    {
                        string playerList = cell.InputValue;
                        string[] playerNames = null;

                        if (!String.IsNullOrWhiteSpace(playerList))
                        {
                            playerNames = playerList.Split(',').Select(sValue => sValue.Trim()).ToArray();
                        }
                        else
                        {
                            break;
                        }

                        foreach (string playerName in playerNames)
                        {
                            string placement = null;
                            string playerNameTrimmed = null;

                            if (playerName.Contains("("))
                            {
                                placement = Regex.Match(playerName, @"\(([^)]*)\)").Groups[1].Value;
                                playerNameTrimmed = playerName.Remove(playerName.Length - 4);
                            }
                            else
                            {
                                playerNameTrimmed = playerName;
                            }

                            if (Players.Exists(player => player.Name == playerNameTrimmed))
                            {
                                Player myPlayer = new Player();
                                myPlayer = Players.Find(player => player.Name == playerNameTrimmed);
                                myPlayer.Wins += 1;

                                if (placement != null)
                                {
                                    if (myPlayer.Placement == null)
                                    {
                                        myPlayer.Placement = new List<int>();
                                    }

                                    myPlayer.Placement.Add(Int32.Parse(placement));
                                }

                                foreach (GameEvent gameEvent in GamesPlayed)
                                {
                                    if (gameEvent.Name == wsFeed.Entries[i].Title.Text && gameEvent.ID == cellID)
                                    {
                                        if (gameEvent.Winners == null)
                                        {
                                            gameEvent.Winners = new List<Player>();
                                        }

                                        gameEvent.Winners.Add(myPlayer);
                                    }
                                }
                            }
                        }

                        cellID++;
                    }
                }
            }

            foreach (Player player in Players)
            {
                player.WinPercentage = player.GetWinPercentage();
            }

            GetLosses(service, entry, wsFeed, Players);
        }
        private void GetPlayers(SpreadsheetsService service, SpreadsheetEntry entry, WorksheetFeed wsFeed)
        {
            int cellID = 0;
            Players = new List<Player>();

            List<CellFeed> cellFeeds = DoCellQuery(service, wsFeed, 2, 2, 2);

            for (int i = 0; i < cellFeeds.Count; i++)
            {
                CellFeed currentCellFeed = cellFeeds[i];

                if (currentCellFeed != null)
                {
                    foreach (CellEntry cell in currentCellFeed.Entries)
                    {
                        string playerList = cell.InputValue;
                        string[] playerNames = null;

                        if (!String.IsNullOrWhiteSpace(playerList))
                        {
                            playerNames = playerList.Split(',').Select(sValue => sValue.Trim()).ToArray();
                        }
                        else
                        {
                            break;
                        }

                        foreach (string playerName in playerNames)
                        {
                            if (!Players.Exists(player => player.Name == playerName))
                            {
                                Players.Add(new Player() { Name = playerName });
                            }

                            Player myPlayer = new Player();
                            myPlayer = Players.Find(player => player.Name == playerName);
                            myPlayer.GamesPlayed += 1;

                            foreach (GameEvent gameEvent in GamesPlayed)
                            {
                                if (gameEvent.Name == wsFeed.Entries[i].Title.Text && gameEvent.ID == cellID)
                                {
                                    if (gameEvent.Participants == null)
                                    {
                                        gameEvent.Participants = new List<Player>();
                                    }

                                    gameEvent.Participants.Add(myPlayer);
                                }
                            }
                        }

                        cellID++;
                    }
                }
            }

            GetWins(service, entry, wsFeed, Players);
        }
 public static List<SelectListItem> GetWorkSheets(SpreadsheetEntry spreadSheet)
 {
     var indexValue = 0;
     return spreadSheet.Worksheets.Entries.Select(worksheet => new SelectListItem
         {
             Text = worksheet.Title.Text.ToString(), Value = (indexValue++).ToString()
         }).ToList();
 }
 public void CreateWorksheet(SpreadsheetEntry spreadsheet, string worksheeTitle, uint rows = 100, uint cols = 10)
 {
     //TODO: tratar se está autenticado
     var worksheet = new WorksheetEntry(rows, cols, worksheeTitle);
     _connection.SpreadsheetService.Insert(spreadsheet.Worksheets, worksheet);
 }
Example #22
0
        public void logItConference(string fileName, string result)
        {
            try
            {
                this.canClose = false;
                WorksheetEntry worksheet = null;
                CellFeed cells = null;

                // FIND THE SPREADSHEET AND WORKSHEET
                SpreadsheetQuery query = new SpreadsheetQuery();
                this.allSheets = this.service.Query(query);

                String lastCode = "";
                this.currentSpreadSheet = new SpreadsheetEntry();


                string s = fileName;

                string code = this.getCode(s);

                if (code == "NO FILE CODE FOUND")
                {
                    return;
                }
                string spreadsheetCode = spreadsheets[code];


                if (lastCode != this.getFullCode(s))
                {
                    lastCode = this.getFullCode(s);
                    for (int i = 0; i < this.allSheets.Entries.Count; i++)
                    {
                        if (this.allSheets.Entries[i].AlternateUri.Content.Contains(spreadsheetCode))
                        {
                            this.currentSpreadSheet = (SpreadsheetEntry)this.allSheets.Entries[i];
                            WorksheetFeed wsFeed = this.currentSpreadSheet.Worksheets;

                            for (int x = 0; x < wsFeed.Entries.Count; x++)
                            {
                                WorksheetEntry wksht = (WorksheetEntry)wsFeed.Entries[x];
                                worksheet = wksht;
                                CellQuery Querycells = new CellQuery(wksht.CellFeedLink);
                                Querycells.MaximumColumn = 1;
                                Querycells.MaximumRow = 2;
                                Querycells.MinimumColumn = 1;
                                Querycells.MinimumRow = 2;
                                this.cells = this.service.Query(Querycells);
                                string fix = System.IO.Path.GetFileName(s);

                                if (fix.Contains(this.cells.Entries[0].Content.Content))
                                {
                                    this.currentWorkSheet = wksht;
                                    break;
                                }

                            }
                        }
                    }


                    // NOW, if all went well, we are in the right sheet. Create the list of the needed things--

                    //List of languages

                    CellQuery languageQuery = new CellQuery(this.currentWorkSheet.CellFeedLink);
                    languageQuery.MinimumRow = 3;
                    languageQuery.MaximumColumn = 2;
                    languageQuery.MinimumColumn = 2;
                    languageQuery.ReturnEmpty = ReturnEmptyCells.no;

                    CellFeed languages = this.service.Query(languageQuery);

                    //OVP tabs

                    CellQuery OVPTabs = new CellQuery(this.currentWorkSheet.CellFeedLink);
                    OVPTabs.MinimumRow = OVPTabs.MaximumRow = 1;
                    CellFeed columnHeadings = this.service.Query(OVPTabs);

                    //USE THIS TO FIND EACH INDIVIDUAL VIDEO'S COLUMN

                    uint row = this.getLanguageRow(s, languages);
                    uint col = this.getEditColumn(s, columnHeadings, "QC", this.currentWorkSheet);
                    //OVP tabs

                    //USE THIS TO FIND EACH INDIVIDUAL VIDEO'S COLUMN

                    if (col == 0 || row == 0)
                    {
                        // something failed--write to the google doc to say that it failed
                        return;

                    }

                    //Get Individual Cell

                    CellQuery edit = new CellQuery(this.currentWorkSheet.CellFeedLink);
                    edit.MaximumRow = edit.MinimumRow = row;
                    edit.MaximumColumn = edit.MinimumColumn = col;

                    edit.ReturnEmpty = ReturnEmptyCells.yes;

                    CellFeed editCell = this.service.Query(edit);

                    CellEntry temp = (CellEntry)editCell.Entries[0];

                    if (this.initials == "")
                    {
                        temp.InputValue = "";
                    }
                    else
                    {

                        temp.InputValue = result;
                    }
                    temp.Update();
                    this.canClose = true;




                }
            }
            catch (Exception exeption)
            {
                logger.writeErrorLog("Failed to log " + fileName + " in conference google docs " + DateTime.Now);
                this.canClose = true;
            }
            this.canClose = true;

        }
 public void DeleteWorksheet(SpreadsheetEntry spreadsheet, string worksheetName)
 {
     //TODO: tratar se está autenticado
     var worksheet = spreadsheet.Worksheets.Entries.FirstOrDefault(e => e.Title.Text == worksheetName);
     worksheet?.Delete();
 }
    private void ShowExportUI()
    {
        DatablockManager datablockManager = DatablockManager.Instance;

        EditorGUILayout.HelpBox("Export datablocks of the selected type to a Google sheet. Select the worksheet you want to export to. Note: All exiting data on the first sheet will be overwritten.", MessageType.None);

        EditorGUILayout.BeginHorizontal();

        GUI.backgroundColor = new Color(0, 0.8f, .8f);

        if (GUILayout.Button("Refresh Spreesheets"))
        {
            spreadsheetEntries.Clear();

            var query = new SpreadsheetQuery();

            SpreadsheetFeed feed = null;
            try
            {
                feed = sheetsAPI.Service.Query(query);
            }
            catch (Exception)
            {
                Debug.LogError("OAuth error");
                sheetsAPI.ClearOAuthToken();
                throw;
            }

            // Iterate through all of the spreadsheets returned
            foreach (SpreadsheetEntry entry in feed.Entries)
            {
                spreadsheetEntries.Add(entry);
            }
        }

        GUI.backgroundColor = new Color(1f, 0.2f, .4f);

        if (GUILayout.Button("Clear OAuth token"))
        {
            sheetsAPI.ClearOAuthToken();
        }

        GUI.backgroundColor = Color.white;

        EditorGUILayout.EndHorizontal();

        var options = new List<string>(spreadsheetEntries.Select(s => s.Title.Text));

        if (spreadsheetEntries.Count == 0)
        {
            options.Insert(0, "No spreadsheets found");
        }
        else
        {
            options.Insert(0, "Select");
        }

        if (spreadsheetIndex >= options.Count)
            spreadsheetIndex = 0;

        int tempSpreadsheetIndex = EditorGUILayout.Popup("Select spreedsheet", spreadsheetIndex, options.ToArray());

        if (tempSpreadsheetIndex != spreadsheetIndex)
        {
            canBeExported = false;

            spreadsheetIndex = tempSpreadsheetIndex;

            if (spreadsheetIndex != 0)
            {
                DatablockManager.Instance.RefreshAssets();

                spreadsheet = spreadsheetEntries.FirstOrDefault(s => s.Title.Text == options[spreadsheetIndex]);

                if (spreadsheet.Worksheets.Entries.Count == 0)
                {
                    Debug.LogError("Spreadsheet has no worksheet. Please add a worksheet to use this spreadsheet.");
                    return;
                }

                canBeExported = true;
            }
        }

        if (spreadsheetIndex != 0 && canBeExported)
        {
            List<Type> types = DatablockList.GetInstances(typeof (Datablock));

            datablockTypeIndex = EditorGUILayout.Popup("Choose datablock type", datablockTypeIndex, types.Select(d => d.ToString()).ToArray());
            Type datablockType = types[datablockTypeIndex];

            GUI.backgroundColor = new Color(0, 0.8f, 0);
            string exportLabel = exportData ? "Export " + datablockManager.GetDatablocks(datablockType).Count() + " datablocks" : "Export schema";

            if (GUILayout.Button(exportLabel))
            {
                ExportDatablocks(datablockType);
            }

            GUI.backgroundColor = Color.white;
            EditorGUILayout.HelpBox("All data on the first sheet will be overwritten.", MessageType.Warning);
        }

        showExportOptions = EditorGUILayout.Foldout(showExportOptions, "Export options");

        if (showExportOptions)
        {
            EditorGUI.indentLevel = 1;

            exportData = EditorGUILayout.Toggle("Export data", exportData);
            exportFullValues = EditorGUILayout.Toggle(new GUIContent("Include full values", "Exports the full value of a field even if it inherits its value."), exportFullValues);
        }
    }
        private WorksheetEntry GetWorksheet(SpreadsheetEntry pSpreadsheetEntry)
        {
            AtomLink link = tDicingSpreadsheet.Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null);
            string tLink = link.HRef.ToString();

            WorksheetQuery tWorksheetQuery = new WorksheetQuery(tLink);
            tWorksheetQuery.Title = tSheetName;

            WorksheetFeed wfeed = tService.Query(tWorksheetQuery);
            WorksheetEntry wentry = wfeed.Entries.FirstOrDefault() as WorksheetEntry;
            return wentry;
        }
 /// <summary>
 /// this will reload the list of spreadsheets from the server and reset the 
 /// currently active spreadsheet/worksheet
 /// </summary>
 /// <returns></returns>
 public void Refresh()
 {
     Application.sf = null;
     Application.se = null;
     Application.we = null; 
 }
        private void GetGameDateName(SpreadsheetsService service, SpreadsheetEntry entry, WorksheetFeed wsFeed)
        {
            GamesPlayed = new List<GameEvent>();
            List<CellFeed> cellFeeds = DoCellQuery(service, wsFeed, 2, 1, 1);

            int gameID = 0;

            for (int i = 0; i < cellFeeds.Count; i++)
            {
                CellFeed currentCellFeed = cellFeeds[i];

                if (currentCellFeed != null)
                {
                    foreach (CellEntry cell in currentCellFeed.Entries)
                    {
                        GameEvent newGameEvent = new GameEvent();
                        string dateTimeString = cell.InputValue;
                        DateTime dateTime = DateTime.Parse(dateTimeString);
                        newGameEvent.Date = dateTime;
                        newGameEvent.Name = wsFeed.Entries[i].Title.Text;
                        newGameEvent.ID = gameID;
                        GamesPlayed.Add(newGameEvent);
                        gameID++;
                    }
                }

            }

            GetPlayers(service, entry, wsFeed);
        }
Example #28
0
        public SpellManager()
        {
            spreadsheet = GDriveManager.getSpreadsheet(Constants.SPELL_LISTING_URI);
            logger.Info("Spreadsheet " + spreadsheet.Title.Text + " loaded");

            loadSpellTemplate();
            loadSpellLog();
        }
    private void FindSpreadsheet()
    {
        SpreadsheetQuery query = new SpreadsheetQuery();
        SpreadsheetFeed feed = service.Query(query);

        if (feed.Entries.Count <= 0)
            Debug.LogWarning("No spreadsheets found");

        foreach (SpreadsheetEntry spreadsheet in feed.Entries)
        {
            if (spreadsheet.Title.Text == googleSpreadsheetName)
            {
                sheet = spreadsheet;
                break;
            }
        }

        WorksheetFeed wsFeed = sheet.Worksheets;
        worksheet = (WorksheetEntry)wsFeed.Entries[0];

        if (wsFeed.Entries.Count <= 0)
            Debug.LogWarning("No sheets in spreadsheet found");
    }
Example #30
-1
 /// <summary>
 /// Creates a new instance of the RestoreData class.
 /// </summary>
 /// <param name="settings">The current Settings object.</param>
 /// <param name="values">The current float-array with the values.</param>
 /// <param name="sheetEntries">The current array of SpreadsheetEntry objects.</param>
 /// <param name="sheetService">The current SpreadsheetService object.</param>
 public RestoreData(Settings settings, float[] values, SpreadsheetEntry[] sheetEntries, SpreadsheetsService sheetService)
 {
     this.Settings = settings;
     this.Values = values;
     this.SheetEntries = sheetEntries;
     this.SheetService = SheetService;
 }