public override void WriteDelegateParam(SourceStreamWriter sw, RegistryContext ctx, Command parentCommand)
 {
     if (mIsStrong)
     {
         // Strongly typed enum must be casted to delegate call type (int or uint)
         sw.Write("({0}){1}", OverridenParameter.GetImportType(parentCommand), GetDelegateCallVarName(parentCommand));
     }
     else
     {
         base.WriteDelegateParam(sw, ctx, parentCommand);
     }
 }
示例#2
0
        public override void WriteDelegateParam(SourceStreamWriter sw, RegistryContext ctx, Command parentCommand)
        {
            if (IsArrayLengthParameter(this, ctx, parentCommand))
            {
                CommandParameter arrayParam = GetArrayParameter(this, ctx, parentCommand);

                if (OverridenParameter.GetImportType(parentCommand) != "int")
                {
                    sw.Write("({0})", OverridenParameter.GetImportType(parentCommand));
                }

                switch (arrayParam.LengthMode)
                {
                case CommandParameterLengthMode.ArgumentReference:
                    sw.Write("{0}.Length", arrayParam.GetDelegateCallVarName(parentCommand));
                    break;

                case CommandParameterLengthMode.ArgumentMultiple:
                    uint multiple = arrayParam.LengthMultiple;

                    if (multiple > 1)
                    {
                        sw.Write("{0}.Length / {1}", arrayParam.GetDelegateCallVarName(parentCommand), multiple);
                    }
                    else
                    {
                        sw.Write("{0}.Length", arrayParam.GetDelegateCallVarName(parentCommand));
                    }
                    break;
                }
            }
            else
            {
                base.WriteDelegateParam(sw, ctx, parentCommand);
            }
        }