Пример #1
0
        public static string ExportNGUILegacyString(Google2uWorksheet in_sheet, Google2uExportOptions in_options,
                                                    int in_langIndex)
        {
            var ret = FormatLine("Flag = Flag-" + in_sheet.Rows[0][in_langIndex].CellValueString);

            for (var i = 1; i < in_sheet.Rows.Count - 1; ++i)
            {
                var row = in_sheet.Rows[i];
                if (string.IsNullOrEmpty(row.Cells[0].CellValueString) && in_options.NGUICullRows)
                {
                    break;
                }

                var tmpRet = in_options.EscapeNGUIStrings
                    ? SanitizeDf(row.Cells[in_langIndex].CellValueString)
                    : row.Cells[in_langIndex].CellValueString;

                if (in_options.NGUIConvertLineBreaks)
                {
                    tmpRet = ConvertLineBreaks(tmpRet);
                }

                ret += FormatLine(row.Cells[0].CellValueString + " = " + tmpRet);
            }
            return(ret);
        }
Пример #2
0
        public static string ExportCsvString(Google2uWorksheet in_sheet, Google2uExportOptions in_options)
        {
            // for each page
            var ret   = string.Empty;
            var rowCt = in_sheet.Rows.Count;

            if (rowCt <= 0)
            {
                return(ret);
            }
            // Iterate through each row, printing its cell values.
            foreach (var row in in_sheet.Rows)
            {
                var rowType   = row[0].GetTypeFromValue();
                var rowHeader = row[0].CellValueString;
                if (string.IsNullOrEmpty(rowHeader))
                // if this header is empty
                {
                    if (in_options.CSVCullRows)
                    {
                        break;
                    }
                    continue;
                }

                if (rowType == SupportedType.Void ||
                    rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                // if this cell is void, then skip the row completely
                {
                    continue;
                }

                // Iterate over the remaining columns, and print each cell value
                for (var i = 0; i < in_sheet.Rows[0].Count; i++)
                {
                    if ((row[i].MyType == SupportedType.Void ||
                         string.IsNullOrEmpty(rowHeader) ||
                         (in_options.CSVCullColumns && i > in_sheet.FirstBlankCol)))
                    {
                        continue;
                    }

                    var tmpRet = in_options.EscapeCSVStrings
                        ? SanitizeDf(row[i].CellValueString)
                        : AutoQuote(row[i].CellValueString);

                    if (in_options.CSVConvertLineBreaks)
                    {
                        tmpRet = ConvertLineBreaks(tmpRet);
                    }

                    ret += tmpRet;

                    ret += ",";
                }
                ret  = ret.Remove(ret.Length - 1); // remove the last comma
                ret += Environment.NewLine;
            }
            return(ret);
        }
        public static void ExportXML(Google2uWorksheet in_sheet, string in_path, Google2uExportOptions in_options)
        {
            if (!Directory.Exists(in_path))
                Directory.CreateDirectory(in_path);

            in_path = Path.Combine(in_path, in_sheet.WorksheetName);

            if (!Directory.Exists(in_path))
                Directory.CreateDirectory(in_path);

            in_path = Path.Combine(in_path, in_sheet.WorksheetName + ".xml").Replace('\\', '/');

            using (
                var fs = File.Open(in_path,
                    File.Exists(in_path) ? FileMode.Truncate : FileMode.OpenOrCreate,
                    FileAccess.Write))
            {
                using (var sw = new StreamWriter(fs))
                {
                    var fileString = ExportXMLString(in_sheet, in_options);
                    sw.Write(fileString);
                    sw.Flush();
                }
            }

            PushNotification("Saving to: " + in_path);
        }
Пример #4
0
        public static void ExportCsv(Google2uWorksheet in_sheet, string in_path, Google2uExportOptions in_options)
        {
            if (!Directory.Exists(in_path))
            {
                Directory.CreateDirectory(in_path);
            }

            in_path = Path.Combine(in_path, in_sheet.WorksheetName);

            if (!Directory.Exists(in_path))
            {
                Directory.CreateDirectory(in_path);
            }

            in_path = Path.Combine(in_path, in_sheet.WorksheetName + ".csv").Replace('\\', '/');

            using (
                var fs = File.Open(in_path,
                                   File.Exists(in_path) ? FileMode.Truncate : FileMode.OpenOrCreate,
                                   FileAccess.Write))
            {
                using (var sw = new StreamWriter(fs))
                {
                    var fileString = ExportCsvString(in_sheet, in_options);
                    sw.Write(fileString);
                    sw.Flush();
                }
            }

            PushNotification("Saving to: " + in_path);
        }
Пример #5
0
        public static void ExportJson(Google2uWorksheet in_sheet, string in_path, Google2uExportOptions in_options)
        {
            if (!Directory.Exists(in_path))
            {
                Directory.CreateDirectory(in_path);
            }

            if (!in_options.JSONExportSingleSubfolder)
            {
                in_path = Path.Combine(in_path, in_sheet.WorksheetName);

                if (!Directory.Exists(in_path))
                {
                    Directory.CreateDirectory(in_path);
                }
            }

            var jsonPath = Path.Combine(in_path, in_sheet.WorksheetName + ".json").Replace('\\', '/');

            using (
                var fs = File.Open(jsonPath,
                                   File.Exists(jsonPath) ? FileMode.Truncate : FileMode.OpenOrCreate,
                                   FileAccess.Write))
            {
                using (var sw = new StreamWriter(fs))
                {
                    var fileString = ExportJsonObjectString(in_sheet, in_options, false);
                    sw.Write(fileString);
                    sw.Flush();
                }
            }

            if (in_options.JSONExportClass)
            {
                var jsonClassDir = in_path + "\\Resources";
                if (!Directory.Exists(jsonClassDir))
                {
                    Directory.CreateDirectory(jsonClassDir);
                }

                var jsonClassPath = Path.Combine(jsonClassDir, in_sheet.WorksheetName + ".cs").Replace('\\', '/');

                using (
                    var fs = File.Open(jsonClassPath,
                                       File.Exists(jsonClassPath) ? FileMode.Truncate : FileMode.OpenOrCreate,
                                       FileAccess.Write))
                {
                    using (var sw = new StreamWriter(fs))
                    {
                        var fileString = ExportJsonObjectClassString(in_sheet, in_options);
                        sw.Write(fileString);
                        sw.Flush();
                    }
                }
            }

            PushNotification("Saving to: " + in_path);
        }
Пример #6
0
        public static string ExportNGUIString(Google2uWorksheet in_sheet, Google2uExportOptions in_options)
        {
            // for each page
            var ret = string.Empty;
            var rowCt = in_sheet.Rows.Count;
            if (rowCt <= 0) return ret;
            // Iterate through each row, printing its cell values.
            foreach (var row in in_sheet.Rows)
            {
                var rowType = row[0].GetTypeFromValue();
                var rowHeader = row[0].CellValueString;
                if (string.IsNullOrEmpty(rowHeader))
                    // if this header is empty
                {
                    if (in_options.NGUICullRows)
                        break;
                    continue;
                }

                if (rowType == SupportedType.Void ||
                    rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                    // if this cell is void, then skip the row completely
                {
                    continue;
                }

                // Iterate over the remaining columns, and print each cell value
                for (var i = 0; i < in_sheet.Rows[0].Count; i++)
                {
                    if ((row[i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(row[0].CellValueString) ||
                             in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(in_sheet.Rows[0][i].CellValueString) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("void", StringComparison.InvariantCultureIgnoreCase) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("ignore", StringComparison.InvariantCultureIgnoreCase) ||
                             (in_options.NGUICullColumns && i >= in_sheet.FirstBlankCol)))
                    {
                        continue;
                    }

                    var tmpRet = in_options.EscapeNGUIStrings
                        ? SanitizeDf(row[i].CellValueString)
                        : AutoQuote(row[i].CellValueString);

                    if (in_options.NGUIConvertLineBreaks)
                        tmpRet = ConvertLineBreaks(tmpRet);


                    ret += tmpRet;

                    ret += ",";
                }
                ret = ret.Remove(ret.Length - 1); // remove the last comma
                ret += Environment.NewLine;
            }
            return ret;
        }
Пример #7
0
        public static void ExportNGUILegacy(Google2uWorksheet in_sheet, string in_path, Google2uExportOptions in_options)
        {
            if (!Directory.Exists(in_path))
            {
                Directory.CreateDirectory(in_path);
            }

            var finalCol = in_sheet.Rows[0].Count;

            if (in_options.NGUICullColumns)
            {
                finalCol = in_sheet.FirstBlankCol;
            }

            var languages = new List <string>();

            for (var j = 1; j < in_sheet.Rows[0].Count - 1; ++j)
            {
                if (j == finalCol)
                {
                    break;
                }
                languages.Add(in_sheet.Rows[0][j].CellValueString);
            }

            foreach (var lang in languages)
            {
                var filepath = in_path + "/" + lang + ".txt";


                using (
                    var fs = File.Open(filepath,
                                       File.Exists(filepath) ? FileMode.Truncate : FileMode.OpenOrCreate,
                                       FileAccess.Write))
                {
                    using (var sw = new StreamWriter(fs))
                    {
                        var langIndex = 0;
                        for (var index = 0; index < in_sheet.Rows[0].Cells.Count; index++)
                        {
                            var cell = in_sheet.Rows[0].Cells[index];
                            if (cell.CellValueString.Equals(lang))
                            {
                                langIndex = index;
                                break;
                            }
                        }
                        sw.Write(ExportNGUILegacyString(in_sheet, in_options, langIndex));
                        sw.Flush();
                    }
                }
            }
        }
        public void QueryWorksheets(object in_workbook)
        {
            var myWorkbook = in_workbook as Google2uManualWorkbook;
            if (myWorkbook == null) return;

            myWorkbook.Worksheets.Clear();
            foreach (var entry in myWorkbook.Workbook.Entries)
            {
                var ws = new Google2uWorksheet(entry as WorksheetEntry, _Service, this);
                myWorkbook.Worksheets.Add(ws);
                if (myWorkbook.ActiveWorksheetIndex == -1)
                    myWorkbook.ActiveWorksheetIndex = 0;
            }
            myWorkbook.WorksheetQueryStatus = QueryStatus.QueryComplete;
        }
        public static void ExportNGUILegacy(Google2uWorksheet in_sheet, string in_path, Google2uExportOptions in_options)
        {
            if (!Directory.Exists(in_path))
                Directory.CreateDirectory(in_path);

            var finalCol = in_sheet.Rows[0].Count;
            if (in_options.NGUICullColumns)
                finalCol = in_sheet.FirstBlankCol;

            var languages = new List<string>();
            for (var j = 1; j < in_sheet.Rows[0].Count - 1; ++j)
            {
                if (j == finalCol)
                    break;
                languages.Add(in_sheet.Rows[0][j].CellValueString);
            }

            foreach (var lang in languages)
            {
                var filepath = in_path + "/" + lang + ".txt";

                using (
                    var fs = File.Open(filepath,
                        File.Exists(filepath) ? FileMode.Truncate : FileMode.OpenOrCreate,
                        FileAccess.Write))
                {
                    using (var sw = new StreamWriter(fs))
                    {
                        var langIndex = 0;
                        for (var index = 0; index < in_sheet.Rows[0].Cells.Count; index++)
                        {
                            var cell = in_sheet.Rows[0].Cells[index];
                            if (cell.CellValueString.Equals(lang))
                            {
                                langIndex = index;
                                break;
                            }
                        }
                        sw.Write(ExportNGUILegacyString(in_sheet, in_options, langIndex));
                        sw.Flush();
                    }
                }
            }
        }
Пример #10
0
        public static void CalculateColumnWidth(int in_col, Google2uWorksheet in_worksheet)
        {
            var longest       = 0;
            var longestString = string.Empty;

            foreach (var row in in_worksheet.RowsDisplay)
            {
                var cell = row[in_col];
                var len  = cell.CellValueLength;
                if (len <= longest)
                {
                    continue;
                }

                longest       = len;
                longestString = cell.CellValueString;
            }
            var strlen = GUIStyle.none.CalcSize(new GUIContent(longestString));

            in_worksheet.ColOptions[in_col].Width = Math.Max(26, (int)Math.Round(strlen.x + 0.5f) + 16);
        }
Пример #11
0
        public void QueryWorksheets(object in_workbook)
        {
            var myWorkbook = in_workbook as Google2uManualWorkbook;

            if (myWorkbook == null)
            {
                return;
            }

            myWorkbook.Worksheets.Clear();
            foreach (var entry in myWorkbook.Workbook.Entries)
            {
                var ws = new Google2uWorksheet(entry as WorksheetEntry, _Service, this);
                myWorkbook.Worksheets.Add(ws);
                if (myWorkbook.ActiveWorksheetIndex == -1)
                {
                    myWorkbook.ActiveWorksheetIndex = 0;
                }
            }
            myWorkbook.WorksheetQueryStatus = QueryStatus.QueryComplete;
        }
Пример #12
0
        public static string ExportNGUILegacyString(Google2uWorksheet in_sheet, Google2uExportOptions in_options,
            int in_langIndex)
        {
            var ret = FormatLine("Flag = Flag-" + in_sheet.Rows[0][in_langIndex].CellValueString);
            for (var i = 1; i < in_sheet.Rows.Count - 1; ++i)
            {
                var row = in_sheet.Rows[i];
                if (string.IsNullOrEmpty(row.Cells[0].CellValueString) && in_options.NGUICullRows)
                    break;

                var tmpRet = in_options.EscapeNGUIStrings
                    ? SanitizeDf(row.Cells[in_langIndex].CellValueString)
                    : row.Cells[in_langIndex].CellValueString;

                if (in_options.NGUIConvertLineBreaks)
                    tmpRet = ConvertLineBreaks(tmpRet);

                ret += FormatLine(row.Cells[0].CellValueString + " = " + tmpRet);
            }
            return ret;
        }
Пример #13
0
        public static void ExportStaticDB(Google2uWorksheet in_sheet, string in_path, string in_fileName, Google2uExportOptions in_options)
        {
            if (!Directory.Exists(in_path))
                Directory.CreateDirectory(in_path);

            var className = Path.GetInvalidFileNameChars().Aggregate(in_sheet.WorksheetName, (in_current, in_c) => in_current.Replace(in_c, '_'));

            var arrayDelimiter = in_options.DelimiterOptions[in_options.ArrayDelimiters];
            var stringArrayDelimiter = in_options.DelimiterOptions[in_options.StringArrayDelimiters];
            var complexTypeDelimiter = in_options.DelimiterOptions[in_options.ComplexTypeDelimiters];
            var complexTypeArrayDelimiters = in_options.DelimiterOptions[in_options.ComplexArrayDelimiters];

            var typesInFirstRow = in_sheet.UseTypeRow;


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

            using (var fs = File.Open(Path.Combine(in_path, className + ".cs"), FileMode.Create, FileAccess.Write))
            {
                using (var sw = new StreamWriter(fs))
                {

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

                    fileString += FormatLine("//----------------------------------------------");
                    fileString += FormatLine("//    Google2u: Google Doc Unity integration");
                    fileString += FormatLine("//         Copyright © 2015 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 Google2u");
                    fileString += FormatLine("{");
                    fileString += FormatLine("	[System.Serializable]");
                    fileString += FormatLine("	public class " + className + "Row : IGoogle2uRow");
                    fileString += FormatLine("	{");

                    // variable declarations
                    for (int i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        var rowType = in_sheet.Rows[0][i].MyType;
                        var rowHeader = in_sheet.Rows[0][i].CellValueString;

                        if (rowType == SupportedType.Void ||
                            string.IsNullOrEmpty(MakeValidVariableName(rowHeader, in_options.LowercaseHeader)) ||
                            (in_options.StaticDBCullColumns && i > in_sheet.FirstBlankCol)) 
                        { 
                            continue;
                        }

                        if (IsSupportedArrayType(rowType))
                            fileString += FormatLine("		public System.Collections.Generic.List<" + StringSupportedType(rowType) + "> " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " = new System.Collections.Generic.List<" + StringSupportedType(rowType) + ">();");
                        else
                            fileString += FormatLine("		public " + StringSupportedType(rowType) + " " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ";");
                    }

                    // constructor parameter list
                    fileString += ("		public " + className + "Row(");
                    {
                        var firstItem = true;
                        for (var i = 0; i < in_sheet.Rows[0].Count; i++)
                        {
                            var rowType = in_sheet.Rows[0][i].MyType;
                            var rowHeader = in_sheet.Rows[0][i].CellValueString;

                            if (rowType == SupportedType.Void ||
                                string.IsNullOrEmpty(MakeValidVariableName(rowHeader, in_options.LowercaseHeader)) ||
                                (in_options.StaticDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;

                            if (!firstItem)
                                fileString += (", ");
                            firstItem = false;
                            fileString += ("string _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader));
                        }
                    }
                    fileString += FormatLine(") " + System.Environment.NewLine + "		{");


                    // processing each of the input parameters and copying it into the members
                    for (int i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        var rowType = in_sheet.Rows[0][i].MyType;
                        var rowHeader = in_sheet.Rows[0][i].CellValueString;

                        //nightmare time
                        if (rowType == SupportedType.Void ||
                            string.IsNullOrEmpty(MakeValidVariableName(rowHeader, in_options.LowercaseHeader)) ||
                            (in_options.StaticDBCullColumns && i > in_sheet.FirstBlankCol))
                        {
                            continue;
                        }

                        if (rowType == SupportedType.GameObject)
                        {
                            fileString += FormatLine("			" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " = GameObject.Find(\"" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                        }
                        else if (rowType == SupportedType.Bool)
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("			" + StringSupportedType(rowType) + " res;");
                            fileString += FormatLine("				if(" + StringSupportedType(rowType) + ".TryParse(_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ", out res))");
                            fileString += FormatLine("					" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " = res;");
                            fileString += FormatLine("				else");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Failed To Convert " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " string: \"+ _" +
                                           MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " +\" to bool\");");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Byte)
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("			" + StringSupportedType(rowType) + " res;");
                            fileString += FormatLine("				if(" + StringSupportedType(rowType) + ".TryParse(_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ", out res))");
                            fileString += FormatLine("					" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " = res;");
                            fileString += FormatLine("				else");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Failed To Convert " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " string: \"+ _" +
                                           MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " +\" to byte\");");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Float)
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("			" + StringSupportedType(rowType) + " res;");
                            fileString += FormatLine("				if(" + StringSupportedType(rowType) + ".TryParse(_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ", out res))");
                            fileString += FormatLine("					" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " = res;");
                            fileString += FormatLine("				else");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Failed To Convert " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " string: \"+ _" +
                                           MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " +\" to " + StringSupportedType(rowType) + "\");");
                            fileString += FormatLine("			}");
                        }
                        else if ((rowType == SupportedType.ByteArray)
                                    || (rowType == SupportedType.BoolArray)
                                    || (rowType == SupportedType.FloatArray))
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("				" + StringSupportedType(rowType) + " res;");
                            fileString +=
                                FormatLine("				string []result = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" + arrayDelimiter +
                                           "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                            fileString += FormatLine("				{");
                            fileString += FormatLine("					if(" + StringSupportedType(rowType) + ".TryParse(result[i], out res))");
                            fileString += FormatLine("						" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add(res);");
                            fileString += FormatLine("					else");
                            fileString += FormatLine("					{");
                            if (rowType == SupportedType.ByteArray)
                                fileString += FormatLine("						" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( 0 );");
                            else if (rowType == SupportedType.BoolArray)
                                fileString += FormatLine("						" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( false );");
                            else if (rowType == SupportedType.FloatArray)
                                fileString += FormatLine("						" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( float.NaN );");
                            fileString +=
                                FormatLine("						Debug.LogError(\"Failed To Convert " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) +
                                           " string: \"+ result[i] +\" to " + (StringSupportedType(rowType)) + "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Int)
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("			" + StringSupportedType(rowType) + " res;");
                            fileString += FormatLine("				if(int.TryParse(_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ", out res))");
                            fileString += FormatLine("					" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " = res;");
                            fileString += FormatLine("				else");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Failed To Convert " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " string: \"+ _" +
                                           MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " +\" to int\");");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.IntArray)
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("				" + (StringSupportedType(rowType)) + " res;");
                            fileString +=
                                FormatLine("				string []result = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" + arrayDelimiter +
                                           "\".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("						" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( res );");
                            fileString += FormatLine("					else");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( 0 );");
                            fileString +=
                                FormatLine("						Debug.LogError(\"Failed To Convert " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) +
                                           " string: \"+ result[i] +\" to " + (StringSupportedType(rowType)) + "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.String)
                        {
                            if (in_options.TrimStrings)
                                fileString += FormatLine("			" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Trim();");
                            else
                                fileString += FormatLine("			" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ";");
                        }
                        else if (rowType == SupportedType.StringArray)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" + stringArrayDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                            fileString += FormatLine("				{");
                            if (in_options.TrimStringArrays)
                                fileString += FormatLine("					" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( result[i].Trim() );");
                            else
                                fileString += FormatLine("					" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( result[i] );");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Vector2)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 2)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) + " in \" + _" +
                                           MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".x = results[0];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".y = results[1];");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Vector2Array)
                        {
                            fileString += FormatLine("			{");

                            fileString +=
                                FormatLine("				string []result = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 2)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) +
                                           " in \" + _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString +=
                                FormatLine("		        		" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( new " + (StringSupportedType(rowType)) +
                                           "(results[0], results[1] ));");
                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Vector3)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 3)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) + " in \" + _" +
                                           MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".x = results[0];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".y = results[1];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".z = results[2];");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Vector3Array)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 3)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) +
                                           " in \" + _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString +=
                                FormatLine("		        	" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( new " + (StringSupportedType(rowType)) +
                                           "(results[0], results[1], results[2] ));");

                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Color)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) + " in \" + _" +
                                           MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".r = results[0];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".g = results[1];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".b = results[2];");
                            fileString += FormatLine("				if(splitpath.Length == 4)");
                            fileString += FormatLine("					" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".a = results[3];");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.ColorArray)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) +
                                           " in \" + _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString += FormatLine("		        		if(splitpath.Length == 3)");
                            fileString +=
                                FormatLine("		        		" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( new " + (StringSupportedType(rowType)) +
                                           "(results[0], results[1], results[2] ));");
                            fileString += FormatLine("		        		else");
                            fileString +=
                                FormatLine("		        		" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( new " + (StringSupportedType(rowType)) +
                                           "(results[0], results[1], results[2], results[3] ));");

                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Color32)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) + " in \" + _" +
                                           MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".r = results[0];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".g = results[1];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".b = results[2];");
                            fileString += FormatLine("				if(splitpath.Length == 4)");
                            fileString += FormatLine("					" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".a = results[3];");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Color32Array)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) +
                                           " in \" + _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString += FormatLine("		        		if(splitpath.Length == 3)");
                            fileString +=
                                FormatLine("		        		    " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( new " + (StringSupportedType(rowType)) +
                                           "(results[0], results[1], results[2], System.Convert.ToByte(0) ));");
                            fileString += FormatLine("		        		else");
                            fileString +=
                                FormatLine("		        		    " + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( new " + (StringSupportedType(rowType)) +
                                           "(results[0], results[1], results[2], results[3] ));");

                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.Quaternion)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 4)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) + " in \" + _" +
                                           MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".x = results[0];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".y = results[1];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".z = results[2];");
                            fileString += FormatLine("				" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".w = results[3];");
                            fileString += FormatLine("			}");
                        }
                        else if (rowType == SupportedType.QuaternionArray)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " + StringSupportedType(rowType) +
                                           " in \" + _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " );");
                            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 \" + "
                                                     + "_" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString +=
                                FormatLine("		        		" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ".Add( new " + (StringSupportedType(rowType)) +
                                           "(results[0], results[1], results[2], results[3] ));");
                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else
                        {
                            fileString += FormatLine("			" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + " = _" + MakeValidVariableName(rowHeader, in_options.LowercaseHeader) + ";");
                        }
                    }
                    fileString += FormatLine("		}");

                    fileString += FormatLine(System.String.Empty);
                    {

                        int colCount = 0;

                        for (int i = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                                string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString, in_options.LowercaseHeader)) ||
                                (in_options.StaticDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;
                            colCount++;
                        }
                        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 (int i = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                                string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString, in_options.LowercaseHeader)) ||
                                (in_options.StaticDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;
                            fileString += FormatLine("				case " + colNum++ + ":");
                            fileString += FormatLine("					ret = " + MakeValidVariableName(in_sheet.Rows[0][i].CellValueString, in_options.LowercaseHeader) + ".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;");
                    if (in_options.LowercaseHeader)
                        fileString += FormatLine("			switch( colID.ToLower() )");
                    else
                        fileString += FormatLine("			switch( colID )");
                    fileString += FormatLine("			{");

                    for (int i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                                string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString, in_options.LowercaseHeader)) ||
                                (in_options.StaticDBCullColumns && i > in_sheet.FirstBlankCol))
                            continue;
                        fileString += FormatLine("				case \"" + (in_sheet.Rows[0][i].CellValueString) + "\":");
                        fileString += FormatLine("					ret = " + MakeValidVariableName(in_sheet.Rows[0][i].CellValueString, in_options.LowercaseHeader) + ".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 = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                                string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString, in_options.LowercaseHeader)) ||
                                (in_options.StaticDBCullColumns && i > in_sheet.FirstBlankCol))
                            continue;
                        fileString += FormatLine("			ret += \"{\" + \"" + (in_sheet.Rows[0][i].CellValueString) + "\" + \" : \" + " + MakeValidVariableName(in_sheet.Rows[0][i].CellValueString, in_options.LowercaseHeader) + ".ToString() + \"} \";");
                    }
                    fileString += FormatLine("			return ret;");
                    fileString += FormatLine("		}");

                    fileString += FormatLine("	}");



                    ///////////////////////////////////////////////////////////////////////////////
                    // the database class itself, this contains the rows defined above
                    fileString += FormatLine("	public sealed class " + className + " : IGoogle2uDB");
                    fileString += FormatLine("	{");


                    // this is the enums, the enum matches the name of the row
                    fileString += FormatLine("		public enum rowIds {");
                    fileString += ("			");

                    {
                        int curRow = 0;
                        // Iterate through each row, printing its cell values to be the enum names.
                        foreach (var row in in_sheet.Rows)
                        {
                            if (curRow == 0 || (in_sheet.UseTypeRow && curRow == 1))
                            {
                                curRow++;
                                continue;
                            }

                            var rowType = row[0].MyType;
                            var rowHeader = row[0].CellValueString;
                            if (string.IsNullOrEmpty(rowHeader))
                            // if this header is empty
                            {
                                if (in_options.StaticDBCullRows)
                                    break;
                                continue;
                            }

                            if (rowType == SupportedType.Void ||
                    rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                            // if this cell is void, then skip the row completely
                            {
                                continue;
                            }

                            fileString += rowHeader;
                            if ((curRow + 1) % 20 == 0)
                                fileString += System.Environment.NewLine + "			";
                            fileString += (", ");
                            curRow++;
                        }
                    }
                    fileString = fileString.Remove(fileString.Length - 2); // remove the last comma

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



                    fileString += FormatLine("		public string [] rowNames = {");
                    fileString += "			";
                    // Iterate through each row, printing its cell values for the row names strings.
                    {
                        int curRow = 0;
                        foreach (var row in in_sheet.Rows)
                        {
                            if (curRow == 0 || (in_sheet.UseTypeRow && curRow == 1))
                            {
                                curRow++;
                                continue;
                            }

                            var rowType = row[0].MyType;
                            var rowHeader = row[0].CellValueString;
                            if (string.IsNullOrEmpty(rowHeader))
                            // if this header is empty
                            {
                                if (in_options.StaticDBCullRows)
                                    break;
                                curRow++;
                                continue;
                            }

                            if (rowType == SupportedType.Void ||
                    rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                            // if this cell is void, then skip the row completely
                            {
                                curRow++;
                                continue;
                            }

                            fileString += "\"" + rowHeader + "\"";
                            if ((curRow + 1) % 20 == 0)
                                fileString += System.Environment.NewLine + "			";
                            fileString += ", ";
                            curRow++;
                        }
                    }
                    fileString = fileString.Remove(fileString.Length - 2); // remove the last comma
                    fileString += FormatLine(System.Environment.NewLine + "		};");
                    // the declaration of the storage for the row data
                    fileString += FormatLine("		public System.Collections.Generic.List<" + className + "Row> Rows = new System.Collections.Generic.List<" + className + "Row>();");

                    // declare the instance as well as the get functionality
                    fileString += FormatLine(System.String.Empty);
                    fileString += FormatLine("		public static " + className + " Instance");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			get { return Nested" + className + ".instance; }");
                    fileString += FormatLine("		}");
                    fileString += FormatLine(System.String.Empty);
                    fileString += FormatLine("		private class Nested" + className + "");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			static Nested" + className + "() { }");
                    fileString += FormatLine("			internal static readonly " + className + " instance = new " + className + "();");
                    fileString += FormatLine("		}");
                    fileString += FormatLine(System.String.Empty);
                    fileString += FormatLine("		private " + className + "()");
                    fileString += FormatLine("		{");

                    var rowCt = 0;
                    // Iterate through each row, printing its cell values.

                    for (int i = 0; i < in_sheet.Rows.Count; i++)
                    {
                        // skip the first row. This is the title row, and we can get the values later
                        if (rowCt == 0 || (typesInFirstRow && rowCt == 1))
                        {
                            rowCt++;
                            continue;
                        }

                        var rowType = in_sheet.Rows[i][0].MyType;
                        var rowHeader = in_sheet.Rows[i][0].CellValueString;
                        if (string.IsNullOrEmpty(rowHeader))
                        // if this header is empty
                        {
                            if (in_options.StaticDBCullRows)
                                break;
                            rowCt++;
                            continue;
                        }

                        if (rowType == SupportedType.Void ||
                    rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                        // if this cell is void, then skip the row completely
                        {
                            rowCt++;
                            continue;
                        }

                        // Iterate over the remaining columns, and print each cell value

                        fileString += "			Rows.Add( new " + className + "Row(";

                        for (int j = 0; j < in_sheet.Rows[0].Count; j++)
                        {
                            if ((j != 0) && 
                                (in_sheet.Rows[i][j].MyType == SupportedType.Void ||
                                string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][j].CellValueString, in_options.LowercaseHeader)) ||
                                (in_options.StaticDBCullColumns && j > in_sheet.FirstBlankCol)))
                            {
                                continue;
                            }

                            fileString += ToLiteral(in_sheet.Rows[i][j].CellValueString) + ", ";
                        }
                        fileString = fileString.Remove(fileString.Length - 2); // remove the last comma
                        fileString += FormatLine("));");

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


                    fileString += FormatLine("		public IGoogle2uRow GetGenRow(string in_RowString)");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			IGoogle2uRow 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 IGoogle2uRow GetGenRow(rowIds in_RowID)");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			IGoogle2uRow 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 " + className + "Row GetRow(rowIds in_RowID)");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			" + className + "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 " + className + "Row GetRow(string in_RowString)");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			" + className + "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();
    
                } // Using streamwriter

            } // Using FileSystem

            PushNotification("Saving to: " + in_path);
        }
Пример #14
0
 public DataValidationParams(Google2uWorksheet in_worksheet, Google2uExportOptions in_options)
 {
     Worksheet = in_worksheet;
     Options   = in_options;
 }
Пример #15
0
        public static void ExportObjectDb(Google2uWorksheet in_sheet, string in_resourcesPath, string in_editorPath,
            string in_playmakerPath, Google2uExportOptions in_options)
        {
            if (!Directory.Exists(in_resourcesPath))
                Directory.CreateDirectory(in_resourcesPath);

            if (!Directory.Exists(in_editorPath))
                Directory.CreateDirectory(in_editorPath);


            var arrayDelimiter = in_options.DelimiterOptions[in_options.ArrayDelimiters];
            var stringArrayDelimiter = in_options.DelimiterOptions[in_options.StringArrayDelimiters];
            var complexTypeDelimiter = in_options.DelimiterOptions[in_options.ComplexTypeDelimiters];
            var complexTypeArrayDelimiters = in_options.DelimiterOptions[in_options.ComplexArrayDelimiters];

            var typesInFirstRow = in_sheet.UseTypeRow;

            ///////////////////////////////////////////////
            // open the file 
            var className = Path.GetInvalidFileNameChars()
                .Aggregate(in_sheet.WorksheetName, (in_current, in_c) => in_current.Replace(in_c, '_'));

            var exportInfo = new Google2uObjDbExport {Data = in_sheet, CullEmptyRows = in_options.ObjectDBCullRows, CullEmptyCols = in_options.ObjectDBCullColumns};

            var overrideName = in_options.GetOverrideObjectDatabaseGameObjectName(in_sheet.WorksheetName);

            exportInfo.ObjectName = string.IsNullOrEmpty(overrideName)
                ? (string.IsNullOrEmpty(in_options.ExportDatabaseGameObjectName)
                    ? "Google2uDatabase"
                    : in_options.ExportDatabaseGameObjectName)
                : overrideName;

            exportInfo.ScriptName = className;

            using (var fs = File.Open(Path.Combine(in_resourcesPath, className + ".cs"),
                File.Exists(Path.Combine(in_resourcesPath, className + ".cs"))
                    ? FileMode.Truncate
                    : FileMode.OpenOrCreate,
                FileAccess.Write))
            {
                using (var sw = new StreamWriter(fs))
                {
                    var fileString = string.Empty;

                    fileString += FormatLine("//----------------------------------------------");
                    fileString += FormatLine("//    Google2u: Google Doc Unity integration");
                    fileString += FormatLine("//         Copyright © 2015 Litteratus");
                    fileString += FormatLine("//");
                    fileString += FormatLine("//        This file has been auto-generated");
                    fileString += FormatLine("//              Do not manually edit");
                    fileString += FormatLine("//----------------------------------------------");
                    fileString += FormatLine(string.Empty);
                    fileString += FormatLine("using UnityEngine;");
                    fileString += FormatLine("using System.Globalization;");
                    fileString += FormatLine(string.Empty);
                    fileString += FormatLine("namespace Google2u");
                    fileString += FormatLine("{");
                    fileString += FormatLine("	[System.Serializable]");
                    fileString += FormatLine("	public class " + className + "Row : IGoogle2uRow");
                    fileString += FormatLine("	{");

                    // variable declarations
                    for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                            string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader)) ||
                            (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                        {
                        }
                        else if (IsSupportedArrayType(in_sheet.Rows[0][i].MyType))
                        {
                            fileString +=
                                FormatLine("		public System.Collections.Generic.List<" +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) + "> " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " = new System.Collections.Generic.List<" +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) + ">();");
                        }
                        else
                            fileString +=
                                FormatLine("		public " + StringSupportedType(in_sheet.Rows[0][i].MyType) + " " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ";");
                    }

                    // constructor parameter list
                    fileString += ("		public " + className + "Row(");
                    {
                        var firstItem = true;
                        for (var i = 0; i < in_sheet.Rows[0].Count; i++)
                        {
                            if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                                string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                    in_options.LowercaseHeader)) ||
                                (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;

                            if (!firstItem)
                                fileString += (", ");
                            firstItem = false;
                            fileString += ("string _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader));
                        }
                    }
                    fileString += FormatLine(") " + Environment.NewLine + "		{");

                    // processing each of the input parameters and copying it into the members
                    for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        //nightmare time
                        if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                            string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader)) ||
                            (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                        {
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.GameObject)
                        {
                            fileString +=
                                FormatLine("			" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " = GameObject.Find(\"" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + "\");");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Bool)
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("			" + StringSupportedType(in_sheet.Rows[0][i].MyType) + " res;");
                            fileString +=
                                FormatLine("				if(" + StringSupportedType(in_sheet.Rows[0][i].MyType) + ".TryParse(_" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ", out res))");
                            fileString +=
                                FormatLine("					" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " = res;");
                            fileString += FormatLine("				else");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Failed To Convert " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " string: \"+ _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " +\" to bool\");");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Byte)
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("			" + StringSupportedType(in_sheet.Rows[0][i].MyType) + " res;");
                            fileString +=
                                FormatLine("				if(" + StringSupportedType(in_sheet.Rows[0][i].MyType) + ".TryParse(_" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ", NumberStyles.Any, CultureInfo.InvariantCulture, out res))");
                            fileString +=
                                FormatLine("					" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " = res;");
                            fileString += FormatLine("				else");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Failed To Convert " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " string: \"+ _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " +\" to byte\");");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Float)
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("			" + StringSupportedType(in_sheet.Rows[0][i].MyType) + " res;");
                            fileString +=
                                FormatLine("				if(" + StringSupportedType(in_sheet.Rows[0][i].MyType) + ".TryParse(_" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ", NumberStyles.Any, CultureInfo.InvariantCulture, out res))");
                            fileString +=
                                FormatLine("					" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " = res;");
                            fileString += FormatLine("				else");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Failed To Convert " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " string: \"+ _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + " +\" to " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) + "\");");
                            fileString += FormatLine("			}");
                        }
                        else if ((in_sheet.Rows[0][i].MyType == SupportedType.ByteArray)
                                 || (in_sheet.Rows[0][i].MyType == SupportedType.BoolArray)
                                 || (in_sheet.Rows[0][i].MyType == SupportedType.FloatArray))
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("				" + StringSupportedType(in_sheet.Rows[0][i].MyType) + " res;");
                            fileString +=
                                FormatLine("				string []result = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           arrayDelimiter +
                                           "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                            fileString += FormatLine("				{");
                            if (in_sheet.Rows[0][i].MyType == SupportedType.BoolArray)
                                fileString +=
                                    FormatLine("					if(" + StringSupportedType(in_sheet.Rows[0][i].MyType) +
                                               ".TryParse(result[i], out res))");
                            else
                                fileString +=
                                    FormatLine("					if(" + StringSupportedType(in_sheet.Rows[0][i].MyType) +
                                               ".TryParse(result[i], NumberStyles.Any, CultureInfo.InvariantCulture, out res))");

                            fileString +=
                                FormatLine("						" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".Add(res);");
                            fileString += FormatLine("					else");
                            fileString += FormatLine("					{");
                            if (in_sheet.Rows[0][i].MyType == SupportedType.ByteArray)
                                fileString +=
                                    FormatLine("						" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               ".Add( 0 );");
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.BoolArray)
                                fileString +=
                                    FormatLine("						" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               ".Add( false );");
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.FloatArray)
                                fileString +=
                                    FormatLine("						" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               ".Add( float.NaN );");
                            fileString +=
                                FormatLine("						Debug.LogError(\"Failed To Convert " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " string: \"+ result[i] +\" to " +
                                           (StringSupportedType(in_sheet.Rows[0][i].MyType)) + "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Int)
                        {
                            fileString += FormatLine("			{");
                            fileString += FormatLine("			" + StringSupportedType(in_sheet.Rows[0][i].MyType) + " res;");
                            fileString +=
                                FormatLine("				if(int.TryParse(_" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ", NumberStyles.Any, CultureInfo.InvariantCulture, out res))");
                            fileString +=
                                FormatLine("					" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " = res;");
                            fileString += FormatLine("				else");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Failed To Convert " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " string: \"+ _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " +\" to int\");");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.IntArray)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				" + (StringSupportedType(in_sheet.Rows[0][i].MyType)) + " res;");
                            fileString +=
                                FormatLine("				string []result = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           arrayDelimiter +
                                           "\".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                            fileString += FormatLine("				{");
                            fileString +=
                                FormatLine(
                                    "					if(int.TryParse(result[i], NumberStyles.Any, CultureInfo.InvariantCulture, out res))");
                            fileString +=
                                FormatLine("						" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".Add( res );");
                            fileString += FormatLine("					else");
                            fileString += FormatLine("					{");
                            fileString +=
                                FormatLine("						" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".Add( 0 );");
                            fileString +=
                                FormatLine("						Debug.LogError(\"Failed To Convert " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " string: \"+ result[i] +\" to " +
                                           (StringSupportedType(in_sheet.Rows[0][i].MyType)) + "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.String)
                        {
                            if (in_options.TrimStrings)
                                fileString +=
                                    FormatLine("			" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               " = _" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               ".Trim();");
                            else
                                fileString +=
                                    FormatLine("			" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               " = _" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               ";");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.StringArray)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           stringArrayDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				for(int i = 0; i < result.Length; i++)");
                            fileString += FormatLine("				{");
                            if (in_options.TrimStringArrays)
                                fileString +=
                                    FormatLine("					" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               ".Add( result[i].Trim() );");
                            else
                                fileString +=
                                    FormatLine("					" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               ".Add( result[i] );");
                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector2)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 2)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) + " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out res))");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						results[i] = res;");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("					else ");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".x = results[0];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".y = results[1];");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector2Array)
                        {
                            fileString += FormatLine("			{");

                            fileString +=
                                FormatLine("				string []result = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 2)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) +
                                           " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out temp[j]))");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("      						results[j] = temp[j];");
                            fileString += FormatLine("      					}");
                            fileString += FormatLine("      					else ");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString +=
                                FormatLine("		        		" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".Add( new " + (StringSupportedType(in_sheet.Rows[0][i].MyType)) +
                                           "(results[0], results[1] ));");
                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector3)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 3)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) + " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out res))");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						results[i] = res;");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("					else ");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".x = results[0];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".y = results[1];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".z = results[2];");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector3Array)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 3)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) +
                                           " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out temp[j]))");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("      						results[j] = temp[j];");
                            fileString += FormatLine("      					}");
                            fileString += FormatLine("      					else ");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString +=
                                FormatLine("		        	" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".Add( new " + (StringSupportedType(in_sheet.Rows[0][i].MyType)) +
                                           "(results[0], results[1], results[2] ));");

                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Color)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) + " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out res))");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						results[i] = res;");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("					else ");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".r = results[0];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".g = results[1];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".b = results[2];");
                            fileString += FormatLine("				if(splitpath.Length == 4)");
                            fileString +=
                                FormatLine("					" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".a = results[3];");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.ColorArray)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) +
                                           " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out temp[j]))");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("      						results[j] = temp[j];");
                            fileString += FormatLine("      					}");
                            fileString += FormatLine("      					else ");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString += FormatLine("		        		if(splitpath.Length == 3)");
                            fileString +=
                                FormatLine("		        		" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".Add( new " + (StringSupportedType(in_sheet.Rows[0][i].MyType)) +
                                           "(results[0], results[1], results[2] ));");
                            fileString += FormatLine("		        		else");
                            fileString +=
                                FormatLine("		        		" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".Add( new " + (StringSupportedType(in_sheet.Rows[0][i].MyType)) +
                                           "(results[0], results[1], results[2], results[3] ));");

                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Color32)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) + " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out res))");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						results[i] = res;");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("					else ");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".r = results[0];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".g = results[1];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".b = results[2];");
                            fileString += FormatLine("				if(splitpath.Length == 4)");
                            fileString +=
                                FormatLine("					" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".a = results[3];");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Color32Array)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) +
                                           " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out temp[j]))");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("      						results[j] = temp[j];");
                            fileString += FormatLine("      					}");
                            fileString += FormatLine("      					else ");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString += FormatLine("		        		if(splitpath.Length == 3)");
                            fileString +=
                                FormatLine("		        		    " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Add( new " +
                                           (StringSupportedType(in_sheet.Rows[0][i].MyType)) +
                                           "(results[0], results[1], results[2], System.Convert.ToByte(0) ));");
                            fileString += FormatLine("		        		else");
                            fileString +=
                                FormatLine("		        		    " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Add( new " +
                                           (StringSupportedType(in_sheet.Rows[0][i].MyType)) +
                                           "(results[0], results[1], results[2], results[3] ));");

                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.Quaternion)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string [] splitpath = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("				if(splitpath.Length != 4)");
                            fileString +=
                                FormatLine("					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) + " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out res))");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						results[i] = res;");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("					else ");
                            fileString += FormatLine("					{");
                            fileString += FormatLine("						Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("					}");
                            fileString += FormatLine("				}");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".x = results[0];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".y = results[1];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".z = results[2];");
                            fileString +=
                                FormatLine("				" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".w = results[3];");
                            fileString += FormatLine("			}");
                        }
                        else if (in_sheet.Rows[0][i].MyType == SupportedType.QuaternionArray)
                        {
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("				string []result = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Split(\"" +
                                           complexTypeArrayDelimiters +
                                           "\".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(\"" + complexTypeDelimiter +
                                           "\".ToCharArray(),System.StringSplitOptions.RemoveEmptyEntries);");
                            fileString += FormatLine("      				if(splitpath.Length != 3 && splitpath.Length != 4)");
                            fileString +=
                                FormatLine("      					Debug.LogError(\"Incorrect number of parameters for " +
                                           StringSupportedType(in_sheet.Rows[0][i].MyType) +
                                           " in \" + _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           " );");
                            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], NumberStyles.Any, CultureInfo.InvariantCulture, out temp[j]))");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("      						results[j] = temp[j];");
                            fileString += FormatLine("      					}");
                            fileString += FormatLine("      					else ");
                            fileString += FormatLine("      					{");
                            fileString += FormatLine("	        					Debug.LogError(\"Error parsing \" + "
                                                     + "_" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader)
                                                     +
                                                     " + \" Component: \" + splitpath[i] + \" parameter \" + i + \" of variable "
                                                     +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "\");");
                            fileString += FormatLine("		        			continue;");
                            fileString += FormatLine("		        		}");
                            fileString += FormatLine("		        	}");
                            fileString +=
                                FormatLine("		        		" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".Add( new " + (StringSupportedType(in_sheet.Rows[0][i].MyType)) +
                                           "(results[0], results[1], results[2], results[3] ));");
                            fileString += FormatLine("		        	}");

                            fileString += FormatLine("				}");
                            fileString += FormatLine("			}");
                        }
                        else
                        {
                            fileString +=
                                FormatLine("			" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + " = _" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ";");
                        }
                    }
                    fileString += FormatLine("		}");

                    fileString += FormatLine(string.Empty);
                    {
                        var colCount = 0;

                        for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                                string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                    in_options.LowercaseHeader)) ||
                                (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;
                            colCount++;
                        }
                        fileString += FormatLine("		public int Length { get { return " + colCount + "; } }");
                    }
                    fileString += FormatLine(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(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 = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                                string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                    in_options.LowercaseHeader)) ||
                                (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;
                            fileString += FormatLine("				case " + colNum++ + ":");
                            fileString +=
                                FormatLine("					ret = " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".ToString();");
                            fileString += FormatLine("					break;");
                        }
                    }
                    fileString += FormatLine("			}");
                    fileString += FormatLine(string.Empty);
                    fileString += FormatLine("			return ret;");
                    fileString += FormatLine("		}");
                    fileString += FormatLine(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;");

                    if (in_options.LowercaseHeader)
                        fileString += FormatLine("			switch( colID.ToLower() )");
                    else
                        fileString += FormatLine("			switch( colID )");
                    fileString += FormatLine("			{");

                    for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                            string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader)) ||
                            (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                            continue;
                        fileString +=
                            FormatLine("				case \"" +
                                       MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                           in_options.LowercaseHeader) + "\":");
                        fileString +=
                            FormatLine("					ret = " +
                                       MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                           in_options.LowercaseHeader) +
                                       ".ToString();");
                        fileString += FormatLine("					break;");
                    }

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

                    fileString += FormatLine("		public override string ToString()");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			string ret = System.String.Empty;");
                    for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                            string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader)) ||
                            (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                            continue;
                        fileString +=
                            FormatLine("			ret += \"{\" + \"" +
                                       MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                           in_options.LowercaseHeader) +
                                       "\" + \" : \" + " +
                                       MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                           in_options.LowercaseHeader) +
                                       ".ToString() + \"} \";");
                    }
                    fileString += FormatLine("			return ret;");
                    fileString += FormatLine("		}");

                    fileString += FormatLine("	}");

                    fileString +=
                        FormatLine("	public class " + className + " :  Google2uComponentBase, IGoogle2uDB");
                    fileString += FormatLine("	{");

                    // this is the enums, the enum matches the name of the row
                    fileString += FormatLine("		public enum rowIds {");
                    fileString += ("			");

                    {
                        var curRow = 0;
                        // Iterate through each row, printing its cell values to be the enum names.
                        foreach (var row in in_sheet.Rows)
                        {
                            if (curRow == 0 || (typesInFirstRow && curRow == 1))
                            {
                                curRow++;
                                continue;
                            }

                            var rowType = row[0].MyType;
                            var rowHeader = row[0].CellValueString;
                            if (string.IsNullOrEmpty(rowHeader))
                                // if this header is empty
                            {
                                if (in_options.ObjectDBCullRows)
                                    break;
                                curRow++;
                                continue;
                            }

                            if (rowType == SupportedType.Void ||
                                rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                                // if this cell is void, then skip the row completely
                            {
                                curRow++;
                                continue;
                            }

                            fileString += row[0].CellValueString;
                            if ((curRow + 1)%20 == 0)
                                fileString += Environment.NewLine + "			";
                            fileString += (", ");
                            curRow++;
                        }
                    }
                    fileString = fileString.Remove(fileString.Length - 2); // remove the last comma

                    fileString += FormatLine(string.Empty);
                    fileString += FormatLine("		};");


                    fileString += FormatLine("		public string [] rowNames = {");
                    fileString += "			";
                    // Iterate through each row, printing its cell values for the row names strings.
                    {
                        var curRow = 0;
                        foreach (var row in in_sheet.Rows)
                        {
                            if (curRow == 0 || (typesInFirstRow && curRow == 1))
                            {
                                curRow++;
                                continue;
                            }

                            var rowType = row[0].MyType;
                            var rowHeader = row[0].CellValueString;
                            if (string.IsNullOrEmpty(rowHeader))
                                // if this header is empty
                            {
                                if (in_options.ObjectDBCullRows)
                                    break;
                                curRow++;
                                continue;
                            }

                            if (rowType == SupportedType.Void ||
                                rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                                // if this cell is void, then skip the row completely
                            {
                                curRow++;
                                continue;
                            }

                            fileString += "\"" + row[0].CellValueString + "\"";
                            if ((curRow + 1)%20 == 0)
                                fileString += Environment.NewLine + "			";
                            fileString += ", ";
                            curRow++;
                        }
                    }
                    fileString = fileString.Remove(fileString.Length - 2); // remove the last comma
                    fileString += FormatLine(Environment.NewLine + "		};");
                    // the declaration of the storage for the row data
                    fileString +=
                        FormatLine("		public System.Collections.Generic.List<" + className +
                                   "Row> Rows = new System.Collections.Generic.List<" + className + "Row>();");


                    {
                        // the dont destroy on awake flag
                        if (in_options.UseDoNotDestroy)
                        {
                            fileString += FormatLine(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 " + className + "Row(");
                        {
                            var typeCount = 1;
                            // variable declarations
                            for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                            {
                                if (in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                                    string.IsNullOrEmpty(MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                        in_options.LowercaseHeader)) ||
                                    (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                                    continue;
                                typeCount++;
                            }
                            var firstItem = true;
                            for (var i = 0; i < typeCount; i++)
                            {
                                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 IGoogle2uRow GetGenRow(string in_RowString)");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			IGoogle2uRow 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 IGoogle2uRow GetGenRow(rowIds in_RowID)");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			IGoogle2uRow 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 " + className + "Row GetRow(rowIds in_RowID)");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			" + className + "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 " + className + "Row GetRow(string in_RowString)");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			" + className + "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(string.Empty);
                    fileString += FormatLine("	}");
                    fileString += FormatLine(string.Empty);
                    fileString += FormatLine("}");


                    sw.Write(fileString);
                    sw.Flush();
                } // using StreamWriter
            } // Using Filestream

            exportInfo.LastAttempt = DateTime.Now;
            Instance.ObjDbExport.Add(exportInfo);

            using (var fs = File.Open(Path.Combine(in_editorPath, className + ".cs"),
                File.Exists(Path.Combine(in_editorPath, className + ".cs")) ? FileMode.Truncate : FileMode.OpenOrCreate,
                FileAccess.Write))
            {
                using (var sw = new StreamWriter(fs))
                {
                    var fileString = string.Empty;
                    //////////////////////////////////////////////////////////////////////////////////////////////////////
                    // Writing out the custom inspector
                    //////////////////////////////////////////////////////////////////////////////////////////////////////

                    fileString += FormatLine("using UnityEngine;");
                    fileString += FormatLine("using UnityEditor;");
                    fileString += FormatLine(string.Empty);
                    fileString += FormatLine("namespace Google2u");
                    fileString += FormatLine("{");
                    fileString += FormatLine("	[CustomEditor(typeof(" + className + "))]");
                    fileString += FormatLine("	public class " + className + "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 (var i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        if (in_sheet.Rows[0][i].IsArrayType)
                        {
                            fileString +=
                                FormatLine("		public int " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           "_Index = 0;");
                        }
                    }
                    fileString += FormatLine("		public override void OnInspectorGUI ()");
                    fileString += FormatLine("		{");
                    fileString += FormatLine("			" + className + " s = target as " + className + ";");
                    fileString += FormatLine("			" + className + "Row r = s.Rows[ Index ];");
                    fileString += FormatLine(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(string.Empty);
                    fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                    fileString += FormatLine(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(string.Empty);

                    for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        if (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol)
                            continue;

                        fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");

                        if (in_sheet.Rows[0][i].IsArrayType)
                        {
                            fileString +=
                                FormatLine("			if ( r." +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Count == 0 )");
                            fileString += FormatLine("			{");
                            fileString +=
                                FormatLine("			    GUILayout.Label( \"" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           "\", 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( \"" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           "\", 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 ( " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           "_Index >= r." +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Count )");
                            fileString +=
                                FormatLine("				    " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + "_Index = 0;");
                            // back button
                            fileString += FormatLine("			    if ( GUILayout.Button(\"<\", GUILayout.Width( 18.0f )) )");
                            fileString += FormatLine("			    {");
                            fileString +=
                                FormatLine("			    	" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + "_Index -= 1;");
                            fileString +=
                                FormatLine("			    	if ( " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           "_Index < 0 )");
                            fileString +=
                                FormatLine("			    		" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           "_Index = r." +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           ".Count - 1;");
                            fileString += FormatLine("			    }");

                            fileString += FormatLine("			    EditorGUILayout.LabelField(" +
                                                     MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                         in_options.LowercaseHeader) +
                                                     "_Index.ToString(), GUILayout.Width( 15.0f ));");

                            // fwd button
                            fileString += FormatLine("			    if ( GUILayout.Button(\">\", GUILayout.Width( 18.0f )) )");
                            fileString += FormatLine("			    {");
                            fileString +=
                                FormatLine("			    	" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + "_Index += 1;");
                            fileString +=
                                FormatLine("			    	if ( " +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           "_Index >= r." +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) + ".Count )");
                            fileString +=
                                FormatLine("		        		" +
                                           MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                               in_options.LowercaseHeader) +
                                           "_Index = 0;");
                            fileString += FormatLine("				}");
                        }
                        if (in_sheet.Rows[0][i].MyType != SupportedType.Void)
                        {
                            if (in_sheet.Rows[0][i].MyType == SupportedType.Float)
                            {
                                fileString += FormatLine("			GUILayout.Label( \"" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "\", GUILayout.Width( 150.0f ) );");
                                fileString += FormatLine("			{");
                                fileString += FormatLine("				EditorGUILayout.FloatField( (float)r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + " );");
                                fileString += FormatLine("			}");
                            }
                            else if ((in_sheet.Rows[0][i].MyType == SupportedType.Byte) ||
                                     (in_sheet.Rows[0][i].MyType == SupportedType.Int))
                            {
                                fileString += FormatLine("			GUILayout.Label( \"" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "\", GUILayout.Width( 150.0f ) );");
                                fileString += FormatLine("			{");
                                fileString += FormatLine("				EditorGUILayout.IntField( r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + " );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.BoolArray)
                            {
                                fileString += FormatLine("				EditorGUILayout.Toggle( System.Convert.ToBoolean( r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "_Index] ) );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.StringArray)
                            {
                                fileString += FormatLine("				EditorGUILayout.TextField( r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "_Index] );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.FloatArray)
                            {
                                fileString += FormatLine("				EditorGUILayout.FloatField( (float)r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "_Index] );");
                                fileString += FormatLine("			}");
                            }
                            else if (IsSupportedArrayType(in_sheet.Rows[0][i].MyType) &&
                                     (in_sheet.Rows[0][i].MyType == SupportedType.ByteArray) ||
                                     (in_sheet.Rows[0][i].MyType == SupportedType.IntArray))
                            {
                                fileString += FormatLine("				EditorGUILayout.IntField( r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "_Index] );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Byte)
                            {
                                fileString += FormatLine("			GUILayout.Label( \"" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "\", GUILayout.Width( 150.0f ) );");
                                fileString += FormatLine("			{");
                                fileString += FormatLine("				EditorGUILayout.TextField( System.Convert.ToString( r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         " ) );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Bool)
                            {
                                fileString +=
                                    FormatLine("			GUILayout.Label( \"" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) + "\", GUILayout.Width( 150.0f ) );");
                                fileString += FormatLine("			{");
                                fileString += FormatLine("				EditorGUILayout.Toggle( System.Convert.ToBoolean( r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + " ) );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.String)
                            {
                                fileString += FormatLine("			GUILayout.Label( \"" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "\", GUILayout.Width( 150.0f ) );");
                                fileString += FormatLine("			{");
                                fileString +=
                                    FormatLine("				EditorGUILayout.TextField( r." +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) + " );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.GameObject)
                            {
                                fileString +=
                                    FormatLine("			GUILayout.Label( \"" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) +
                                               "\", GUILayout.Width( 150.0f ) );");
                                fileString += FormatLine("			{");
                                fileString +=
                                    FormatLine("				EditorGUILayout.ObjectField( r." +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) + " );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector2)
                            {
                                fileString +=
                                    FormatLine("			EditorGUILayout.Vector2Field( \"" +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) + "\", r." +
                                               MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                   in_options.LowercaseHeader) + " );");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector2Array)
                            {
                                fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                                fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                                fileString += FormatLine("			EditorGUILayout.Vector2Field( \"\", r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "_Index] );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector3)
                            {
                                fileString += FormatLine("			EditorGUILayout.Vector3Field( \"" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "\", r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + " );");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector3Array)
                            {
                                fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                                fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                                fileString += FormatLine("			EditorGUILayout.Vector3Field( \"\", r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "_Index] );");
                                fileString += FormatLine("			}");
                            }
                            else if ((in_sheet.Rows[0][i].MyType == SupportedType.Color) ||
                                     (in_sheet.Rows[0][i].MyType == SupportedType.Color32))
                            {
                                fileString += FormatLine("			GUILayout.Label( \"" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "\", GUILayout.Width( 150.0f ) );");
                                fileString += FormatLine("			{");
                                fileString += FormatLine("				EditorGUILayout.ColorField( r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + " );");
                                fileString += FormatLine("			}");
                            }
                            else if ((in_sheet.Rows[0][i].MyType == SupportedType.ColorArray) ||
                                     (in_sheet.Rows[0][i].MyType == SupportedType.Color32Array))
                            {
                                fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                                fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                                fileString += FormatLine("			EditorGUILayout.ColorField( \"\", r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "_Index] );");
                                fileString += FormatLine("			}");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Quaternion)
                            {
                                fileString += FormatLine("          Vector4 converted" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) +
                                                         " = new Vector4( r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + ".x, "
                                                         + "r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + ".y, "
                                                         + "r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + ".z, "
                                                         + "r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + ".w ); ");
                                fileString += FormatLine("			EditorGUILayout.Vector4Field( \"" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "\", converted" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + " );");
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.QuaternionArray)
                            {
                                fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                                fileString += FormatLine("			EditorGUILayout.BeginHorizontal();");
                                fileString += FormatLine("          Vector4 converted" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + " = new Vector4( r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "_Index].x, " +
                                                         "r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "_Index].y, " +
                                                         "r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "_Index].z, " +
                                                         "r." +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "[" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + "_Index].w ); ");
                                fileString += FormatLine("			EditorGUILayout.Vector4Field( \"\", converted" +
                                                         MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                                             in_options.LowercaseHeader) + " );");
                                fileString += FormatLine("			}");
                            }
                        }

                        fileString += FormatLine("			EditorGUILayout.EndHorizontal();");
                        fileString += FormatLine(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 (in_options.GeneratePlaymakerActions)
            {
                var playmakerPath = in_playmakerPath;

                using (var fs = File.Open(Path.Combine(playmakerPath, "Get" + className + "DataByID.cs"),
                    File.Exists(Path.Combine(playmakerPath, "Get" + className + "DataByID.cs"))
                        ? FileMode.Truncate
                        : FileMode.OpenOrCreate,
                    FileAccess.Write))
                {
                    using (var sw = new StreamWriter(fs))
                    {
                        /////////////////////////////
                        // Generate the Action for Get*DataByID

                        var fileString = string.Empty;
                        fileString += FormatLine("using UnityEngine;");
                        fileString += FormatLine(string.Empty);

                        fileString += FormatLine("namespace HutongGames.PlayMaker.Actions");
                        fileString += FormatLine("{");
                        fileString += FormatLine("	[ActionCategory(\"Google2u\")]");
                        fileString +=
                            FormatLine("	[Tooltip(\"Gets the specified entry in the " + className +
                                       " Database.\")]");
                        fileString +=
                            FormatLine("	public class Get" + className + "DataByID : FsmStateAction");
                        fileString += FormatLine("	{");
                        fileString += FormatLine("		[RequiredField]");
                        fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                        fileString +=
                            FormatLine("		[Tooltip(\"The object that contains the " + className +
                                       " 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 = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            var fsmvarType = string.Empty;
                            var varType = StringSupportedType(in_sheet.Rows[0][i].MyType);
                            var varName = MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader);

                            if ((in_sheet.Rows[0][i].MyType == SupportedType.Void) ||
                                (IsSupportedArrayType(in_sheet.Rows[0][i].MyType)) ||
                                (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                            {
                                continue;
                            }

                            if (in_sheet.Rows[0][i].MyType == SupportedType.Float)
                            {
                                fsmvarType = "FsmFloat";
                            }
                            else if ((in_sheet.Rows[0][i].MyType == SupportedType.Int) ||
                                     (in_sheet.Rows[0][i].MyType == SupportedType.Byte))
                            {
                                fsmvarType = "FsmInt";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Bool)
                            {
                                fsmvarType = "FsmBool";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.String)
                            {
                                fsmvarType = "FsmString";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.GameObject)
                            {
                                fsmvarType = "FsmGameObject";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector2)
                            {
                                fsmvarType = "FsmVector2";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector3)
                            {
                                fsmvarType = "FsmVector3";
                            }
                            else if ((in_sheet.Rows[0][i].MyType == SupportedType.Color) ||
                                     (in_sheet.Rows[0][i].MyType == SupportedType.Color32))
                            {
                                fsmvarType = "FsmColor";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.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 (var i = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            var varName = MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader);

                            if ((in_sheet.Rows[0][i].MyType == SupportedType.Void) ||
                                IsSupportedArrayType(in_sheet.Rows[0][i].MyType) ||
                                (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;

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

                            if (string.Compare(tmpVarName, "IGNORE", StringComparison.OrdinalIgnoreCase) == 0 ||
                                string.Compare(tmpVarName, "VOID", StringComparison.OrdinalIgnoreCase) == 0)
                                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("				Google2u." + className +
                                       " db = databaseObj.Value.GetComponent<Google2u." +
                                       className + ">();");
                        fileString +=
                            FormatLine("				Google2u." + className +
                                       "Row row = db.GetRow( rowName.Value );");

                        for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            var varName = MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader);

                            if ((in_sheet.Rows[0][i].MyType == SupportedType.Void) ||
                                IsSupportedArrayType(in_sheet.Rows[0][i].MyType) ||
                                (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;

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


                            if (string.Compare(tmpVarName, "IGNORE", StringComparison.OrdinalIgnoreCase) == 0 ||
                                string.Compare(tmpVarName, "VOID", StringComparison.OrdinalIgnoreCase) == 0)
                                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();
                    }
                }

                using (var fs = File.Open(Path.Combine(playmakerPath, "Get" + className + "DataByIndex.cs"),
                    File.Exists(Path.Combine(playmakerPath, "Get" + className + "DataByIndex.cs"))
                        ? FileMode.Truncate
                        : FileMode.OpenOrCreate,
                    FileAccess.Write))
                {
                    using (var sw = new StreamWriter(fs))
                    {
                        var fileString = string.Empty;

                        /////////////////////////////
                        // Generate the Action for Get*DataByIndex
                        fileString += FormatLine("using UnityEngine;");
                        fileString += FormatLine(string.Empty);

                        fileString += FormatLine("namespace HutongGames.PlayMaker.Actions");
                        fileString += FormatLine("{");
                        fileString += FormatLine("	[ActionCategory(\"Google2u\")]");
                        fileString +=
                            FormatLine("	[Tooltip(\"Gets the specified entry in the " + className +
                                       " Database By Index.\")]");
                        fileString +=
                            FormatLine("	public class Get" + className + "DataByIndex : FsmStateAction");
                        fileString += FormatLine("	{");
                        fileString += FormatLine("		[RequiredField]");
                        fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                        fileString +=
                            FormatLine("		[Tooltip(\"The object that contains the " + className +
                                       " 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 = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            var fsmvarType = string.Empty;
                            var varType = StringSupportedType(in_sheet.Rows[0][i].MyType);
                            var varName = MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader);

                            if ((in_sheet.Rows[0][i].MyType == SupportedType.Void) ||
                                IsSupportedArrayType(in_sheet.Rows[0][i].MyType) ||
                                (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                            {
                                continue;
                            }

                            if (in_sheet.Rows[0][i].MyType == SupportedType.Float)
                            {
                                fsmvarType = "FsmFloat";
                            }
                            else if ((in_sheet.Rows[0][i].MyType == SupportedType.Byte) ||
                                     (in_sheet.Rows[0][i].MyType == SupportedType.Int))
                            {
                                fsmvarType = "FsmInt";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Bool)
                            {
                                fsmvarType = "FsmBool";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.String)
                            {
                                fsmvarType = "FsmString";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.GameObject)
                            {
                                fsmvarType = "FsmGameObject";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector2)
                            {
                                fsmvarType = "FsmVector2";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.Vector3)
                            {
                                fsmvarType = "FsmVector3";
                            }
                            else if ((in_sheet.Rows[0][i].MyType == SupportedType.Color) ||
                                     (in_sheet.Rows[0][i].MyType == SupportedType.Color32))
                            {
                                fsmvarType = "FsmColor";
                            }
                            else if (in_sheet.Rows[0][i].MyType == SupportedType.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 (var i = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            var varName = MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader);

                            if ((in_sheet.Rows[0][i].MyType == SupportedType.Void) ||
                                IsSupportedArrayType(in_sheet.Rows[0][i].MyType) ||
                                (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;

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

                            if (string.Compare(tmpVarName, "IGNORE", StringComparison.OrdinalIgnoreCase) == 0 ||
                                string.Compare(tmpVarName, "VOID", StringComparison.OrdinalIgnoreCase) == 0)
                                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("				Google2u." + className +
                                       " db = databaseObj.Value.GetComponent<Google2u." +
                                       className + ">();");

                        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("				Google2u." + className + "Row row = db.Rows[i];");

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

                        for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                        {
                            var varName = MakeValidVariableName(in_sheet.Rows[0][i].CellValueString,
                                in_options.LowercaseHeader);

                            if ((in_sheet.Rows[0][i].MyType == SupportedType.Void) ||
                                IsSupportedArrayType(in_sheet.Rows[0][i].MyType) ||
                                (in_options.ObjectDBCullColumns && i > in_sheet.FirstBlankCol))
                                continue;

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

                            if (string.Compare(tmpVarName, "IGNORE", StringComparison.OrdinalIgnoreCase) == 0 ||
                                string.Compare(tmpVarName, "VOID", StringComparison.OrdinalIgnoreCase) == 0)
                                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();
                    }
                }

                using (var fs = File.Open(Path.Combine(playmakerPath, "Get" + className + "Count.cs"),
                    File.Exists(Path.Combine(playmakerPath, "Get" + className + "Count.cs"))
                        ? FileMode.Truncate
                        : FileMode.OpenOrCreate,
                    FileAccess.Write))
                {
                    using (var sw = new StreamWriter(fs))
                    {
                        /////////////////////////////
                        // Generate the Action for Get*DataByIndex
                        var fileString = string.Empty;

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

                        fileString += FormatLine("namespace HutongGames.PlayMaker.Actions");
                        fileString += FormatLine("{");
                        fileString += FormatLine("	[ActionCategory(\"Google2u\")]");
                        fileString +=
                            FormatLine("	[Tooltip(\"Gets the specified entry in the " + className +
                                       " Database By Index.\")]");
                        fileString += FormatLine("	public class Get" + className + "Count : FsmStateAction");
                        fileString += FormatLine("	{");
                        fileString += FormatLine("		[RequiredField]");
                        fileString += FormatLine("		[UIHint(UIHint.Variable)]");
                        fileString +=
                            FormatLine("		[Tooltip(\"The object that contains the " + className +
                                       " 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("				Google2u." + className +
                                       " db = databaseObj.Value.GetComponent<Google2u." +
                                       className + ">();");
                        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();
                    }
                }
            } // /found playmaker

            PushNotification("Saving to: " + in_editorPath);
        } // ExportObjectDb
Пример #16
0
        public static void ExportJson(Google2uWorksheet in_sheet, string in_path, Google2uExportOptions in_options)
        {
            if (!Directory.Exists(in_path))
                Directory.CreateDirectory(in_path);

            in_path = Path.Combine(in_path, in_sheet.WorksheetName);

            if (!Directory.Exists(in_path))
                Directory.CreateDirectory(in_path);

            var jsonPath = Path.Combine(in_path, in_sheet.WorksheetName + ".json").Replace('\\', '/'); ;

            using (
                var fs = File.Open(jsonPath,
                    File.Exists(in_path) ? FileMode.Truncate : FileMode.OpenOrCreate,
                    FileAccess.Write))
            {
                using (var sw = new StreamWriter(fs))
                {
                    var fileString = ExportJsonObjectString(in_sheet, in_options, false);
                    sw.Write(fileString);
                    sw.Flush();
                }
            }

            if (in_options.JSONExportClass)
            {
                var jsonClassDir = in_path + "\\Resources";
                if (!Directory.Exists(jsonClassDir))
                    Directory.CreateDirectory(jsonClassDir);

                var jsonClassPath = Path.Combine(jsonClassDir, in_sheet.WorksheetName + ".cs").Replace('\\', '/'); ;

                using (
                var fs = File.Open(jsonClassPath,
                    File.Exists(in_path) ? FileMode.Truncate : FileMode.OpenOrCreate,
                    FileAccess.Write))
                {
                    using (var sw = new StreamWriter(fs))
                    {
                        var fileString = ExportJsonObjectClassString(in_sheet, in_options);
                        sw.Write(fileString);
                        sw.Flush();
                    }
                }
            }

            PushNotification("Saving to: " + in_path);
        }
        protected void DrawSpreadsheetOptions(EditorGUILayoutEx in_layout, ExportType in_exportType,
            Google2uWorksheet in_activeWorksheet)
        {
            ShowSpreadsheetOptions =
                Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsOpen",
                    ShowSpreadsheetOptions);
            var showWorkbookOptions = in_layout.BeginFadeArea(ShowSpreadsheetOptions,
                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_EXPORT_OPTIONS),
                "workbook" + WorkbookName.Replace(' ', '_') + "_Options", in_layout.InnerBox, in_layout.InnerBoxHeader);
            ShowSpreadsheetOptions = showWorkbookOptions.Open;
            Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsOpen", ShowSpreadsheetOptions);
            if (showWorkbookOptions.Show())
            {
                var prefix = "workbook" + WorkbookName.Replace(' ', '_') + "_Option_";

                ShowSpreadsheetOptionsLegacy =
                    Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsLegacyOpen",
                        ShowSpreadsheetOptionsLegacy);
                var showWorkbookOptionsLegacy = in_layout.BeginFadeArea(ShowSpreadsheetOptionsLegacy,
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_LEGACY_OPTIONS),
                    "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsLegacy", in_layout.OuterBox,
                    in_layout.OuterBoxHeader);
                ShowSpreadsheetOptionsLegacy = showWorkbookOptionsLegacy.Open;
                Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsLegacyOpen",
                    ShowSpreadsheetOptionsLegacy);
                if (showWorkbookOptionsLegacy.Show())
                {
                    EditorGUILayoutEx.ToggleInput(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_LOWERCASE_HEADER),
                        ref ExportOptions.LowercaseHeader, prefix + "LowercaseHeader");
                }
                in_layout.EndFadeArea();

                ShowSpreadsheetOptionsWhitespace =
                    Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsWhitespaceOpen",
                        ShowSpreadsheetOptionsWhitespace);
                var showWorkbookOptionsWhitespace = in_layout.BeginFadeArea(ShowSpreadsheetOptionsWhitespace,
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_WHITESPACE),
                    "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsWhitespace", in_layout.OuterBox,
                    in_layout.OuterBoxHeader);
                ShowSpreadsheetOptionsWhitespace = showWorkbookOptionsWhitespace.Open;
                Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsWhitespaceOpen",
                    ShowSpreadsheetOptionsWhitespace);
                if (showWorkbookOptionsWhitespace.Show())
                {
                    EditorGUILayoutEx.ToggleInput(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TRIM_STRINGS),
                        ref ExportOptions.TrimStrings, prefix + "TrimStrings");
                    EditorGUILayoutEx.ToggleInput(
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_TRIM_STRING_ARRAYS),
                        ref ExportOptions.TrimStringArrays, prefix + "TrimStringArrays");
                }
                in_layout.EndFadeArea();

                ShowSpreadsheetOptionsArrayDelimiters =
                    Google2uGUIUtil.GetBool(
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsArrayDelimitersOpen",
                        ShowSpreadsheetOptionsArrayDelimiters);
                var showWorkbookOptionsArrayDelimiters = in_layout.BeginFadeArea(ShowSpreadsheetOptionsArrayDelimiters,
                    Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ARRAY_DELIMITERS),
                    "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsArrayDelimiters", in_layout.OuterBox,
                    in_layout.OuterBoxHeader);
                ShowSpreadsheetOptionsArrayDelimiters = showWorkbookOptionsArrayDelimiters.Open;
                Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsArrayDelimitersOpen",
                    ShowSpreadsheetOptionsArrayDelimiters);
                if (showWorkbookOptionsArrayDelimiters.Show())
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_NON_STRING));
                    var newArrayDelimiters = EditorGUILayout.Popup(ExportOptions.ArrayDelimiters,
                        ExportOptions.DelimiterOptionStrings, GUILayout.Width(100));
                    GUILayout.FlexibleSpace();

                    switch (newArrayDelimiters)
                    {
                        case 0: // , - Comma
                            GUILayout.Label("Example Int Array - 1,2,3,4");
                            break;
                        case 1: // | - Pipe
                            GUILayout.Label("Example Int Array - 1|2|3|4");
                            break;
                        case 2: //   - Space
                            GUILayout.Label("Example Int Array - 1 2 3 4");
                            break;
                    }
                    EditorGUILayout.EndHorizontal();

                    if (newArrayDelimiters != ExportOptions.ArrayDelimiters)
                    {
                        Google2uGUIUtil.SetInt(prefix + "ArrayDelimiters", newArrayDelimiters);
                        ExportOptions.ArrayDelimiters = newArrayDelimiters;
                        in_activeWorksheet.UpdateValidation = true;
                    }

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_STRINGS));
                    var newStringArrayDelimiters = EditorGUILayout.Popup(ExportOptions.StringArrayDelimiters,
                        ExportOptions.DelimiterOptionStrings, GUILayout.Width(100));
                    GUILayout.FlexibleSpace();

                    switch (newStringArrayDelimiters)
                    {
                        case 0: // , - Comma
                            GUILayout.Label("Example String Array - Hello,Hola,Bonjour");
                            break;
                        case 1: // | - Pipe
                            GUILayout.Label("Example String Array - Hello|Hola|Bonjour");
                            break;
                        case 2: //   - Space
                            GUILayout.Label("Example String Array - Hello Hola Bonjour");
                            break;
                    }
                    EditorGUILayout.EndHorizontal();

                    if (newStringArrayDelimiters != ExportOptions.StringArrayDelimiters)
                    {
                        Google2uGUIUtil.SetInt(prefix + "StringArrayDelimiters", newStringArrayDelimiters);
                        ExportOptions.StringArrayDelimiters = newStringArrayDelimiters;
                        in_activeWorksheet.UpdateValidation = true;
                    }

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_COMPLEX_TYPES));
                    var newComplexTypeDelimiters = EditorGUILayout.Popup(ExportOptions.ComplexTypeDelimiters,
                        ExportOptions.DelimiterOptionStrings, GUILayout.Width(100));
                    GUILayout.FlexibleSpace();

                    switch (newComplexTypeDelimiters)
                    {
                        case 0: // , - Comma
                            GUILayout.Label("Example Vector - 1,2,3");
                            break;
                        case 1: // | - Pipe
                            GUILayout.Label("Example Vector - 1|2|3");
                            break;
                        case 2: //   - Space
                            GUILayout.Label("Example Vector - 1 2 3");
                            break;
                    }
                    EditorGUILayout.EndHorizontal();

                    if (newComplexTypeDelimiters != ExportOptions.ComplexTypeDelimiters)
                    {
                        Google2uGUIUtil.SetInt(prefix + "ComplexTypeDelimiters", newComplexTypeDelimiters);
                        ExportOptions.ComplexTypeDelimiters = newComplexTypeDelimiters;
                        in_activeWorksheet.UpdateValidation = true;
                    }

                    var tmpDelimStrings = new List<string>();
                    var tmpDelimInts = new List<int>();
                    var curDelim = 0;
                    for (var i = 0; i < ExportOptions.DelimiterOptionStrings.Length; ++i)
                    {
                        if (i == ExportOptions.ComplexTypeDelimiters)
                            continue;
                        tmpDelimStrings.Add(ExportOptions.DelimiterOptionStrings[i]);
                        if (ExportOptions.ComplexArrayDelimiters == i)
                            curDelim = tmpDelimInts.Count;
                        tmpDelimInts.Add(i);
                    }

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_COMPLEX_ARRAYS));
                    var newComplexArrayDelimiters = EditorGUILayout.Popup(curDelim,
                        tmpDelimStrings.ToArray(), GUILayout.Width(100));
                    newComplexArrayDelimiters = tmpDelimInts[newComplexArrayDelimiters];
                    GUILayout.FlexibleSpace();

                    switch (newComplexArrayDelimiters)
                    {
                        case 0: // , - Comma
                        {
                            switch (ExportOptions.ComplexTypeDelimiters)
                            {
                                case 0: // , - Comma
                                    GUILayout.Label("Cannot use Comma as both Complex Type and Complex Array delimiters");
                                    break;
                                case 1: // | - Pipe
                                    GUILayout.Label("Example Vector Array - 1,2,3|4,5,6|7,8,9");
                                    break;
                                case 2: //   - Space
                                    GUILayout.Label("Example Vector Array - 1,2,3 4,5,6 7,8,9");
                                    break;
                            }
                        }
                            break;
                        case 1: // | - Pipe
                        {
                            switch (ExportOptions.ComplexTypeDelimiters)
                            {
                                case 0: // , - Comma
                                    GUILayout.Label("Example Vector Array - 1|2|3,4|5|6,7|8|9");
                                    break;
                                case 1: // | - Pipe
                                    GUILayout.Label("Cannot use Pipe as both Complex Type and Complex Array delimiters");
                                    break;
                                case 2: //   - Space
                                    GUILayout.Label("Example Vector Array - 1|2|3 4|5|6 7|8|9");
                                    break;
                            }
                        }
                            break;
                        case 2: //   - Space
                        {
                            switch (ExportOptions.ComplexTypeDelimiters)
                            {
                                case 0: // , - Comma
                                    GUILayout.Label("Example Vector Array - 1 2 3,4 5 6,7 8 9");
                                    break;
                                case 1: // | - Pipe
                                    GUILayout.Label("Example Vector Array - 1 2 3|4 5 6|7 8 9");
                                    break;
                                case 2: //   - Space
                                    GUILayout.Label("Cannot use Space as both Complex Type and Complex Array delimiters");
                                    break;
                            }
                        }
                            break;
                    }
                    EditorGUILayout.EndHorizontal();

                    if (newComplexArrayDelimiters != ExportOptions.ComplexArrayDelimiters)
                    {
                        Google2uGUIUtil.SetInt(prefix + "ComplexArrayDelimiters", newComplexArrayDelimiters);
                        ExportOptions.ComplexArrayDelimiters = newComplexArrayDelimiters;
                    }
                }
                in_layout.EndFadeArea();

                if (in_exportType == ExportType.ObjectDatabase)
                {
                    ShowSpreadsheetOptionsObjectDB =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsObjectDBOpen",
                            ShowSpreadsheetOptionsObjectDB);
                    var showWorkbookOptionsObjectDB = in_layout.BeginFadeArea(ShowSpreadsheetOptionsObjectDB,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GAME_OBJECT_DATABASE) + " " +
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CREATION_OPTIONS),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsObjectDB", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);
                    ShowSpreadsheetOptionsObjectDB = showWorkbookOptionsObjectDB.Open;
                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsObjectDBOpen",
                        ShowSpreadsheetOptionsObjectDB);
                    if (showWorkbookOptionsObjectDB.Show())
                    {
                        EditorGUILayout.LabelField("Global Options");
                        EditorGUILayout.Separator();

                        ExportOptions.ExportDatabaseGameObject =
                            EditorGUILayout.ObjectField(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GAME_OBJECT_DATABASE) +
                                ": ", ExportOptions.ExportDatabaseGameObject, typeof (GameObject), true) as GameObject;

                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PLAYMAKER),
                            ref ExportOptions.GeneratePlaymakerActions, prefix + "GeneratePlaymakerActions");
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_PERSIST_SCENE_LOADING),
                            ref ExportOptions.UseDoNotDestroy, prefix + "UseDoNotDestroy");

                        var oldObjectDBCullColumns = ExportOptions.ObjectDBCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.ObjectDBCullColumns, prefix + "ObjectDBCullColumns");

                        if (oldObjectDBCullColumns != ExportOptions.ObjectDBCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldObjectDBCullRows = ExportOptions.ObjectDBCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.ObjectDBCullRows, prefix + "ObjectDBCullRows");

                        if (oldObjectDBCullRows != ExportOptions.ObjectDBCullRows)
                            in_activeWorksheet.UpdateValidation = true;

                        EditorGUILayout.Separator();
                        EditorGUILayout.LabelField("Local Options - " + in_activeWorksheet.WorksheetName);
                        EditorGUILayout.Separator();

                        var overrideObject =
                            EditorGUILayout.ObjectField(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GAME_OBJECT_DATABASE) +
                                ": ",
                                ExportOptions.GetOverrideObjectDatabaseGameObject(in_activeWorksheet.WorksheetName),
                                typeof (GameObject), true) as GameObject;
                        if (overrideObject != null)
                            ExportOptions.SetOverrideObjectDatabaseGameObject(in_activeWorksheet.WorksheetName,
                                overrideObject);
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.StaticDatabase)
                {
                    ShowSpreadsheetOptionsStaticDB =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsStaticDBOpen",
                            ShowSpreadsheetOptionsObjectDB);

                    var showWorkbookOptionsStaticDB = in_layout.BeginFadeArea(ShowSpreadsheetOptionsStaticDB,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_STATIC_DATABASE) + " " +
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CREATION_OPTIONS),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsStaticDB", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsStaticDB = showWorkbookOptionsStaticDB.Open;
                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsStaticDBOpen",
                        ShowSpreadsheetOptionsStaticDB);
                    if (showWorkbookOptionsStaticDB.Show())
                    {
                        var oldStaticDBCullColumns = ExportOptions.StaticDBCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.StaticDBCullColumns, prefix + "StaticDBCullColumns");
                        if (oldStaticDBCullColumns != ExportOptions.StaticDBCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldStaticDBCullRows = ExportOptions.StaticDBCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.StaticDBCullRows, prefix + "StaticDBCullRows");
                        if (oldStaticDBCullRows != ExportOptions.StaticDBCullRows)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.JSON)
                {
                    ShowSpreadsheetOptionsJSON =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONOpen",
                            ShowSpreadsheetOptionsJSON);

                    var showWorkbookOptionsJSON = in_layout.BeginFadeArea(ShowSpreadsheetOptionsJSON,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_FORMATTING),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSON", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsJSON = showWorkbookOptionsJSON.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONOpen",
                        ShowSpreadsheetOptionsJSON);

                    if (showWorkbookOptionsJSON.Show())
                    {
                        var oldEscapeUnicode = ExportOptions.EscapeUnicode;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_UNICODE),
                            ref ExportOptions.EscapeUnicode, prefix + "EscapeUnicode");
                        if (oldEscapeUnicode != ExportOptions.EscapeUnicode)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldJSONCellArrayToString = ExportOptions.JSONCellArrayToString;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CONVERT_CELL_ARRAYS),
                            ref ExportOptions.JSONCellArrayToString, prefix + "JSONCellArrayToString");
                        if (oldJSONCellArrayToString != ExportOptions.JSONCellArrayToString)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldJSONExportClass = ExportOptions.JSONExportClass;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_EXPORT_CLASS),
                            ref ExportOptions.JSONExportClass, prefix + "JSONExportClass");
                        if (oldJSONExportClass != ExportOptions.JSONExportClass)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldExportType = ExportOptions.JSONExportType;
                        ExportOptions.JSONExportType =
                            (Google2uExportOptions.ExportType) EditorGUILayout.EnumPopup(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_EXPORT_TYPE) + ":",
                                ExportOptions.JSONExportType);
                        if (oldExportType != ExportOptions.JSONExportType)
                        {
                            Google2uGUIUtil.SetEnum(prefix + "JSONExportType", ExportOptions.JSONExportType);
                            in_activeWorksheet.UpdateValidation = true;
                        }

                        var oldJSONCullColumns = ExportOptions.JSONCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.JSONCullColumns, prefix + "JSONCullColumns");
                        if (oldJSONCullColumns != ExportOptions.JSONCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldJSONCullRows = ExportOptions.JSONCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.JSONCullRows, prefix + "JSONCullRows");
                        if (oldJSONCullRows != ExportOptions.JSONCullRows)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldJSONIgnoreIDColumn = ExportOptions.JSONIgnoreIDColumn;
                        EditorGUILayoutEx.ToggleInput(
                            "Ignore ID Column",
                            ref ExportOptions.JSONIgnoreIDColumn, prefix + "JSONIgnoreIDColumn");
                        if (oldJSONIgnoreIDColumn != ExportOptions.JSONIgnoreIDColumn)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewJSON =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewOpen",
                            ShowSpreadsheetPreviewJSON);

                    var showWorkbookPreviewJSON = in_layout.BeginFadeArea(ShowSpreadsheetPreviewJSON,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_OBJECT_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewJSON = showWorkbookPreviewJSON.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewOpen",
                        ShowSpreadsheetPreviewJSON);

                    if (showWorkbookPreviewJSON.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("JSONPREVIEW");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PREVIEW)))
                        {
                            _JSONPreviewString = Google2u.ExportJsonObjectString(in_activeWorksheet, ExportOptions, true);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_JSONPreviewString));
                        _JSONPreviewScrollPos = EditorGUILayout.BeginScrollView(_JSONPreviewScrollPos, false, false,
                            GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_JSONPreviewString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _JSONPreviewString)
                            GUI.FocusControl("JSONPREVIEW");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewJSONClass =
                        Google2uGUIUtil.GetBool(
                            "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewClassOpen",
                            ShowSpreadsheetPreviewJSONClass);

                    var showWorkbookPreviewJSONClass = in_layout.BeginFadeArea(ShowSpreadsheetPreviewJSONClass,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_JSON_CLASS_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewClassOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewJSONClass = showWorkbookPreviewJSONClass.Open;

                    Google2uGUIUtil.SetBool(
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsJSONPreviewClassOpen",
                        ShowSpreadsheetPreviewJSONClass);

                    if (showWorkbookPreviewJSONClass.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("JSONPREVIEWCLASS");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_CLASS)))
                        {
                            _JSONPreviewClassString = Google2u.ExportJsonObjectClassString(in_activeWorksheet,
                                ExportOptions);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_JSONPreviewClassString));
                        _JSONPreviewClassScrollPos = EditorGUILayout.BeginScrollView(_JSONPreviewClassScrollPos, false,
                            false, GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_JSONPreviewClassString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _JSONPreviewClassString)
                            GUI.FocusControl("JSONPREVIEWCLASS");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.CSV)
                {
                    ShowSpreadsheetOptionsCSV =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVOpen",
                            ShowSpreadsheetOptionsCSV);

                    var showWorkbookOptionsCSV = in_layout.BeginFadeArea(ShowSpreadsheetOptionsCSV,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CSV_FORMATTING),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSV", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsCSV = showWorkbookOptionsCSV.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVOpen",
                        ShowSpreadsheetOptionsCSV);

                    if (showWorkbookOptionsCSV.Show())
                    {
                        var oldEscapeCSVStrings = ExportOptions.EscapeCSVStrings;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_STRINGS),
                            ref ExportOptions.EscapeCSVStrings, prefix + "EscapeCSVStrings");
                        if (oldEscapeCSVStrings != ExportOptions.EscapeCSVStrings)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldCSVCullColumns = ExportOptions.CSVCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.CSVCullColumns, prefix + "CSVCullColumns");
                        if (oldCSVCullColumns != ExportOptions.CSVCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldCSVCullRows = ExportOptions.CSVCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.CSVCullRows, prefix + "CSVCullRows");
                        if (oldCSVCullRows != ExportOptions.CSVCullRows)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldCSVConvertLineBreaks = ExportOptions.CSVConvertLineBreaks;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_LINE_BREAKS),
                            ref ExportOptions.CSVConvertLineBreaks, prefix + "CSVConvertLineBreaks");
                        if (oldCSVConvertLineBreaks != ExportOptions.CSVConvertLineBreaks)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewCSV =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVPreviewOpen",
                            ShowSpreadsheetPreviewCSV);

                    var showWorkbookPreviewCSV = in_layout.BeginFadeArea(ShowSpreadsheetPreviewCSV,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CSV_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVPreviewOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewCSV = showWorkbookPreviewCSV.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsCSVPreviewOpen",
                        ShowSpreadsheetPreviewCSV);

                    if (showWorkbookPreviewCSV.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("CSVPREVIEW");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PREVIEW)))
                        {
                            _CSVPreviewString = Google2u.ExportCsvString(in_activeWorksheet, ExportOptions);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_CSVPreviewString));
                        _CSVPreviewScrollPos = EditorGUILayout.BeginScrollView(_CSVPreviewScrollPos, false, false,
                            GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_CSVPreviewString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _CSVPreviewString)
                            GUI.FocusControl("CSVPREVIEW");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.NGUI)
                {
                    ShowSpreadsheetOptionsNGUI =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIOpen",
                            ShowSpreadsheetOptionsNGUI);

                    var showWorkbookOptionsNGUI = in_layout.BeginFadeArea(ShowSpreadsheetOptionsNGUI,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_NGUI_FORMATTING),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUI", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsNGUI = showWorkbookOptionsNGUI.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIOpen",
                        ShowSpreadsheetOptionsNGUI);

                    if (showWorkbookOptionsNGUI.Show())
                    {
                        var oldEscapeNGUIStrings = ExportOptions.EscapeNGUIStrings;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_STRINGS),
                            ref ExportOptions.EscapeNGUIStrings, prefix + "EscapeNGUIStrings");
                        if (oldEscapeNGUIStrings != ExportOptions.EscapeNGUIStrings)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldNGUICullColumns = ExportOptions.NGUICullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.NGUICullColumns, prefix + "NGUICullColumns");
                        if (oldNGUICullColumns != ExportOptions.NGUICullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldNGUICullRows = ExportOptions.NGUICullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.NGUICullRows, prefix + "NGUICullRows");
                        if (oldNGUICullRows != ExportOptions.NGUICullRows)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldNGUIConvertLineBreaks = ExportOptions.NGUIConvertLineBreaks;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_ESCAPE_LINE_BREAKS),
                            ref ExportOptions.NGUIConvertLineBreaks, prefix + "NGUIConvertLineBreaks");
                        if (oldNGUIConvertLineBreaks != ExportOptions.NGUIConvertLineBreaks)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldNGUILegacyExport = ExportOptions.NGUILegacyExport;
                        // TODO: Localize
                        EditorGUILayoutEx.ToggleInput(
                            "Use NGUI Legacy Export",
                            ref ExportOptions.NGUILegacyExport, prefix + "NGUILegacyExport");
                        if (oldNGUILegacyExport != ExportOptions.NGUILegacyExport)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewNGUI =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIPreviewOpen",
                            ShowSpreadsheetPreviewNGUI);

                    var showWorkbookPreviewNGUI = in_layout.BeginFadeArea(ShowSpreadsheetPreviewNGUI,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_NGUI_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIPreviewOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewNGUI = showWorkbookPreviewNGUI.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsNGUIPreviewOpen",
                        ShowSpreadsheetPreviewNGUI);

                    if (showWorkbookPreviewNGUI.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("NGUIPREVIEW");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PREVIEW)))
                        {
                            if (ExportOptions.NGUILegacyExport)
                                _NGUIPreviewString = Google2u.ExportNGUILegacyString(in_activeWorksheet, ExportOptions);
                            else
                                _NGUIPreviewString = Google2u.ExportNGUIString(in_activeWorksheet, ExportOptions);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_NGUIPreviewString));
                        _NGUIPreviewScrollPos = EditorGUILayout.BeginScrollView(_NGUIPreviewScrollPos, false, false,
                            GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_NGUIPreviewString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _NGUIPreviewString)
                            GUI.FocusControl("NGUIPREVIEW");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();
                }

                if (in_exportType == ExportType.XML)
                {
                    ShowSpreadsheetOptionsXML =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLOpen",
                            ShowSpreadsheetOptionsXML);

                    var showWorkbookOptionsXML = in_layout.BeginFadeArea(ShowSpreadsheetOptionsXML,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_XML_FORMATTING),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXML", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetOptionsXML = showWorkbookOptionsXML.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLOpen",
                        ShowSpreadsheetOptionsXML);

                    if (showWorkbookOptionsXML.Show())
                    {
                        var oldXMLCellArrayToString = ExportOptions.XMLCellArrayToString;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CONVERT_CELL_ARRAYS),
                            ref ExportOptions.XMLCellArrayToString, prefix + "XMLCellArrayToString");
                        if (oldXMLCellArrayToString != ExportOptions.XMLCellArrayToString)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldXMLCullColumns = ExportOptions.XMLCullColumns;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_COLUMNS),
                            ref ExportOptions.XMLCullColumns, prefix + "XMLCullColumns");
                        if (oldXMLCullColumns != ExportOptions.XMLCullColumns)
                            in_activeWorksheet.UpdateValidation = true;

                        var oldXMLCullRows = ExportOptions.XMLCullRows;
                        EditorGUILayoutEx.ToggleInput(
                            Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_CULL_ROWS),
                            ref ExportOptions.XMLCullRows, prefix + "XMLCullRows");
                        if (oldXMLCullRows != ExportOptions.XMLCullRows)
                            in_activeWorksheet.UpdateValidation = true;
                    }
                    in_layout.EndFadeArea();

                    ShowSpreadsheetPreviewXML =
                        Google2uGUIUtil.GetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLPreviewOpen",
                            ShowSpreadsheetPreviewXML);

                    var showWorkbookPreviewXML = in_layout.BeginFadeArea(ShowSpreadsheetPreviewXML,
                        Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_XML_PREVIEW),
                        "workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLPreviewOpen", in_layout.OuterBox,
                        in_layout.OuterBoxHeader);

                    ShowSpreadsheetPreviewXML = showWorkbookPreviewXML.Open;

                    Google2uGUIUtil.SetBool("workbook" + WorkbookName.Replace(' ', '_') + "_OptionsXMLPreviewOpen",
                        ShowSpreadsheetPreviewXML);

                    if (showWorkbookPreviewXML.Show())
                    {
                        var oldEnabled = GUI.enabled;
                        if (!in_activeWorksheet.IsDataValid)
                            GUI.enabled = false;

                        GUI.SetNextControlName("XMLPREVIEW");
                        if (
                            GUILayout.Button(
                                Google2u.LocalizationInfo.Localize(Localization.rowIds.ID_LABEL_GENERATE_PREVIEW)))
                        {
                            _XMLPreviewString = Google2u.ExportXMLString(in_activeWorksheet, ExportOptions);
                        }

                        var textSize = in_layout.CellHeader.CalcSize(new GUIContent(_XMLPreviewString));
                        _XMLPreviewScrollPos = EditorGUILayout.BeginScrollView(_XMLPreviewScrollPos, false, false,
                            GUILayout.MinHeight(250));

                        var newString = EditorGUILayout.TextArea(_XMLPreviewString, GUILayout.ExpandHeight(true),
                            GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x), GUILayout.MinHeight(textSize.y));
                        if (newString != _XMLPreviewString)
                            GUI.FocusControl("XMLPREVIEW");

                        GUI.enabled = oldEnabled;
                        EditorGUILayout.EndScrollView();
                    }
                    in_layout.EndFadeArea();
                }
            }
            in_layout.EndFadeArea();
        }
Пример #18
0
        public static string ExportXMLString(Google2uWorksheet in_sheet, Google2uExportOptions in_options)
        {
            var bConvertArrays = !in_options.XMLCellArrayToString;

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

            xmlDoc.AppendChild(rootNode);

            var sheetNode = xmlDoc.CreateElement("sheet");
            var sheetName = xmlDoc.CreateAttribute("name");

            sheetName.Value = in_sheet.WorksheetName;


            var curRow = 0;

            sheetNode.Attributes.Append(sheetName);
            rootNode.AppendChild(sheetNode);

            // Iterate through each row, printing its cell values.
            foreach (var row in in_sheet.Rows)
            {
                if (curRow < 1)
                {
                    curRow++;
                    continue;
                }
                if (in_sheet.UseTypeRow == true && curRow == 1)
                {
                    curRow++;
                    continue;
                }

                var rowType   = row[0].GetTypeFromValue();
                var rowHeader = row[0].CellValueString;
                if (string.IsNullOrEmpty(rowHeader))
                // if this header is empty
                {
                    if (in_options.XMLCullRows)
                    {
                        break;
                    }
                    curRow++;
                    continue;
                }

                if (rowType == SupportedType.Void ||
                    rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                // if this cell is void, then skip the row completely
                {
                    curRow++;
                    continue;
                }


                if (in_options.XMLColsAsChildTags)
                {
                    XmlNode rowNode = xmlDoc.CreateElement("row");
                    var     rowName = xmlDoc.CreateAttribute("name");
                    rowName.Value = row[0].CellValueString;
                    if (rowNode.Attributes == null)
                    {
                        continue;
                    }
                    rowNode.Attributes.Append(rowName);
                    sheetNode.AppendChild(rowNode);


                    // Iterate over the remaining columns, and print each cell value
                    for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        // Don't process rows or columns marked for ignore
                        if ((row[i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(row[0].CellValueString) ||
                             in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(in_sheet.Rows[0][i].CellValueString) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("void",
                                                                        StringComparison.InvariantCultureIgnoreCase) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("ignore",
                                                                        StringComparison.InvariantCultureIgnoreCase) ||
                             (in_options.XMLCullColumns && i >= in_sheet.FirstBlankCol)))
                        {
                            continue;
                        }

                        XmlNode colNode = xmlDoc.CreateElement(in_sheet.Rows[0][i].CellValueString);

                        var colType = xmlDoc.CreateAttribute("type");
                        colType.Value = row[i].CellTypeString;
                        if (colNode.Attributes != null)
                        {
                            colNode.Attributes.Append(colType);
                        }

                        if (bConvertArrays && IsSupportedArrayType(row[i].MyType))
                        {
                            var delim = in_options.DelimiterOptions[in_options.ArrayDelimiters].ToCharArray();

                            if (row[i].MyType == SupportedType.StringArray)
                            {
                                delim = in_options.DelimiterOptions[in_options.StringArrayDelimiters].ToCharArray();
                            }

                            var value = row[i].CellValueString.Split(delim, StringSplitOptions.RemoveEmptyEntries);
                            foreach (var s in value)
                            {
                                XmlNode arrNode = xmlDoc.CreateElement("entry");
                                if (row[i].MyType == SupportedType.BoolArray)
                                {
                                    var val = s.ToLower();
                                    if (val == "1")
                                    {
                                        val = "true";
                                    }
                                    if (val == "0")
                                    {
                                        val = "false";
                                    }
                                    arrNode.InnerText = val;
                                }
                                else
                                {
                                    arrNode.InnerText = s;
                                }

                                colNode.AppendChild(arrNode);
                            }
                        }
                        else
                        {
                            colNode.InnerText = row[i].CellValueString;
                        }

                        rowNode.AppendChild(colNode);
                    }
                    curRow++;
                }
                else
                {
                    XmlNode rowNode = xmlDoc.CreateElement("row");
                    if (rowNode.Attributes == null)
                    {
                        continue;
                    }

                    var rowAttribute = xmlDoc.CreateAttribute("UID");
                    rowAttribute.Value = row[0].CellValueString;
                    rowNode.Attributes.Append(rowAttribute);

                    // Iterate over the remaining columns, and print each cell value
                    for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                    {
                        // Don't process rows or columns marked for ignore
                        if ((row[i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(row[0].CellValueString) ||
                             in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(in_sheet.Rows[0][i].CellValueString) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("void",
                                                                        StringComparison.InvariantCultureIgnoreCase) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("ignore",
                                                                        StringComparison.InvariantCultureIgnoreCase) ||
                             (in_options.XMLCullColumns && i >= in_sheet.FirstBlankCol)))
                        {
                            continue;
                        }

                        rowAttribute       = xmlDoc.CreateAttribute(in_sheet.Rows[0][i].CellValueString);
                        rowAttribute.Value = row[i].CellValueString;

                        rowNode.Attributes.Append(rowAttribute);
                    }


                    sheetNode.AppendChild(rowNode);

                    curRow++;
                }
            }

            string retstring;

            using (var stringWriter = new StringWriter())
            {
                using (var xmlTextWriter = new XmlTextWriter(stringWriter))
                {
                    xmlTextWriter.Formatting = Formatting.Indented;
                    xmlDoc.WriteTo(xmlTextWriter);
                    retstring = stringWriter.ToString();
                }
            }

            return(retstring);
        }
Пример #19
0
 public static string ExportJsonObjectClassString(Google2uWorksheet in_sheet, Google2uExportOptions in_options)
 {
     return ExportJsonObjectClassString(in_sheet, in_options, 0);
 }
Пример #20
0
 public DataValidationParams(Google2uWorksheet in_worksheet, Google2uExportOptions in_options)
 {
     Worksheet = in_worksheet;
     Options = in_options;
 }
Пример #21
0
 public static string ExportNGUILegacyString(Google2uWorksheet in_sheet, Google2uExportOptions in_options)
 {
     return ExportNGUILegacyString(in_sheet, in_options, 1);
 }
Пример #22
0
        public static string ExportJsonObjectString(Google2uWorksheet in_sheet, Google2uExportOptions in_options,
                                                    bool in_newlines)
        {
            var indent         = 0;
            var retString      = string.Empty;
            var escapeUnicode  = in_options.EscapeUnicode;
            var bConvertArrays = !in_options.JSONCellArrayToString;

            if (in_options.JSONExportPretty)
            {
                in_newlines = true;
            }

            if (in_options.JSONExportType == Google2uExportOptions.ExportType.ExportObject)
            {
                retString += Indent(indent, "{");

                if (in_newlines)
                {
                    retString += Environment.NewLine;
                    indent++;
                }

                retString += Indent(indent, ("\"" + SanitizeJson(in_sheet.WorksheetName, escapeUnicode) + "Row\":"));
                // "sheetName":

                if (in_newlines)
                {
                    retString += Environment.NewLine;
                }
            }

            retString += Indent(indent, "["); // [

            if (in_newlines)
            {
                retString += Environment.NewLine;
                indent++;
            }

            var rowCt = in_sheet.Rows.Count;

            if (rowCt > 0)
            {
                var curRow   = 0;
                var validRow = false;

                // Iterate through each row, printing its cell values.
                foreach (var row in in_sheet.Rows)
                {
                    // if we are skipping the type row, record the types and increment curRow now
                    if (curRow == 0 || (curRow == 1 && in_sheet.UseTypeRow))
                    {
                        curRow++;
                        continue;
                    }

                    var rowType   = row[0].GetTypeFromValue();
                    var rowHeader = row[0].CellValueString;
                    if (string.IsNullOrEmpty(rowHeader))
                    // if this header is empty
                    {
                        if (in_options.JSONCullRows)
                        {
                            break;
                        }
                        curRow++;
                        continue;
                    }

                    if (rowType == SupportedType.Void ||
                        rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                    // if this cell is void, then skip the row completely
                    {
                        curRow++;
                        continue;
                    }

                    if (validRow)
                    {
                        retString += ",";
                        if (in_newlines)
                        {
                            retString += Environment.NewLine;
                        }
                    }

                    validRow = true;

                    retString += Indent(indent, "{");
                    if (in_newlines)
                    {
                        retString += Environment.NewLine;
                        indent++;
                    }

                    var firstCell = true;
                    // Iterate over the remaining columns, and print each cell value
                    for (var i = 0; i < in_sheet.Rows[0].Count; i++)
                    {
                        // Don't process rows or columns marked for ignore
                        if ((row[i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(row[0].CellValueString) ||
                             in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(in_sheet.Rows[0][i].CellValueString) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("void", StringComparison.InvariantCultureIgnoreCase) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("ignore", StringComparison.InvariantCultureIgnoreCase) ||
                             (in_options.JSONCullColumns && i >= in_sheet.FirstBlankCol) ||
                             (in_options.JSONIgnoreIDColumn && i == 0)))
                        {
                            continue;
                        }

                        if (firstCell)
                        {
                            firstCell = false;
                        }
                        else
                        {
                            retString += ", ";
                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                            }
                        }

                        var myType = in_sheet.Rows[0].Cells[i].MyType;

                        if (IsComplexType(myType))
                        {
                            retString += Indent(indent,
                                                "\"" + SanitizeJson(in_sheet.Rows[0][i].CellValueString, escapeUnicode) + "\":");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            retString += Indent(indent, "[");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            var complexTypeDelim =
                                in_options.DelimiterOptions[in_options.ComplexTypeDelimiters].ToCharArray();
                            var value = row[i].CellValueString.Split(complexTypeDelim,
                                                                     StringSplitOptions.RemoveEmptyEntries);
                            var ct = 0;
                            foreach (var s in value)
                            {
                                retString += Indent(indent, SanitizeJson(s, escapeUnicode));

                                if (ct < value.Length - 1)
                                {
                                    retString += ",";
                                    if (in_newlines)
                                    {
                                        retString += Environment.NewLine;
                                    }
                                }
                                ct++;
                            }

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent--;
                            }
                            retString += Indent(indent, "]");

                            if (in_newlines)
                            {
                                indent--;
                            }
                        }
                        else if (IsComplexArrayType(myType))
                        {
                            retString += Indent(indent,
                                                "\"" + SanitizeJson(in_sheet.Rows[0][i].CellValueString, escapeUnicode) + "\":");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            retString += Indent(indent, "[");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            var complexArrayDelim =
                                in_options.DelimiterOptions[in_options.ComplexArrayDelimiters].ToCharArray();
                            var complexArray = row[i].CellValueString.Split(complexArrayDelim,
                                                                            StringSplitOptions.RemoveEmptyEntries);
                            var ctArray = 0;
                            foreach (var cv in complexArray)
                            {
                                if (in_newlines)
                                {
                                    retString += Environment.NewLine;
                                    indent++;
                                }

                                retString += Indent(indent, "[");

                                if (in_newlines)
                                {
                                    retString += Environment.NewLine;
                                    indent++;
                                }

                                var complexTypeDelim =
                                    in_options.DelimiterOptions[in_options.ComplexTypeDelimiters].ToCharArray();
                                var complexType = cv.Split(complexTypeDelim, StringSplitOptions.RemoveEmptyEntries);
                                var ctValue     = 0;
                                foreach (var s in complexType)
                                {
                                    retString += Indent(indent, SanitizeJson(s, escapeUnicode));

                                    if (ctValue < complexType.Length - 1)
                                    {
                                        retString += ",";
                                        if (in_newlines)
                                        {
                                            retString += Environment.NewLine;
                                        }
                                    }
                                    ctValue++;
                                }

                                if (in_newlines)
                                {
                                    retString += Environment.NewLine;
                                    indent--;
                                }
                                retString += Indent(indent, "]");

                                if (in_newlines)
                                {
                                    indent--;
                                }

                                if (ctArray < complexArray.Length - 1)
                                {
                                    retString += ",";
                                    if (in_newlines)
                                    {
                                        retString += Environment.NewLine;
                                    }
                                }
                                ctArray++;
                            }

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent--;
                            }
                            retString += Indent(indent, "]");

                            if (in_newlines)
                            {
                                indent--;
                            }
                        }
                        else if (bConvertArrays && IsSupportedArrayType(myType))
                        {
                            var delim = in_options.DelimiterOptions[in_options.ArrayDelimiters].ToCharArray();

                            retString += Indent(indent,
                                                "\"" + SanitizeJson(in_sheet.Rows[0][i].CellValueString, escapeUnicode) + "\":");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            retString += Indent(indent, "[");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            var isString = false;

                            if (row[i].MyType == SupportedType.StringArray)
                            {
                                delim    = in_options.DelimiterOptions[in_options.StringArrayDelimiters].ToCharArray();
                                isString = true;
                            }
                            if (i == 0)
                            {
                                isString = true;
                            }

                            var value = row[i].CellValueString.Split(delim, StringSplitOptions.RemoveEmptyEntries);
                            var ct    = 0;
                            foreach (var s in value)
                            {
                                if (isString)
                                {
                                    retString += Indent(indent, "\"" + SanitizeJson(s, escapeUnicode) + "\"");
                                }
                                else if (in_sheet.Rows[0].Cells[i].MyType == SupportedType.BoolArray)
                                {
                                    var val = s.ToLower();
                                    if (val == "1")
                                    {
                                        val = "true";
                                    }
                                    if (val == "0")
                                    {
                                        val = "false";
                                    }
                                    retString += Indent(indent, SanitizeJson(val, escapeUnicode));
                                }
                                else
                                {
                                    retString += Indent(indent, SanitizeJson(s, escapeUnicode));
                                }

                                if (ct < value.Length - 1)
                                {
                                    retString += ",";
                                    if (in_newlines)
                                    {
                                        retString += Environment.NewLine;
                                    }
                                }
                                ct++;
                            }
                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent--;
                            }
                            retString += Indent(indent, "]");

                            if (in_newlines)
                            {
                                indent--;
                            }
                        }
                        else
                        {
                            if (in_sheet.UseTypeRow == false ||
                                in_sheet.Rows[0].Cells[i].MyType == SupportedType.String || (i == 0))
                            {
                                retString += Indent(indent, "\"" +
                                                    SanitizeJson(in_sheet.Rows[0][i].CellValueString,
                                                                 escapeUnicode) +
                                                    "\":\"" +
                                                    SanitizeJson(row[i].CellValueString, escapeUnicode) + "\"");
                            }
                            else if (in_sheet.Rows[0].Cells[i].MyType == SupportedType.Bool)
                            {
                                var val = row[i].CellValueString.ToLower();
                                if (val == "1")
                                {
                                    val = "true";
                                }
                                if (val == "0")
                                {
                                    val = "false";
                                }
                                retString += Indent(indent, "\"" +
                                                    SanitizeJson(in_sheet.Rows[0][i].CellValueString,
                                                                 escapeUnicode) +
                                                    "\":" +
                                                    SanitizeJson(val, escapeUnicode));
                            }

                            else if (in_sheet.Rows[0].Cells[i].MyType == SupportedType.BoolArray)
                            {
                                var val = row[i].CellValueString.ToLower();
                                if (val == "1")
                                {
                                    val = "true";
                                }
                                if (val == "0")
                                {
                                    val = "false";
                                }
                                retString += Indent(indent, "\"" +
                                                    SanitizeJson(in_sheet.Rows[0][i].CellValueString,
                                                                 escapeUnicode) +
                                                    "\":" +
                                                    SanitizeJson(val, escapeUnicode));
                            }
                            else
                            {
                                retString += Indent(indent, "\"" +
                                                    SanitizeJson(in_sheet.Rows[0][i].CellValueString,
                                                                 escapeUnicode) +
                                                    "\":" +
                                                    SanitizeJson(row[i].CellValueString, escapeUnicode) + "");
                            }
                        }

                        if (in_newlines)
                        {
                            //retString += Environment.NewLine;
                        }
                    }

                    if (in_newlines)
                    {
                        retString += Environment.NewLine;
                        indent--;
                    }

                    retString += Indent(indent, "}");

                    curRow++;
                }
            }

            if (in_newlines)
            {
                retString += Environment.NewLine;
                indent--;
            }
            retString += Indent(indent, "]");

            if (in_options.JSONExportType == Google2uExportOptions.ExportType.ExportObject)
            {
                if (in_newlines)
                {
                    retString += Environment.NewLine;
                    indent--;
                }
                retString += Indent(indent, "}");
            }
            return(retString);
        }
Пример #23
0
        public static string ExportJsonObjectClassString(Google2uWorksheet in_sheet, Google2uExportOptions in_options,
                                                         int in_indent)
        {
            var retString = string.Empty;

            if (in_sheet.Rows.Count <= 0)
            {
                return(retString);
            }

            var headerRow = in_sheet.Rows[0];

            var indent = in_indent;

            retString += FormatLine("//----------------------------------------------");
            retString += FormatLine("//    Google2u: Google Doc Unity integration");
            retString += FormatLine("//         Copyright © 2015 Litteratus");
            retString += FormatLine("//");
            retString += FormatLine("//        This file has been auto-generated");
            retString += FormatLine("//              Do not manually edit");
            retString += FormatLine("//----------------------------------------------");
            retString += FormatLine(string.Empty);
            retString += FormatLine("using System.Collections.Generic;");
            retString += FormatLine("using UnityEngine;");
            retString += FormatLine(string.Empty);
            retString += FormatLine("namespace Google2u");
            retString += FormatLine("{");

            indent++;

            retString += Indent(indent, "public class " + in_sheet.WorksheetName + "Row" + Environment.NewLine);
            retString += Indent(indent, "{" + Environment.NewLine);

            indent++;

            var idCell = true;

            foreach (var cell in headerRow.Cells)
            {
                if (!idCell && (cell.MyType == SupportedType.Void || cell.MyType == SupportedType.Unrecognized))
                // Don't process rows or columns marked for ignore
                {
                    if (in_options.JSONCullColumns)
                    {
                        break;
                    }
                    continue;
                }

                retString += Indent(indent, "");

                if (idCell)
                {
                    retString += "public string " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                }
                else
                {
                    // check the type
                    switch (cell.MyType)
                    {
                    case SupportedType.GameObject:
                    case SupportedType.String:
                        retString += "public string " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        break;

                    case SupportedType.Int:
                        retString += "public int " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                        break;

                    case SupportedType.Float:
                        retString += "public float " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                        break;

                    case SupportedType.Bool:
                        retString += "public bool " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                        break;

                    case SupportedType.Byte:
                        retString += "public byte  " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                        break;

                    case SupportedType.Vector2:
                        retString += "public List<float> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString += "public Vector2 " + cell.CellValueString +
                                     "_Vector2 { get { return new Vector2(" + cell.CellValueString + "[0], " +
                                     cell.CellValueString + "[1]); } }" + Environment.NewLine;
                        break;

                    case SupportedType.Vector3:
                        retString += "public List<float> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString += "public Vector3 " + cell.CellValueString +
                                     "_Vector3 { get { return new Vector3(" + cell.CellValueString + "[0], " +
                                     cell.CellValueString + "[1], " + cell.CellValueString + "[2]); } }" +
                                     Environment.NewLine;
                        break;

                    case SupportedType.Color:
                        retString += "public List<float> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString += "public Color " + cell.CellValueString + "_Color { get { return new Color(" +
                                     cell.CellValueString + "[0], " + cell.CellValueString + "[1], " +
                                     cell.CellValueString + "[2], " + cell.CellValueString + "[3]); } }" +
                                     Environment.NewLine;
                        break;

                    case SupportedType.Color32:
                        retString += "public List<int> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString += "public Color32 " + cell.CellValueString +
                                     "_Color32 { get { return new Color((byte)" + cell.CellValueString +
                                     "[0], (byte)" + cell.CellValueString + "[1], (byte)" + cell.CellValueString +
                                     "[2], (byte)" + cell.CellValueString + "[3]); } }" + Environment.NewLine;
                        break;

                    case SupportedType.Quaternion:
                        retString += "public List<float> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString += "public Quaternion " + cell.CellValueString +
                                     "_Quaternion { get { return new Color(" + cell.CellValueString + "[0], " +
                                     cell.CellValueString + "[1], " + cell.CellValueString + "[2], " +
                                     cell.CellValueString + "[3]); } }" + Environment.NewLine;
                        break;

                    case SupportedType.FloatArray:
                        retString += "public List<float> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        break;

                    case SupportedType.IntArray:
                        retString += "public List<int> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        break;

                    case SupportedType.BoolArray:
                        retString += "public List<bool> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        break;

                    case SupportedType.ByteArray:
                        retString += "public List<byte> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        break;

                    case SupportedType.StringArray:
                        retString += "public List<string> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        break;

                    case SupportedType.Vector2Array:
                        retString += "public List<List<float>> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString +=
                            string.Format(
                                "public Vector2[] {0}_Vector2Array {{get {{var len = {0}.Count; var ret = new Vector2[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Vector2({0}[i][0], {0}[i][1]); }} return ret; }} }}",
                                cell.CellValueString);
                        break;

                    case SupportedType.Vector3Array:
                        retString += "public List<List<float>>  " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString +=
                            string.Format(
                                "public Vector3[] {0}_Vector3Array {{get {{var len = {0}.Count; var ret = new Vector3[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Vector3({0}[i][0], {0}[i][1], {0}[i][2]); }} return ret; }} }}",
                                cell.CellValueString);
                        break;

                    case SupportedType.ColorArray:
                        retString += "public List<List<float>> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString +=
                            string.Format(
                                "public Color[] {0}_ColorArray {{get {{var len = {0}.Count; var ret = new Color[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Color({0}[i][0], {0}[i][1], {0}[i][2], {0}[i][3]); }} return ret; }} }}",
                                cell.CellValueString);
                        break;

                    case SupportedType.Color32Array:
                        retString += "public List<List<float>> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString +=
                            string.Format(
                                "public Color32[] {0}_Color32Array {{get {{var len = {0}.Count; var ret = new Color32[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Color32({0}[i][0], {0}[i][1], {0}[i][2], {0}[i][3]); }} return ret; }} }}",
                                cell.CellValueString);
                        break;

                    case SupportedType.QuaternionArray:
                        retString += "public List<List<float>> " + cell.CellValueString + " { get; set; }" +
                                     Environment.NewLine;
                        retString += Indent(indent, "");
                        retString +=
                            string.Format(
                                "public Quaternion[] {0}_QuaternionArray {{get {{var len = {0}.Count; var ret = new Quaternion[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Quaternion({0}[i][0], {0}[i][1], {0}[i][2], {0}[i][3]); }} return ret; }} }}",
                                cell.CellValueString);
                        break;
                    }
                }
                idCell = false;
            }

            indent--;

            retString += Indent(indent, "}" + Environment.NewLine);

            if (in_options.JSONExportType == Google2uExportOptions.ExportType.ExportObject)
            {
                retString += Environment.NewLine;
                retString += Indent(indent, "public class " + in_sheet.WorksheetName + "Database" + Environment.NewLine);
                retString += Indent(indent, "{" + Environment.NewLine);

                indent++;
                retString += Indent(indent,
                                    "public List< " + in_sheet.WorksheetName + "Row > " + in_sheet.WorksheetName + "Row { get; set; }" +
                                    Environment.NewLine);
                indent--;

                retString += Indent(indent, "}" + Environment.NewLine);
            }

            retString += FormatLine("}");

            return(retString);
        }
Пример #24
0
 public static string ExportJsonObjectClassString(Google2uWorksheet in_sheet, Google2uExportOptions in_options)
 {
     return(ExportJsonObjectClassString(in_sheet, in_options, 0));
 }
Пример #25
0
        public static void CalculateColumnWidth(int in_col, Google2uWorksheet in_worksheet)
        {
            var longest = 0;
            var longestString = string.Empty;
            foreach (var row in in_worksheet.RowsDisplay)
            {
                var cell = row[in_col];
                var len = cell.CellValueLength;
                if (len <= longest)
                    continue;

                longest = len;
                longestString = cell.CellValueString;
            }
            var strlen = GUIStyle.none.CalcSize(new GUIContent(longestString));
            in_worksheet.ColOptions[in_col].Width = Math.Max(26, (int) Math.Round(strlen.x + 0.5f) + 16);
        }
Пример #26
0
 public static string ExportNGUILegacyString(Google2uWorksheet in_sheet, Google2uExportOptions in_options)
 {
     return(ExportNGUILegacyString(in_sheet, in_options, 1));
 }
Пример #27
0
        public static string ExportJsonObjectClassString(Google2uWorksheet in_sheet, Google2uExportOptions in_options, int in_indent)
        {
            var retString =  string.Empty;

            if (in_sheet.Rows.Count <= 0)
                return retString;

            var headerRow = in_sheet.Rows[0];

            var indent = in_indent;

            retString += FormatLine("//----------------------------------------------");
            retString += FormatLine("//    Google2u: Google Doc Unity integration");
            retString += FormatLine("//         Copyright © 2015 Litteratus");
            retString += FormatLine("//");
            retString += FormatLine("//        This file has been auto-generated");
            retString += FormatLine("//              Do not manually edit");
            retString += FormatLine("//----------------------------------------------");
            retString += FormatLine(System.String.Empty);
            retString += FormatLine("using System.Collections.Generic;");
            retString += FormatLine("using UnityEngine;"); 
            retString += FormatLine(System.String.Empty);
            retString += FormatLine("namespace Google2u");
            retString += FormatLine("{");

            indent++;

            retString += Indent(indent, "public class " + in_sheet.WorksheetName + "Row" + Environment.NewLine);
            retString += Indent(indent, "{" + Environment.NewLine);

            indent++;

            var idCell = true;
            foreach (var cell in headerRow.Cells)
            {
                
                if(!idCell && (cell.MyType == SupportedType.Void || cell.MyType == SupportedType.Unrecognized))
                // Don't process rows or columns marked for ignore
                {
                    if (string.IsNullOrEmpty(cell.CellValueString) && in_options.JSONCullColumns)
                        break;
                    continue;
                }

                retString += Indent(indent, "");

                if (idCell)
                {
                    retString += "public string " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                }
                else
                {

                    // check the type
                    switch (cell.MyType)
                    {
                        case SupportedType.GameObject:
                        case SupportedType.String:
                            retString += "public string " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.Int:
                            retString += "public int " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.Float:
                            retString += "public float " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.Bool:
                            retString += "public bool " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.Byte:
                            retString += "public byte  " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.Vector2:
                            retString += "public List<float> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += "public Vector2 " + cell.CellValueString + "_Vector2 { get { return new Vector2(" + cell.CellValueString + "[0], " + cell.CellValueString + "[1]); } }" + Environment.NewLine;
                            break;
                        case SupportedType.Vector3:
                            retString += "public List<float> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += "public Vector3 " + cell.CellValueString + "_Vector3 { get { return new Vector3(" + cell.CellValueString + "[0], " + cell.CellValueString + "[1], " + cell.CellValueString + "[2]); } }" + Environment.NewLine;
                            break;
                        case SupportedType.Color:
                            retString += "public List<float> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += "public Color " + cell.CellValueString + "_Color { get { return new Color(" + cell.CellValueString + "[0], " + cell.CellValueString + "[1], " + cell.CellValueString + "[2], " + cell.CellValueString + "[3]); } }" + Environment.NewLine;
                            break;
                        case SupportedType.Color32:
                            retString += "public List<int> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += "public Color32 " + cell.CellValueString + "_Color32 { get { return new Color((byte)" + cell.CellValueString + "[0], (byte)" + cell.CellValueString + "[1], (byte)" + cell.CellValueString + "[2], (byte)" + cell.CellValueString + "[3]); } }" + Environment.NewLine;
                            break;
                        case SupportedType.Quaternion:
                            retString += "public List<float> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += "public Quaternion " + cell.CellValueString + "_Quaternion { get { return new Color(" + cell.CellValueString + "[0], " + cell.CellValueString + "[1], " + cell.CellValueString + "[2], " + cell.CellValueString + "[3]); } }" + Environment.NewLine;
                            break;
                        case SupportedType.FloatArray:
                            retString += "public List<float> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.IntArray:
                            retString += "public List<int> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.BoolArray:
                            retString += "public List<bool> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.ByteArray:
                            retString += "public List<byte> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.StringArray:
                            retString += "public List<string> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;
                            break;
                        case SupportedType.Vector2Array:
                            retString += "public List<List<float>> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += string.Format("public Vector2[] {0}_Vector2Array {{get {{var len = {0}.Count; var ret = new Vector2[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Vector2({0}[i][0], {0}[i][1]); }} return ret; }} }}", cell.CellValueString);
                            break;
                        case SupportedType.Vector3Array:
                            retString += "public List<List<float>>  " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += string.Format("public Vector3[] {0}_Vector3Array {{get {{var len = {0}.Count; var ret = new Vector3[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Vector3({0}[i][0], {0}[i][1], {0}[i][2]); }} return ret; }} }}", cell.CellValueString);
                            break;
                        case SupportedType.ColorArray:
                            retString += "public List<List<float>> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += string.Format("public Color[] {0}_ColorArray {{get {{var len = {0}.Count; var ret = new Color[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Color({0}[i][0], {0}[i][1], {0}[i][2], {0}[i][3]); }} return ret; }} }}", cell.CellValueString);
                            break;
                        case SupportedType.Color32Array:
                            retString += "public List<List<float>> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += string.Format("public Color32[] {0}_Color32Array {{get {{var len = {0}.Count; var ret = new Color32[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Color32({0}[i][0], {0}[i][1], {0}[i][2], {0}[i][3]); }} return ret; }} }}", cell.CellValueString);
                            break;
                        case SupportedType.QuaternionArray:
                            retString += "public List<List<float>> " + cell.CellValueString + " { get; set; }" + Environment.NewLine;retString += Indent(indent, "");
                            retString += string.Format("public Quaternion[] {0}_QuaternionArray {{get {{var len = {0}.Count; var ret = new Quaternion[len]; for (var i = 0; i < len; ++i) {{ ret[i] = new Quaternion({0}[i][0], {0}[i][1], {0}[i][2], {0}[i][3]); }} return ret; }} }}", cell.CellValueString);
                            break;
                    }

                }
                idCell = false;

            }

            indent--;

            retString += Indent(indent, "}" + Environment.NewLine);

            if (in_options.JSONExportType == Google2uExportOptions.ExportType.ExportObject)
            {
                retString += Environment.NewLine;
                retString += Indent(indent, "public class " + in_sheet.WorksheetName + "Database" + Environment.NewLine);
                retString += Indent(indent, "{" + Environment.NewLine);

                indent++;
                retString += Indent(indent,
                    "public List< " + in_sheet.WorksheetName + "Row > " + in_sheet.WorksheetName + "Row { get; set; }" + Environment.NewLine);
                indent--;

                retString += Indent(indent, "}" + Environment.NewLine);
            }

            retString += FormatLine("}");

            return retString;
        }
Пример #28
0
        public static string ExportXMLString(Google2uWorksheet in_sheet, Google2uExportOptions in_options)
        {
            var bConvertArrays = !in_options.XMLCellArrayToString;

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

            var sheetNode = xmlDoc.CreateElement("sheet");
            var sheetName = xmlDoc.CreateAttribute("name");
            sheetName.Value = in_sheet.WorksheetName;


            var curRow = 0;

            sheetNode.Attributes.Append(sheetName);
            rootNode.AppendChild(sheetNode);

            // Iterate through each row, printing its cell values.
            foreach (var row in in_sheet.Rows)
            {
                if (curRow < 1)
                {
                    curRow++;
                    continue;
                }
                if (in_sheet.UseTypeRow == true && curRow == 1)
                {
                    curRow++;
                    continue;
                }

                var rowType = row[0].GetTypeFromValue();
                var rowHeader = row[0].CellValueString;
                if (string.IsNullOrEmpty(rowHeader))
                    // if this header is empty
                {
                    if (in_options.XMLCullRows)
                        break;
                    curRow++;
                    continue;
                }

                if (rowType == SupportedType.Void ||
                    rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                    // if this cell is void, then skip the row completely
                {
                    curRow++;
                    continue;
                }

                XmlNode rowNode = xmlDoc.CreateElement("row");
                var rowName = xmlDoc.CreateAttribute("name");
                rowName.Value = row[0].CellValueString;
                if (rowNode.Attributes == null) continue;
                rowNode.Attributes.Append(rowName);
                sheetNode.AppendChild(rowNode);


                // Iterate over the remaining columns, and print each cell value
                for (var i = 1; i < in_sheet.Rows[0].Count; i++)
                {
                    // Don't process rows or columns marked for ignore
                    if ((row[i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(row[0].CellValueString) ||
                             in_sheet.Rows[0][i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(in_sheet.Rows[0][i].CellValueString) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("void", StringComparison.InvariantCultureIgnoreCase) ||
                             in_sheet.Rows[0][i].CellValueString.Equals("ignore", StringComparison.InvariantCultureIgnoreCase) ||
                             (in_options.XMLCullColumns && i >= in_sheet.FirstBlankCol)))
                    {
                        continue;
                    }

                    XmlNode colNode = xmlDoc.CreateElement(in_sheet.Rows[0][i].CellValueString);

                    var colType = xmlDoc.CreateAttribute("type");
                    colType.Value = row[i].CellTypeString;
                    if (colNode.Attributes != null) colNode.Attributes.Append(colType);

                    if (bConvertArrays && IsSupportedArrayType(row[i].MyType))
                    {
                        var delim = in_options.DelimiterOptions[in_options.ArrayDelimiters].ToCharArray();

                        if (row[i].MyType == SupportedType.StringArray)
                            delim = in_options.DelimiterOptions[in_options.StringArrayDelimiters].ToCharArray();

                        var value = row[i].CellValueString.Split(delim, StringSplitOptions.RemoveEmptyEntries);
                        foreach (var s in value)
                        {
                            XmlNode arrNode = xmlDoc.CreateElement("entry");
                            if (row[i].MyType == SupportedType.BoolArray)
                            {
                                var val = s.ToLower();
                                if (val == "1")
                                    val = "true";
                                if (val == "0")
                                    val = "false";
                                arrNode.InnerText = val;
                            }
                            else
                                arrNode.InnerText = s;

                            colNode.AppendChild(arrNode);
                        }
                    }
                    else
                    {
                        colNode.InnerText = row[i].CellValueString;
                    }

                    rowNode.AppendChild(colNode);
                }
                curRow++;
            }

            string retstring;
            using (var stringWriter = new StringWriter())
            {
                using (var xmlTextWriter = new XmlTextWriter(stringWriter))
                {
                    xmlTextWriter.Formatting = Formatting.Indented;
                    xmlDoc.WriteTo(xmlTextWriter);
                    retstring = stringWriter.ToString();
                }
            }

            return retstring;
        }
Пример #29
0
        public static string ExportJsonObjectString(Google2uWorksheet in_sheet, Google2uExportOptions in_options, bool in_newlines)
        {
            var indent = 0;
            var retString = String.Empty;
            var escapeUnicode = in_options.EscapeUnicode;
            var bConvertArrays = !in_options.JSONCellArrayToString;

            if (in_options.JSONExportType == Google2uExportOptions.ExportType.ExportObject)
            {
                retString += Indent(indent, "{");

                if (in_newlines)
                {
                    retString += Environment.NewLine;
                    indent++;
                }

                retString += Indent(indent, ("\"" + SanitizeJson(in_sheet.WorksheetName, escapeUnicode) + "Row\":"));
                    // "sheetName":

                if (in_newlines)
                {
                    retString += Environment.NewLine;
                }

            }

            retString += Indent(indent, "["); // [

            if (in_newlines)
            {
                retString += Environment.NewLine;
                indent++;
            }

            var rowCt = in_sheet.Rows.Count;
            if (rowCt > 0)
            {

                var curRow = 0;
                var validRow = false;

                // Iterate through each row, printing its cell values.
                foreach (var row in in_sheet.Rows)
                {
                    // if we are skipping the type row, record the types and increment curRow now
                    if (curRow == 0 || (curRow == 1 && in_sheet.UseTypeRow))
                    {
                        curRow++;
                        continue;
                    }

                    var rowType = row[0].GetTypeFromValue();
                    var rowHeader = row[0].CellValueString;
                    if (string.IsNullOrEmpty(rowHeader))
                    // if this header is empty
                    {
                        if (in_options.JSONCullRows)
                            break;
                        curRow++;
                        continue;
                    }

                    if (rowType == SupportedType.Void ||
                    rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                    // if this cell is void, then skip the row completely
                    {
                        curRow++;
                        continue;
                    }

                    if (validRow)
                    {
                        retString += ",";
                        if (in_newlines)
                        {
                            retString += Environment.NewLine;
                        }
                    }

                    validRow = true;

                    retString += Indent(indent, "{");
                    if (in_newlines)
                    {
                        retString += Environment.NewLine;
                        indent++;
                    }

                    bool firstCell = true;
                    // Iterate over the remaining columns, and print each cell value
                    for (int i = 0; i < in_sheet.Rows[0].Count; i++)
                    {
                        // Don't process rows or columns marked for ignore
                        if ((row[i].MyType == SupportedType.Void ||
                             string.IsNullOrEmpty(row[0].CellValueString) ||
                             (in_options.JSONCullColumns && i > in_sheet.FirstBlankCol)))
                        {
                            continue;
                        }

                        if (firstCell)
                            firstCell = false;
                        else
                        {
                            retString += ", ";
                            if (in_newlines)
                                retString += Environment.NewLine;
                        }

                        var myType = in_sheet.Rows[0].Cells[i].MyType;

                        if (IsComplexType(myType))
                        {
                            retString += Indent(indent,
                                "\"" + SanitizeJson(in_sheet.Rows[0][i].CellValueString, escapeUnicode) + "\":");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            retString += Indent(indent, "[");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            var complexTypeDelim = in_options.DelimiterOptions[in_options.ComplexTypeDelimiters].ToCharArray();
                            var value = row[i].CellValueString.Split(complexTypeDelim, StringSplitOptions.RemoveEmptyEntries);
                            var ct = 0;
                            foreach (var s in value)
                            {
                                retString += Indent(indent, SanitizeJson(s, escapeUnicode));

                                if (ct < value.Length - 1)
                                {
                                    retString += ",";
                                    if (in_newlines)
                                    {
                                        retString += Environment.NewLine;
                                    }
                                }
                                ct++;
                            }

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent--;
                            }
                            retString += Indent(indent, "]");

                            if (in_newlines)
                            {
                                indent--;
                            }

                        }
                        else 
                        if(IsComplexArrayType(myType))
                        {
                            retString += Indent(indent,
                                "\"" + SanitizeJson(in_sheet.Rows[0][i].CellValueString, escapeUnicode) + "\":");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            retString += Indent(indent, "[");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            var complexArrayDelim = in_options.DelimiterOptions[in_options.ComplexArrayDelimiters].ToCharArray();
                            var complexArray = row[i].CellValueString.Split(complexArrayDelim, StringSplitOptions.RemoveEmptyEntries);
                            var ctArray = 0;
                            foreach (var cv in complexArray)
                            {
                                if (in_newlines)
                                {
                                    retString += Environment.NewLine;
                                    indent++;
                                }

                                retString += Indent(indent, "[");

                                if (in_newlines)
                                {
                                    retString += Environment.NewLine;
                                    indent++;
                                }

                                var complexTypeDelim = in_options.DelimiterOptions[in_options.ComplexTypeDelimiters].ToCharArray();
                                var complexType = cv.Split(complexTypeDelim, StringSplitOptions.RemoveEmptyEntries);
                                var ctValue = 0;
                                foreach (var s in complexType)
                                {
                                    retString += Indent(indent, SanitizeJson(s, escapeUnicode));

                                    if (ctValue < complexType.Length - 1)
                                    {
                                        retString += ",";
                                        if (in_newlines)
                                        {
                                            retString += Environment.NewLine;
                                        }
                                    }
                                    ctValue++;
                                }

                                if (in_newlines)
                                {
                                    retString += Environment.NewLine;
                                    indent--;
                                }
                                retString += Indent(indent, "]");

                                if (in_newlines)
                                {
                                    indent--;
                                }

                                if (ctArray < complexArray.Length - 1)
                                {
                                    retString += ",";
                                    if (in_newlines)
                                    {
                                        retString += Environment.NewLine;
                                    }
                                }
                                ctArray++;

                            }

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent--;
                            }
                            retString += Indent(indent, "]");

                            if (in_newlines)
                            {
                                indent--;
                            }

                        }
                        else
                        if (bConvertArrays && IsSupportedArrayType(myType))
                        {

                            var delim = in_options.DelimiterOptions[in_options.ArrayDelimiters].ToCharArray();

                            retString += Indent(indent,
                                "\"" + SanitizeJson(in_sheet.Rows[0][i].CellValueString, escapeUnicode) + "\":");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            retString += Indent(indent, "[");

                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent++;
                            }

                            bool isString = false;

                            if (row[i].MyType == SupportedType.StringArray)
                            {
                                delim = in_options.DelimiterOptions[in_options.StringArrayDelimiters].ToCharArray();
                                isString = true;
                            }
                            if (i == 0)
                                isString = true;

                            var value = row[i].CellValueString.Split(delim, System.StringSplitOptions.RemoveEmptyEntries);
                            var ct = 0;
                            foreach (var s in value)
                            {
                                if (isString)
                                {
                                    retString += Indent(indent, "\"" + SanitizeJson(s, escapeUnicode) + "\"");
                                }
                                else if (in_sheet.Rows[0].Cells[i].MyType == SupportedType.BoolArray)
                                {
                                    string val = s.ToLower();
                                    if (val == "1")
                                        val = "true";
                                    if (val == "0")
                                        val = "false";
                                    retString += Indent(indent, SanitizeJson(val, escapeUnicode));
                                }
                                else
                                    retString += Indent(indent, SanitizeJson(s, escapeUnicode));

                                if (ct < value.Length - 1)
                                {
                                    retString += ",";
                                    if (in_newlines)
                                    {
                                        retString += Environment.NewLine;
                                    }
                                }
                                ct++;
                            }
                            if (in_newlines)
                            {
                                retString += Environment.NewLine;
                                indent--;
                            }
                            retString += Indent(indent, "]");

                            if (in_newlines)
                            {
                                indent--;
                            }
                        }
                        else
                        {
                            if (in_sheet.UseTypeRow == false ||
                                in_sheet.Rows[0].Cells[i].MyType == SupportedType.String || (i == 0))
                            {
                                retString += Indent(indent, "\"" +
                                              SanitizeJson(in_sheet.Rows[0][i].CellValueString, escapeUnicode) +
                                              "\":\"" +
                                              SanitizeJson(row[i].CellValueString, escapeUnicode) + "\"");
                            }
                            else if (in_sheet.Rows[0].Cells[i].MyType == SupportedType.Bool)
                            {
                                string val = row[i].CellValueString.ToLower();
                                if (val == "1")
                                    val = "true";
                                if (val == "0")
                                    val = "false";
                                retString += Indent(indent, "\"" +
                                                            SanitizeJson(in_sheet.Rows[0][i].CellValueString,
                                                                escapeUnicode) +
                                                            "\":" +
                                                            SanitizeJson(val, escapeUnicode));
                            }

                            else if (in_sheet.Rows[0].Cells[i].MyType == SupportedType.BoolArray)
                            {
                                string val = row[i].CellValueString.ToLower();
                                if (val == "1")
                                    val = "true";
                                if (val == "0")
                                    val = "false";
                                retString += Indent(indent, "\"" +
                                                            SanitizeJson(in_sheet.Rows[0][i].CellValueString,
                                                                escapeUnicode) +
                                                            "\":" +
                                                            SanitizeJson(val, escapeUnicode));
                            }
                            else
                                retString += Indent(indent, "\"" +
                                                            SanitizeJson(in_sheet.Rows[0][i].CellValueString,
                                                                escapeUnicode) +
                                                            "\":" +
                                                            SanitizeJson(row[i].CellValueString, escapeUnicode) + "");
                        }

                        if (in_newlines)
                        {
                            //retString += Environment.NewLine;
                        }


                    }

                    if (in_newlines)
                    {
                        retString += Environment.NewLine;
                        indent--;
                    }

                    retString += Indent(indent, "}");

                    curRow++;
                }

            }

            if (in_newlines)
            {
                retString += Environment.NewLine;
                indent--;
            }
            retString += Indent(indent, "]");

            if (in_options.JSONExportType == Google2uExportOptions.ExportType.ExportObject)
            {
                if (in_newlines)
                {
                    retString += Environment.NewLine;
                    indent--;
                }
                retString += ("}");
            }
            return retString;
        }