Ejemplo n.º 1
0
        /// <summary>
        /// Get Config from the CEngineConfig file through key
        /// </summary>
        public static string GetConfig(string key, bool showLog = true)
        {
            EnsureConfigTab();

            var conf = ConfigsTable.FindByPrimaryKey(key);

            if (conf == null)
            {
                if (showLog)
                {
                    Logger.LogError("Cannot get CosmosConfig: {0}", key);
                }
                return(null);
            }
            return(conf["Value"] as string);
        }
Ejemplo n.º 2
0
        public static void SetConfig(string key, string value)
        {
            EnsureConfigTab();
            if (!Application.isEditor)
            {
                Logger.LogError("Set Config is Editor only");
                return;
            }

            var item    = ConfigsTable.FindByPrimaryKey(key);
            var writer  = new TabFileWriter(ConfigsTable);
            var row     = writer.GetRow(item.RowNumber);
            var rowInfo = KEngineInfo.Wrap(row);

            rowInfo.Value = value;

            writer.Save(ConfigFilePath);
        }