Esempio n. 1
0
        public void SetAllCustomScriptAssemblyJsons(string[] paths)
        {
            List <CustomScriptAssembly> list = new List <CustomScriptAssembly>();

            for (int i = 0; i < paths.Length; i++)
            {
                string text = paths[i];
                try
                {
                    string path = (!Path.IsPathRooted(text)) ? Path.Combine(this.projectDirectory, text) : text;
                    CustomScriptAssembly loadedCustomScriptAssembly = EditorCompilation.LoadCustomScriptAssemblyFromJson(path);
                    if (list.Any((CustomScriptAssembly a) => string.Equals(a.Name, loadedCustomScriptAssembly.Name, StringComparison.OrdinalIgnoreCase)))
                    {
                        throw new Exception(string.Format("Assembly with name '{0}' is already defined ({1})", loadedCustomScriptAssembly.Name.Length, loadedCustomScriptAssembly.FilePath));
                    }
                    if (loadedCustomScriptAssembly.References == null)
                    {
                        loadedCustomScriptAssembly.References = new string[0];
                    }
                    if (loadedCustomScriptAssembly.References.Length != loadedCustomScriptAssembly.References.Distinct <string>().Count <string>())
                    {
                        throw new Exception(string.Format("Duplicate assembly references in {0}", loadedCustomScriptAssembly.FilePath));
                    }
                    list.Add(loadedCustomScriptAssembly);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message + " - '" + text + "'");
                }
            }
            this.customScriptAssemblies = list.ToArray();
            try
            {
                EditorCompilation.CheckCyclicAssemblyReferences(this.customScriptAssemblies);
            }
            catch (Exception ex2)
            {
                this.customScriptAssemblies = null;
                this.customTargetAssemblies = null;
                throw ex2;
            }
            this.customTargetAssemblies = EditorBuildRules.CreateTargetAssemblies(this.customScriptAssemblies);
        }