Exemple #1
0
        public void NestedGenericArrayTypeTest()
        {
            // ShuHai.Tests.TypeNameFixture+NestedGeneric`2
            // [
            //   [System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],
            //   [System.Collections.Generic.KeyValuePair`2
            //   [
            //     [ShuHai.TypeCache, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],
            //     [UnityEditor.SceneManagement.EditorSceneManager[,], UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]
            //   ], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]
            // ][][], Assembly-CSharp-Editor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
            NestedGenericArrayTypeTest(TypeName.Get(NestedGenericArrayType.AssemblyQualifiedName), true);

            // ShuHai.Tests.TypeNameFixture+NestedGeneric`2
            // [
            //   System.String,System.Collections.Generic.KeyValuePair`2
            //   [
            //     ShuHai.TypeCache,
            //     UnityEditor.SceneManagement.EditorSceneManager[,]
            //   ]
            // ][][]
            NestedGenericArrayTypeTest(TypeName.Get(NestedGenericArrayType.ToString()), false);
        }
Exemple #2
0
        public void GenericTypeTest()
        {
            // System.Collections.Generic.Dictionary`2
            // [
            //   System.String,
            //   System.Collections.Generic.KeyValuePair`2
            //   [
            //     ShuHai.TypeName, UnityEditor.SceneManagement.EditorSceneManager
            //   ]
            // ]
            GenericTypeTest(TypeName.Get(GenericType.ToString()), false);

            // System.Collections.Generic.Dictionary`2
            // [
            //   [System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],
            //   [System.Collections.Generic.KeyValuePair`2
            //   [
            //     [ShuHai.TypeName, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],
            //     [UnityEditor.SceneManagement.EditorSceneManager, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]
            //   ], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]
            // ], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
            GenericTypeTest(TypeName.Get(GenericType.AssemblyQualifiedName), true);
        }
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (InputObject.Expression != null)
            {
                targetCommand.AddParameter("InputObject", InputObject.Get(context));
            }

            if (MemberType.Expression != null)
            {
                targetCommand.AddParameter("MemberType", MemberType.Get(context));
            }

            if (Name.Expression != null)
            {
                targetCommand.AddParameter("Name", Name.Get(context));
            }

            if (Value.Expression != null)
            {
                targetCommand.AddParameter("Value", Value.Get(context));
            }

            if (SecondValue.Expression != null)
            {
                targetCommand.AddParameter("SecondValue", SecondValue.Get(context));
            }

            if (TypeName.Expression != null)
            {
                targetCommand.AddParameter("TypeName", TypeName.Get(context));
            }

            if (Force.Expression != null)
            {
                targetCommand.AddParameter("Force", Force.Get(context));
            }

            if (PassThru.Expression != null)
            {
                targetCommand.AddParameter("PassThru", PassThru.Get(context));
            }

            if (NotePropertyName.Expression != null)
            {
                targetCommand.AddParameter("NotePropertyName", NotePropertyName.Get(context));
            }

            if (NotePropertyValue.Expression != null)
            {
                targetCommand.AddParameter("NotePropertyValue", NotePropertyValue.Get(context));
            }

            if (NotePropertyMembers.Expression != null)
            {
                targetCommand.AddParameter("NotePropertyMembers", NotePropertyMembers.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
 protected override PropertyModel Execute(CodeActivityContext context)
 {
     return(new PropertyModel(Name.Get(context), TypeName.Get(context), Description.Get(context), RequiresInitialization.Get(context), MarkRequiredInBuilder.Get(context)));
 }
 string ICodingStyle.GetName(IType type) => TypeName.Get(type);
Exemple #6
0
 public static string TypeNameOf(Type type, FormatterAssemblyStyle?assemblyNameStyle)
 {
     return(TypeName.Get(type).ToString(assemblyNameStyle));
 }