private static List <string> ProcessScript(MonoScript monoScript)
        {
            var result = new List <string>();

            var dataScript = monoScript.ToString();

            do
            {
                var index = dataScript.IndexOf(ScriptMarkFind, StringComparison.Ordinal);
                if (index > 0)
                {
                    var text = GetScriptTextToTranslation(dataScript, index);
                    result.Add(text);

                    Debug.Log(
                        "SCRIPT: [ " + monoScript.name + " ] --- Found new text for Locale --- LocaleText:" + text);
                    dataScript = dataScript.Substring(index + ScriptMarkFind.Length + 2);
                }
                else
                {
                    break;
                }
            } while (dataScript.Contains(ScriptMarkFind));

            return(result);
        }
Beispiel #2
0
        public string[] Parse(MonoScript script)
        {
            string        src  = script.ToString();
            Match         m    = regex.Match(src);
            List <string> list = new List <string>();

            for (int i = 1; i < m.Groups.Count; i++)
            {
                Group g = m.Groups[i];
                foreach (Capture c in g.Captures)
                {
                    list.Add(c.Value);
                }
            }
            return(list.ToArray());
        }
        private Type GetTargetedType(bool checkForSerializable = true)
        {
            Type type = m_type.GetClass();

            if (type == null)
            {
                string typeDefenition = m_type.ToString();

                var parts = typeDefenition.Split(new [] { "namespace" },
                                                 StringSplitOptions.RemoveEmptyEntries)[1].Split(' ')[1].Split('\n');

                typeDefenition = parts[0].Trim() + "." + m_type.name;

                type = TypeExt.GetType(typeDefenition);
            }

            if (checkForSerializable && type != null && !type.IsSerializable)
            {
                throw new Exception($"{type} is not serializable");
            }

            return(type);
        }