예제 #1
0
        /// <summary>
        /// Enable's ot disable's script define line
        /// </summary>
        /// <param name="file">path to a script file</param>
        /// <param name="define">defined name</param>
        /// <param name="isEnabled">new define state</param>
        public static void ChangeScriptDefineState(string file, string define, bool isEnabled)
        {
            if (SA_FilesUtil.IsFileExists(file))
            {
                string content = SA_FilesUtil.Read(file);


                int endlineIndex;
                endlineIndex = content.IndexOf(System.Environment.NewLine, System.StringComparison.CurrentCulture);
                if (endlineIndex == -1)
                {
                    endlineIndex = content.IndexOf("\n", System.StringComparison.CurrentCulture);
                }
                string TagLine = content.Substring(0, endlineIndex);

                if (isEnabled)
                {
                    content = content.Replace(TagLine, "#define " + define);
                }
                else
                {
                    content = content.Replace(TagLine, "//#define " + define);
                }
                SA_FilesUtil.Write(file, content);
            }
        }
 public static void OverrideGamesIds(string data)
 {
     SA_FilesUtil.Write(AN_Settings.ANDROID_GAMES_IDS_FILE_PATH, data);
     SA_AssetDatabase.ImportAsset(AN_Settings.ANDROID_GAMES_IDS_FILE_PATH);
 }