private static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .ReadFrom.AppSettings() .CreateLogger(); var options = new CommandLineOptions(); // allow app to be debugged in visual studio. if (Debugger.IsAttached) { // args = "--help ".Split(' '); args = "--platform=essentials".Split(' '); // args = new[] // { // "--platform=none", // @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Xamarin.iOS.dll" // }; } // Parse in 'strict mode'; i.e. success or quit if (Parser.Default.ParseArgumentsStrict(args, options)) { try { if (!string.IsNullOrWhiteSpace(options.Template)) { _mustacheTemplate = options.Template; Log.Debug("Using {template} instead of the default template.", _mustacheTemplate); } if (!string.IsNullOrWhiteSpace(options.ReferenceAssemblies)) { _referenceAssembliesLocation = options.ReferenceAssemblies; Log.Debug($"Using {_referenceAssembliesLocation} instead of the default reference assemblies location."); } IPlatform platform = null; switch (options.Platform) { case AutoPlatform.None: if (!options.Assemblies.Any()) { throw new Exception("Assemblies to be used for manual generation were not specified."); } platform = new Bespoke(); platform.Assemblies = options.Assemblies; if (PlatformHelper.IsRunningOnMono()) { platform.CecilSearchDirectories = platform.Assemblies.Select(Path.GetDirectoryName).Distinct().ToList(); } else { platform.CecilSearchDirectories.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"); } break; case AutoPlatform.Android: platform = new Android(_referenceAssembliesLocation); break; case AutoPlatform.iOS: platform = new iOS(_referenceAssembliesLocation); break; case AutoPlatform.Mac: platform = new Mac(_referenceAssembliesLocation); break; case AutoPlatform.TVOS: platform = new TVOS(_referenceAssembliesLocation); break; case AutoPlatform.WPF: platform = new WPF(); break; case AutoPlatform.XamForms: platform = new XamForms(); break; case AutoPlatform.Tizen: platform = new Tizen(); break; case AutoPlatform.UWP: platform = new UWP(); break; case AutoPlatform.Winforms: platform = new Winforms(); break; case AutoPlatform.Essentials: platform = new Essentials(); _mustacheTemplate = "XamarinEssentialsTemplate.mustache"; break; default: throw new ArgumentOutOfRangeException(); } ExtractEventsFromAssemblies(platform); Environment.Exit((int)ExitCode.Success); } catch (Exception ex) { Log.Fatal(ex.ToString()); if (Debugger.IsAttached) { Debugger.Break(); } } } Environment.Exit((int)ExitCode.Error); }
private void Server_ReceiveErrored(object sender, Bespoke.Common.ExceptionEventArgs e) { debug("Unhandled Receive Errored"); }
/// <summary> /// Creates a new instance of OscServer. /// </summary> /// <param name="transportType">The underlying transport protocol.</param> /// <param name="ipAddress">The local IP address to bind to.</param> /// <param name="port">The UDP port to bind to.</param> /// <param name="multicastAddress">The multicast IP address to join.</param> /// <param name="transmissionType">The transmission type for the server to use.</param> /// <remarks>If ipAddress is specified, Unicast; otherwise, if multicastAddress is specified, Multicast.</remarks> public OscServer(Bespoke.Common.Net.TransportType transportType, IPAddress ipAddress, int port, IPAddress multicastAddress, TransmissionType transmissionType) : this(transportType, ipAddress, port, multicastAddress, transmissionType, true) { }
public static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .ReadFrom.AppSettings() .CreateLogger(); // allow app to be debugged in visual studio. if (Debugger.IsAttached) { args = "--platform=essentials --output-path=test.txt".Split(' '); } await new Parser(parserSettings => parserSettings.CaseInsensitiveEnumValues = true).ParseArguments <CommandLineOptions>(args).MapResult( async options => { try { if (!string.IsNullOrWhiteSpace(options.Template)) { _mustacheTemplate = options.Template; Log.Debug("Using {template} instead of the default template.", _mustacheTemplate); } if (!string.IsNullOrWhiteSpace(options.ReferenceAssemblies)) { _referenceAssembliesLocation = options.ReferenceAssemblies; Log.Debug($"Using {_referenceAssembliesLocation} instead of the default reference assemblies location."); } IPlatform platform = null; switch (options.Platform) { case AutoPlatform.None: if (options.Assemblies.Any() == false) { throw new Exception("Assemblies to be used for manual generation were not specified."); } platform = new Bespoke(); platform.Assemblies.AddRange(options.Assemblies); if (PlatformHelper.IsRunningOnMono()) { platform.CecilSearchDirectories.AddRange(platform.Assemblies.Select(Path.GetDirectoryName).Distinct().ToList()); } else { platform.CecilSearchDirectories.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"); } break; case AutoPlatform.Android: platform = new Android(_referenceAssembliesLocation); break; case AutoPlatform.iOS: platform = new iOS(_referenceAssembliesLocation); break; case AutoPlatform.Mac: platform = new Mac(_referenceAssembliesLocation); break; case AutoPlatform.TVOS: platform = new TVOS(_referenceAssembliesLocation); break; case AutoPlatform.WPF: platform = new WPF(); break; case AutoPlatform.XamForms: platform = new XamForms(); break; case AutoPlatform.Tizen4: platform = new Tizen(); break; case AutoPlatform.UWP: platform = new UWP(); break; case AutoPlatform.Winforms: platform = new Winforms(); break; case AutoPlatform.Essentials: platform = new Essentials(); _mustacheTemplate = "XamarinEssentialsTemplate.mustache"; break; default: throw new ArgumentException($"Platform not {options.Platform} supported"); } await ExtractEventsFromAssemblies(options.OutputPath, platform).ConfigureAwait(false); Environment.Exit((int)ExitCode.Success); } catch (Exception ex) { Log.Fatal(ex.ToString()); if (Debugger.IsAttached) { Debugger.Break(); } } Environment.Exit((int)ExitCode.Error); }, _ => Task.CompletedTask).ConfigureAwait(false); }
/// <summary> /// Creates a new instance of OscServer. /// </summary> /// <param name="transportType">The underlying transport protocol.</param> /// <param name="ipAddress">The local IP address to bind to.</param> /// <param name="port">The UDP port to bind to.</param> /// <remarks>TransmissionType.Unicast.</remarks> public OscServer(Bespoke.Common.Net.TransportType transportType, IPAddress ipAddress, int port) : this(transportType, ipAddress, port, null, TransmissionType.Unicast, true) { }
/// <summary> /// Creates a new instance of OscServer. /// </summary> /// <param name="transportType">The underlying transport protocol.</param> /// <param name="ipAddress">The local IP address to bind to.</param> /// <param name="port">The UDP port to bind to.</param> /// <param name="multicastAddress">The multicast IP address to join.</param> /// <param name="transmissionType">The transmission type for the server to use.</param> /// <param name="consumeParsingExceptions">Specifies the behavior of handling parsing exceptions.</param> /// <remarks>If ipAddress is specified, Unicast; otherwise, if multicastAddress is specified, Multicast.</remarks> public OscServer(Bespoke.Common.Net.TransportType transportType, IPAddress ipAddress, int port, IPAddress multicastAddress, TransmissionType transmissionType, bool consumeParsingExceptions) { Assert.IsTrue(transportType == Bespoke.Common.Net.TransportType.Udp || transportType == Bespoke.Common.Net.TransportType.Tcp); if ((transportType == Bespoke.Common.Net.TransportType.Tcp) && (transmissionType != TransmissionType.Unicast)) { throw new InvalidOperationException("TCP must be used with TransmissionType.Unicast."); } mTransportType = transportType; mIPAddress = ipAddress; mPort = port; mIPEndPoint = new IPEndPoint(ipAddress, port); mTransmissionType = transmissionType; if (mTransmissionType == TransmissionType.Multicast) { Assert.ParamIsNotNull(multicastAddress); mMulticastAddress = multicastAddress; } mRegisteredMethods = new List<string>(); mFilterRegisteredMethods = true; mConsumeParsingExceptions = consumeParsingExceptions; switch (mTransportType) { case Bespoke.Common.Net.TransportType.Udp: mUdpServer = new UdpServer(mIPAddress, mPort, mMulticastAddress, mTransmissionType); mUdpServer.DataReceived += new UdpDataReceivedHandler(mUdpServer_DataReceived); break; case Bespoke.Common.Net.TransportType.Tcp: mTcpServer = new TcpServer(mIPAddress, mPort, true, false, OscPacket.LittleEndianByteOrder); mTcpServer.DataReceived += new TcpDataReceivedHandler(mTcpServer_DataReceived); break; default: throw new InvalidOperationException("Invalid transport type: " + mTransportType.ToString()); } }
private static void osc_receiver_ReceiveErrored(object sender, Bespoke.Common.ExceptionEventArgs e) { Debug.WriteLine("Error during reception of packet: {0}",e.Exception.Message); }
private void osc_ReceiveErrored(object sender, Bespoke.Common.ExceptionEventArgs e) { }
private static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .ReadFrom.AppSettings() .CreateLogger(); var options = new CommandLineOptions(); // allow app to be debugged in visual studio. if (Debugger.IsAttached) { //args = "--help ".Split(' '); args = "--platform=ios".Split(' '); //args = new[] //{ // "--platform=none", // @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Xamarin.iOS.dll" //}; } // Parse in 'strict mode'; i.e. success or quit if (Parser.Default.ParseArgumentsStrict(args, options)) { try { if (!string.IsNullOrWhiteSpace(options.Template)) { _mustacheTemplate = options.Template; Log.Debug("Using {template} instead of the default template.", _mustacheTemplate); } IPlatform platform = null; switch (options.Platform) { case AutoPlatform.None: if (!options.Assemblies.Any()) { throw new Exception("Assemblies to be used for manual generation were not specified."); } platform = new Bespoke(); platform.Assemblies = options.Assemblies; if (PlatformHelper.IsRunningOnMono()) { platform.CecilSearchDirectories = platform.Assemblies.Select(x => Path.GetDirectoryName(x)).Distinct().ToList(); } else { platform.CecilSearchDirectories.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"); } break; case AutoPlatform.Android: platform = new Android(); break; case AutoPlatform.iOS: platform = new iOS(); break; case AutoPlatform.Mac: platform = new Mac(); break; case AutoPlatform.NET45: platform = new Net45(); break; case AutoPlatform.XamForms: platform = new XamForms(); break; case AutoPlatform.UWP: platform = new UWP(); break; case AutoPlatform.WP81: platform = new WP81(); break; case AutoPlatform.WPA81: platform = new WPA81(); break; default: throw new ArgumentOutOfRangeException(); } ExtractEventsFromAssemblies(platform); Environment.Exit((int) ExitCode.Success); } catch (Exception ex) { Log.Fatal(ex.ToString()); } } Environment.Exit((int) ExitCode.Error); }