public static void AddMatchRequest(KeyValuePair<string,ClientServant> request) { lock(m_waiting_queue) { m_waiting_queue.Enqueue(request); } }
/// <summary> /// Proceeds the along path. /// </summary> /// <returns><c>true</c>, if progress along the path was made, <c>false</c> otherwise.</returns> protected bool ProceedAlongPath(GoapPlan _currentPlan) { //find the next GO on the currentPath GameObject targetTroct = _currentPlan.plannedPath.Value[0]; Vector3 towardsTarget = (targetTroct.transform.position - core.actor.currentTrOct.transform.position).normalized; //is this actor facing the troct? if (towardsTarget == core.actor.transform.forward) { //if so, try move forwards if (core.actor.TryMoveForwards()) { _currentPlan.plannedPath.Value.RemoveAt(0); //see if the target node has been reached if (_currentPlan.plannedPath.Value.Count == 0) { KeyValuePair<string, List<GameObject>> tempPath = new KeyValuePair<string, List<GameObject>>(_currentPlan.plannedPath.Key, null); _currentPlan.plannedPath = tempPath; } return true; //return a successful progression along the path } else { return false; // return an unsuccessful progression along the path } } else //turn to face the next TrOct { return core.actor.TryRotate(targetTroct.transform); //return the result of attempting to look at the next troct. } }
public bool PosTest1() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("Return the property get_Current in the IEnumerator 1"); try { Dictionary<string, string> dictionary = new Dictionary<string, string>(); dictionary.Add("str1", "helloworld"); Dictionary<string, string>.Enumerator enumer = dictionary.GetEnumerator(); IEnumerator iEnumer = (IEnumerator)enumer; while (iEnumer.MoveNext()) { object objCurrent = iEnumer.Current; KeyValuePair<string, string> keyVal = new KeyValuePair<string, string>("str1", "helloworld"); if (!objCurrent.Equals(keyVal)) { TestLibrary.TestFramework.LogError("001", "the ExpectResult is not the ActualResult"); retVal = false; } } } catch (Exception e) { TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e); retVal = false; } return retVal; }
public TerrainFollow(MAVLinkInterface inInterface) { _interface = inInterface; log.Info("Subscribe to packets"); subscription = _interface.SubscribeToPacketType(MAVLink.MAVLINK_MSG_ID.TERRAIN_REQUEST, ReceviedPacket); }
public bool PosTest2() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("Return the property get_Current in the IEnumerator 2"); try { Dictionary<TestClass, TestClass> dictionary = new Dictionary<TestClass, TestClass>(); TestClass Tkey1 = new TestClass(); TestClass TVal1 = new TestClass(); dictionary.Add(Tkey1, TVal1); Dictionary<TestClass, TestClass>.Enumerator enumer = dictionary.GetEnumerator(); IEnumerator iEnumer = (IEnumerator)enumer; while(iEnumer.MoveNext()) { object objCurrent = iEnumer.Current; KeyValuePair<TestClass, TestClass> keyVal = new KeyValuePair<TestClass, TestClass>(Tkey1, TVal1); if (!objCurrent.Equals(keyVal)) { TestLibrary.TestFramework.LogError("003", "the ExpectResult is not the ActualResult"); retVal = false; } } } catch (Exception e) { TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e); retVal = false; } return retVal; }
public void ThrowUpdateLanguage(KeyValuePair<int, string> language) { if (this.UpdateLanguage != null) { this.UpdateLanguage(this, new LanguageChangeEventArgs(language)); } }
void FixedUpdate() { NetworkClient newClient = ConnectionManager.GameServer.AcceptClient(); if( newClient != null ) remoteClients.Add( newClient ); int messageLength = 1; foreach( KeyValuePair<byte,byte> localPositionKey in localPositions.Keys ) { outputBuffer[ messageLength ] = localPositionKey.Key; outputBuffer[ messageLength + 1 ] = localPositionKey.Value; Buffer.BlockCopy( BitConverter.GetBytes( localPositions[ localPositionKey ] ), 0, outputBuffer, messageLength + 2, sizeof(float) ); messageLength += DATA_SIZE; } foreach( NetworkClient client in remoteClients ) { if( client.ReceiveData( inputBuffer ) ) { Buffer.BlockCopy( inputBuffer, 0, outputBuffer, messageLength, DATA_SIZE ); KeyValuePair<byte,byte> remotePositionKey = new KeyValuePair<byte,byte>( inputBuffer[ 0 ], inputBuffer[ 1 ] ); remotePositions[ remotePositionKey ] = BitConverter.ToSingle( inputBuffer, 2 ); } messageLength += DATA_SIZE; } outputBuffer[ 0 ] = (byte) messageLength; foreach( NetworkClient client in remoteClients ) client.SendData( outputBuffer ); }
void IManageTimeouts.PopTimeout() { var pair = new KeyValuePair<DateTime, List<TimeoutData>>(DateTime.MinValue, null); var now = DateTime.UtcNow; lock (data) { if (data.Count > 0) { var next = data.ElementAt(0); if (next.Key - now < duration) { pair = next; data.Remove(pair.Key); } } } if (pair.Key == DateTime.MinValue) { Thread.Sleep(duration); return; } if (pair.Key > now) Thread.Sleep(pair.Key - now); DispatchTimeouts(pair.Value); }
/// <summary> /// 关系映射 /// </summary> /// <param name="type">实体类Type</param> public FieldMap(Type type) { Type = type; MapList = new Dictionary<PropertyInfo, FieldState>(); #region 变量属性 // 循环Set的字段 foreach (var fieldProperty in Type.GetProperties()) { // 获取字段的特性 var attField = fieldProperty.GetCustomAttributes(false); var fieldState = new FieldState(); foreach (var attr in attField) { // 数据类型 if (attr is DataTypeAttribute) { fieldState.DataType = (DataTypeAttribute)attr; continue; } // 字段映射 if (attr is FieldAttribute) { fieldState.FieldAtt = (FieldAttribute)attr; continue; } // 属性扩展 if (attr is PropertyExtendAttribute) { fieldState.PropertyExtend = ((PropertyExtendAttribute)attr).PropertyExtend; continue; } } if (fieldState.FieldAtt == null) { fieldState.FieldAtt = new FieldAttribute { Name = fieldProperty.Name }; } if (string.IsNullOrEmpty(fieldState.FieldAtt.Name)) { fieldState.FieldAtt.Name = fieldProperty.Name; } if (fieldState.FieldAtt.IsMap && fieldState.FieldAtt.IsPrimaryKey) { PrimaryState = new KeyValuePair<PropertyInfo, FieldState>(fieldProperty, fieldState); } else { fieldState.FieldAtt.IsPrimaryKey = false; } //添加属变量标记名称 MapList.Add(fieldProperty, fieldState); } #endregion }
public HttpClientBuilder AcceptJson() { var jsonAccept = new KeyValuePair<string, string>("accept", "application/json"); _headers.Add(jsonAccept); return this; }
public HttpClientBuilder AcceptOctetStream() { var jsonAccept = new KeyValuePair<string, string>("accept", "application/octet-stream"); _headers.Add(jsonAccept); return this; }
private static void resolveConflicts(KeyValuePair<string, object> attribute) { if (attribute.Key.Equals("physic_entity") && attribute.Value.Equals("rigid")) { entity.Replace("physic_entity = \"dynamic\"", "physic_entity = \"rigid\""); } }
private void CalculateColumns(List<FormatObjectProperty> row) { _fullWidth = OutputWriter.Columns - 1; // -1 because of newline if (_fullWidth <= 0) { _fullWidth = OutputWriter.DefaultColumns - 1; } var cols = row.Count; // make sure it fits if (2 * cols - 1 > _fullWidth) { cols = (_fullWidth + 1) / 2; string format = "Warning: {0} columns have to be omitted in this format" + "as they don't fit the available width."; OutputWriter.WriteLine(String.Format(format, row.Count - cols)); } int perColumn = (_fullWidth - cols + 1) / cols; int rest = _fullWidth - cols + 1 - perColumn * cols; // because of rounding _currentColumns = new KeyValuePair<string, int>[cols]; for (int i = 0; i < cols; i++) { _currentColumns[i] = new KeyValuePair<string,int>(row[i].PropertyName, i < rest ? perColumn + 1 : perColumn); } }
public void CreateMimeMessage() { var message = Mail.GetInstance(); var attachment = System.IO.Path.GetTempFileName(); var text = "this is a test"; var html = "<b>This<\b> is a better test"; var headers = new KeyValuePair<String, String>("custom", "header"); message.AddAttachment(attachment); message.Text = text; message.Html = html; message.AddTo("*****@*****.**"); message.From = new MailAddress("*****@*****.**"); message.AddHeaders(new Dictionary<string, string>{{headers.Key, headers.Value}}); message.EnableGravatar(); var mime = message.CreateMimeMessage(); var sr = new StreamReader(mime.AlternateViews[0].ContentStream); var result = sr.ReadToEnd(); Assert.AreEqual(text, result); sr = new StreamReader(mime.AlternateViews[1].ContentStream); result = sr.ReadToEnd(); Assert.AreEqual(html, result); result = mime.Headers.Get(headers.Key); Assert.AreEqual(headers.Value, result); result = mime.Headers.Get("X-Smtpapi"); var expected = "{\"filters\" : {\"gravatar\" : {\"settings\" : {\"enable\" : \"1\"}}}}"; Assert.AreEqual(expected, result); result = mime.Attachments[0].Name; Assert.AreEqual(Path.GetFileName(attachment), result); }
public static Func<ShapePlacementContext, bool> BuildPredicate(Func<ShapePlacementContext, bool> predicate, KeyValuePair<string, string> term) { var expression = term.Value; switch (term.Key) { case "ContentPart": return ctx => ctx.Content != null && ctx.Content.ContentItem.Parts.Any(part => part.PartDefinition.Name == expression) && predicate(ctx); case "ContentType": if (expression.EndsWith("*")) { var prefix = expression.Substring(0, expression.Length - 1); return ctx => ((ctx.ContentType ?? "").StartsWith(prefix) || (ctx.Stereotype ?? "").StartsWith(prefix)) && predicate(ctx); } return ctx => ((ctx.ContentType == expression) || (ctx.Stereotype == expression)) && predicate(ctx); case "DisplayType": if (expression.EndsWith("*")) { var prefix = expression.Substring(0, expression.Length - 1); return ctx => (ctx.DisplayType ?? "").StartsWith(prefix) && predicate(ctx); } return ctx => (ctx.DisplayType == expression) && predicate(ctx); case "Path": var normalizedPath = VirtualPathUtility.IsAbsolute(expression) ? VirtualPathUtility.ToAppRelative(expression) : VirtualPathUtility.Combine("~/", expression); if (normalizedPath.EndsWith("*")) { var prefix = normalizedPath.Substring(0, normalizedPath.Length - 1); return ctx => VirtualPathUtility.ToAppRelative(String.IsNullOrEmpty(ctx.Path) ? "/" : ctx.Path).StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && predicate(ctx); } normalizedPath = VirtualPathUtility.AppendTrailingSlash(normalizedPath); return ctx => (ctx.Path.Equals(normalizedPath, StringComparison.OrdinalIgnoreCase)) && predicate(ctx); } return predicate; }
private void SetSwitchValue(KeyValuePair<string, string> commandSwitch) { // Find the property PropertyInfo propertyInfo = GetType().GetProperty(commandSwitch.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase); if (propertyInfo == null) { throw new InvalidOperationException(T("Switch \"{0}\" was not found", commandSwitch.Key).Text); } if (propertyInfo.GetCustomAttributes(typeof(OrchardSwitchAttribute), false).Length == 0) { throw new InvalidOperationException(T("A property \"{0}\" exists but is not decorated with \"{1}\"", commandSwitch.Key, typeof(OrchardSwitchAttribute).Name).Text); } // Set the value try { object value = Convert.ChangeType(commandSwitch.Value, propertyInfo.PropertyType); propertyInfo.SetValue(this, value, null/*index*/); } catch(Exception ex) { if (ex.IsFatal()) { throw; } string message = T("Error converting value \"{0}\" to \"{1}\" for switch \"{2}\"", LocalizedString.TextOrDefault(commandSwitch.Value, T("(empty)")), propertyInfo.PropertyType.FullName, commandSwitch.Key).Text; throw new InvalidOperationException(message, ex); } }
public MAVLinkSerialPort(MAVLinkInterface mavint, MAVLink.SERIAL_CONTROL_DEV port) { this.mavint = mavint; this.port = port; if (!mavint.BaseStream.IsOpen) { mavint.BaseStream.Open(); } if (mavint.getHeartBeat().Length == 0) { throw new Exception("No valid heartbeats read from port"); } if (subscription.Value != null) mavint.UnSubscribeToPacketType(subscription); subscription = mavint.SubscribeToPacketType(MAVLink.MAVLINK_MSG_ID.SERIAL_CONTROL, ReceviedPacket, true); bgdata = new Thread(mainloop); bgdata.Name = "MAVLinkSerialPort"; bgdata.IsBackground = true; bgdata.Start(); }
public static void SetErrorWithCount(this ErrorProvider ep, Control c, string message) { if (message == "") { if (ep.GetError(c) != "") { _count--; var ctrlRemove = new KeyValuePair<Control, string>(); foreach (var ctrl in _controles.Where(ctrl => ctrl.Key == c)) { ctrlRemove = ctrl; } _controles.Remove(ctrlRemove); } } else { _count++; _controles.Add(new KeyValuePair<Control, string>(c, message)); } ep.SetError(c, message); }
public async Task<HttpResponseMessage> DeleteAsync(Uri uri, List<KeyValuePair<string, string>> headers) { HttpClient client = (HttpClient)null; HttpResponseMessage response = (HttpResponseMessage)null; HttpResponseMessage httpResponseMessage1; try { client = this.CreateClient(); if (headers != null) { foreach (KeyValuePair<string, string> keyValuePair in headers) { KeyValuePair<string, string> header = keyValuePair; client.DefaultRequestHeaders.Add(header.Key, header.Value); header = new KeyValuePair<string, string>(); } //List<KeyValuePair<string, string>>.Enumerator enumerator = new List<KeyValuePair<string, string>>.Enumerator(); } HttpResponseMessage httpResponseMessage = await client.DeleteAsync(uri); httpResponseMessage1 = httpResponseMessage; } finally { Memory.DisposeGarbage((IDisposable)response, (IDisposable)client); } return httpResponseMessage1; }
static void Main(string[] args) { const int BIBLIOGRAPHY_ID = 1039; Myth kingOfIthaca = new Myth("Odysseus", "Ulysses"); KeyValuePair<int, Myth> kvp = new KeyValuePair<int, Myth>(BIBLIOGRAPHY_ID, kingOfIthaca); Console.WriteLine("Key = {0}", kvp.Key); Console.WriteLine("Value = {0}", kvp.Value.GreekName); Console.WriteLine("Value = {0}", kvp.Value.RomanName); Console.ReadLine(); List<string> collection = new List<string>(); AddItems(collection); ShowItems(collection); RemoveItems(collection); ShowItems(collection); Console.ReadLine(); List<Account> accountList = new List<Account>(); accountList.Add(new Checking()); accountList.Add(new Savings()); foreach (Account item in accountList) { item.DisplayDetail(); } }
public RouteMatch(string[] orderedArgs, KeyValuePair<string, string>[] boundVars, string rawUrl) { this.OrderedArgs = orderedArgs; this.BoundVars = boundVars; this.QueryParams = null; this.RawUrl = rawUrl; }
private static MethodInfo GetFromCache(MethodInfo methodInfo, Type type) { var key = new KeyValuePair<MethodInfo, Type>(methodInfo, type); MethodInfo method; cache.TryGetValue(key, out method); return method; }
/// <summary> /// 根据模板分析,并且返回已替换内容 /// </summary> /// <param name="content"></param> /// <param name="regex"></param> /// <param name="modelInfo"></param> /// <param name="TransferFactory"></param> /// <returns></returns> public string AnalyAndReplace(string content, string regex, EntityInfo entity, Object obj, IExTransferFactory TransferFactory) { string Result = ""; Dictionary<int, string> expresses = content.RegBaseDic(@regex); ; Dictionary<int, int> patternS_E = AnaUtil.Instance().GetKeyIndVal(expresses); Result += patternS_E.Count > 0 ? content.Substring(0, patternS_E.ElementAt(0).Key) : ""; KeyValuePair<int, int> S_EPair = new KeyValuePair<int, int>(); KeyValuePair<int, int> S_EPair2 = new KeyValuePair<int, int>(); for (int i = 0; i < expresses.Count; i++) { Result += TransferFactory.CreateTransfer(expresses.ElementAt(i).Value).Transfer(expresses.ElementAt(i).Value, entity, obj); S_EPair = patternS_E.ElementAt(i); S_EPair2 = patternS_E.Count > (i + 1) ? patternS_E.ElementAt(i + 1) : patternS_E.ElementAt(i); Result += S_EPair2.Equals(S_EPair) ? "" : content.Substring(S_EPair.Value, S_EPair2.Key - S_EPair.Value); } Result += patternS_E.Count > 0 ? content.Substring(S_EPair.Value, content.Length - S_EPair.Value) : ""; Result = patternS_E.Count == 0 ? content : Result; return Result; }
private void FindCurrentAlbum(string albumName) { albumName = albumName.ToUpper(); if (!albumName.Equals(this.currentAlbum.Key)) { if (this.Albums.ContainsKey(albumName)) { this.currentAlbum = new KeyValuePair<string, List<Music>> ( albumName, this.Albums[albumName] ); } else { this.currentAlbum = new KeyValuePair<string, List<Music>> ( albumName, new List<Music>() ); this.Albums.Add(this.currentAlbum); } } }
public override void Draw(SpriteBatch sb) { int spacingR = 50; int spacingB = 50; lock (World.PlayerInfo) { try { sb.DrawString(TextureManager.Fonts["console"], "Lobby", new Vector2( GameConst.SCREEN_WIDTH / 20, GameConst.SCREEN_HEIGHT / 20), Color.White); var p = new KeyValuePair<int, PlayerInfo>(World.gameId, World.PlayerInfo[World.gameId]); DrawPlayerIcon(sb, p, ref spacingR, ref spacingB); foreach (var player in World.PlayerInfo) { if (player.Key != World.gameId) { DrawPlayerIcon(sb, player, ref spacingR, ref spacingB); } } Texture2D checkTexture = ready ? TextureManager.Map["check-true"] : TextureManager.Map["check-false"]; sb.Draw(checkTexture, checkRect, Color.White); } catch (Exception e) { } } base.Draw(sb); }
public override async Task<IEnumerable<KeyValuePair<string, NuGetVersion>>> GetLatestVersions(IEnumerable<string> packageIds, bool includePrerelease, bool includeUnlisted, CancellationToken token) { var results = new List<KeyValuePair<string, NuGetVersion>>(); var tasks = new Stack<KeyValuePair<string, Task<IEnumerable<NuGetVersion>>>>(); // fetch all ids in parallel foreach (var id in packageIds) { var task = new KeyValuePair<string, Task<IEnumerable<NuGetVersion>>>(id, GetVersions(id, includePrerelease, includeUnlisted, token)); tasks.Push(task); } foreach (var pair in tasks) { // wait for the query to finish var versions = await pair.Value; if (versions == null || !versions.Any()) { results.Add(new KeyValuePair<string, NuGetVersion>(pair.Key, null)); } else { // sort and take only the highest version var latestVersion = versions.OrderByDescending(p => p, VersionComparer.VersionRelease).FirstOrDefault(); results.Add(new KeyValuePair<string, NuGetVersion>(pair.Key, latestVersion)); } } return results; }
public string this[string key] { get { foreach (var entry in _records) { if (entry.Key == key) { return entry.Value; } } return null; } set { for (int i = 0; i < _records.Count; ++i ) { if (_records[i].Key == key) { _records[i] = new KeyValuePair<string, string>(key, value); return; } } _records.Add(new KeyValuePair<string, string>(key, value)); } }
public void Create() { var p1 = new KeyValuePair<int, string>(42, "The answer"); var p2 = KeyValuePair.Create(42, "The answer"); Assert.AreEqual(p1, p2); }
private GraphiteLine [] MakeGraphiteLines ( KeyValuePair<string, LatencyDatapointBox> latency ) { if ( _calculateSumSquares ) { return new GraphiteLine [] { new GraphiteLine(RootNamespace + latency.Key + ".count", latency.Value.Count, Epoch), new GraphiteLine(RootNamespace + latency.Key + ".min", latency.Value.Min, Epoch), new GraphiteLine(RootNamespace + latency.Key + ".max", latency.Value.Max, Epoch), new GraphiteLine(RootNamespace + latency.Key + ".mean", latency.Value.Mean, Epoch), new GraphiteLine(RootNamespace + latency.Key + ".sum", latency.Value.Sum, Epoch), new GraphiteLine(RootNamespace + latency.Key + ".sumSquares", latency.Value.SumSquares, Epoch) }; } else { return new GraphiteLine [] { new GraphiteLine(RootNamespace + latency.Key + ".count", latency.Value.Count, Epoch), new GraphiteLine(RootNamespace + latency.Key + ".min", latency.Value.Min, Epoch), new GraphiteLine(RootNamespace + latency.Key + ".max", latency.Value.Max, Epoch), new GraphiteLine(RootNamespace + latency.Key + ".mean", latency.Value.Mean, Epoch), new GraphiteLine(RootNamespace + latency.Key + ".sum", latency.Value.Sum, Epoch) }; } }
public OscMessage BuildJointMessage(Body body, KeyValuePair<JointType, Joint> joint) { var address = String.Format("/bodies/{0}/joints/{1}", body.TrackingId, joint.Key); var position = joint.Value.Position; //System.Diagnostics.Debug.WriteLine(address); return new OscMessage(address, position.X, position.Y, position.Z, joint.Value.TrackingState.ToString()); }
public static void AddOrUpdate<TKey, TValue>(this IDictionary<TKey, TValue> dic, KeyValuePair<TKey, TValue> keyValue) { if (dic.ContainsKey(keyValue.Key)) { dic[keyValue.Key] = keyValue.Value; } else { dic.Add(keyValue.Key, keyValue.Value); } }
public bool Contains(KeyValuePair <TKey, TValue> item) { return(data.Contains(item)); }
public bool Remove(KeyValuePair <T, K> item) { throw new ReadonlyOperationException("This instance is readonly."); }
public bool Contains(KeyValuePair <T, K> item) { return(_dictionaryImplementation.Contains(item)); }
public void Add(KeyValuePair <T, K> item) { throw new ReadonlyOperationException("This instance is readonly."); }
public static void Init(KeyValuePair <Type, IController> controller) { Init(controller.Key, controller.Value); }
public bool Remove(KeyValuePair <TKey, TValue> item) { throw new NotImplementedException(); }
public void OnNext(KeyValuePair <string, object> value) { EventName = value.Key; EventObject = value.Value; }
public virtual void Add(KeyValuePair <TKey, TValue> item) { using (new WriteLock(dictionaryLock)) { dict.Add(item); } }
private static Project CreateProject( FileAndSource[] sources, string language = LanguageNames.CSharp, bool addLanguageSpecificCodeAnalysisReference = true, Solution addToSolution = null, string projectName = TestProjectName, bool allowUnsafeCode = false) { string fileNamePrefix = DefaultFilePathPrefix; string fileExt = language == LanguageNames.CSharp ? CSharpDefaultFileExt : VisualBasicDefaultExt; CompilationOptions options = language == LanguageNames.CSharp ? (allowUnsafeCode ? s_CSharpUnsafeCodeDefaultOptions : s_CSharpDefaultOptions) : s_visualBasicDefaultOptions; ProjectId projectId = ProjectId.CreateNewId(debugName: projectName); Project project = (addToSolution ?? new AdhocWorkspace().CurrentSolution) .AddProject(projectId, projectName, projectName, language) .AddMetadataReference(projectId, s_corlibReference) .AddMetadataReference(projectId, s_systemCoreReference) .AddMetadataReference(projectId, s_systemXmlReference) .AddMetadataReference(projectId, s_systemXmlDataReference) .AddMetadataReference(projectId, s_codeAnalysisReference) .AddMetadataReference(projectId, SystemRuntimeFacadeRef) .AddMetadataReference(projectId, SystemThreadingFacadeRef) .AddMetadataReference(projectId, SystemThreadingTaskFacadeRef) .AddMetadataReference(projectId, s_immutableCollectionsReference) .AddMetadataReference(projectId, s_workspacesReference) .AddMetadataReference(projectId, s_systemDiagnosticsDebugReference) .AddMetadataReference(projectId, s_systemDataReference) .WithProjectCompilationOptions(projectId, options) .GetProject(projectId); // Enable IOperation Feature on the project var parseOptions = project.ParseOptions.WithFeatures(project.ParseOptions.Features.Concat(SpecializedCollections.SingletonEnumerable(KeyValuePair.Create("IOperation", "true")))); project = project.WithParseOptions(parseOptions); if (addLanguageSpecificCodeAnalysisReference) { MetadataReference symbolsReference = language == LanguageNames.CSharp ? s_csharpSymbolsReference : s_visualBasicSymbolsReference; project = project.AddMetadataReference(symbolsReference); } if (language == LanguageNames.VisualBasic) { project = project.AddMetadataReference(s_visualBasicReference); } int count = 0; foreach (FileAndSource source in sources) { string newFileName = source.FilePath ?? fileNamePrefix + count++ + "." + fileExt; DocumentId documentId = DocumentId.CreateNewId(projectId, debugName: newFileName); project = project.AddDocument(newFileName, SourceText.From(source.Source)).Project; } return(project); }
public bool Remove(KeyValuePair <string, object> item) { return(_dictionary.Remove(item)); }
public virtual bool Remove(KeyValuePair <TKey, TValue> item) { using (new WriteLock(dictionaryLock)) { return(dict.Remove(item)); } }
public void Add(KeyValuePair <string, object> item) { _dictionary.Add(item); }
public virtual bool Contains(KeyValuePair <TKey, TValue> item) { using (new ReadOnlyLock(dictionaryLock)) { return(dict.Contains(item)); } }
/// <summary> /// Non-supported action. /// </summary> /// <param name="item"></param> /// <returns></returns> public bool Remove(KeyValuePair <TKey, TValue> item) { CheckAndThrow("Remove"); return(false); }
public bool Contains(KeyValuePair <string, object> item) { return(_dictionary.Contains(item)); }
public bool CanRetrieve(KeyValuePair <string, string> keyValuePair, Type targetType, Type type) { throw new NotImplementedException(); }
void ICollection <KeyValuePair <TKey, TValue> > .Add(KeyValuePair <TKey, TValue> item) { Add(item.Key, item.Value); }
public string GetWherePkStringFor(object val) { KeyValuePair<string, object> pair = columnMapper.MapObjectPrimaryKey(val); return string.Format("{0} = '{1}'", pair.Key, pair.Value); }
/// <summary> /// Not-supported. /// </summary> /// <param name="item"></param> public void Add(KeyValuePair <TKey, TValue> item) { CheckAndThrow("Add"); }
public bool Contains(KeyValuePair <string, StringValues> item) { return(_headers.Contains(item)); }
public object Retrieve(KeyValuePair <string, string> keyValuePair, Type targetType, Type propertyType) { throw new NotImplementedException(); }
public static void GetTrackerEvents(DSReplay replay, dynamic trackerevents_dec) { bool isBrawl_set = false; //bool noStagingAreaNextSpawn = true; bool noStagingAreaNextSpawn = false; if (replay.GAMETIME < new DateTime(2019, 03, 24, 21, 46, 15)) // 20190324214615 { noStagingAreaNextSpawn = true; } HashSet <string> Mutation = new HashSet <string>(); replay.Middle = new List <DbMiddle>() { new DbMiddle() { Gameloop = 0, Team = 0 } }; List <StagingAreaNextSpawn> stagingAreaNextSpawns = new List <StagingAreaNextSpawn>(); Vector2 ObjectivePlanetaryFortress = Vector2.Zero; Vector2 ObjectiveNexus = Vector2.Zero; Vector2 ObjectiveBunker = Vector2.Zero; Vector2 ObjectivePhotonCannon = Vector2.Zero; Vector2 Center = Vector2.Zero; KeyValuePair <Vector2, Vector2> LineT1 = new KeyValuePair <Vector2, Vector2>(Vector2.Zero, Vector2.Zero); KeyValuePair <Vector2, Vector2> LineT2 = new KeyValuePair <Vector2, Vector2>(Vector2.Zero, Vector2.Zero); KeyValuePair <int, int> PhotonCannon = new KeyValuePair <int, int>(); KeyValuePair <int, int> Bunker = new KeyValuePair <int, int>(); int LastSpawn = 480; foreach (PythonDictionary pydic in trackerevents_dec) { if (pydic.ContainsKey("m_unitTypeName")) //11998 { if (pydic.ContainsKey("m_controlPlayerId")) { int playerid = (int)pydic["m_controlPlayerId"]; int gameloop = (int)pydic["_gameloop"]; // Game end if (DecodeService.GetString(pydic, "m_unitTypeName").StartsWith("DeathBurst")) { replay.DURATION = (int)(gameloop / 22.4); if (playerid == 13) { replay.WINNER = 1; } else if (playerid == 14) { replay.WINNER = 0; } break; } // Objectives init if (gameloop == 0 && pydic.ContainsKey("m_creatorAbilityName") && (pydic["m_creatorAbilityName"] == null || DecodeService.GetString(pydic, "m_creatorAbilityName") == "")) { if (DecodeService.GetString(pydic, "m_unitTypeName") == "ObjectivePlanetaryFortress") { ObjectivePlanetaryFortress = new Vector2((int)pydic["m_x"], (int)pydic["m_y"]); } else if (DecodeService.GetString(pydic, "m_unitTypeName") == "ObjectiveNexus") { ObjectiveNexus = new Vector2((int)pydic["m_x"], (int)pydic["m_y"]); } else if (DecodeService.GetString(pydic, "m_unitTypeName") == "ObjectiveBunker") { ObjectiveBunker = new Vector2((int)pydic["m_x"], (int)pydic["m_y"]); Bunker = new KeyValuePair <int, int>((int)pydic["m_unitTagIndex"], (int)pydic["m_unitTagRecycle"]); } else if (DecodeService.GetString(pydic, "m_unitTypeName") == "ObjectivePhotonCannon") { ObjectivePhotonCannon = new Vector2((int)pydic["m_x"], (int)pydic["m_y"]); PhotonCannon = new KeyValuePair <int, int>((int)pydic["m_unitTagIndex"], (int)pydic["m_unitTagRecycle"]); } if (ObjectiveBunker != Vector2.Zero && ObjectivePhotonCannon != Vector2.Zero && ObjectivePlanetaryFortress != Vector2.Zero && ObjectiveNexus != Vector2.Zero) { float x1t1 = ObjectivePlanetaryFortress.X + MathF.Cos(135 * MathF.PI / 180) * 100; float y1t1 = ObjectivePlanetaryFortress.Y + MathF.Sin(135 * MathF.PI / 180) * 100; float x2t1 = ObjectivePlanetaryFortress.X + MathF.Cos(315 * MathF.PI / 180) * 100; float y2t1 = ObjectivePlanetaryFortress.Y + MathF.Sin(315 * MathF.PI / 180) * 100; LineT1 = new KeyValuePair <Vector2, Vector2>(new Vector2(x1t1, y1t1), new Vector2(x2t1, y2t1)); float x1t2 = ObjectiveNexus.X + MathF.Cos(135 * MathF.PI / 180) * 100; float y1t2 = ObjectiveNexus.Y + MathF.Sin(135 * MathF.PI / 180) * 100; float x2t2 = ObjectiveNexus.X + MathF.Cos(315 * MathF.PI / 180) * 100; float y2t2 = ObjectiveNexus.Y + MathF.Sin(315 * MathF.PI / 180) * 100; LineT2 = new KeyValuePair <Vector2, Vector2>(new Vector2(x1t2, y1t2), new Vector2(x2t2, y2t2)); Center = new Vector2((ObjectiveNexus.X + ObjectivePlanetaryFortress.X) / 2, (ObjectiveNexus.Y + ObjectivePlanetaryFortress.Y) / 2); replay.OBJECTIVE = (Center.X, Center.Y) switch { (128.0f, 120.0f) => 1, (120.0f, 120.0f) => 2, (128.0f, 122.0f) => 3, _ => 0 }; } } if (playerid == 0 || playerid > 12) { continue; } // Player DSPlayer pl = replay.DSPlayer.SingleOrDefault(s => s.POS == playerid); if (pl == null) { pl = replay.DSPlayer.SingleOrDefault(s => s.WORKINGSETSLOT == playerid - 1); if (pl == null) { continue; } else { pl.POS = (byte)playerid; } } ; // Race if (gameloop < 1440) { Match m = rx_race2.Match(DecodeService.GetString(pydic, "m_unitTypeName")); if (m.Success && m.Groups[1].Value.Length > 0) { pl.RACE = m.Groups[1].Value; } } if (pydic.ContainsKey("m_creatorAbilityName")) { if (pydic["m_creatorAbilityName"] == null || DecodeService.GetString(pydic, "m_creatorAbilityName") == "") { if (gameloop == 0) { if (DecodeService.GetString(pydic, "_event") == "NNet.Replay.Tracker.SUnitBornEvent") { // Refineries init if (DecodeService.GetString(pydic, "m_unitTypeName").StartsWith("MineralField")) { int index = (int)pydic["m_unitTagIndex"]; int recycle = (int)pydic["m_unitTagRecycle"]; pl.Refineries.Add(new DbRefinery(gameloop, index, recycle, pl)); continue; } } } if (gameloop < 480) { continue; } if (noStagingAreaNextSpawn == false) { if (gameloop - LastSpawn >= 9) { continue; } } if (DecodeService.GetString(pydic, "_event") == "NNet.Replay.Tracker.SUnitBornEvent") { string born_unit = DecodeService.GetString(pydic, "m_unitTypeName"); bool isSpawnUnit = (born_unit switch { "TrophyRiftPremium" => true, "MineralIncome" => true, "ParasiticBombRelayDummy" => true, "Biomass" => true, "PurifierAdeptShade" => true, "PurifierTalisShade" => true, "HornerReaperLD9ClusterCharges" => true, "Broodling" => true, "Raptorling" => true, "InfestedLiberatorViralSwarm" => true, "SplitterlingSpawn" => true, "GuardianShell" => true, "BroodlingStetmann" => true, _ => false });
public bool Remove(KeyValuePair <string, StringValues> item) { return(_headers.Remove(item)); }
public async void DeleteAuthModule(KeyValuePair <string, AuthenticationNode> node) { authModules.Remove(node); config.User.AuthenticationDic.Remove(node.Key); await this.ShowMessageAsync("删除成功", "记得点击应用按钮保存噢"); }
public void Add(KeyValuePair <string, StringValues> item) => _headers.Add(item);
public void Add(KeyValuePair <string, object> item) { this.Add(item.Key, item.Value); }
void ICollection <KeyValuePair <string, JToken> > .Add(KeyValuePair <string, JToken> item) { Add(new JProperty(item.Key, item.Value)); }
public void OnAddSubjectiveViews(SubDatasetSubjectiveStackedGroup group, KeyValuePair<SubDataset, SubDataset> subjViews) { lock(this) m_shouldAddConnections = true; }
public async void SaveAuthModule(KeyValuePair <string, AuthenticationNode> node) { await this.ShowMessageAsync("保存成功", "记得点击应用按钮保存噢"); }