private static AssemblyDefinitionImporterInspector.AssemblyDefinitionReference CreateAssemblyDefinitionReference(string assemblyName)
        {
            AssemblyDefinitionImporterInspector.AssemblyDefinitionReference assemblyDefinitionReference = new AssemblyDefinitionImporterInspector.AssemblyDefinitionReference();
            string assemblyDefinitionFilePathFromAssemblyName = CompilationPipeline.GetAssemblyDefinitionFilePathFromAssemblyName(assemblyName);

            if (string.IsNullOrEmpty(assemblyDefinitionFilePathFromAssemblyName))
            {
                throw new Exception(string.Format("Could not get assembly definition filename for assembly '{0}'", assemblyName));
            }
            assemblyDefinitionReference.asset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(assemblyDefinitionFilePathFromAssemblyName);
            if (assemblyDefinitionReference.asset == null)
            {
                throw new FileNotFoundException(string.Format("Assembly definition file '{0}' not found", assemblyDefinitionReference.path), assemblyDefinitionReference.path);
            }
            assemblyDefinitionReference.data = CustomScriptAssemblyData.FromJson(assemblyDefinitionReference.asset.text);
            return(assemblyDefinitionReference);
        }
        private void DrawReferenceListElement(Rect rect, int index, bool selected, bool focused)
        {
            IList list = this.m_ReferencesList.list;

            AssemblyDefinitionImporterInspector.AssemblyDefinitionReference assemblyDefinitionReference = list[index] as AssemblyDefinitionImporterInspector.AssemblyDefinitionReference;
            rect.height -= 2f;
            string text = (assemblyDefinitionReference.data == null) ? "(Missing Reference)" : assemblyDefinitionReference.data.name;
            AssemblyDefinitionAsset asset = assemblyDefinitionReference.asset;
            bool flag = assemblyDefinitionReference.displayValue == AssemblyDefinitionImporterInspector.MixedBool.Mixed;

            EditorGUI.showMixedValue          = flag;
            assemblyDefinitionReference.asset = (EditorGUI.ObjectField(rect, (!flag) ? text : "(Multiple Values)", asset, typeof(AssemblyDefinitionAsset), false) as AssemblyDefinitionAsset);
            EditorGUI.showMixedValue          = false;
            if (asset != assemblyDefinitionReference.asset && assemblyDefinitionReference.asset != null)
            {
                assemblyDefinitionReference.data = CustomScriptAssemblyData.FromJson(assemblyDefinitionReference.asset.text);
                AssemblyDefinitionImporterInspector.AssemblyDefintionState[] targetStates = this.m_TargetStates;
                for (int i = 0; i < targetStates.Length; i++)
                {
                    AssemblyDefinitionImporterInspector.AssemblyDefintionState assemblyDefintionState = targetStates[i];
                    assemblyDefintionState.references[index] = assemblyDefinitionReference;
                }
            }
        }
        private static AssemblyDefinitionImporterInspector.AssemblyDefintionState LoadAssemblyDefintionState(string path)
        {
            AssemblyDefinitionAsset assemblyDefinitionAsset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(path);

            AssemblyDefinitionImporterInspector.AssemblyDefintionState result;
            if (assemblyDefinitionAsset == null)
            {
                result = null;
            }
            else
            {
                CustomScriptAssemblyData customScriptAssemblyData = CustomScriptAssemblyData.FromJson(assemblyDefinitionAsset.text);
                if (customScriptAssemblyData == null)
                {
                    result = null;
                }
                else
                {
                    AssemblyDefinitionImporterInspector.AssemblyDefintionState assemblyDefintionState = new AssemblyDefinitionImporterInspector.AssemblyDefintionState();
                    assemblyDefintionState.asset      = assemblyDefinitionAsset;
                    assemblyDefintionState.name       = customScriptAssemblyData.name;
                    assemblyDefintionState.references = new List <AssemblyDefinitionImporterInspector.AssemblyDefinitionReference>();
                    if (customScriptAssemblyData.references != null)
                    {
                        string[] references = customScriptAssemblyData.references;
                        for (int i = 0; i < references.Length; i++)
                        {
                            string text = references[i];
                            try
                            {
                                AssemblyDefinitionImporterInspector.AssemblyDefinitionReference assemblyDefinitionReference = new AssemblyDefinitionImporterInspector.AssemblyDefinitionReference();
                                string assemblyDefinitionFilePathFromAssemblyName = CompilationPipeline.GetAssemblyDefinitionFilePathFromAssemblyName(text);
                                if (string.IsNullOrEmpty(assemblyDefinitionFilePathFromAssemblyName))
                                {
                                    throw new AssemblyDefinitionException(string.Format("Could not find assembly reference '{0}'", text), new string[]
                                    {
                                        path
                                    });
                                }
                                assemblyDefinitionReference.asset = AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>(assemblyDefinitionFilePathFromAssemblyName);
                                if (assemblyDefinitionReference.asset == null)
                                {
                                    throw new AssemblyDefinitionException(string.Format("Reference assembly definition file '{0}' not found", assemblyDefinitionFilePathFromAssemblyName), new string[]
                                    {
                                        path
                                    });
                                }
                                assemblyDefinitionReference.data         = CustomScriptAssemblyData.FromJson(assemblyDefinitionReference.asset.text);
                                assemblyDefinitionReference.displayValue = AssemblyDefinitionImporterInspector.MixedBool.False;
                                assemblyDefintionState.references.Add(assemblyDefinitionReference);
                            }
                            catch (AssemblyDefinitionException exception)
                            {
                                Debug.LogException(exception, assemblyDefinitionAsset);
                                assemblyDefintionState.references.Add(new AssemblyDefinitionImporterInspector.AssemblyDefinitionReference());
                                assemblyDefintionState.modified = true;
                            }
                        }
                    }
                    AssemblyDefinitionPlatform[] assemblyDefinitionPlatforms = CompilationPipeline.GetAssemblyDefinitionPlatforms();
                    assemblyDefintionState.platformCompatibility = new AssemblyDefinitionImporterInspector.MixedBool[assemblyDefinitionPlatforms.Length];
                    CustomScriptOptinalUnityAssembly[] optinalUnityAssemblies = CustomScriptAssembly.OptinalUnityAssemblies;
                    assemblyDefintionState.optionalUnityReferences = new AssemblyDefinitionImporterInspector.MixedBool[optinalUnityAssemblies.Length];
                    if (customScriptAssemblyData.optionalUnityReferences != null)
                    {
                        for (int j = 0; j < optinalUnityAssemblies.Length; j++)
                        {
                            string optionalUnityReferences = optinalUnityAssemblies[j].OptionalUnityReferences.ToString();
                            bool   flag = customScriptAssemblyData.optionalUnityReferences.Any((string x) => x == optionalUnityReferences);
                            if (flag)
                            {
                                assemblyDefintionState.optionalUnityReferences[j] = AssemblyDefinitionImporterInspector.MixedBool.True;
                            }
                        }
                    }
                    assemblyDefintionState.compatibleWithAnyPlatform = AssemblyDefinitionImporterInspector.MixedBool.True;
                    string[] array = null;
                    if (customScriptAssemblyData.includePlatforms != null && customScriptAssemblyData.includePlatforms.Length > 0)
                    {
                        assemblyDefintionState.compatibleWithAnyPlatform = AssemblyDefinitionImporterInspector.MixedBool.False;
                        array = customScriptAssemblyData.includePlatforms;
                    }
                    else if (customScriptAssemblyData.excludePlatforms != null && customScriptAssemblyData.excludePlatforms.Length > 0)
                    {
                        assemblyDefintionState.compatibleWithAnyPlatform = AssemblyDefinitionImporterInspector.MixedBool.True;
                        array = customScriptAssemblyData.excludePlatforms;
                    }
                    if (array != null)
                    {
                        string[] array2 = array;
                        for (int k = 0; k < array2.Length; k++)
                        {
                            string name          = array2[k];
                            int    platformIndex = AssemblyDefinitionImporterInspector.GetPlatformIndex(assemblyDefinitionPlatforms, name);
                            assemblyDefintionState.platformCompatibility[platformIndex] = AssemblyDefinitionImporterInspector.MixedBool.True;
                        }
                    }
                    result = assemblyDefintionState;
                }
            }
            return(result);
        }