示例#1
0
 private static void Add(ThryEditorShader s)
 {
     Init();
     if (!dictionary.ContainsKey(s.name))
     {
         dictionary.Add(s.name, s);
         shaders.Add(s);
     }
 }
示例#2
0
        private static bool TestShaderForThryEditor(string path)
        {
            string code = Helper.ReadFileIntoString(path);

            if (ShaderUsesThryEditor(code))
            {
                ThryEditorShader shader = new ThryEditorShader();
                shader.path = path;
                Match name_match = Regex.Match(code, @"(?<=[Ss]hader)\s*\""[^\""]+(?=\""\s*{)");
                if (name_match.Success)
                {
                    shader.name = name_match.Value.TrimStart(new char[] { ' ', '"' });
                }
                Match master_label_match = Regex.Match(code, @"\[HideInInspector\]\s*shader_master_label\s*\(\s*\""[^\""]*(?=\"")");
                if (master_label_match.Success)
                {
                    shader.version = GetVersionFromMasterLabel(master_label_match.Value);
                }
                thry_editor_shaders.Add(shader);
                return(true);
            }
            return(false);
        }