Example #1
0
        public void DoExport()
        {
            switch (WorksheetExportType)
            {
            default:
                return;

            case ExportType.CSV:
                _CSVPath = Google2uGUIUtil.GetString("g2ucsvDirectory", Google2u.Google2uGenPath("CSV"));
                break;

            case ExportType.JSON:
                _JSONPath = Google2uGUIUtil.GetString("g2ujsonDirectory", Google2u.Google2uGenPath("JSON"));
                break;

            case ExportType.NGUI:
                _NGUIPath = Google2uGUIUtil.GetString("g2unguiDirectory", Google2u.Google2uGenPath("NGUI"));
                break;

            case ExportType.StaticDatabase:
                _StaticDbPath = Google2uGUIUtil.GetString("g2uStaticDBResourcesDirectory", Google2u.Google2uGenPath("STATICDBRESOURCES"));
                break;

            case ExportType.XML:
                _XMLPath = Google2uGUIUtil.GetString("g2uxmlDirectory", Google2u.Google2uGenPath("XML"));
                break;

            case ExportType.ObjectDatabase:
                _ObjdbResourcesPath = Google2uGUIUtil.GetString("g2uobjDBResourcesDirectory", Google2u.Google2uGenPath("OBJDBRESOURCES"));
                _ObjdbEditorPath    = Google2uGUIUtil.GetString("g2uobjDBEditorDirectory", Google2u.Google2uGenPath("OBJDBEDITOR"));
                _PlaymakerPath      = Google2uGUIUtil.GetString("g2uplaymakerDirectory", Google2u.Google2uGenPath("PLAYMAKER"));
                break;
            }



            if (_ExportThread == null || _ExportThread.IsAlive == false)
            {
                _ExportThread = new Thread(ExportThread)
                {
                    Name = "ExportThread"
                };
                _ExportThread.Start(this);
            }
        }
Example #2
0
        public void DoExport()
        {
            _JSONPath     = Google2uGUIUtil.GetString("g2ujsonDirectory", Google2u.Google2uGenPath("JSON"));
            _CSVPath      = Google2uGUIUtil.GetString("g2ucsvDirectory", Google2u.Google2uGenPath("CSV"));
            _XMLPath      = Google2uGUIUtil.GetString("g2uxmlDirectory", Google2u.Google2uGenPath("XML"));
            _NGUIPath     = Google2uGUIUtil.GetString("g2unguiDirectory", Google2u.Google2uGenPath("NGUI"));
            _StaticDbPath = Google2uGUIUtil.GetString("g2uStaticDBResourcesDirectory",
                                                      Google2u.Google2uGenPath("STATICDBRESOURCES"));
            _ObjdbResourcesPath = Google2uGUIUtil.GetString("g2uobjDBResourcesDirectory",
                                                            Google2u.Google2uGenPath("OBJDBRESOURCES"));
            _ObjdbEditorPath = Google2uGUIUtil.GetString("g2uobjDBEditorDirectory",
                                                         Google2u.Google2uGenPath("OBJDBEDITOR"));
            _PlaymakerPath = Google2uGUIUtil.GetString("g2uplaymakerDirectory", Google2u.Google2uGenPath("PLAYMAKER"));


            if (_ExportThread == null || _ExportThread.IsAlive == false)
            {
                _ExportThread = new Thread(ExportThread)
                {
                    Name = "ExportThread"
                };
                _ExportThread.Start(this);
            }
        }
Example #3
0
        public Google2uExportOptions(string in_prefix)
        {
            _Prefix = in_prefix;

            LowercaseHeader = Google2uGUIUtil.GetBool(in_prefix + "LowercaseHeader", LowercaseHeader);

            TrimStrings      = Google2uGUIUtil.GetBool(in_prefix + "TrimStrings", TrimStrings);
            TrimStringArrays = Google2uGUIUtil.GetBool(in_prefix + "TrimStringArrays", TrimStringArrays);

            ArrayDelimiters        = Google2uGUIUtil.GetInt(in_prefix + "ArrayDelimiters", ArrayDelimiters);
            StringArrayDelimiters  = Google2uGUIUtil.GetInt(in_prefix + "StringArrayDelimiters", StringArrayDelimiters);
            ComplexTypeDelimiters  = Google2uGUIUtil.GetInt(in_prefix + "ComplexTypeDelimiters", ComplexTypeDelimiters);
            ComplexArrayDelimiters = Google2uGUIUtil.GetInt(in_prefix + "ComplexArrayDelimiters", ComplexArrayDelimiters);

            #region ObjectDatabase Options

            var dbObjName = Google2uGUIUtil.GetString(_Prefix + "GameObjectDatabaseName", string.Empty);
            if (string.IsNullOrEmpty(dbObjName) == false)
            {
                var go = GameObject.Find(dbObjName);
                if (go)
                {
                    ExportDatabaseGameObjectName = dbObjName;
                    _ExportDatabaseGameObject    = go;
                }
            }


            _OverrideObjectDatabaseNames = new Dictionary <string, string>();


            var tmpOverrides = Google2uGUIUtil.GetString(_Prefix + "OverrideObjectDatabaseNames",
                                                         string.Empty);
            var tmpOverrideSplit = tmpOverrides.Split(',');
            foreach (var s in tmpOverrideSplit)
            {
                var sSplit = s.Split('|');
                if (sSplit.Length == 2)
                {
                    _OverrideObjectDatabaseNames.Add(sSplit[0], sSplit[1]);
                }
            }

            GeneratePlaymakerActions = Google2uGUIUtil.GetBool(in_prefix + "GeneratePlaymakerActions",
                                                               GeneratePlaymakerActions);
            UseDoNotDestroy     = Google2uGUIUtil.GetBool(in_prefix + "UseDoNotDestroy", UseDoNotDestroy);
            ObjectDBCullColumns = Google2uGUIUtil.GetBool(in_prefix + "ObjectDBCullColumns", ObjectDBCullColumns);
            ObjectDBCullRows    = Google2uGUIUtil.GetBool(in_prefix + "ObjectDBCullRows", ObjectDBCullRows);

            #endregion

            #region Static DB Options

            StaticDBCullColumns = Google2uGUIUtil.GetBool(in_prefix + "StaticDBCullColumns", StaticDBCullColumns);
            StaticDBCullRows    = Google2uGUIUtil.GetBool(in_prefix + "StaticDBCullRows", StaticDBCullRows);

            #endregion

            #region JSON Options

            EscapeUnicode         = Google2uGUIUtil.GetBool(in_prefix + "EscapeUnicode", EscapeUnicode);
            JSONCellArrayToString = Google2uGUIUtil.GetBool(in_prefix + "JSONCellArrayToString", JSONCellArrayToString);
            JSONExportClass       = Google2uGUIUtil.GetBool(in_prefix + "JSONExportClass", JSONExportClass);
            JSONExportType        = Google2uGUIUtil.GetEnum(in_prefix + "JSONExportType", JSONExportType);
            JSONCullColumns       = Google2uGUIUtil.GetBool(in_prefix + "JSONCullColumns", JSONCullColumns);
            JSONCullRows          = Google2uGUIUtil.GetBool(in_prefix + "JSONCullRows", JSONCullRows);
            JSONIgnoreIDColumn    = Google2uGUIUtil.GetBool(in_prefix + "JSONIgnoreIDColumn", JSONIgnoreIDColumn);
            JSONExportPretty      = Google2uGUIUtil.GetBool(in_prefix + "JSONExportPretty", JSONExportPretty);
            #endregion

            #region XML Options

            XMLCellArrayToString = Google2uGUIUtil.GetBool(in_prefix + "XMLCellArrayToString", XMLCellArrayToString);
            XMLCullColumns       = Google2uGUIUtil.GetBool(in_prefix + "XMLCullColumns", XMLCullColumns);
            XMLCullRows          = Google2uGUIUtil.GetBool(in_prefix + "XMLCullRows", XMLCullRows);

            #endregion

            #region CSV Options

            EscapeCSVStrings     = Google2uGUIUtil.GetBool(in_prefix + "EscapeCSVStrings", EscapeCSVStrings);
            CSVCullColumns       = Google2uGUIUtil.GetBool(in_prefix + "CSVCullColumns", CSVCullColumns);
            CSVCullRows          = Google2uGUIUtil.GetBool(in_prefix + "CSVCullRows", CSVCullRows);
            CSVConvertLineBreaks = Google2uGUIUtil.GetBool(in_prefix + "CSVConvertLineBreaks", CSVConvertLineBreaks);

            #endregion

            #region NGUI Options

            EscapeNGUIStrings     = Google2uGUIUtil.GetBool(in_prefix + "EscapeNGUIStrings", EscapeNGUIStrings);
            NGUICullColumns       = Google2uGUIUtil.GetBool(in_prefix + "NGUICullColumns", NGUICullColumns);
            NGUICullRows          = Google2uGUIUtil.GetBool(in_prefix + "NGUICullRows", NGUICullRows);
            NGUIConvertLineBreaks = Google2uGUIUtil.GetBool(in_prefix + "NGUIConvertLineBreaks", NGUIConvertLineBreaks);
            NGUILegacyExport      = Google2uGUIUtil.GetBool(in_prefix + "NGUILegacyExport", NGUILegacyExport);

            #endregion
        }
Example #4
0
        public static string Google2uGenPath(string in_pathType)
        {
            var retPath = string.Empty;

            if (Google2uGUIUtil.GfuStrCmp(in_pathType, "Google2uGEN"))
            {
                retPath = Path.Combine(Instance.InstanceData.ProjectPath, "Google2uGen").Replace('\\', '/');
                if (!Directory.Exists(retPath))
                {
                    Debug.Log("Generating: " + retPath);
                    Directory.CreateDirectory(retPath);
                }
            } // Standard Assets
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "OBJDB"))
            {
                {
                    var Google2ugenPath = Google2uGenPath("Google2uGEN");

                    retPath = Path.Combine(Google2ugenPath, "ObjDB").Replace('\\', '/');
                    if (!Directory.Exists(retPath))
                    {
                        Debug.Log("Generating: " + retPath);
                        Directory.CreateDirectory(retPath);
                    }
                }
            }
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "OBJDBRESOURCES"))
            {
                {
                    retPath = Google2uGUIUtil.GetString("g2uobjDBResourcesDirectory", retPath);
                    if (!Directory.Exists(retPath))
                    {
                        var objdbPath = Google2uGenPath("OBJDB");

                        retPath = Path.Combine(objdbPath, "Resources").Replace('\\', '/');
                        if (!Directory.Exists(retPath))
                        {
                            Debug.Log("Generating: " + retPath);
                            Directory.CreateDirectory(retPath);
                        }

                        Google2uGUIUtil.SetString("g2uobjDBResourcesDirectory", retPath);
                    }
                }
            }
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "OBJDBEDITOR"))
            {
                {
                    retPath = Google2uGUIUtil.GetString("g2uobjDBEditorDirectory", retPath);
                    if (!Directory.Exists(retPath))
                    {
                        var objdbPath = Google2uGenPath("OBJDB");

                        retPath = Path.Combine(objdbPath, "Editor").Replace('\\', '/');
                        if (!Directory.Exists(retPath))
                        {
                            Debug.Log("Generating: " + retPath);
                            Directory.CreateDirectory(retPath);
                        }

                        Google2uGUIUtil.SetString("g2uobjDBEditorDirectory", retPath);
                    }
                }
            }
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "STATICDB"))
            {
                {
                    var Google2ugenPath = Google2uGenPath("Google2uGEN");

                    retPath = Path.Combine(Google2ugenPath, "StaticDB").Replace('\\', '/');
                    if (!Directory.Exists(retPath))
                    {
                        Debug.Log("Generating: " + retPath);
                        Directory.CreateDirectory(retPath);
                    }
                }
            }
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "STATICDBRESOURCES"))
            {
                {
                    retPath = Google2uGUIUtil.GetString("g2uStaticDBResourcesDirectory", retPath);
                    if (Directory.Exists(retPath))
                    {
                        return(retPath);
                    }
                    var staticdbPath = Google2uGenPath("STATICDB");

                    retPath = Path.Combine(staticdbPath, "Resources").Replace('\\', '/');
                    if (!Directory.Exists(retPath))
                    {
                        Debug.Log("Generating: " + retPath);
                        Directory.CreateDirectory(retPath);
                    }

                    Google2uGUIUtil.SetString("g2uStaticDBResourcesDirectory", retPath);
                }
            }
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "JSON"))
            {
                {
                    retPath = Google2uGUIUtil.GetString("g2ujsonDirectory", retPath);
                    if (Directory.Exists(retPath))
                    {
                        return(retPath);
                    }
                    var Google2ugenPath = Google2uGenPath("Google2uGEN");

                    retPath = Path.Combine(Google2ugenPath, "JSON").Replace('\\', '/');
                    if (!Directory.Exists(retPath))
                    {
                        Debug.Log("Generating: " + retPath);
                        Directory.CreateDirectory(retPath);
                    }

                    Google2uGUIUtil.SetString("g2ujsonDirectory", retPath);
                }
            }
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "CSV"))
            {
                {
                    retPath = Google2uGUIUtil.GetString("g2ucsvDirectory", retPath);
                    if (Directory.Exists(retPath))
                    {
                        return(retPath);
                    }
                    var Google2ugenPath = Google2uGenPath("Google2uGEN");

                    retPath = Path.Combine(Google2ugenPath, "CSV").Replace('\\', '/');
                    if (!Directory.Exists(retPath))
                    {
                        Debug.Log("Generating: " + retPath);
                        Directory.CreateDirectory(retPath);
                    }

                    Google2uGUIUtil.SetString("g2ucsvDirectory", retPath);
                }
            }
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "XML"))
            {
                {
                    retPath = Google2uGUIUtil.GetString("g2uxmlDirectory", retPath);
                    if (Directory.Exists(retPath))
                    {
                        return(retPath);
                    }
                    var Google2ugenPath = Google2uGenPath("Google2uGEN");

                    retPath = Path.Combine(Google2ugenPath, "XML").Replace('\\', '/');
                    if (!Directory.Exists(retPath))
                    {
                        Debug.Log("Generating: " + retPath);
                        Directory.CreateDirectory(retPath);
                    }

                    Google2uGUIUtil.SetString("g2uxmlDirectory", retPath);
                }
            }
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "NGUI"))
            {
                {
                    retPath = Google2uGUIUtil.GetString("g2unguiDirectory", retPath);
                    if (Directory.Exists(retPath))
                    {
                        return(retPath);
                    }
                    var Google2ugenPath = Google2uGenPath("Google2uGEN");

                    retPath = Path.Combine(Google2ugenPath, "NGUI").Replace('\\', '/');
                    if (!Directory.Exists(retPath))
                    {
                        Debug.Log("Generating: " + retPath);
                        Directory.CreateDirectory(retPath);
                    }

                    Google2uGUIUtil.SetString("g2unguiDirectory", retPath);
                }
            }
            else if (Google2uGUIUtil.GfuStrCmp(in_pathType, "PLAYMAKER"))
            {
                {
                    retPath = Google2uGUIUtil.GetString("g2uplaymakerDirectory", retPath);
                    if (Directory.Exists(retPath))
                    {
                        return(retPath);
                    }
                    // attempt to find the playmaker actions directory
                    // We already know that the playmaker dll exists, but we need to find the actual path
                    var playmakerPaths = Directory.GetFiles(Application.dataPath, "PlayMaker.dll",
                                                            SearchOption.AllDirectories);
                    var playmakerPath = string.Empty;
                    if (playmakerPaths.Length > 0)
                    {
                        // We are just going to use the first entry. If there is more than 1 entry, there are bigger issues
                        var fileName = playmakerPaths[0];
                        var fileInfo = new FileInfo(fileName);
                        playmakerPath = fileInfo.DirectoryName;
                    }

                    if (playmakerPath != string.Empty)
                    {
                        if (playmakerPath != null)
                        {
                            retPath = Path.Combine(playmakerPath, "Actions");
                        }
                        if (Directory.Exists(retPath))
                        {
                            // We have found the Playmaker Actions dir!
                            Google2uGUIUtil.SetString("g2uplaymakerDirectory", retPath);
                        }
                        else
                        {
                            // The actions subdirectory doesn't exist? Rather than making it in the playmaker directory,
                            // We will just use our Google2uGen path instead and let the user figure it out
                            var Google2ugenPath = Google2uGenPath("Google2uGEN");

                            retPath = Path.Combine(Google2ugenPath, "PlayMaker").Replace('\\', '/');
                            if (!Directory.Exists(retPath))
                            {
                                Directory.CreateDirectory(retPath);
                            }

                            Google2uGUIUtil.SetString("g2uplaymakerDirectory", retPath);
                        }
                    }
                }
            }

            return(retPath);
        }
Example #5
0
        private void Init()
        {
            var lastChecked =
                Convert.ToDateTime(Google2uGUIUtil.GetString("Google2uLastCheckedForUpdate",
                                                             Convert.ToString(DateTime.MinValue)));

            if ((DateTime.Now - lastChecked).Days >= 1)
            {
                Google2uGUIUtil.SetString("Google2uLastCheckedForUpdate", Convert.ToString(DateTime.Now));
                var t = new Thread(CheckForUpdate);
                t.Start();
            }

            ShowDocsAtStartup = Google2uGUIUtil.GetBool("ShowDocsAtStartup", ShowDocsAtStartup);
            if (ShowDocsAtStartup)
            {
                Google2uDocs.ShowWindow(MyGUILayout, LocalizationInfo);
            }

            ServicePointManager.ServerCertificateValidationCallback = Validator;
            OAuthToken     = Google2uGUIUtil.GetString("OAuthToken", OAuthToken);
            RefreshToken   = Google2uGUIUtil.GetString("RefreshToken", RefreshToken);
            RefreshTimeout =
                DateTime.ParseExact(Google2uGUIUtil.GetString("RefreshTimeout", RefreshTimeout.ToString("O")), "O",
                                    CultureInfo.InvariantCulture);

            if (InstanceData.Service == null && !string.IsNullOrEmpty(OAuthToken))
            {
                SetupParameters();

                _authParameters.AccessToken = OAuthToken;


                var requestFactory = new GOAuth2RequestFactory("structuredcontent", "Google2Unity", _authParameters);
                InstanceData.Service = new SpreadsheetsService("Google2Unity")
                {
                    RequestFactory = requestFactory
                };

                Thread.Sleep(100);

                if (!InstanceData.Commands.Contains(GFCommand.RetrieveWorkbooks))
                {
                    InstanceData.Commands.Add(GFCommand.RetrieveWorkbooks);
                }
            }

            // Close lingering editor windows
            var ed = GetWindow <Google2uEditor>();

            if (ed != null)
            {
                ed.Close();
            }

            if (ObjDbExport == null)
            {
                ObjDbExport = new List <Google2uObjDbExport>();
            }

            Instance = this;
        }