Пример #1
0
        /// <summary>
        /// Create the dump file using expdp.exe.
        /// </summary>
        public string CreateDmpFile()
        {
            try
            {
                Console.WriteLine("Create an Export dmp file...");

                // Get values from XML File and args //
                XmlAccessor xClass = new XmlAccessor();
                xClass.ReadXmlFile();
                string oracleLocation = xClass.XmlValues["OracleLocation"];
                string fileName = "upg_" + currentEdition + "_" + nextEdition;

                // Update upg_exp.txt // 
                string[] upgradeParmText = { "DUMPFILE=" + fileName + ".dmp",
                                             "LOGFILE=" + fileName + ".log",
                                             "REUSE_DUMPFILES=YES",
                                             "SCHEMAS=LYNX",
                                             "INCLUDE=SEQUENCE:\"IN ('UPGRADE_COMMAND_SEQ','UPGRADE_MIGRATION_JOB_SEQ')\"",
                                             "INCLUDE=TABLE:\"IN ('RT_NAMESPACE_TYPE','RT_UPGRADE','RT_UPGRADE_COMMAND','RT_UPGRADE_MIGRATION_JOB','RT_UPGRADE_HOST_SCRIPT','RT_CLR_ASSEMBLIES')\"",
                                             "INCLUDE=PACKAGE:\"IN ('UPGRADE_PKG')\""
                                           };

                File.WriteAllLines("upg_exp.txt", upgradeParmText);

                // Get Current Directory //
                string upgFile = Directory.GetCurrentDirectory() + "\\upg_exp.txt";

                ProcessStartInfo pInfo = new ProcessStartInfo();
                pInfo.FileName = "expdp.exe";
                pInfo.WorkingDirectory = oracleLocation;
                pInfo.Arguments = "lynx_dev@pldb/f3line parfile=" + upgFile;
                pInfo.UseShellExecute = false;
                pInfo.CreateNoWindow = true;
                pInfo.RedirectStandardError = true;
                pInfo.RedirectStandardOutput = true;
                System.Environment.SetEnvironmentVariable("ORACLE_HOME", "C:\\app\\oracle\\product\\11.2.0\\dbhome_2", EnvironmentVariableTarget.Process);
                System.Environment.SetEnvironmentVariable("ORACLE_UNQNAME", "PLDB", EnvironmentVariableTarget.Process);

                Process p = new Process();
                p.StartInfo = pInfo;
                p.OutputDataReceived += new DataReceivedEventHandler(Display);
                p.ErrorDataReceived += new DataReceivedEventHandler(Display);
                p.Start();
                p.BeginOutputReadLine();
                p.BeginErrorReadLine();

                p.WaitForExit();
                p.Close();

                Console.WriteLine("Export dmp file has been created!");
                return fileName;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine("Create dmp file Failed!");
                return "";
            }
        }
Пример #2
0
    private static void SaveRuntimeLoadXml()
    {
        Dictionary <string, RuntimeAssetLoadInfo> runtimeAssetLoadInfos = new Dictionary <string, RuntimeAssetLoadInfo>();

        foreach (KeyValuePair <GameObject, EntitySaveOption> p in entitySaveOptions)
        {
            if (!runtimeAssetLoadInfos.ContainsKey(p.Value.assetName))
            {
                runtimeAssetLoadInfos.Add(p.Value.assetName, new RuntimeAssetLoadInfo(p.Value.categoryIndex, p.Value.specieIndex, p.Value.assetName, p.Key.activeSelf));
            }
        }

        XmlAccessor.WriteRuntimePrefabXml(PathTool.RuntimePrefabXmlPath(), runtimeAssetLoadInfos);
        FileTool.CopyFileToDestFolder(PathTool.RuntimePrefabXmlPath(), PathTool.GetAssetBundlePath());
    }
Пример #3
0
    public static void ExportOrganizeData()
    {//改为树形遍历
        AddRegisterToAll();

        Stack <EntityConfig> configs = new Stack <EntityConfig>();
        Queue <GameObject>   objs    = new Queue <GameObject>();

        foreach (GameObject o in SceneManager.GetActiveScene().GetRootGameObjects())
        {
            objs.Enqueue(o);
        }

        while (objs.Count > 0)
        {
            GameObject o = objs.Dequeue();
            if (o.GetComponent <EntityConfig>() != null)
            {
                configs.Push(o.GetComponent <EntityConfig>());
            }
            for (int k = 0; k < o.transform.childCount; k++)
            {
                objs.Enqueue(o.transform.GetChild(k).gameObject);
            }
        }

        Dictionary <string, AssetLoadInfo>            loadDic     = new Dictionary <string, AssetLoadInfo>();
        Stack <KeyValuePair <GameObject, Transform> > parentCache = new Stack <KeyValuePair <GameObject, Transform> >();

        int i = 0;

        while (configs.Count > 0)
        {
            EditorUtility.DisplayProgressBar("Exporting", "逐个导出,请勿退出!", (float)i / (float)configs.Count);
            EntityConfig config = configs.Pop();
            GameObject   go     = config.gameObject;
            config.RecordInfo();

            string catName = "";
            if (config.entitySaveOption != null)
            {
                catName = config.entitySaveOption.categoryName;
            }
            else
            {
                catName = LayerMask.LayerToName(go.layer);
            }

            string name = null;
            if (config.entitySaveOption.ifLoadRuntime)
            {
                name = config.entitySaveOption.name;
            }
            else
            {
                name = go.name;
            }


            string prefabSavePath     = new StringBuilder(PathTool.SceneResourcesPath()).Append("/").Append(catName).Append("/").Append(name).Append(".prefab").ToString();
            string prefabABName       = new StringBuilder(SceneManager.GetActiveScene().name.ToLower()).Append("/").Append(catName.ToLower()).Append(".ld ").Append(name).Append(".prefab").ToString();
            string organizeDataABName = new StringBuilder(PathTool.GetOrganizeDataABName().ToLower()).Append(catName.ToLower()).Append(".ld ").Append(name).Append(".asset").ToString();

            if (config.entitySaveOption.ifLoadRuntime)
            {
                parentCache.Push(new KeyValuePair <GameObject, Transform>(go, go.transform.parent));
                go.transform.SetParent(null, true);
                PrefabUtility.CreatePrefab(prefabSavePath, go, ReplacePrefabOptions.Default);
            }
            else if (!loadDic.ContainsKey(prefabABName))
            {
                loadDic.Add(prefabABName, new AssetLoadInfo(prefabABName, organizeDataABName, i, go.activeSelf));

                string organizeDataPath = new StringBuilder(PathTool.GetOrganizeDataPath()).Append(catName).Append("/").ToString();
                ExportInfo(config.entityInfo, organizeDataPath, name);
                parentCache.Push(new KeyValuePair <GameObject, Transform>(go, go.transform.parent));
                go.transform.SetParent(null, true);
                PrefabUtility.CreatePrefab(prefabSavePath, go, ReplacePrefabOptions.Default);
            }
            else
            {
                continue;
            }

            i++;
        }
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
        while (parentCache.Count > 0)
        {
            KeyValuePair <GameObject, Transform> p = parentCache.Pop();
            p.Key.transform.SetParent(p.Value, true);
        }

        XmlAccessor.WriteLoadRecordXml(PathTool.GetLoadRecordFilePath(), loadDic);
        FileTool.CopyFileToDestFolder(PathTool.GetLoadRecordFilePath(), PathTool.GetAssetBundlePath());

        EditorUtility.ClearProgressBar();
    }
Пример #4
0
        /// <summary>
        /// Check the args given by the user.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        static bool CheckArgs(string[] args)
        {
            // Setup for any unhandled exceptions //
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;

            // Check each arg //
            foreach (var arg in args)
            {
                if (arg == "newxml")
                {
                    XmlAccessor xClass = new XmlAccessor();
                    xClass.CreateDefaultXml();
                    return(true);
                }
                else if (arg == "testdb")
                {
                    Console.WriteLine("User ID: ");
                    string UserId = Console.ReadLine();
                    Console.WriteLine("Password: "******"Privilege: ");
                    string Privilege = Console.ReadLine();
                    TestDbConnection(UserId, Password, Privilege);
                    return(true);
                }
                else if (arg == "version")
                {
                    Console.WriteLine("Version - " + Assembly.GetEntryAssembly().GetName().Version.ToString());
                    return(true);
                }
                else if (arg == "help")
                {
                    ShowHelp();
                    return(true);
                }
                else if (arg.IndexOf("E") == 0)
                {
                    // Valid arg check //
                    if ((args[0].IndexOf("E") == 0) && (args[1].IndexOf("E") == 0))
                    {
                        return(false);
                    }
                    else
                    {
                        Console.WriteLine("Invalid Entry!  Press enter to exit!");
                        Console.ReadLine();
                        return(true);
                    }
                }
                else
                {
                    Console.WriteLine("Invalid Entry!  Press enter to exit!");
                    Console.ReadLine();
                    return(true);
                }
            }

            Console.WriteLine("Invalid Entry!  Press enter to exit!");
            Console.ReadLine();
            return(true);
        }