so i need to call a propriatry CLR function that expect a system.DateTimeOffset as on of the arguments
i am having a hella time getting one
;Convert WIL YMDHMS to a DateTime Object
arrYMDHMS = Arrayize( TimeYmdHms(), ":" )
objYear = ObjectClrNew( 'System.Int32', arrYMDHMS[0] )
objMonth = ObjectClrNew( 'System.Int32', arrYMDHMS[1] )
objDay = ObjectClrNew( 'System.Int32', arrYMDHMS[2] )
objHour = ObjectClrNew( 'System.Int32', arrYMDHMS[3] )
objMin = ObjectClrNew( 'System.Int32', arrYMDHMS[4] )
objSec = ObjectClrNew( 'System.Int32', arrYMDHMS[5] )
ObjNull = ObjectType( "NULL", 0 )
; DateTimeOffset should be able to take Y,M,D,H,M,S,TimeSpan as a constructor, but I can't get a TimeSpan
objTimeSpan = ObjectClrNew("System.Timespan",-6,0,0)
; Goes boom: Method Type Signature is not interop compatible
;also tried
objZero = ObjectClrNew( 'System.Int32', 0 )
objNegSix = ObjectClrNew( 'System.Int32', -6 )
objTimeSpan = ObjectClrNew("System.TimeSpan",objNegSix,objZero,objZero)
;same no-go
;I tried to get a timespan from a return of calling a Propertu of the TimeZoneInfo object... Still nothing
ObjTZ = ObjectClrNew( 'System.TimeZoneInfo')
ObjTimeSpan = ObjTZ.BaseUtcOffset ; didnt work = Error: Non Static Method requires a target
ObjTimeSpan = ObjTZ.Local.BaseUtcOffset; didn;t work either: Method Type Signature is not interop compatible.. back to the original Error
ObjDTOff = ObjectClrNew( 'System.DateTimeOffset',objYear, objMonth, objDay, objHour, objMin, objSec, objTimeSpan)
;OR it looks like you could construct a DateTimeOffset with just a DateTime, but still having trouble
ObjDT = ObjectClrNew( 'System.DateTime',objYear, objMonth, objDay, objHour, objMin, objSec)
ObjDTOff = ObjectClrNew( 'System.DateTimeOffset',ObjDT)
; still doesnt work
; the end game is to get this to work
;
https://github.com/emertechie/SyslogNetSysLogServer = %A server capable of recieving Syslog over TCP on 514%
SysLogPort = 514
LocalHostName = %FQDN of This Computer%
AppName = %string of some arbitrary appname i made up%
UserFacility1 = ObjectClrNew("SyslogNet.Client.Facility",ObjectClrNew( 'System.Int32',16))
SeverityNotify = ObjectClrNew("SyslogNet.Client.Severity",ObjectClrNew( 'System.Int32',5))
SyslogSerializer = ObjectClrNew("SyslogNet.Client.Serialization.SyslogRfc3164MessageSerializer")
SysLogSender = ObjectClrNew("SyslogNet.Client.Transport.SyslogTcpSender",SyslogServer,SyslogPort)
SyslogMessage = ObjectClrNew("SyslogNet.Client.SyslogMessage",objDTOff,UserFacility1,SeverityNotify,LocalHostName,Appname,"TEST MESSAGE")