public Symbol[] Parse(Dictionary <string, object> arguments) { var text = (arguments["text"] as string).ToUpper(); var mc = Regex.Match(text, regex.Replace(" ", @"[\s]*")); if (!mc.Success) { return(null); } return(new Symbol[] { new SetFDAT() { Namespace = arguments["namespace"] as string, Name = UUID.Generate(arguments["namespace"] as string), File = arguments["file"] as string, Line = (int)arguments["line"], Column = (int)arguments["column"], Text = arguments["text"] as string, referenceSymbols = new List <Symbol>() { new Reference() { Namespace = arguments["namespace"] as string, Name = mc.Groups[1].Value } } } }); }
/// <summary> /// Open Instagram with the specified image and caption. /// </summary> /// <returns><c>true</c> if Instagram is installed, <c>false</c> otherwise.</returns> /// <param name="image">Image.</param> /// <param name="caption">Caption.</param> public static bool Instagram(UIImage image, string caption = null) { if (!UIApplication.SharedApplication().CanOpenURL(new NSURL("instagram://app"))) { return(false); } // write image to tmp folder NSData data = image.JPEGRepresentation(1f); string filePath = Application.temporaryCachePath + "/" + UUID.Generate() + ".igo"; data.WriteToFile(filePath, true); _documentIC = UIDocumentInteractionController.InteractionController(new NSURL(filePath, false)); _documentIC.UTI = "com.instagram.exclusivegram"; if (caption != null) { var annotation = new Dictionary <object, object>(); annotation["InstagramCaption"] = caption; _documentIC.annotation = annotation; } var rootView = UIApplication.deviceRootViewController.view; _documentIC.PresentOpenInMenu(new Rect(0, 0, 1, 1), rootView, true); return(true); }
public Symbol[] Parse(Dictionary <string, object> arguments) { var text = (arguments["text"] as string).ToUpper(); var mc = Regex.Match(text, regex.Replace(" ", @"[\s]*")); if (!mc.Success) { return(null); } return(new Symbol[] { new E6Pos() { Namespace = arguments["namespace"] as string, Name = UUID.Generate(arguments["namespace"] as string, mc.Groups[1].Value), File = arguments["file"] as string, Line = (int)arguments["line"], Column = (int)arguments["column"], Text = arguments["text"] as string, X = float.Parse(mc.Groups[2].Value), Y = float.Parse(mc.Groups[3].Value), Z = float.Parse(mc.Groups[4].Value), A = float.Parse(mc.Groups[5].Value), B = float.Parse(mc.Groups[6].Value), C = float.Parse(mc.Groups[7].Value), S = int.Parse(mc.Groups[8].Value), T = int.Parse(mc.Groups[9].Value), E1 = float.Parse(mc.Groups[10].Value), E2 = float.Parse(mc.Groups[11].Value), E3 = float.Parse(mc.Groups[12].Value), E4 = float.Parse(mc.Groups[13].Value), E5 = float.Parse(mc.Groups[14].Value), E6 = float.Parse(mc.Groups[15].Value) } }); }
public Symbol[] Parse(Dictionary <string, object> arguments) { var text = (arguments["text"] as string).ToUpper(); var mc = Regex.Match(text, regex.Replace(" ", @"[\s]*")); if (!mc.Success) { return(null); } return(new Symbol[] { new LDAT() { Namespace = arguments["namespace"] as string, Name = UUID.Generate(arguments["namespace"] as string, mc.Groups[1].Value), File = arguments["file"] as string, Line = (int)arguments["line"], Column = (int)arguments["column"], Text = arguments["text"] as string, VEL = float.Parse(mc.Groups[2].Value), ACC = float.Parse(mc.Groups[3].Value), APO_DIST = float.Parse(mc.Groups[4].Value), APO_FAC = float.Parse(mc.Groups[5].Value), AXIS_VEL = float.Parse(mc.Groups[6].Value), AXIS_ACC = float.Parse(mc.Groups[7].Value), ORI_TYP = mc.Groups[8].Value, CIRC_TYP = mc.Groups[9].Value, JERK_FAC = float.Parse(mc.Groups[10].Value), GEAR_JERK = float.Parse(mc.Groups[11].Value), EXAX_IGN = int.Parse(mc.Groups[12].Value) } }); }
public void UUIDEntropy() { int n = 10000; DateTime dt = DateTime.MinValue; HashSet <int> hs = new HashSet <int> (); for (int i = 0; i != n; i++) { Assert.IsTrue(hs.Add(UUID.Generate(dt).GetHashCode())); } }
/// <summary> /// Exports the audio of a media item to storage. /// </summary> /// <returns><c>true</c> if audio started exporting, <c>false</c> if it is exporting another audio or the media item has DRM.</returns> /// <param name="mediaItem">Media item.</param> /// <param name="outputFolder">Absolute output folder or specify null to use Documents folder.</param> /// <param name="outputFile">Output file name or specify null to use <c>[artist] - [title].[extension]</c>.</param> /// <param name="overwrite">Whether to overwrite the output file.</param> public static bool ExportAudio(MPMediaItem mediaItem, string outputFolder = null, string outputFile = null, bool overwrite = false) { if (_exporter != null) { return(false); } if (mediaItem == null) { return(false); } if (outputFolder == null) { outputFolder = Application.persistentDataPath; } NSURL assetURL = mediaItem.Value(MPMediaItem.PropertyAssetURL) as NSURL; if (assetURL == null) { return(false); } if (outputFile == null) { string artist = mediaItem.Value(MPMediaItem.PropertyArtist) as string; string title = mediaItem.Value(MPMediaItem.PropertyTitle) as string; string extension = Path.GetExtension(assetURL.AbsoluteString().Split('?')[0]); outputFile = artist + " - " + title + extension; } _outputPath = outputFolder + "/" + outputFile; if (!overwrite && File.Exists(_outputPath)) { return(false); } _avAsset = AVURLAsset.Asset(assetURL); _exporter = new AVAssetExportSession(_avAsset, AVAssetExportSession.AVAssetExportPresetPassthrough); _exporter.outputFileType = "com.apple.quicktime-movie"; _exporter.shouldOptimizeForNetworkUse = true; string tmpExt = UTType.CopyPreferredTag(_exporter.outputFileType, UTType.kUTTagClassFilenameExtension); _tmpPath = Application.persistentDataPath + "/" + UUID.Generate() + "." + tmpExt; _exporter.outputURL = new NSURL(_tmpPath, false); _exporter.ExportAsynchronously(_OnExportDone); return(true); }
public void AuthSelf() { SaslServer server = new SaslServer(); SaslClient client = new SaslClient(); server.Peer = client; client.Peer = server; client.Identity = "1000"; server.Guid = UUID.Generate(); Assert.IsTrue(client.AuthenticateSelf()); Assert.AreEqual(server.Guid, client.ActualId); }
public Symbol[] Parse(Dictionary <string, object> arguments) { var text = (arguments["text"] as string).ToUpper(); var mc = Regex.Match(text, regex.Replace(" ", @"[\s]*")); if (!mc.Success) { return(null); } return(new Symbol[] { new END() { Namespace = arguments["namespace"] as string, Name = UUID.Generate(arguments["namespace"] as string, mc.Groups[1].Value), Type = SymbolType.Return, File = arguments["file"] as string, Line = (int)arguments["line"], Column = (int)arguments["column"], Text = arguments["text"] as string } }); }
public override Symbol FindSymbol(Assembly assembly, Reference reference) { reference.Namespace = reference.Namespace?.ToUpper(); reference.Name = reference.Name?.ToUpper(); // 查找同名符号 if (assembly.symbols.ContainsKey(reference.Name)) { return(assembly.symbols[reference.Name]); } // 同程序文件中查找符号 var name = UUID.Generate(reference.Namespace, reference.Name); if (assembly.symbols.ContainsKey(name)) { return(assembly.symbols[name]); } // 同程序文件的数据文件中查找符号 name = name.Replace(".src", ".dat"); if (assembly.symbols.ContainsKey(name)) { return(assembly.symbols[name]); } // 查找全局符号 foreach (var symbol in assembly.symbols) { var simpleName = string.IsNullOrEmpty(symbol.Value.Namespace) ? symbol.Value.Name : symbol.Value.Name.Substring(symbol.Value.Namespace.Length + 1); if (simpleName.Equals(reference.Name)) { return(symbol.Value); } } return(null); }
public Symbol[] Parse(Dictionary <string, object> arguments) { var text = (arguments["text"] as string).ToUpper(); var mc = Regex.Match(text, regex.Replace(" ", @"[\s]*")); if (!mc.Success) { return(null); } return(new Symbol[] { new FDAT() { Namespace = arguments["namespace"] as string, Name = UUID.Generate(arguments["namespace"] as string, mc.Groups[1].Value), File = arguments["file"] as string, Line = (int)arguments["line"], Column = (int)arguments["column"], Text = arguments["text"] as string, TOOL_NO = int.Parse(mc.Groups[2].Value), BASE_NO = int.Parse(mc.Groups[3].Value), IPO_FRAME = mc.Groups[4].Value } }); }