private static void Add(ThryEditorShader s) { Init(); if (!dictionary.ContainsKey(s.name)) { dictionary.Add(s.name, s); shaders.Add(s); } }
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); }