Esempio n. 1
0
 public CSParameterList And(string type, string identifier,
                            CSParameterKind parameterKind = CSParameterKind.None,
                            CSConstant defaultValue       = null)
 {
     return(And(new CSParameter(new CSSimpleType(Exceptions.ThrowOnNull(type, nameof(type))),
                                new CSIdentifier(Exceptions.ThrowOnNull(identifier, nameof(identifier))), parameterKind, defaultValue)));
 }
        public static CSAttribute FieldOffset(int offset)
        {
            CSArgumentList args = new CSArgumentList();

            args.Add(CSConstant.Val(offset));
            return(new CSAttribute(new CSIdentifier("FieldOffset"), args, true));
        }
Esempio n. 3
0
 public CSParameter(CSType type, CSIdentifier name,
                    CSParameterKind parameterKind = CSParameterKind.None,
                    CSConstant defaultValue       = null)
 {
     CSType        = Exceptions.ThrowOnNull(type, nameof(type));
     Name          = Exceptions.ThrowOnNull(name, nameof(name));
     ParameterKind = parameterKind;
     DefaultValue  = defaultValue;
 }
Esempio n. 4
0
        public static CSLine ThrowLine <T> (T exType, string message) where T : Exception
        {
            CommaListElementCollection <CSBaseExpression> args = new CommaListElementCollection <CSBaseExpression> ();

            if (message != null)
            {
                args.Add(CSConstant.Val(message));
            }
            return(ThrowLine(exType, args));
        }
        public static CSAttribute DllImport(CSBaseExpression dllName, string entryPoint = null)
        {
            CSArgumentList args = new CSArgumentList();

            args.Add(dllName);
            if (entryPoint != null)
            {
                args.Add(new CSAssignment("EntryPoint", CSAssignmentOperator.Assign, CSConstant.Val(entryPoint)));
            }
            return(new CSAttribute(new CSIdentifier("DllImport"), args, true));
        }
Esempio n. 6
0
 public static CSBaseExpression operator >>(CSBaseExpression lhs, int bits)
 {
     return(new CSBinaryExpression(CSBinaryOperator.RightShift, lhs, CSConstant.Val(bits)));
 }
Esempio n. 7
0
 public CSParameter(string type, string name,
                    CSParameterKind parameterKind = CSParameterKind.None,
                    CSConstant defaultValue       = null)
     : this(new CSSimpleType(type), new CSIdentifier(name), parameterKind, defaultValue)
 {
 }