Beispiel #1
0
            private void ParseWorksheetEntry(Google.GData.Spreadsheets.WorksheetEntry in_entry, Google.GData.Spreadsheets.SpreadsheetsService in_service, bool in_bFirstRowValueTypes)
            {
                if (in_entry == null)
                {
                    Debug.LogError("Could not read WorksheetEntry - retry count:  ");
                    return;
                }

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

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

                Google.GData.Spreadsheets.ListFeed listFeed = in_service.Query(listQuery);

                //int rowCt = listFeed.Entries.Count;
                //int colCt = ((ListEntry)listFeed.Entries[0]).Elements.Count;

                if (listFeed.Entries.Count > 0)
                {
                    int curRow = 0;
                    // Iterate through each row, printing its cell values.
                    foreach (var atomEntry in listFeed.Entries)
                    {
                        var row = (Google.GData.Spreadsheets.ListEntry)atomEntry;

                        // skip the first row if this is a value type row
                        if (curRow == 0 && in_bFirstRowValueTypes)
                        {
                            curRow++;
                            continue;
                        }

                        if (row.Title.Text.Equals("VOID", StringComparison.OrdinalIgnoreCase))
                        {
                            curRow++;
                            continue;
                        }

                        int curCol = 0;
                        // Iterate over the remaining columns, and print each cell value
                        foreach (Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements)
                        {
                            // this will be the list of all the values in the row excluding the first 'name' column
                            if (curCol > 0)
                            {
                                EntryStrings.Add(element.Value);
                            }
                            curCol++;
                        }
                        EntryStride = curCol - 1;

                        curRow++;
                    }
                }
            }
Beispiel #2
0
            private void ParseWorksheetEntry(Google.GData.Spreadsheets.WorksheetEntry in_entry, Google.GData.Spreadsheets.SpreadsheetsService in_service, bool in_bFirstRowValueTypes)
            {
                if (in_entry == null)
                {
                    Debug.LogError("Could not read WorksheetEntry - retry count:  ");
                    return;
                }

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

                // Fetch the list feed of the worksheet.
                var listQuery = new Google.GData.Spreadsheets.ListQuery(listFeedLink.HRef.ToString());
                Google.GData.Spreadsheets.ListFeed listFeed = in_service.Query(listQuery);

                //int rowCt = listFeed.Entries.Count;
                //int colCt = ((ListEntry)listFeed.Entries[0]).Elements.Count;

                if (listFeed.Entries.Count > 0)
                {

                    int curRow = 0;
                    // Iterate through each row, printing its cell values.
                    foreach (var atomEntry in listFeed.Entries)
                    {
                        var row = (Google.GData.Spreadsheets.ListEntry)atomEntry;

                        // skip the first row if this is a value type row
                        if (curRow == 0 && in_bFirstRowValueTypes)
                        {
                            curRow++;
                            continue;
                        }

                        if (row.Title.Text.Equals("VOID", StringComparison.OrdinalIgnoreCase))
                        {
                            curRow++;
                            continue;
                        }

                        int curCol = 0;
                        // Iterate over the remaining columns, and print each cell value
                        foreach (Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements)
                        {
                            // this will be the list of all the values in the row excluding the first 'name' column
                            if (curCol > 0)
                                EntryStrings.Add(element.Value);
                            curCol++;
                        }
                        EntryStride = curCol - 1;

                        curRow++;
                    }
                }
            }
Beispiel #3
0
        bool ExportDatabase(string in_path, string in_fileName, Google.GData.Spreadsheets.WorksheetEntry in_entry, bool in_staticClass)
        {

            ////////////////////////////////////////////
            // gathering the data
            var types = new System.Collections.Generic.List<string>();
            var colNames = new System.Collections.Generic.List<string>();
            var varNames = new System.Collections.Generic.List<string>();
            var rowNames = new System.Collections.Generic.List<string>();

            bool typesInFirstRow = in_staticClass ?
                GetBool(_ActiveWorkbook.Title + "." + in_entry.Title.Text + ".STATICDB" + ".UFR", false) :
                GetBool(_ActiveWorkbook.Title + "." + in_entry.Title.Text + ".OBJDB" + ".UFR", false);

            if(in_staticClass)
                SetBool("temporaryAutoLogin", true);

            // Define the URL to request the list feed of the worksheet.
            var listFeedLink = in_entry.Links.FindService(Google.GData.Spreadsheets.GDataSpreadsheetsNameTable.ListRel, null);

            // Fetch the list feed of the worksheet.
            var listQuery = new Google.GData.Spreadsheets.ListQuery(listFeedLink.HRef.ToString());
            var listFeed = _Service.Query(listQuery);

            if (listFeed.Entries.Count > 0)
            {
                var rowCt = 0;
                // Iterate through each row, printing its cell values.
                foreach (var row in listFeed.Entries.Cast<Google.GData.Spreadsheets.ListEntry>())
                {
                    // skip the first row. This is the title row, and we can get the values later
                    if (rowCt == 0)
                    {
                        int colCt = 0;
                        // Iterate over the remaining columns, and print each cell value
                        foreach (Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements)
                        {
                            if (colCt > 0)
                            {
                                var vartype = element.Value;
                                var fixedColName = element.LocalName;
                                if (GfuStrCmp(fixedColName, "VOID"))
                                {
                                    // at this point, we know that Google has mangled our void column into a void_2 or something, fix it.
                                    fixedColName = "void";
                                }
                                if (GfuStrCmp(fixedColName, "VOID"))
                                    vartype = "Ignore";
                                else
                                {
                                    if (!typesInFirstRow)
                                    {
                                        vartype = "string";
                                    }
                                    else FixVarType(ref vartype);
                                        
                                }
                                types.Add(vartype);

                                colNames.Add(fixedColName);
                                varNames.Add(MakeValidVariableName(element.LocalName));
                            }
                            colCt++;
                        }

                        if (typesInFirstRow == false)
                        {
                            rowNames.Add(row.Elements[0].Value);
                        }
                    }
                    else
                    {
                        // store the row names to write out into the enum
                        rowNames.Add(row.Elements[0].Value);

                    }
                    rowCt++;
                }
            }

            if (typesInFirstRow)
            {
                if (!IsDataValid(types, colNames, rowNames))
                {
                    Debug.LogError("Cannot output data for " + in_fileName + " until all errors with the data are fixed");

                    // dont nuke their data if the new data is bad
                    return false;
                }
            }
            else
            {
                if (!IsDataValid(colNames, rowNames))
                {
                    Debug.LogError("Cannot output data for " + in_fileName + " until all errors with the data are fixed");
                    // dont nuke their data if the new data is bad
                    return false;
                }
            }

            ///////////////////////////////////////////////
            // open the file 

            var fs = System.IO.File.Open(in_path + "/" + in_fileName + ".cs", System.IO.File.Exists(in_path + "/" + in_fileName + ".cs") ?
                System.IO.FileMode.Truncate :
                System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);

            if (fs == null)
            {
                Debug.LogError("Cannot open " + in_fileName + ".cs for writing");
                return false;
            }

            var sw = new System.IO.StreamWriter(fs);
            if (sw == null)
            {
                Debug.LogError("Cannot make a stream writer.. dude are you out of memory?");
                return false;
            }

            ////////////////////////////////////////
            // writing out the class
            var fileString = System.String.Empty;

            fileString += FormatLine("//----------------------------------------------");
            fileString += FormatLine("//    GoogleFu: Google Doc Unity integration");
            fileString += FormatLine("//         Copyright © 2013 Litteratus");
            fileString += FormatLine("//");
            fileString += FormatLine("//        This file has been auto-generated");
            fileString += FormatLine("//              Do not manually edit");
            fileString += FormatLine("//----------------------------------------------");
            fileString += FormatLine(System.String.Empty);
            fileString += FormatLine("using UnityEngine;");
            fileString += FormatLine(System.String.Empty);
            fileString += FormatLine("namespace GoogleFu");
            fileString += FormatLine("{");
            fileString += FormatLine("	[System.Serializable]");
            fileString += FormatLine("	public class " + in_fileName + "Row : IGoogleFuRow");
            fileString += FormatLine("	{");

            // variable declarations
            for (int i = 0; i < types.Count; i++)
            {
                if (IsSupportedArrayType(types[i]))
                {
                    fileString += FormatLine("		public System.Collections.Generic.List<" + StripArray(types[i]) + "> " + varNames[i] + " = new System.Collections.Generic.List<" + StripArray(types[i]) + ">();");
                }
                else if (GfuStrCmp(types[i], "Ignore")) { }
                else
                    fileString += FormatLine("		public " + types[i] + " " + varNames[i] + ";");
            }
            // constructor parameter list
            fileString += ("		public " + in_fileName + "Row(");
            {
                var firstItem = true;
                for (var i = 0; i < types.Count; i++)
                {
                    if (GfuStrCmp(types[i], "Ignore"))
                        continue;

                    if (!firstItem)
                        fileString += (", ");
                    firstItem = false;
                    fileString += ("string _" + varNames[i]);
                }
            }
            fileString += FormatLine(") " + System.Environment.NewLine + "		{");

            string customArrayDelimiters = _ArrayDelimiters;
            if (customArrayDelimiters.Length == 0)
            {
                Debug.LogWarning("Array Delimiters not found. Using \", \" as default delimiters");
                customArrayDelimiters = ", ";
            }

            string customStringArrayDelimiters = _StringArrayDelimiters;
            if (customStringArrayDelimiters.Length == 0)
            {
                Debug.LogWarning("String Array Delimiters not found. Using \"|\" as default delimiter");
                customStringArrayDelimiters = "|";
            }

            string customComplexTypeDelimiters = _ComplexTypeDelimiters;
            if (customComplexTypeDelimiters.Length == 0)
            {
                customComplexTypeDelimiters = ", ";
                Debug.LogWarning("Complex Type Delimiters not found. Using \", \" as default delimiter");
            }


            string customComplexTypeArrayDelimiters = _ComplexTypeArrayDelimiters;
            if (customComplexTypeArrayDelimiters.Length == 0)
            {
                customComplexTypeArrayDelimiters = "|";
                Debug.LogWarning("Complex Type Array Delimiters not found. Using \"|\" as default delimiter");
            }
            else
            {
                var bContainsInvalid = customComplexTypeArrayDelimiters.ToCharArray().Any(in_c => customComplexTypeDelimiters.Contains(System.Convert.ToString(in_c)));
                if (bContainsInvalid)
                {
                    customComplexTypeDelimiters = ",";
                    Debug.LogWarning("Complex Type Delimiters uses the same Delimiter as Complex Type Array. Using \",\" as default Complex Type delimiter");

                    customComplexTypeArrayDelimiters = "|";
                    Debug.LogWarning("Complex Type Array Delimiters uses the same Delimiter as Complex Type. Using \"|\" as default Complex Type Array delimiter");
                }
            }
            // processing each of the input parameters and copying it into the members
            for (var i = 0; i < types.Count; i++)
            {
                //nightmare time
                if (GfuStrCmp(types[i], "IGNORE"))
                {
                }
                else if (GfuStrCmp(types[i], "GAMEOBJECT"))
                {
                    fileString += FormatLine("			" + varNames[i] + " = GameObject.Find(\"" + colNames[i] + "\");");
                }
                else if (GfuStrCmp(types[i], "BOOL"))
                {
                    fileString += FormatLine("			{");
                    fileString += FormatLine("			" + types[i] + " res;");
                    fileString += FormatLine("				if(" + types[i] + ".TryParse(_" + varNames[i] + ", out res))");
                    fileString += FormatLine("					" + varNames[i] + " = res;");
                    fileString += FormatLine("				else");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Failed To Convert " + colNames[i] + " string: \"+ _" +
                                   varNames[i] + " +\" to bool\");");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "BYTE"))
                {
                    fileString += FormatLine("			{");
                    fileString += FormatLine("			" + types[i] + " res;");
                    fileString += FormatLine("				if(" + types[i] + ".TryParse(_" + varNames[i] + ", out res))");
                    fileString += FormatLine("					" + varNames[i] + " = res;");
                    fileString += FormatLine("				else");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Failed To Convert " + colNames[i] + " string: \"+ _" +
                                   varNames[i] + " +\" to byte\");");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "CHAR"))
                {
                    fileString += FormatLine("			{");
                    fileString += FormatLine("			" + types[i] + " res;");
                    fileString += FormatLine("				if(" + types[i] + ".TryParse(_" + varNames[i] + ", out res))");
                    fileString += FormatLine("					" + varNames[i] + " = res;");
                    fileString += FormatLine("				else");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Failed To Convert " + colNames[i] + " string: \"+ _" +
                                   varNames[i] + " +\" to char\");");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "FLOAT"))
                {
                    fileString += FormatLine("			{");
                    fileString += FormatLine("			" + types[i] + " res;");
                    fileString += FormatLine("				if(" + types[i] + ".TryParse(_" + varNames[i] + ", out res))");
                    fileString += FormatLine("					" + varNames[i] + " = res;");
                    fileString += FormatLine("				else");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Failed To Convert " + colNames[i] + " string: \"+ _" +
                                   varNames[i] + " +\" to " + types[i] + "\");");
                    fileString += FormatLine("			}");
                }
                else if (IsSupportedArrayType(types[i]) && (GfuStrCmp(StripArray(types[i]), "BYTE") || GfuStrCmp(StripArray(types[i]), "BOOL") || GfuStrCmp(StripArray(types[i]), "FLOAT")))
                {
                    fileString += FormatLine("			{");
                    fileString += FormatLine("				" + StripArray(types[i]) + " res;");
                    fileString +=
                        FormatLine("				string []result = _" + varNames[i] + ".Split(\"" + customArrayDelimiters +
                                   "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                    fileString += FormatLine("				{");
                    fileString += FormatLine("					if(" + StripArray(types[i]) + ".TryParse(result[i], out res))");
                    fileString += FormatLine("						" + varNames[i] + ".Add(res);");
                    fileString += FormatLine("					else");
                    fileString += FormatLine("					{");
                    if (GfuStrCmp(StripArray(types[i]), "BYTE"))
                        fileString += FormatLine("						" + varNames[i] + ".Add( 0 );");
                    else if (GfuStrCmp(StripArray(types[i]), "BOOL"))
                        fileString += FormatLine("						" + varNames[i] + ".Add( false );");
                    else if (GfuStrCmp(StripArray(types[i]), "FLOAT"))
                        fileString += FormatLine("						" + varNames[i] + ".Add( float.NaN );");
                    fileString +=
                        FormatLine("						Debug.LogError(\"Failed To Convert " + colNames[i] +
                                   " string: \"+ result[i] +\" to " + StripArray(types[i]) + "\");");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("				}");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "INT"))
                {
                    fileString += FormatLine("			{");
                    fileString += FormatLine("			" + types[i] + " res;");
                    fileString += FormatLine("				if(int.TryParse(_" + varNames[i] + ", out res))");
                    fileString += FormatLine("					" + varNames[i] + " = res;");
                    fileString += FormatLine("				else");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Failed To Convert " + colNames[i] + " string: \"+ _" +
                                   varNames[i] + " +\" to int\");");
                    fileString += FormatLine("			}");
                }
                else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "INT"))
                {
                    fileString += FormatLine("			{");
                    fileString += FormatLine("				" + StripArray(types[i]) + " res;");
                    fileString +=
                        FormatLine("				string []result = _" + varNames[i] + ".Split(\"" + customArrayDelimiters +
                                   "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                    fileString += FormatLine("				{");
                    fileString += FormatLine("					if(int.TryParse(result[i], out res))");
                    fileString += FormatLine("						" + varNames[i] + ".Add( res );");
                    fileString += FormatLine("					else");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						" + varNames[i] + ".Add( 0 );");
                    fileString +=
                        FormatLine("						Debug.LogError(\"Failed To Convert " + colNames[i] +
                                   " string: \"+ result[i] +\" to " + StripArray(types[i]) + "\");");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("				}");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "STRING"))
                {
                    if (_TrimStrings)
                        fileString += FormatLine("			" + varNames[i] + " = _" + varNames[i] + ".Trim();");
                    else
                        fileString += FormatLine("			" + varNames[i] + " = _" + varNames[i] + ";");
                }
                else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "STRING"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string []result = _" + varNames[i] + ".Split(\"" + customStringArrayDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                    fileString += FormatLine("				{");
                    if (_TrimStringArrays)
                        fileString += FormatLine("					" + varNames[i] + ".Add( result[i].Trim() );");
                    else
                        fileString += FormatLine("					" + varNames[i] + ".Add( result[i] );");
                    fileString += FormatLine("				}");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "VECTOR2"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string [] splitpath = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				if(splitpath.Length != 2)");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + types[i] + " in \" + _" +
                                   varNames[i] + " );");
                    fileString += FormatLine("				float []results = new float[splitpath.Length];");
                    fileString += FormatLine("				for(int i = 0; i < 2; i++)");
                    fileString += FormatLine("				{");
                    fileString += FormatLine("					float res;");
                    fileString += FormatLine("					if(float.TryParse(splitpath[i], out res))");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						results[i] = res;");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("					else ");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("				}");
                    fileString += FormatLine("				" + varNames[i] + ".x = results[0];");
                    fileString += FormatLine("				" + varNames[i] + ".y = results[1];");
                    fileString += FormatLine("			}");
                }
                else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "VECTOR2"))
                {
                    fileString += FormatLine("			{");

                    fileString +=
                        FormatLine("				string []result = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeArrayDelimiters +
                                   "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                    fileString += FormatLine("				{");

                    fileString += FormatLine("                  {");
                    fileString +=
                        FormatLine("      				string [] splitpath = result[i].Split(\"" + customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("      				if(splitpath.Length != 2)");
                    fileString +=
                        FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + types[i] +
                                   " in \" + _" + varNames[i] + " );");
                    fileString += FormatLine("      				float []results = new float[splitpath.Length];");
                    fileString += FormatLine("      				for(int j = 0; j < splitpath.Length; j++)");
                    fileString += FormatLine("      				{");
                    fileString += FormatLine("				            float [] temp = new float[splitpath.Length];");
                    fileString += FormatLine("      					if(float.TryParse(splitpath[j], out temp[j]))");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("      						results[j] = temp[j];");
                    fileString += FormatLine("      					}");
                    fileString += FormatLine("      					else ");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("		        			continue;");
                    fileString += FormatLine("		        		}");
                    fileString += FormatLine("		        	}");
                    fileString +=
                        FormatLine("		        		" + varNames[i] + ".Add( new " + StripArray(types[i]) +
                                   "(results[0], results[1] ));");
                    fileString += FormatLine("		        	}");

                    fileString += FormatLine("				}");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "VECTOR3"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string [] splitpath = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				if(splitpath.Length != 3)");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + types[i] + " in \" + _" +
                                   varNames[i] + " );");
                    fileString += FormatLine("				float []results = new float[splitpath.Length];");
                    fileString += FormatLine("				for(int i = 0; i < 3; i++)");
                    fileString += FormatLine("				{");
                    fileString += FormatLine("					float res;");
                    fileString += FormatLine("					if(float.TryParse(splitpath[i], out res))");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						results[i] = res;");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("					else ");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("				}");
                    fileString += FormatLine("				" + varNames[i] + ".x = results[0];");
                    fileString += FormatLine("				" + varNames[i] + ".y = results[1];");
                    fileString += FormatLine("				" + varNames[i] + ".z = results[2];");
                    fileString += FormatLine("			}");
                }
                else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "VECTOR3"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string []result = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeArrayDelimiters +
                                   "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                    fileString += FormatLine("				{");

                    fileString += FormatLine("      			{");
                    fileString +=
                        FormatLine("      				string [] splitpath = result[i].Split(\"" + customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("      				if(splitpath.Length != 3)");
                    fileString +=
                        FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + types[i] +
                                   " in \" + _" + varNames[i] + " );");
                    fileString += FormatLine("      				float []results = new float[splitpath.Length];");
                    fileString += FormatLine("      				for(int j = 0; j < splitpath.Length; j++)");
                    fileString += FormatLine("      				{");
                    fileString += FormatLine("				            float [] temp = new float[splitpath.Length];");
                    fileString += FormatLine("      					if(float.TryParse(splitpath[j], out temp[j]))");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("      						results[j] = temp[j];");
                    fileString += FormatLine("      					}");
                    fileString += FormatLine("      					else ");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("		        			continue;");
                    fileString += FormatLine("		        		}");
                    fileString += FormatLine("		        	}");
                    fileString +=
                        FormatLine("		        	" + varNames[i] + ".Add( new " + StripArray(types[i]) +
                                   "(results[0], results[1], results[2] ));");

                    fileString += FormatLine("		        	}");

                    fileString += FormatLine("				}");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "COLOR"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string [] splitpath = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				if(splitpath.Length != 3 && splitpath.Length != 4)");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + types[i] + " in \" + _" +
                                   varNames[i] + " );");
                    fileString += FormatLine("				float []results = new float[splitpath.Length];");
                    fileString += FormatLine("				for(int i = 0; i < splitpath.Length; i++)");
                    fileString += FormatLine("				{");
                    fileString += FormatLine("					float res;");
                    fileString += FormatLine("					if(float.TryParse(splitpath[i], out res))");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						results[i] = res;");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("					else ");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("				}");
                    fileString += FormatLine("				" + varNames[i] + ".r = results[0];");
                    fileString += FormatLine("				" + varNames[i] + ".g = results[1];");
                    fileString += FormatLine("				" + varNames[i] + ".b = results[2];");
                    fileString += FormatLine("				if(splitpath.Length == 4)");
                    fileString += FormatLine("					" + varNames[i] + ".a = results[3];");
                    fileString += FormatLine("			}");
                }
                else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "COLOR"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string []result = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeArrayDelimiters +
                                   "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                    fileString += FormatLine("				{");

                    fileString += FormatLine("      			{");
                    fileString +=
                        FormatLine("      				string [] splitpath = result[i].Split(\"" + customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("      				if(splitpath.Length != 3 && splitpath.Length != 4)");
                    fileString +=
                        FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + types[i] +
                                   " in \" + _" + varNames[i] + " );");
                    fileString += FormatLine("      				float []results = new float[splitpath.Length];");
                    fileString += FormatLine("      				for(int j = 0; j < splitpath.Length; j++)");
                    fileString += FormatLine("      				{");
                    fileString += FormatLine("				            float [] temp = new float[splitpath.Length];");
                    fileString += FormatLine("      					if(float.TryParse(splitpath[j], out temp[j]))");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("      						results[j] = temp[j];");
                    fileString += FormatLine("      					}");
                    fileString += FormatLine("      					else ");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("		        			continue;");
                    fileString += FormatLine("		        		}");
                    fileString += FormatLine("		        	}");
                    fileString += FormatLine("		        		if(splitpath.Length == 3)");
                    fileString +=
                        FormatLine("		        		" + varNames[i] + ".Add( new " + StripArray(types[i]) +
                                   "(results[0], results[1], results[2] ));");
                    fileString += FormatLine("		        		else");
                    fileString +=
                        FormatLine("		        		" + varNames[i] + ".Add( new " + StripArray(types[i]) +
                                   "(results[0], results[1], results[2], results[3] ));");

                    fileString += FormatLine("		        	}");

                    fileString += FormatLine("				}");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "COLOR32"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string [] splitpath = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				if(splitpath.Length != 3 && splitpath.Length != 4)");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + types[i] + " in \" + _" +
                                   varNames[i] + " );");
                    fileString += FormatLine("				byte []results = new byte[splitpath.Length];");
                    fileString += FormatLine("				for(int i = 0; i < splitpath.Length; i++)");
                    fileString += FormatLine("				{");
                    fileString += FormatLine("					byte res;");
                    fileString += FormatLine("					if(byte.TryParse(splitpath[i], out res))");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						results[i] = res;");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("					else ");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("				}");
                    fileString += FormatLine("				" + varNames[i] + ".r = results[0];");
                    fileString += FormatLine("				" + varNames[i] + ".g = results[1];");
                    fileString += FormatLine("				" + varNames[i] + ".b = results[2];");
                    fileString += FormatLine("				if(splitpath.Length == 4)");
                    fileString += FormatLine("					" + varNames[i] + ".a = results[3];");
                    fileString += FormatLine("			}");
                }
                else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "COLOR32"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string []result = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeArrayDelimiters +
                                   "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                    fileString += FormatLine("				{");

                    fileString += FormatLine("      			{");
                    fileString +=
                        FormatLine("      				string [] splitpath = result[i].Split(\"" + customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("      				if(splitpath.Length != 3 && splitpath.Length != 4)");
                    fileString +=
                        FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + types[i] +
                                   " in \" + _" + varNames[i] + " );");
                    fileString += FormatLine("      				byte []results = new byte[splitpath.Length];");
                    fileString += FormatLine("      				for(int j = 0; j < splitpath.Length; j++)");
                    fileString += FormatLine("      				{");
                    fileString += FormatLine("				            byte [] temp = new byte[splitpath.Length];");
                    fileString += FormatLine("      					if(byte.TryParse(splitpath[j], out temp[j]))");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("      						results[j] = temp[j];");
                    fileString += FormatLine("      					}");
                    fileString += FormatLine("      					else ");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("		        			continue;");
                    fileString += FormatLine("		        		}");
                    fileString += FormatLine("		        	}");
                    fileString += FormatLine("		        		if(splitpath.Length == 3)");
                    fileString +=
                        FormatLine("		        		    " + varNames[i] + ".Add( new " + StripArray(types[i]) +
                                   "(results[0], results[1], results[2], System.Convert.ToByte(0) ));");
                    fileString += FormatLine("		        		else");
                    fileString +=
                        FormatLine("		        		    " + varNames[i] + ".Add( new " + StripArray(types[i]) +
                                   "(results[0], results[1], results[2], results[3] ));");

                    fileString += FormatLine("		        	}");

                    fileString += FormatLine("				}");
                    fileString += FormatLine("			}");
                }
                else if (GfuStrCmp(types[i], "QUATERNION"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string [] splitpath = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				if(splitpath.Length != 4)");
                    fileString +=
                        FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + types[i] + " in \" + _" +
                                   varNames[i] + " );");
                    fileString += FormatLine("				float []results = new float[splitpath.Length];");
                    fileString += FormatLine("				for(int i = 0; i < 4; i++)");
                    fileString += FormatLine("				{");
                    fileString += FormatLine("					float res;");
                    fileString += FormatLine("					if(float.TryParse(splitpath[i], out res))");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						results[i] = res;");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("					else ");
                    fileString += FormatLine("					{");
                    fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("					}");
                    fileString += FormatLine("				}");
                    fileString += FormatLine("				" + varNames[i] + ".x = results[0];");
                    fileString += FormatLine("				" + varNames[i] + ".y = results[1];");
                    fileString += FormatLine("				" + varNames[i] + ".z = results[2];");
                    fileString += FormatLine("				" + varNames[i] + ".w = results[3];");
                    fileString += FormatLine("			}");
                }
                else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "QUATERNION"))
                {
                    fileString += FormatLine("			{");
                    fileString +=
                        FormatLine("				string []result = _" + varNames[i] + ".Split(\"" +
                                   customComplexTypeArrayDelimiters +
                                   "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                    fileString += FormatLine("				{");

                    fileString += FormatLine("      			{");
                    fileString +=
                        FormatLine("      				string [] splitpath = result[i].Split(\"" + customComplexTypeDelimiters +
                                   "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                    fileString += FormatLine("      				if(splitpath.Length != 3 && splitpath.Length != 4)");
                    fileString +=
                        FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + types[i] +
                                   " in \" + _" + varNames[i] + " );");
                    fileString += FormatLine("      				float []results = new float[splitpath.Length];");
                    fileString += FormatLine("      				for(int j = 0; j < splitpath.Length; j++)");
                    fileString += FormatLine("      				{");
                    fileString += FormatLine("				            float [] temp = new float[splitpath.Length];");
                    fileString += FormatLine("      					if(float.TryParse(splitpath[j], out temp[j]))");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("      						results[j] = temp[j];");
                    fileString += FormatLine("      					}");
                    fileString += FormatLine("      					else ");
                    fileString += FormatLine("      					{");
                    fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                             + "_" + varNames[i]
                                             +
                                             " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                             + colNames[i] + "\");");
                    fileString += FormatLine("		        			continue;");
                    fileString += FormatLine("		        		}");
                    fileString += FormatLine("		        	}");
                    fileString +=
                        FormatLine("		        		" + varNames[i] + ".Add( new " + StripArray(types[i]) +
                                   "(results[0], results[1], results[2], results[3] ));");
                    fileString += FormatLine("		        	}");

                    fileString += FormatLine("				}");
                    fileString += FormatLine("			}");
                }
                else
                {
                    fileString += FormatLine("			" + varNames[i] + " = _" + varNames[i] + ";");
                }
            }
            fileString += FormatLine("		}");

            fileString += FormatLine(System.String.Empty);
            {
                var colCount = colNames.Where((in_t, in_i) => !GfuStrCmp(in_t, "VOID") && !GfuStrCmp(types[in_i], "Ignore")).Count();
                fileString += FormatLine("		public int Length { get { return " + colCount + "; } }");
            }
            fileString += FormatLine(System.String.Empty);

            // allow indexing by []
            fileString += FormatLine("		public string this[int i]");
            fileString += FormatLine("		{");
            fileString += FormatLine("		    get");
            fileString += FormatLine("		    {");
            fileString += FormatLine("		        return GetStringDataByIndex(i);");
            fileString += FormatLine("		    }");
            fileString += FormatLine("		}");
            fileString += FormatLine(System.String.Empty);
            // get string data by index lets the user use an int field rather than the name to retrieve the data
            fileString += FormatLine("		public string GetStringDataByIndex( int index )");
            fileString += FormatLine("		{");
            fileString += FormatLine("			string ret = System.String.Empty;");
            fileString += FormatLine("			switch( index )");
            fileString += FormatLine("			{");

            {
                var colNum = 0;
                for (var i = 0; i < colNames.Count; i++)
                {
                    if (GfuStrCmp(types[i], "Ignore"))
                        continue;
                    if (GfuStrCmp(colNames[i], "VOID"))
                        continue;
                    fileString += FormatLine("				case " + colNum++ + ":");
                    fileString += FormatLine("					ret = " + varNames[i] + ".ToString();");
                    fileString += FormatLine("					break;");
                }
            }
            fileString += FormatLine("			}");
            fileString += FormatLine(System.String.Empty);
            fileString += FormatLine("			return ret;");
            fileString += FormatLine("		}");
            fileString += FormatLine(System.String.Empty);

            // get the data by column name rather than index
            fileString += FormatLine("		public string GetStringData( string colID )");
            fileString += FormatLine("		{");
            fileString += FormatLine("			var ret = System.String.Empty;");
            fileString += FormatLine("			switch( colID.ToLower() )");
            fileString += FormatLine("			{");

            for (var i = 0; i < colNames.Count; i++)
            {
                if (GfuStrCmp(types[i], "Ignore"))
                    continue;
                if (GfuStrCmp(colNames[i], "VOID"))
                    continue;
                fileString += FormatLine("				case \"" + colNames[i] + "\":");
                fileString += FormatLine("					ret = " + varNames[i] + ".ToString();");
                fileString += FormatLine("					break;");
            }

            fileString += FormatLine("			}");
            fileString += FormatLine(System.String.Empty);
            fileString += FormatLine("			return ret;");
            fileString += FormatLine("		}");

            fileString += FormatLine("		public override string ToString()");
            fileString += FormatLine("		{");
            fileString += FormatLine("			string ret = System.String.Empty;");
            for (int i = 0; i < colNames.Count; i++)
            {
                if (GfuStrCmp(types[i], "Ignore"))
                    continue;
                if (GfuStrCmp(colNames[i], "VOID"))
                    continue;
                fileString += FormatLine("			ret += \"{\" + \"" + colNames[i] + "\" + \" : \" + " + varNames[i] + ".ToString() + \"} \";");
            }
            fileString += FormatLine("			return ret;");
            fileString += FormatLine("		}");

            fileString += FormatLine("	}");



            ///////////////////////////////////////////////////////////////////////////////
            // the database class itself, this contains the rows defined above
            if (in_staticClass)
                fileString += FormatLine("	public sealed class " + in_fileName + " : IGoogleFuDB");
            else
                fileString += FormatLine("	public class " + in_fileName + " :  GoogleFuComponentBase, IGoogleFuDB");
            fileString += FormatLine("	{");


            // this is the enums, the enum matches the name of the row
            fileString += FormatLine("		public enum rowIds {");
            fileString += ("			");
            for (var i = 0; i < rowNames.Count; i++)
            {
                if (GfuStrCmp(rowNames[i], "VOID"))
                    continue;

                fileString += (rowNames[i]);
                if (i != rowNames.Count - 1)
                    fileString += (", ");
                if ((i + 1) % 20 == 0)
                    fileString += System.Environment.NewLine + "			";
            }
            fileString += FormatLine(System.String.Empty);
            fileString += FormatLine("		};");



            fileString += FormatLine("		public string [] rowNames = {");
            fileString += "			";
            for (int i = 0; i < rowNames.Count; i++)
            {
                if (GfuStrCmp(rowNames[i], "VOID"))
                    continue;

                fileString += "\"" + rowNames[i] + "\"";
                if (i != rowNames.Count - 1)
                    fileString += ", ";
                if ((i + 1) % 20 == 0)
                    fileString += System.Environment.NewLine + "			";
            }
            fileString += FormatLine(System.Environment.NewLine + "		};");
            // the declaration of the storage for the row data
            fileString += FormatLine("		public System.Collections.Generic.List<" + in_fileName + "Row> Rows = new System.Collections.Generic.List<" + in_fileName + "Row>();");

            // declare the instance as well as the get functionality, if this is going to be a static class
            if (in_staticClass)
            {
                fileString += FormatLine(System.String.Empty);
                fileString += FormatLine("		public static " + in_fileName + " Instance");
                fileString += FormatLine("		{");
                fileString += FormatLine("			get { return Nested" + in_fileName + ".instance; }");
                fileString += FormatLine("		}");
                fileString += FormatLine(System.String.Empty);
                fileString += FormatLine("		private class Nested" + in_fileName + "");
                fileString += FormatLine("		{");
                fileString += FormatLine("			static Nested" + in_fileName + "() { }");
                fileString += FormatLine("			internal static readonly " + in_fileName + " instance = new " + in_fileName + "();");
                fileString += FormatLine("		}");
                fileString += FormatLine(System.String.Empty);
                fileString += FormatLine("		private " + in_fileName + "()");
                fileString += FormatLine("		{");

                var rowCt = 0;
                // Iterate through each row, printing its cell values.
                foreach (var row in listFeed.Entries.Cast<Google.GData.Spreadsheets.ListEntry>())
                {
                    if (typesInFirstRow)
                    {
                        // skip the first row. This is the title row, and we can get the values later
                        if (rowCt == 0)
                        {
                            rowCt++;
                            continue;
                        }
                    }

                    if (GfuStrCmp(row.Title.Text, "VOID"))
                    {
                        rowCt++;
                        continue;
                    }

                    var thisRow = (from Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements select SanitizeJson(element.Value, true)).ToList();
                    // Iterate over the remaining columns, and print each cell value

                    // Prevent empty / void row entries
                    if (string.IsNullOrEmpty(thisRow[0]))
                    {
                        rowCt++;
                        continue;
                    }

                    fileString += "			Rows.Add( new " + in_fileName + "Row(";
                    {
                        bool firstItem = true;
                        for (var i = 1; i < thisRow.Count; i++)
                        {
                            if (GfuStrCmp(types[i - 1], "Ignore"))
                                continue;
                            if (!firstItem)
                                fileString += "," + System.Environment.NewLine + "														";
                            firstItem = false;
                            fileString += "\"" + thisRow[i] + "\"";
                        }
                    }
                    fileString += FormatLine("));");

                    rowCt++;
                }
                fileString += FormatLine("		}");
            }
            else
            {
                // the dont destroy on awake flag
                if (GetBool(_ActiveWorkbook.Title + "." + in_entry.Title.Text + ".OBJDB" + ".DND", false))
                {
                    fileString += FormatLine(System.String.Empty);
                    fileString += FormatLine("		void Awake()");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			DontDestroyOnLoad(this);");
                    fileString += FormatLine("		}");
                }

                // this is the processing that actually gets the data into the object itself later on, 
                // this loops through the generic input and seperates it into strings for the above
                // row class to handle and parse into its members
                fileString += FormatLine("		public override void AddRowGeneric (System.Collections.Generic.List<string> input)");
                fileString += FormatLine("		{");
                fileString += ("			Rows.Add(new " + in_fileName + "Row(");
                {
                    bool firstItem = true;
                    for (int i = 0; i < types.Count; i++)
                    {
                        if (GfuStrCmp(types[i], "Ignore"))
                            continue;

                        if (!firstItem)
                            fileString += (",");
                        firstItem = false;
                        fileString += ("input[" + i + "]");
                    }
                }
                fileString += FormatLine("));");
                fileString += FormatLine("		}");

                fileString += FormatLine("		public override void Clear ()");
                fileString += FormatLine("		{");
                fileString += FormatLine("			Rows.Clear();");
                fileString += FormatLine("		}");
            }

            fileString += FormatLine("		public IGoogleFuRow GetGenRow(string in_RowString)");
            fileString += FormatLine("		{");
            fileString += FormatLine("			IGoogleFuRow ret = null;");
            fileString += FormatLine("			try");
            fileString += FormatLine("			{");
            fileString += FormatLine("				ret = Rows[(int)System.Enum.Parse(typeof(rowIds), in_RowString)];");
            fileString += FormatLine("			}");
            fileString += FormatLine("			catch(System.ArgumentException) {");
            fileString += FormatLine("				Debug.LogError( in_RowString + \" is not a member of the rowIds enumeration.\");");
            fileString += FormatLine("			}");
            fileString += FormatLine("			return ret;");
            fileString += FormatLine("		}");

            fileString += FormatLine("		public IGoogleFuRow GetGenRow(rowIds in_RowID)");
            fileString += FormatLine("		{");
            fileString += FormatLine("			IGoogleFuRow ret = null;");
            fileString += FormatLine("			try");
            fileString += FormatLine("			{");
            fileString += FormatLine("				ret = Rows[(int)in_RowID];");
            fileString += FormatLine("			}");
            fileString += FormatLine("			catch( System.Collections.Generic.KeyNotFoundException ex )");
            fileString += FormatLine("			{");
            fileString += FormatLine("				Debug.LogError( in_RowID + \" not found: \" + ex.Message );");
            fileString += FormatLine("			}");
            fileString += FormatLine("			return ret;");
            fileString += FormatLine("		}");

            fileString += FormatLine("		public " + in_fileName + "Row GetRow(rowIds in_RowID)");
            fileString += FormatLine("		{");
            fileString += FormatLine("			" + in_fileName + "Row ret = null;");
            fileString += FormatLine("			try");
            fileString += FormatLine("			{");
            fileString += FormatLine("				ret = Rows[(int)in_RowID];");
            fileString += FormatLine("			}");
            fileString += FormatLine("			catch( System.Collections.Generic.KeyNotFoundException ex )");
            fileString += FormatLine("			{");
            fileString += FormatLine("				Debug.LogError( in_RowID + \" not found: \" + ex.Message );");
            fileString += FormatLine("			}");
            fileString += FormatLine("			return ret;");
            fileString += FormatLine("		}");


            fileString += FormatLine("		public " + in_fileName + "Row GetRow(string in_RowString)");
            fileString += FormatLine("		{");
            fileString += FormatLine("			" + in_fileName + "Row ret = null;");
            fileString += FormatLine("			try");
            fileString += FormatLine("			{");
            fileString += FormatLine("				ret = Rows[(int)System.Enum.Parse(typeof(rowIds), in_RowString)];");
            fileString += FormatLine("			}");
            fileString += FormatLine("			catch(System.ArgumentException) {");
            fileString += FormatLine("				Debug.LogError( in_RowString + \" is not a member of the rowIds enumeration.\");");
            fileString += FormatLine("			}");
            fileString += FormatLine("			return ret;");
            fileString += FormatLine("		}");
            fileString += FormatLine(System.String.Empty);
            fileString += FormatLine("	}");
            fileString += FormatLine(System.String.Empty);
            fileString += FormatLine("}");

            sw.Write(fileString);

            ///////////////////////////////////
            // done writing, clean up
            sw.Flush();
            sw.Close();
            fs.Close();

            if (in_staticClass == false)
            {
                // Writing out the custom inspector
                ///////////////////////////////////////////////
                // open the file 

                Debug.Log("Saving to: " + GoogleFuGenPath("ObjDBEditor") + "/" + in_fileName + "Editor.cs");
                fs = System.IO.File.Open(GoogleFuGenPath("ObjDBEditor") + "/" + in_fileName + "Editor.cs", System.IO.File.Exists(GoogleFuGenPath("ObjDBEditor") + "/" + in_fileName + "Editor.cs") ?
                    System.IO.FileMode.Truncate :
                    System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);

                if (fs == null)
                {
                    Debug.LogError("Cannot open " + in_fileName + "Editor.cs for writing");
                    return false;
                }

                sw = new System.IO.StreamWriter(fs);
                if (sw == null)
                {
                    Debug.LogError("Cannot create a streamwriter, dude are you out of memory?");
                    return false;
                }

                fileString = System.String.Empty;
                fileString += FormatLine("using UnityEngine;");
                fileString += FormatLine("using UnityEditor;");
                fileString += FormatLine(System.String.Empty);
                fileString += FormatLine("namespace GoogleFu");
                fileString += FormatLine("{");
                fileString += FormatLine("	[CustomEditor(typeof(" + in_fileName + "))]");
                fileString += FormatLine("	public class " + in_fileName + "Editor : Editor");
                fileString += FormatLine("	{");
                fileString += FormatLine("		public int Index = 0;");
                // sneaky time, count all the arrays and make an index for each of them within the inspector
                for (int i = 0; i < types.Count; i++)
                {
                    if (types[i].Contains("array"))
                    {
                        fileString += FormatLine("		public int " + varNames[i] + "_Index = 0;");
                    }
                }
                fileString += FormatLine("		public override void OnInspectorGUI ()");
                fileString += FormatLine("		{");
                fileString += FormatLine("			" + in_fileName + " s = target as " + in_fileName + ";");
                fileString += FormatLine("			" + in_fileName + "Row r = s.Rows[ Index ];");
                fileString += FormatLine(System.String.Empty);
                fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                fileString += FormatLine("			if ( GUILayout.Button(\"<<\") )");
                fileString += FormatLine("			{");
                fileString += FormatLine("				Index = 0;");
                fileString += FormatLine("			}");
                fileString += FormatLine("			if ( GUILayout.Button(\"<\") )");
                fileString += FormatLine("			{");
                fileString += FormatLine("				Index -= 1;");
                fileString += FormatLine("				if ( Index < 0 )");
                fileString += FormatLine("					Index = s.Rows.Count - 1;");
                fileString += FormatLine("			}");
                fileString += FormatLine("			if ( GUILayout.Button(\">\") )");
                fileString += FormatLine("			{");
                fileString += FormatLine("				Index += 1;");
                fileString += FormatLine("				if ( Index >= s.Rows.Count )");
                fileString += FormatLine("					Index = 0;");
                fileString += FormatLine("			}");
                fileString += FormatLine("			if ( GUILayout.Button(\">>\") )");
                fileString += FormatLine("			{");
                fileString += FormatLine("				Index = s.Rows.Count - 1;");
                fileString += FormatLine("			}");
                fileString += FormatLine(System.String.Empty);
                fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                fileString += FormatLine(System.String.Empty);
                fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                fileString += FormatLine("			GUILayout.Label( \"ID\", GUILayout.Width( 150.0f ) );");
                fileString += FormatLine("			{");
                fileString += FormatLine("				EditorGUILayout.LabelField( s.rowNames[ Index ] );");
                fileString += FormatLine("			}");
                fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                fileString += FormatLine(System.String.Empty);

                for (int i = 0; i < types.Count; i++)
                {
                    fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");

                    if (types[i].ToUpper().Contains("ARRAY"))
                    {
                        fileString += FormatLine("			if ( r." + varNames[i] + ".Count == 0 )");
                        fileString += FormatLine("			{");
                        fileString += FormatLine("			    GUILayout.Label( \"" + colNames[i] + "\", GUILayout.Width( 150.0f ) );");
                        fileString += FormatLine("			    {");
                        fileString += FormatLine("			    	EditorGUILayout.LabelField( \"Empty Array\" );");
                        fileString += FormatLine("			    }");
                        fileString += FormatLine("			}");
                        fileString += FormatLine("			else");
                        fileString += FormatLine("			{");
                        fileString += FormatLine("			    GUILayout.Label( \"" + colNames[i] + "\", GUILayout.Width( 130.0f ) );");
                        // when you switch the row you are examining, they may have different array sizes... therefore, we may actually be past the end of the list
                        fileString += FormatLine("			    if ( " + varNames[i] + "_Index >= r." + varNames[i] + ".Count )");
                        fileString += FormatLine("				    " + varNames[i] + "_Index = 0;");
                        // back button
                        fileString += FormatLine("			    if ( GUILayout.Button(\"<\", GUILayout.Width( 18.0f )) )");
                        fileString += FormatLine("			    {");
                        fileString += FormatLine("			    	" + varNames[i] + "_Index -= 1;");
                        fileString += FormatLine("			    	if ( " + varNames[i] + "_Index < 0 )");
                        fileString += FormatLine("			    		" + varNames[i] + "_Index = r." + varNames[i] + ".Count - 1;");
                        fileString += FormatLine("			    }");

                        fileString += FormatLine("			    EditorGUILayout.LabelField(" + varNames[i] + "_Index.ToString(), GUILayout.Width( 15.0f ));");

                        // fwd button
                        fileString += FormatLine("			    if ( GUILayout.Button(\">\", GUILayout.Width( 18.0f )) )");
                        fileString += FormatLine("			    {");
                        fileString += FormatLine("			    	" + varNames[i] + "_Index += 1;");
                        fileString += FormatLine("			    	if ( " + varNames[i] + "_Index >= r." + varNames[i] + ".Count )");
                        fileString += FormatLine("		        		" + varNames[i] + "_Index = 0;");
                        fileString += FormatLine("				}");
                    }
                    if (!GfuStrCmp(types[i], "IGNORE"))
                    {
                        if (GfuStrCmp(types[i], "FLOAT"))
                        {
                            fileString +=
                                FormatLine("			GUILayout.Label( \"" + colNames[i] + "\", GUILayout.Width( 150.0f ) );");
                            fileString += FormatLine("			{");
                            fileString += FormatLine("				EditorGUILayout.FloatField( (float)r." + varNames[i] + " );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "BYTE") || GfuStrCmp(types[i], "INT"))
                        {
                            fileString +=
                                FormatLine("			GUILayout.Label( \"" + colNames[i] + "\", GUILayout.Width( 150.0f ) );");
                            fileString += FormatLine("			{");
                            fileString += FormatLine("				EditorGUILayout.IntField( r." + varNames[i] + " );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "BOOL ARRAY"))
                        {
                            fileString +=
                                FormatLine("				EditorGUILayout.Toggle( System.Convert.ToBoolean( r." + varNames[i] +
                                           "[" +
                                           varNames[i] + "_Index] ) );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "STRING ARRAY"))
                        {
                            fileString +=
                                FormatLine("				EditorGUILayout.TextField( r." + varNames[i] + "[" + varNames[i] +
                                           "_Index] );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "FLOAT ARRAY"))
                        {
                            fileString +=
                                FormatLine("				EditorGUILayout.FloatField( (float)r." + varNames[i] + "[" + varNames[i] +
                                           "_Index] );");
                            fileString += FormatLine("			}");
                        }
                        else if (IsSupportedArrayType(types[i]) && (GfuStrCmp(StripArray(types[i]), "BYTE") || GfuStrCmp(StripArray(types[i]), "INT")))
                        {
                            fileString +=
                                FormatLine("				EditorGUILayout.IntField( r." + varNames[i] + "[" + varNames[i] +
                                           "_Index] );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "CHAR"))
                        {
                            fileString +=
                                FormatLine("			GUILayout.Label( \"" + colNames[i] + "\", GUILayout.Width( 150.0f ) );");
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				EditorGUILayout.TextField( System.Convert.ToString( r." + varNames[i] +
                                           " ) );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "BOOL"))
                        {
                            fileString +=
                                FormatLine("			GUILayout.Label( \"" + colNames[i] + "\", GUILayout.Width( 150.0f ) );");
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				EditorGUILayout.Toggle( System.Convert.ToBoolean( r." + varNames[i] +
                                           " ) );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "STRING"))
                        {
                            fileString +=
                                FormatLine("			GUILayout.Label( \"" + colNames[i] + "\", GUILayout.Width( 150.0f ) );");
                            fileString += FormatLine("			{");
                            fileString += FormatLine("				EditorGUILayout.TextField( r." + varNames[i] + " );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "GAMEOBJECT"))
                        {
                            fileString +=
                                FormatLine("			GUILayout.Label( \"" + colNames[i] + "\", GUILayout.Width( 150.0f ) );");
                            fileString += FormatLine("			{");
                            fileString += FormatLine("				EditorGUILayout.ObjectField( r." + varNames[i] + " );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "VECTOR2"))
                        {
                            fileString +=
                                FormatLine("			EditorGUILayout.Vector2Field( \"" + colNames[i] + "\", r." + varNames[i] +
                                           " );");
                        }
                        else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "VECTOR2"))
                        {
                            fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                            fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                            fileString +=
                                FormatLine("			EditorGUILayout.Vector2Field( \"\", r." + varNames[i] + "[" + varNames[i] +
                                           "_Index] );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "VECTOR3"))
                        {
                            fileString +=
                                FormatLine("			EditorGUILayout.Vector3Field( \"" + colNames[i] + "\", r." + varNames[i] +
                                           " );");
                        }
                        else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "VECTOR3"))
                        {
                            fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                            fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                            fileString +=
                                FormatLine("			EditorGUILayout.Vector3Field( \"\", r." + varNames[i] + "[" + varNames[i] +
                                           "_Index] );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "COLOR") || GfuStrCmp(types[i], "COLOR32"))
                        {
                            fileString +=
                                FormatLine("			GUILayout.Label( \"" + colNames[i] + "\", GUILayout.Width( 150.0f ) );");
                            fileString += FormatLine("			{");
                            fileString += FormatLine("				EditorGUILayout.ColorField( r." + varNames[i] + " );");
                            fileString += FormatLine("			}");
                        }
                        else if (IsSupportedArrayType(types[i]) && (GfuStrCmp(StripArray(types[i]), "COLOR") || GfuStrCmp(StripArray(types[i]), "COLOR32")))
                        {
                            fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                            fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                            fileString +=
                                FormatLine("			EditorGUILayout.ColorField( \"\", r." + varNames[i] + "[" + varNames[i] +
                                           "_Index] );");
                            fileString += FormatLine("			}");
                        }
                        else if (GfuStrCmp(types[i], "QUATERNION"))
                        {
                            fileString +=
                                FormatLine("          Vector4 converted" + colNames[i] + " = new Vector4( r." +
                                           varNames[i] +
                                           ".x, " +
                                           "r." + varNames[i] + ".y, " +
                                           "r." + varNames[i] + ".z, " +
                                           "r." + varNames[i] + ".w ); ");
                            fileString +=
                                FormatLine("			EditorGUILayout.Vector4Field( \"" + colNames[i] + "\", converted" +
                                           colNames[i] + " );");
                        }
                        else if (IsSupportedArrayType(types[i]) && GfuStrCmp(StripArray(types[i]), "QUATERNION"))
                        {
                            fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                            fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                            fileString +=
                                FormatLine("          Vector4 converted" + colNames[i] + " = new Vector4( r." +
                                           varNames[i] +
                                           "[" + varNames[i] + "_Index].x, " +
                                           "r." + varNames[i] + "[" + varNames[i] + "_Index].y, " +
                                           "r." + varNames[i] + "[" + varNames[i] + "_Index].z, " +
                                           "r." + varNames[i] + "[" + varNames[i] + "_Index].w ); ");
                            fileString +=
                                FormatLine("			EditorGUILayout.Vector4Field( \"\", converted" + colNames[i] + " );");
                            fileString += FormatLine("			}");
                        }
                    }

                    fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                    fileString += FormatLine(System.String.Empty);
                }

                fileString += FormatLine("		}");
                fileString += FormatLine("	}");
                fileString += FormatLine("}");


                sw.Write(fileString);

                ///////////////////////////////////
                // done writing, clean up
                sw.Flush();
                sw.Close();
                fs.Close();

                ///////////////////////////////////
                // export playmaker actions (check if playmaker is installed first)
                if (_FoundPlaymaker && (GetBool(_ActiveWorkbook.Title + "." + in_entry.Title.Text + ".OBJDB" + ".PM", false)))
                {
                    /////////////////////////////
                    // Generate the Action for Get*DataByID
                    Debug.Log("Saving to: " + GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "DataByID.cs");

                    if (System.IO.Directory.Exists(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu") == false)
                        System.IO.Directory.CreateDirectory(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu");

                    fs = System.IO.File.Open(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "DataByID.cs", System.IO.File.Exists(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "DataByID.cs") ?
                        System.IO.FileMode.Truncate :
                        System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);

                    if (fs == null)
                    {
                        Debug.LogError("Cannot open " + GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "DataByID.cs for writing");
                        return false;
                    }

                    sw = new System.IO.StreamWriter(fs);
                    if (sw == null)
                    {
                        Debug.LogError("Cannot create a streamwriter, dude are you out of memory?");
                        return false;
                    }

                    fileString = System.String.Empty;
                    fileString += FormatLine("using UnityEngine;");
                    fileString += FormatLine(System.String.Empty);

                    fileString += FormatLine("namespace HutongGames.PlayMaker.Actions");
                    fileString += FormatLine("{");
                    fileString += FormatLine("	[ActionCategory(\"GoogleFu\")]");
                    fileString += FormatLine("	[Tooltip(\"Gets the specified entry in the " + in_fileName + " Database.\")]");
                    fileString += FormatLine("	public class Get" + in_fileName + "DataByID : FsmStateAction");
                    fileString += FormatLine("	{");
                    fileString += FormatLine("		[RequiredField]");
                    fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                    fileString += FormatLine("		[Tooltip(\"The object that contains the " + in_fileName + " database.\")]");
                    fileString += FormatLine("		public FsmGameObject databaseObj;");

                    fileString += FormatLine("		[RequiredField]");
                    fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                    fileString += FormatLine("		[Tooltip(\"Row name of the entry you wish to retrieve.\")]");
                    fileString += FormatLine("		public FsmString rowName;");

                    for (var i = 0; i < types.Count; i++)
                    {
                        var fsmvarType = System.String.Empty;
                        var varType = types[i];
                        var varName = varNames[i];

                        if (GfuStrCmp(types[i], "IGNORE") || GfuStrCmp(types[i], "VOID") || IsSupportedArrayType(types[i]))
                        {
                            continue;
                        }

                        if (GfuStrCmp(types[i], "FLOAT"))
                        {
                            fsmvarType = "FsmFloat";
                        }
                        else if (GfuStrCmp(types[i], "UNISGNED INT") || GfuStrCmp(types[i], "INT") || GfuStrCmp(types[i], "CHAR"))
                        {
                            fsmvarType = "FsmInt";
                        }
                        else if (GfuStrCmp(types[i], "BOOLEAN") || GfuStrCmp(types[i], "BOOL"))
                        {
                            fsmvarType = "FsmBool";
                        }
                        else if (GfuStrCmp(types[i], "STRING"))
                        {
                            fsmvarType = "FsmString";
                        }
                        else if (GfuStrCmp(types[i], "GAMEOBJECT"))
                        {
                            fsmvarType = "FsmGameObject";
                        }
                        else if (GfuStrCmp(types[i], "VECTOR2"))
                        {
                            fsmvarType = "FsmVector2";
                        }
                        else if (GfuStrCmp(types[i], "VECTOR3"))
                        {
                            fsmvarType = "FsmVector3";
                        }
                        else if (GfuStrCmp(types[i], "COLOR") || GfuStrCmp(types[i], "COLOR32"))
                        {
                            fsmvarType = "FsmColor";
                        }
                        else if (GfuStrCmp(types[i], "QUATERNION"))
                        {
                            fsmvarType = "FsmQuaternion";
                        }

                        fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                        fileString += FormatLine("		[Tooltip(\"Store the " + varName + " in a " + varType + " variable.\")]");

                        fileString += FormatLine("		public " + fsmvarType + " " + varName + ";");
                    }

                    fileString += FormatLine("		public override void Reset()");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			databaseObj = null;");
                    fileString += FormatLine("			rowName = null;");

                    for (int index = 0; index < varNames.Count; index++)
                    {
                        var varName = varNames[index];

                        if (GfuStrCmp(types[index], "IGNORE") || GfuStrCmp(types[index], "VOID") || IsSupportedArrayType(types[index]))
                            continue;

                        var tmpVarName = varName.Split(new[] { '_' }, System.StringSplitOptions.RemoveEmptyEntries)[0];

                        if (GfuStrCmp(tmpVarName, "IGNORE") || GfuStrCmp(tmpVarName, "VOID"))
                            continue;

                        fileString += FormatLine("			" + varName + " = null;");
                    }

                    fileString += FormatLine("		}");

                    fileString += FormatLine("		public override void OnEnter()");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			if ( databaseObj != null && rowName != null && rowName.Value != System.String.Empty )");
                    fileString += FormatLine("			{");
                    fileString += FormatLine("				GoogleFu." + in_fileName + " db = databaseObj.Value.GetComponent<GoogleFu." + in_fileName + ">();");
                    fileString += FormatLine("				GoogleFu." + in_fileName + "Row row = db.GetRow( rowName.Value );");

                    for (int index = 0; index < varNames.Count; index++)
                    {
                        var varName = varNames[index];

                        if (GfuStrCmp(types[index], "IGNORE") || GfuStrCmp(types[index], "VOID") || IsSupportedArrayType(types[index]))
                            continue;

                        var tmpVarName = varName.Split(new[] { '_' }, System.StringSplitOptions.RemoveEmptyEntries)[0];

                        if (GfuStrCmp(tmpVarName, "IGNORE") || GfuStrCmp(tmpVarName, "VOID"))
                            continue;

                        fileString += FormatLine("				if ( " + varName + " != null )");
                        fileString += FormatLine("				" + varName + ".Value = row." + varName + ";");
                    }

                    fileString += FormatLine("			}");
                    fileString += FormatLine("			Finish();");
                    fileString += FormatLine("		}");
                    fileString += FormatLine("	}");
                    fileString += FormatLine("}");

                    sw.Write(fileString);

                    ///////////////////////////////////
                    // done writing, clean up
                    sw.Flush();
                    sw.Close();
                    fs.Close();

                    /////////////////////////////
                    // Generate the Action for Get*DataByIndex
                    Debug.Log("Saving to: " + GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "DataByIndex.cs");

                    if (System.IO.Directory.Exists(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu") == false)
                        System.IO.Directory.CreateDirectory(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu");

                    fs = System.IO.File.Open(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "DataByIndex.cs", System.IO.File.Exists(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "DataByIndex.cs") ? System.IO.FileMode.Truncate : System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);

                    if (fs == null)
                    {
                        Debug.LogError("Cannot open " + GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "DataByIndex.cs for writing");
                        return false;
                    }

                    sw = new System.IO.StreamWriter(fs);
                    if (sw == null)
                    {
                        Debug.LogError("Cannot create a streamwriter, dude are you out of memory?");
                        return false;
                    }

                    fileString = System.String.Empty;
                    fileString += FormatLine("using UnityEngine;");
                    fileString += FormatLine(System.String.Empty);

                    fileString += FormatLine("namespace HutongGames.PlayMaker.Actions");
                    fileString += FormatLine("{");
                    fileString += FormatLine("	[ActionCategory(\"GoogleFu\")]");
                    fileString += FormatLine("	[Tooltip(\"Gets the specified entry in the " + in_fileName + " Database By Index.\")]");
                    fileString += FormatLine("	public class Get" + in_fileName + "DataByIndex : FsmStateAction");
                    fileString += FormatLine("	{");
                    fileString += FormatLine("		[RequiredField]");
                    fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                    fileString += FormatLine("		[Tooltip(\"The object that contains the " + in_fileName + " database.\")]");
                    fileString += FormatLine("		public FsmGameObject databaseObj;");

                    fileString += FormatLine("		[RequiredField]");
                    fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                    fileString += FormatLine("		[Tooltip(\"Row index of the entry you wish to retrieve.\")]");
                    fileString += FormatLine("		public FsmInt rowIndex;");

                    fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                    fileString += FormatLine("		[Tooltip(\"Row ID of the entry.\")]");
                    fileString += FormatLine("		public FsmString rowName;");

                    for (var i = 0; i < types.Count; i++)
                    {
                        var fsmvarType = System.String.Empty;
                        var varType = types[i];
                        var varName = varNames[i];

                        if (GfuStrCmp(types[i], "IGNORE") || GfuStrCmp(types[i], "VOID") || IsSupportedArrayType(types[i]))
                        {
                            continue;
                        }

                        if (GfuStrCmp(types[i], "FLOAT"))
                        {
                            fsmvarType = "FsmFloat";
                        }
                        else if (GfuStrCmp(types[i], "BYTE") || GfuStrCmp(types[i], "INT") || GfuStrCmp(types[i], "CHAR"))
                        {
                            fsmvarType = "FsmInt";
                        }
                        else if (GfuStrCmp(types[i], "BOOLEAN") || GfuStrCmp(types[i], "BOOL"))
                        {
                            fsmvarType = "FsmBool";
                        }
                        else if (GfuStrCmp(types[i], "STRING"))
                        {
                            fsmvarType = "FsmString";
                        }
                        else if (GfuStrCmp(types[i], "GAMEOBJECT"))
                        {
                            fsmvarType = "FsmGameObject";
                        }
                        else if (GfuStrCmp(types[i], "VECTOR2"))
                        {
                            fsmvarType = "FsmVector2";
                        }
                        else if (GfuStrCmp(types[i], "VECTOR3"))
                        {
                            fsmvarType = "FsmVector3";
                        }
                        else if (GfuStrCmp(types[i], "COLOR") || GfuStrCmp(types[i], "COLOR32"))
                        {
                            fsmvarType = "FsmColor";
                        }
                        else if (GfuStrCmp(types[i], "QUATERNION"))
                        {
                            fsmvarType = "FsmQuaternion";
                        }

                        fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                        fileString += FormatLine("		[Tooltip(\"Store the " + varName + " in a " + varType + " variable.\")]");

                        fileString += FormatLine("		public " + fsmvarType + " " + varName + ";");
                    }

                    fileString += FormatLine("		public override void Reset()");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			databaseObj = null;");
                    fileString += FormatLine("			rowIndex = null;");

                    for (int index = 0; index < varNames.Count; index++)
                    {
                        var varName = varNames[index];

                        if (GfuStrCmp(types[index], "IGNORE") || GfuStrCmp(types[index], "VOID") || IsSupportedArrayType(types[index]))
                            continue;

                        var tmpVarName = varName.Split(new[] { '_' }, System.StringSplitOptions.RemoveEmptyEntries)[0];

                        if (GfuStrCmp(tmpVarName, "IGNORE") || GfuStrCmp(tmpVarName, "VOID"))
                            continue;

                        fileString += FormatLine("			" + varName + " = null;");
                    }

                    fileString += FormatLine("		}");

                    fileString += FormatLine("		public override void OnEnter()");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			if ( databaseObj != null && rowIndex != null )");
                    fileString += FormatLine("			{");
                    fileString += FormatLine("				GoogleFu." + in_fileName + " db = databaseObj.Value.GetComponent<GoogleFu." + in_fileName + ">();");

                    fileString += FormatLine("				// For sanity sake, we are going to do an auto-wrap based on the input");
                    fileString += FormatLine("				// This should prevent accessing the array out of bounds");
                    fileString += FormatLine("				int i = rowIndex.Value;");
                    fileString += FormatLine("				int L = db.Rows.Count;");
                    fileString += FormatLine("				while ( i < 0 )");
                    fileString += FormatLine("					i += L;");
                    fileString += FormatLine("				while ( i > L-1 )");
                    fileString += FormatLine("					i -= L;");
                    fileString += FormatLine("				GoogleFu." + in_fileName + "Row row = db.Rows[i];");

                    fileString += FormatLine("				if ( rowName != null )");
                    fileString += FormatLine("					rowName.Value = db.rowNames[i];");

                    for (int index = 0; index < varNames.Count; index++)
                    {
                        var varName = varNames[index];

                        if (GfuStrCmp(types[index], "IGNORE") || GfuStrCmp(types[index], "VOID") || IsSupportedArrayType(types[index]))
                            continue;

                        var tmpVarName = varName.Split(new[] { '_' }, System.StringSplitOptions.RemoveEmptyEntries)[0];

                        if (GfuStrCmp(tmpVarName, "IGNORE") || GfuStrCmp(tmpVarName, "VOID"))
                            continue;

                        fileString += FormatLine("				if ( " + varName + " != null )");
                        fileString += FormatLine("				" + varName + ".Value = row." + varName + ";");
                    }

                    fileString += FormatLine("			}");
                    fileString += FormatLine("			Finish();");
                    fileString += FormatLine("		}");
                    fileString += FormatLine("	}");
                    fileString += FormatLine("}");

                    sw.Write(fileString);

                    ///////////////////////////////////
                    // done writing, clean up
                    sw.Flush();
                    sw.Close();
                    fs.Close();


                    /////////////////////////////
                    // Generate the Action for Get*DataByIndex
                    Debug.Log("Saving to: " + GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "Count.cs");

                    if (System.IO.Directory.Exists(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu") == false)
                        System.IO.Directory.CreateDirectory(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu");

                    fs = System.IO.File.Open(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "Count.cs", System.IO.File.Exists(GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "Count.cs") ?
                        System.IO.FileMode.Truncate :
                        System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);

                    if (fs == null)
                    {
                        Debug.LogError("Cannot open " + GoogleFuGenPath("PLAYMAKER") + "/GoogleFu/Get" + in_fileName + "Count.cs for writing");
                        return false;
                    }

                    sw = new System.IO.StreamWriter(fs);
                    if (sw == null)
                    {
                        Debug.LogError("Cannot create a streamwriter, dude are you out of memory?");
                        return false;
                    }

                    fileString = System.String.Empty;
                    fileString += FormatLine("using UnityEngine;");
                    fileString += FormatLine(System.String.Empty);

                    fileString += FormatLine("namespace HutongGames.PlayMaker.Actions");
                    fileString += FormatLine("{");
                    fileString += FormatLine("	[ActionCategory(\"GoogleFu\")]");
                    fileString += FormatLine("	[Tooltip(\"Gets the specified entry in the " + in_fileName + " Database By Index.\")]");
                    fileString += FormatLine("	public class Get" + in_fileName + "Count : FsmStateAction");
                    fileString += FormatLine("	{");
                    fileString += FormatLine("		[RequiredField]");
                    fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                    fileString += FormatLine("		[Tooltip(\"The object that contains the " + in_fileName + " database.\")]");
                    fileString += FormatLine("		public FsmGameObject databaseObj;");

                    fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                    fileString += FormatLine("		[Tooltip(\"Row Count of the database.\")]");
                    fileString += FormatLine("		public FsmInt rowCount;");

                    fileString += FormatLine("		public override void Reset()");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			databaseObj = null;");
                    fileString += FormatLine("			rowCount = null;");
                    fileString += FormatLine("		}");

                    fileString += FormatLine("		public override void OnEnter()");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			if ( databaseObj != null && rowCount != null )");
                    fileString += FormatLine("			{");
                    fileString += FormatLine("				GoogleFu." + in_fileName + " db = databaseObj.Value.GetComponent<GoogleFu." + in_fileName + ">();");
                    fileString += FormatLine("				rowCount.Value = db.Rows.Count;");
                    fileString += FormatLine("			}");
                    fileString += FormatLine("			Finish();");
                    fileString += FormatLine("		}");
                    fileString += FormatLine("	}");
                    fileString += FormatLine("}");

                    sw.Write(fileString);

                    ///////////////////////////////////
                    // done writing, clean up
                    sw.Flush();
                    sw.Close();
                    fs.Close();
                }
            }

            ShowNotification(new GUIContent("Saving to: " + in_path + "/" + in_fileName + ".cs"));
            Debug.Log("Saving to: " + in_path);
            return true;
        }
Beispiel #4
0
        private void ExportJsonWorkbook(System.IO.StreamWriter in_sw, System.Collections.Generic.List<Google.GData.Spreadsheets.WorksheetEntry> in_entries)
        {
            string fileString = System.String.Empty;
            fileString += ("{");

            var sheetCount = in_entries.Count;
            var curSheet = 0;
            // for each page
            foreach (Google.GData.Spreadsheets.WorksheetEntry entry in in_entries)
            {
                // Define the URL to request the list feed of the worksheet.
                var listFeedLink = entry.Links.FindService(Google.GData.Spreadsheets.GDataSpreadsheetsNameTable.ListRel, null);

                // Fetch the list feed of the worksheet.
                var listQuery = new Google.GData.Spreadsheets.ListQuery(listFeedLink.HRef.ToString());
                var listFeed = _Service.Query(listQuery);

                var escapeUnicode = GetBool(_ActiveWorkbook.Title + "." + entry.Title.Text + ".JSON" + ".ESCAPEUNICODE", true);
                var includeTypeRow = GetBool(_ActiveWorkbook.Title + "." + entry.Title.Text + ".JSON" + ".INCLUDETYPEROW", false);
                var bConvertArrays = GetBool(_ActiveWorkbook.Title + "." + entry.Title.Text + ".JSON" + ".CONVERTARRAYS", true);

                // This is always row 0. This may or may not be valid types
                var typesList = new System.Collections.Generic.List<string>();

                fileString += ("\"" + SanitizeJson(listFeed.Title.Text, escapeUnicode) + "\":["); // "sheetName":[

                var rowCt = listFeed.Entries.Count;
                var voidRows = 0;
                if (rowCt > 0)
                {

                    var colCt = ((Google.GData.Spreadsheets.ListEntry)listFeed.Entries[0]).Elements.Count;

                    // We need to make sure we don't process the last column if it's flagged as _Ignore.
                    while ((colCt > 0) && GfuStrCmp(((Google.GData.Spreadsheets.ListEntry)listFeed.Entries[0]).Elements[colCt - 1].LocalName, "VOID"))
                        colCt -= 1;

                    var curRow = 0;
                    var curCol = 0;

                    // Iterate through each row, printing its cell values.
                    foreach (var row in listFeed.Entries.Cast<Google.GData.Spreadsheets.ListEntry>())
                    {
                        // if we are skipping the type row, record the types and increment curRow now
                        if (curRow == 0)
                        {
                            typesList.AddRange(from Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements select element.Value);

                            if (includeTypeRow == false)
                            {
                                curRow++;
                                continue;
                            }
                        }

                        if (GfuStrCmp(row.Title.Text, "void"))
                        {
                            curRow++;
                            voidRows++;
                            continue;
                        }


                        fileString += ("{");
                        // Iterate over the remaining columns, and print each cell value
                        foreach (Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements)
                        {
                            // Don't process rows or columns marked for ignore
                            if (GfuStrCmp(element.LocalName, "void"))
                            {
                                curCol++;
                                continue;
                            }

                            if (bConvertArrays && IsSupportedArrayType(typesList[curCol]))
                            {

                                var delim = GetString("arrayDelimiters", _ArrayDelimiters).ToCharArray();

                                fileString += "\"" + SanitizeJson(element.LocalName, escapeUnicode) + "\":[";
                                bool isString = false;

                                if (GfuStrCmp(typesList[curCol], "string array") ||
                                    GfuStrCmp(typesList[curCol], "string []") ||
                                    GfuStrCmp(typesList[curCol], "string[]"))
                                {
                                    delim = GetString("stringArrayDelimiters", _StringArrayDelimiters).ToCharArray();
                                    isString = true;
                                }
                                if (curCol == 0)
                                    isString = true;

                                var value = element.Value.Split(delim, System.StringSplitOptions.RemoveEmptyEntries);
                                var ct = 0;
                                foreach (var s in value)
                                {
                                    if (isString)
                                        fileString += "\"" + SanitizeJson(s, escapeUnicode) + "\"";
                                    else if (GfuStrCmp(typesList[curCol], "bool"))
                                    {
                                        string val = s.ToLower();
                                        if (val == "1")
                                            val = "true";
                                        if (val == "0")
                                            val = "false";
                                        fileString += SanitizeJson(val, escapeUnicode);
                                    }
                                    else
                                        fileString += SanitizeJson(s, escapeUnicode);
                                    if (ct < value.Length - 1)
                                        fileString += ",";
                                    ct++;
                                }

                                fileString += "]";
                            }
                            else
                            {
                                if (GfuStrCmp(typesList[curCol], "string") || (curCol == 0))
                                    fileString += ("\"" + SanitizeJson(element.LocalName, escapeUnicode) + "\":\"" + SanitizeJson(element.Value, escapeUnicode) + "\"");
                                else if (GfuStrCmp(typesList[curCol], "bool"))
                                {
                                    string val = element.Value.ToLower();
                                    if (val == "1")
                                        val = "true";
                                    if (val == "0")
                                        val = "false";
                                    fileString += ("\"" + SanitizeJson(element.LocalName, escapeUnicode) + "\":" +
                                                   SanitizeJson(val, escapeUnicode));
                                }
                                else
                                    fileString += ("\"" + SanitizeJson(element.LocalName, escapeUnicode) + "\":" + SanitizeJson(element.Value, escapeUnicode) + "");
                            }

                            if (curCol < colCt - 1)
                                fileString += ",";

                            curCol++;

                        }

                        fileString += ("}");
                        if (curRow < rowCt - voidRows - 1)
                            fileString += ",";

                        curCol = 0;
                        curRow++;
                    }

                }

                fileString += ("]");
                if (curSheet < sheetCount - 1)
                    fileString += ",";

                curSheet++;

            }
            fileString += ("}");
            in_sw.Write(fileString);
        }
Beispiel #5
0
        void ExportXml(string in_path, System.Collections.Generic.IEnumerable<Google.GData.Spreadsheets.WorksheetEntry> in_entries)
        {

            ShowNotification(new GUIContent("Saving to: " + in_path));
            Debug.Log("Saving to: " + in_path);

            // Create the System.Xml.XmlDocument.
            var xmlDoc = new System.Xml.XmlDocument();
            var rootNode = xmlDoc.CreateElement("Sheets");
            xmlDoc.AppendChild(rootNode);

            foreach (Google.GData.Spreadsheets.WorksheetEntry entry in in_entries)
            {
                // Define the URL to request the list feed of the worksheet.
                Google.GData.Client.AtomLink listFeedLink = entry.Links.FindService(Google.GData.Spreadsheets.GDataSpreadsheetsNameTable.ListRel, null);

                // Fetch the list feed of the worksheet.
                var listQuery = new Google.GData.Spreadsheets.ListQuery(listFeedLink.HRef.ToString());
                var listFeed = _Service.Query(listQuery);

                //int rowCt = listFeed.Entries.Count;
                //int colCt = ((Google.GData.Spreadsheets.ListEntry)listFeed.Entries[0]).Elements.Count;

                System.Xml.XmlNode sheetNode = xmlDoc.CreateElement("sheet");
                System.Xml.XmlAttribute sheetName = xmlDoc.CreateAttribute("name");
                sheetName.Value = entry.Title.Text;
                if (sheetNode.Attributes != null)
                {
                    sheetNode.Attributes.Append(sheetName);
                    rootNode.AppendChild(sheetNode);

                    if (listFeed.Entries.Count <= 0) continue;
                    // Iterate through each row, printing its cell values.
                    foreach (var atomEntry in listFeed.Entries)
                    {
                        var row = (Google.GData.Spreadsheets.ListEntry)atomEntry;
                        // Don't process rows or columns marked for _Ignore
                        if (GfuStrCmp(row.Title.Text, "VOID"))
                        {
                            continue;
                        }

                        System.Xml.XmlNode rowNode = xmlDoc.CreateElement("row");
                        System.Xml.XmlAttribute rowName = xmlDoc.CreateAttribute("name");
                        rowName.Value = row.Title.Text;
                        if (rowNode.Attributes == null) continue;
                        rowNode.Attributes.Append(rowName);
                        sheetNode.AppendChild(rowNode);

                        // Iterate over the remaining columns, and print each cell value
                        foreach (Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements)
                        {
                            // Don't process rows or columns marked for _Ignore
                            if (GfuStrCmp(element.LocalName, "VOID"))
                            {
                                continue;
                            }

                            System.Xml.XmlNode colNode = xmlDoc.CreateElement("col");
                            System.Xml.XmlAttribute colName = xmlDoc.CreateAttribute("name");
                            colName.Value = element.LocalName;
                            if (colNode.Attributes != null) colNode.Attributes.Append(colName);
                            colNode.InnerText = element.Value;
                            rowNode.AppendChild(colNode);
                        }
                    }
                }
            }

            // Save the document to a file and auto-indent the output.
            var writer = new System.Xml.XmlTextWriter(in_path, null) { Formatting = System.Xml.Formatting.Indented };
            xmlDoc.Save(writer);
            writer.Close();
            ShowNotification(new GUIContent("Saving to: " + in_path));
            Debug.Log("Saving to: " + in_path);
        }
Beispiel #6
0
        void ExportNguiLegacy(string in_path, System.Collections.Generic.IEnumerable<Google.GData.Spreadsheets.WorksheetEntry> in_entries)
        {
            if (_FoundNgui == false)
                return;

            ShowNotification(new GUIContent("Saving to: " + in_path));
            Debug.Log("Saving to: " + in_path);

            var languages = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.Dictionary<string, string>>();

            // for each page
            foreach (Google.GData.Spreadsheets.WorksheetEntry entry in in_entries)
            {
                // Define the URL to request the list feed of the worksheet.
                var listFeedLink = entry.Links.FindService(Google.GData.Spreadsheets.GDataSpreadsheetsNameTable.ListRel, null);

                // Fetch the list feed of the worksheet.
                var listQuery = new Google.GData.Spreadsheets.ListQuery(listFeedLink.HRef.ToString());
                var listFeed = _Service.Query(listQuery);

                var curCol = 0;
                if (listFeed.Entries.Count <= 0) continue;

                foreach (var atomEntry in listFeed.Entries)
                {
                    var row = (Google.GData.Spreadsheets.ListEntry)atomEntry;

                    foreach (Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements)
                    {
                        if (curCol > 0)
                        {
                            if (!languages.ContainsKey(element.LocalName))
                                languages.Add(element.LocalName, new System.Collections.Generic.Dictionary<string, string>());
                            languages[element.LocalName].Add(row.Title.Text, element.Value);
                        }
                        curCol++;
                    }

                    curCol = 0;
                }
            }

            foreach (var lang in languages)
            {
                var filepath = in_path + "/" + lang.Key + ".txt";
                var fs = System.IO.File.Open(filepath, System.IO.File.Exists(filepath) ?
                    System.IO.FileMode.Truncate :
                    System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);

                var sw = new System.IO.StreamWriter(fs);
                var fileString = System.String.Empty;

                fileString += FormatLine("Flag = Flag-" + lang.Key);
                fileString = lang.Value.Aggregate(fileString, (in_current, in_word) => in_current + FormatLine(in_word.Key + " = " + in_word.Value));
                sw.Write(fileString);
                sw.Close();
                fs.Close();
            }
        }