public static void ProcessCommand(MCSession session, Foundation.NSData data, MCPeerID peerID) { Console.WriteLine("Received command to process " + data.ToString()); // disconnect session if needed. // forward to internet if available }
public override void DidReceiveData(MCSession session, Foundation.NSData data, MCPeerID peerID) { System.Diagnostics.Debug.WriteLine("MCSessionDelegate ** DidReceiveData"); AppDelegate.PeerHistoryMonitor[peerID.DisplayName].LastReceiveData = DateTime.UtcNow; DataProcessor.ProcessCommand(session, data, peerID); }
public async Task <Byte[]> CapturePhoto(CropRatios cropRatios) { var videoConnection = StillImageOutput.ConnectionFromMediaType(AVMediaType.Video); var sampleBuffer = await StillImageOutput.CaptureStillImageTaskAsync(videoConnection); var jpegImageAsNsData = AVCaptureStillImageOutput.JpegStillToNSData(sampleBuffer); UIImage imageInfo = new UIImage(jpegImageAsNsData); // The following code would rotate the image based on the device orientation, but currently we lock to landscape. //**************************************** //UIImageOrientation? orientationToApply = null; //switch (GetVideoOrientationFromDevice()) //{ // case AVCaptureVideoOrientation.Portrait: // orientationToApply = UIImageOrientation.Right; // break; // case AVCaptureVideoOrientation.LandscapeLeft: // orientationToApply = UIImageOrientation.Down; // break; // case AVCaptureVideoOrientation.LandscapeRight: // orientationToApply = null; // break; // case AVCaptureVideoOrientation.PortraitUpsideDown: // orientationToApply = UIImageOrientation.Left; // break; // default: // break; //} //var rotatedImage = ScaleAndRotateImage(imageInfo, orientationToApply); //**************************************** nfloat cropPhotoX = (nfloat)(cropRatios.LeftRatio * imageInfo.Size.Width); nfloat cropPhotoY = (nfloat)(cropRatios.TopRatio * imageInfo.Size.Height); nfloat cropPhotoWidth = (nfloat)(imageInfo.Size.Width * (1 - (cropRatios.LeftRatio + cropRatios.RightRatio))); nfloat cropPhotoHeight = (nfloat)(imageInfo.Size.Height * (1 - (cropRatios.TopRatio + cropRatios.BottomRatio))); var croppedImage = CropImage(imageInfo, cropPhotoX, cropPhotoY, cropPhotoWidth, cropPhotoHeight); // Rotate after cropping since we are locking orentation to landscape. Otherwise this line should be removed. var rotatedImage = ScaleAndRotateImage(croppedImage, UIImageOrientation.Left); Byte[] imageByteArray; using (Foundation.NSData imageData = rotatedImage.AsPNG()) { imageByteArray = new Byte[imageData.Length]; System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, imageByteArray, 0, Convert.ToInt32(imageData.Length)); } return(imageByteArray); }
public override void EpcReceived(Foundation.NSData epc) { InvokeOnMainThread(() => { var builder = new StringBuilder(); var buffer = epc.Bytes; var bytes = new byte[epc.Length]; System.Runtime.InteropServices.Marshal.Copy(buffer, bytes, 0, bytes.Length); for (UInt32 i = 0; i < bytes.Length; i++) { builder.Append(bytes[i].ToString("x2")); } this.ViewController.ReadText.Text = this.ViewController.ReadText.Text + "\n" + builder.ToString(); }); }
public static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream, int lod = 0) { Foundation.NSData nsData = Foundation.NSData.FromStream(textureStream); UIImage image = UIImage.LoadFromData(nsData); if (image == null) { throw new ContentLoadException("Error loading Texture2D Stream"); } ESImage theTexture = new ESImage(image, 1.0f, lod, graphicsDevice.PreferedFilter); Texture2D result = new Texture2D(graphicsDevice, theTexture); return(result); }
public bool MessageReceived(ushort messageId, Foundation.NSData _data) #endif { return(Safety(() => { byte[] data = null; #if ANDROID data = _data; #elif IOS data = _data.ToArray(); #endif logger.Log($"[R7] Packet received {messageId} -> {data.ToHexString()}"); Debugger.Break(); PacketReceived(this, new PacketReceivedEventArgs() { MessageId = (short)(messageId + 10000), Payload = data }); return true; })); }
public static NSAttributedString CreateWithRTFD(NSData rtfdData, out NSDictionary resultDocumentAttributes) { return(new NSAttributedString(rtfdData, NSAttributedStringDataType.RTFD, out resultDocumentAttributes)); }
public UnmanagedMemoryStreamWithMutableRef(NSData source) : base(source) { base_address = source.Bytes; }
protected override void Dispose(bool disposing) { source = null; base.Dispose(disposing); }
public UnmanagedMemoryStreamWithRef(NSData source) : base((byte *)source.Bytes, (long)source.Length) { this.source = source; }
public virtual void SetData([Optional] NSData aData, string forKey) { }
public bool CreateFile(string path, NSData data, NSFileAttributes attributes) { var dict = attributes == null ? null : attributes.ToDictionary(); return(CreateFile(path, data, dict)); }
public void DataLoaded(NSUrlProtocol protocol, NSData data) { Messaging.void_objc_msgSend_IntPtr_IntPtr(this.Handle, Selector.GetHandle(selUrlProtocolDidLoadData_), protocol.Handle, data.Handle); }
public static NSObject PropertyListWithData(NSData data, ref NSPropertyListFormat format, out NSError error) { return(PropertyListWithData(data, NSPropertyListReadOptions.Immutable, ref format, out error)); }
public static void DidReceiveMessage(GKGameSession session, string message, Foundation.NSData data, GKCloudPlayer player) { }
public NSCachedURLResponse(NSURLResponse response, NSData data, Dictionary <NSObject, AnyObject> userInfo, NSURLCacheStoragePolicy storagePolicy) { }
public NSCachedURLResponse(NSURLResponse response, NSData data) { }
public NSData(NSData data) { }
public virtual bool IsEqualToData(NSData otherData) { return(default(bool)); }
public virtual NSRange RangeOfData(NSData dataToFind, NSDataSearchOptions options, NSRange range) { return(default(NSRange)); }
public static void DidReceiveData(GKGameSession session, Foundation.NSData data, GKCloudPlayer player) { }
public static NSAttributedString CreateWithHTML(NSData htmlData, out NSDictionary resultDocumentAttributes) { return(new NSAttributedString(htmlData, NSAttributedStringDataType.HTML, out resultDocumentAttributes)); }
public static void DidSaveData(GKGameSession session, GKCloudPlayer player, Foundation.NSData data) { }
public static NSAttributedString CreateWithDocFormat(NSData wordDocFormat, out NSDictionary docAttributes) { return(new NSAttributedString(wordDocFormat, NSAttributedStringDataType.DocFormat, out docAttributes)); }