CheckArguments() private static method

private static CheckArguments ( object args, MethodInfo method ) : bool
args object
method System.Reflection.MethodInfo
return bool
示例#1
0
        private static void OnWillSaveAssets(string[] assets, out string[] assetsThatShouldBeSaved, out string[] assetsThatShouldBeReverted, int explicitlySaveScene)
        {
            assetsThatShouldBeReverted = new string[0];
            assetsThatShouldBeSaved    = assets;
            bool flag = assets.Length > 0 && EditorPrefs.GetBool("VerifySavingAssets", false) && InternalEditorUtility.isHumanControllingUs;

            if (explicitlySaveScene != 0 && assets.Length == 1 && assets[0].EndsWith(".unity"))
            {
                flag = false;
            }
            if (flag)
            {
                AssetSaveDialog.ShowWindow(assets, out assetsThatShouldBeSaved);
            }
            else
            {
                assetsThatShouldBeSaved = assets;
            }
            foreach (Type current in AssetModificationProcessorInternal.AssetModificationProcessors)
            {
                MethodInfo method = current.GetMethod("OnWillSaveAssets", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                if (method != null)
                {
                    object[] array = new object[]
                    {
                        assetsThatShouldBeSaved
                    };
                    if (AssetModificationProcessorInternal.CheckArguments(array, method))
                    {
                        string[] array2 = (string[])method.Invoke(null, array);
                        if (array2 != null)
                        {
                            assetsThatShouldBeSaved = array2;
                        }
                    }
                }
            }
            if (assetsThatShouldBeSaved == null)
            {
                return;
            }
            List <string> list = new List <string>();

            string[] array3 = assetsThatShouldBeSaved;
            for (int i = 0; i < array3.Length; i++)
            {
                string text = array3[i];
                if (!AssetDatabase.IsOpenForEdit(text))
                {
                    list.Add(text);
                }
            }
            assets = list.ToArray();
            if (assets.Length != 0 && !Provider.PromptAndCheckoutIfNeeded(assets, string.Empty))
            {
                Debug.LogError("Could not check out the following files in version control before saving: " + string.Join(", ", assets));
                assetsThatShouldBeSaved = new string[0];
                return;
            }
        }
示例#2
0
        private static void OnWillSaveAssets(string[] assets, out string[] assetsThatShouldBeSaved, out string[] assetsThatShouldBeReverted, int explicitlySaveScene)
        {
            assetsThatShouldBeReverted = new string[0];
            assetsThatShouldBeSaved    = assets;
            bool flag = assets.Length > 0 && EditorPrefs.GetBool("VerifySavingAssets", false) && InternalEditorUtility.isHumanControllingUs;

            if (explicitlySaveScene != 0 && assets.Length == 1 && assets[0].EndsWith(".unity"))
            {
                flag = false;
            }
            if (flag)
            {
                AssetSaveDialog.ShowWindow(assets, out assetsThatShouldBeSaved);
            }
            else
            {
                assetsThatShouldBeSaved = assets;
            }
            foreach (System.Type modificationProcessor in AssetModificationProcessorInternal.AssetModificationProcessors)
            {
                MethodInfo method = modificationProcessor.GetMethod("OnWillSaveAssets", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                if (method != null)
                {
                    object[] objArray = new object[1]
                    {
                        (object)assetsThatShouldBeSaved
                    };
                    if (AssetModificationProcessorInternal.CheckArguments(objArray, method))
                    {
                        string[] strArray = (string[])method.Invoke((object)null, objArray);
                        if (strArray != null)
                        {
                            assetsThatShouldBeSaved = strArray;
                        }
                    }
                }
            }
            if (assetsThatShouldBeSaved == null)
            {
                return;
            }
            List <string> stringList = new List <string>();

            foreach (string assetOrMetaFilePath in assetsThatShouldBeSaved)
            {
                if (!AssetDatabase.IsOpenForEdit(assetOrMetaFilePath))
                {
                    stringList.Add(assetOrMetaFilePath);
                }
            }
            assets = stringList.ToArray();
            if (assets.Length == 0 || Provider.PromptAndCheckoutIfNeeded(assets, string.Empty))
            {
                return;
            }
            Debug.LogError((object)("Could not check out the following files in version control before saving: " + string.Join(", ", assets)));
            assetsThatShouldBeSaved = new string[0];
        }
示例#3
0
 private static void OnWillCreateAsset(string path)
 {
     foreach (System.Type modificationProcessor in AssetModificationProcessorInternal.AssetModificationProcessors)
     {
         MethodInfo method = modificationProcessor.GetMethod("OnWillCreateAsset", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
         if (method != null)
         {
             object[] objArray = new object[1] {
                 (object)path
             };
             if (AssetModificationProcessorInternal.CheckArguments(objArray, method))
             {
                 method.Invoke((object)null, objArray);
             }
         }
     }
 }
示例#4
0
 private static void OnWillCreateAsset(string path)
 {
     foreach (Type current in AssetModificationProcessorInternal.AssetModificationProcessors)
     {
         MethodInfo method = current.GetMethod("OnWillCreateAsset", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
         if (method != null)
         {
             object[] array = new object[]
             {
                 path
             };
             if (AssetModificationProcessorInternal.CheckArguments(array, method))
             {
                 method.Invoke(null, array);
             }
         }
     }
 }