System.Collections.Generic.List.Remove(string)

Here are the examples of the csharp api System.Collections.Generic.List.Remove(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1095 Examples 7

19 View Source File : Anchor.cs
License : MIT License
Project Creator : alelievr

public void LoadLinks()
		{
			links.Clear();
			
			//we use the LinkTable in the graph to get the only instance of link stored
			//	to know why, take a look at the BaseGraph.cs file.
			var nodeLinkTable = nodeRef.graphRef.nodeLinkTable;

			//only used when a part of a link was not well destroyed, technically never
			var linkToRemove = new List< string >();

			//here we set the anchor references in the link cauz they can't be serialized.
			foreach (var linkGUID in linkGUIDs)
			{
				var linkInstance = nodeLinkTable.GetLinkFromGUID(linkGUID);
			
				//if link does not exists, skip it and add it to the remove list
				if (linkInstance == null)
				{
					linkToRemove.Add(linkGUID);
					continue ;
				}
				
				links.Add(linkInstance);
			}

			//removes ghost links (normally never appends)
			foreach (var linkGUID in linkToRemove)
			{
				Debug.LogError("g: " + anchorFieldRef.graphRef);
				Debug.LogError("[Anchor] Removing link GUID " + linkGUID + " from the link list cauz it was destroyed");

				linkGUIDs.Remove(linkGUID);
			}
			
			foreach (var link in links)
				link.OnAfterDeserialize(this);
		}

19 View Source File : NodeExtension.cs
License : MIT License
Project Creator : alfa-laboratory

private static Node SearchBy(this Node node, List<string> names, ObjectType objectType)
        {
            var _node = node;
            var _names = names;

            foreach (var name in new List<string>(_names))
            {
                _node =
                    (node.Childrens as List<Node>)?.SingleOrDefault(n => n.Type == objectType && n.Name == name) ??
                    throw new SearchException(
                        $"A {objectType.ToString().ToLower()} \"{name}\" was not found in the {_node.Type.ToString().ToLower()} \"{_node.Name}\"");
                
                Log.Logger().LogInformation($"A {objectType.ToString().ToLower()} {name} found in childrens node {_node.Type.ToString().ToLower()} {_node.Name}");
                _names.Remove(name);
                if (_names.Any())
                {
                    return _node.SearchBy(_names, objectType);
                }
            }
            return _node;
        }

19 View Source File : History.cs
License : GNU General Public License v2.0
Project Creator : afrantzis

public void Add(string path)
	{
		if (files.Remove(path) == true) {
			files.Insert(0, path);
		}
		else {
			if (files.Count == maxSize)
				files.RemoveAt(files.Count - 1);
			files.Insert(0, path);
		}

		if (Changed != null)
			Changed(this);
	}

19 View Source File : NodesTree.cs
License : MIT License
Project Creator : alaabenfatma

private void BuildCategories()
        {
            _categories = new List<Dictionary<int, string>>();

            foreach (var node in _pluginsManager.LoadedNodes)
                if (!_catNames.Contains(node.Category))
                    _catNames.Add(node.Category);
            if (VariablesTreeRootIndex() != -1)
                _catNames.Remove("Variables");
            for (var index = 0; index < _catNames.Count; index++)
            {
                var name = _catNames[index];
                var dic = new Dictionary<int, string> {{index, name}};
                _categories.Add(dic);
            }
            for (var index = 0; index < _categories.Count; index++)
            {
                var item = _categories[index];
                var name = item[index];
                if (name != null) Roots.Add(new NodeItem("", name));
            }
        }

19 View Source File : NetManager.cs
License : GNU General Public License v3.0
Project Creator : aglab2

public int RegisterPlayer(string name)
        {
            deadPlayers.Remove(name);
            if (!players.Contains(name))
                players.Add(name);

            return players.IndexOf(name);
        }

19 View Source File : ModEntry.cs
License : GNU General Public License v3.0
Project Creator : aedenthorn

private void GameLoop_OneSecondUpdateTicked(object sender, OneSecondUpdateTickedEventArgs e)
        {
            if (!Context.IsPlayerFree)
                return;

            bool wearing = Jsonreplacedets.GetClothingId("Sixty-Nine Shirt") != -1 && Game1.player.shirreplacedem?.Value?.parentSheetIndex?.Value == Jsonreplacedets.GetClothingId("Sixty-Nine Shirt");

            if (!wearing)
            {
                return;
            }

            //Monitor.Log("Wearing shirt... nice.");

            foreach (NPC npc in Game1.player.currentLocation.characters.Where(n => n.isVillager()))
            {
                if(Vector2.Distance(Game1.player.position, npc.position) < Config.MaxDistanceNice)
                {
                    if (!niceNPCs.Contains(npc.name))
                    {
                        npc.showTextAboveHead(Helper.Translation.Get("nice"));
                        niceNPCs.Add(npc.name);
                    }
                }
                else
                {
                    if(niceNPCs.Contains(npc.name))
                        niceNPCs.Remove(npc.name);
                }
            }
        }

19 View Source File : BaseNode.cs
License : MIT License
Project Creator : alelievr

public void RemoveMessageContains(string subMessage)
		{
			string toRemove = messages.Find(m => m.Contains(subMessage));
			messages.Remove(toRemove);
			onMessageRemoved?.Invoke(toRemove);
		}

19 View Source File : LeapMotionConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void ConfigureLeapMotion(bool isLeapInProject)
        {
            FileInfo[] leapDataProviderAsmDefFile = FileUtilities.FindFilesInreplacedets("Microsoft.MixedReality.Toolkit.Providers.LeapMotion.asmdef");

            replacedemblyDefinition leapDataProviderAsmDef = replacedemblyDefinition.Load(leapDataProviderAsmDefFile[0].FullName);

            List<string> references = leapDataProviderAsmDef.References.ToList();

            if (isLeapInProject && !references.Contains("LeapMotion"))
            {
                // Get the location of the Leap Core replacedets relative to the root directory
                pathDifference = GetPathDifference();

                // Make sure the Leap Core replacedets imported are version 4.4.0
                bool isLeapCorereplacedetsVersionSupported = LeapCorereplacedetsVersionSupport();

                if (isLeapCorereplacedetsVersionSupported)
                {
                    RemoveTestingFolders();
                    AddAndUpdateAsmDefs();
                    AddLeapEditorAsmDefs();

                    // Refresh the database because tests were removed and 10 asmdefs were added
                    replacedetDatabase.Refresh();
                }
                else
                {
                    Debug.LogError("MRTK only supports the Leap Motion Core replacedets Version 4.4.0 and 4.5.0, the Leap Motion Core replacedets imported are not Version 4.4.0 or 4.5.0");
                }
            }
            
            if (!isLeapInProject && references.Contains("LeapMotion"))
            {
                references.Remove("LeapMotion");
                leapDataProviderAsmDef.References = references.ToArray();
                leapDataProviderAsmDef.Save(leapDataProviderAsmDefFile[0].FullName);
            }
        }

19 View Source File : AGXUnityImportCleanup.cs
License : Apache License 2.0
Project Creator : Algoryx

internal static void Remove( string define )
      {
        if ( !Contains( define ) ) {
          Debug.LogWarning( $"DefineSymbols.Remove: Define symbol doesn't exist: {define}" );
          return;
        }

        var defines = Get();
        defines.Remove( define );
        Set( defines );
      }

19 View Source File : WindowsMixedRealityXRSDKConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void UpdateAsmDef()
        {
            FileInfo[] asmDefFiles = FileUtilities.FindFilesInreplacedets(AsmDefFileName);

            if (asmDefFiles.Length == 0)
            {
                Debug.LogWarning($"Unable to locate file: {AsmDefFileName}");
                return;
            }
            if (asmDefFiles.Length > 1)
            {
                Debug.LogWarning($"Multiple ({asmDefFiles.Length}) {AsmDefFileName} instances found. Modifying only the first.");
            }

            replacedemblyDefinition asmDef = replacedemblyDefinition.Load(asmDefFiles[0].FullName);
            if (asmDef == null)
            {
                Debug.LogWarning($"Unable to load file: {AsmDefFileName}");
                return;
            }

            List<string> references = new List<string>();
            if (asmDef.References != null)
            {
                references.AddRange(asmDef.References);
            }

            bool changed = false;

#if UNITY_2019_3_OR_NEWER
            List<VersionDefine> versionDefines = new List<VersionDefine>();
            if (asmDef.VersionDefines != null)
            {
                versionDefines.AddRange(asmDef.VersionDefines);
            }

            if (!references.Contains(WindowsMixedRealityReference))
            {
                // Add a reference to the XR SDK WMR replacedembly
                references.Add(WindowsMixedRealityReference);
                changed = true; 
            }

            if (!versionDefines.Contains(WindowsMixedRealityDefine))
            {
                // Add the WMR #define
                versionDefines.Add(WindowsMixedRealityDefine);
                changed = true;
            }
#else
            if (references.Contains(WindowsMixedRealityReference))
            {
                // Remove the reference to the XR SDK WMR replacedembly
                references.Remove(WindowsMixedRealityReference);
                changed = true;
            }
#endif

            if (changed)
            {
                asmDef.References = references.ToArray();
#if UNITY_2019_3_OR_NEWER
                asmDef.VersionDefines = versionDefines.ToArray();
#endif // UNITY_2019_3_OR_NEWER
                asmDef.Save(asmDefFiles[0].FullName);
            }
        }

19 View Source File : AssetTreeView.cs
License : MIT License
Project Creator : akof1314

protected virtual bool OnWatcherMovedreplacedetsEvent(string[] movedFromreplacedetPaths, string[] movedreplacedets, bool resorreplacedem)
        {
            m_WatcherItems.Clear();
            FindItemsByreplacedetPaths(rooreplacedem, movedFromreplacedetPaths, m_WatcherItems);
            List<string> importedreplacedets = movedreplacedets.ToList();
            if (m_WatcherItems.Count > 0)
            {
                var movedFromreplacedetPathsList = movedFromreplacedetPaths.ToList();
                foreach (var item in m_WatcherItems)
                {
                    var replacedetInfo = GereplacedemreplacedetInfo(item);
                    if (replacedetInfo != null)
                    {
                        int idx = movedFromreplacedetPathsList.IndexOf(replacedetInfo.fileRelativePath);
                        if (idx != -1)
                        {
                            replacedetInfo.fileRelativePath = movedreplacedets[idx];
                            replacedetInfo.displayName = Path.GetFileName(replacedetInfo.fileRelativePath);
                            importedreplacedets.Remove(movedreplacedets[idx]);
                        }
                    }
                }

                // 移除掉额外显示的项,因为不需要变动
                m_WatcherItems.RemoveAll(IsExtraItem);
            }

            if (resorreplacedem && m_WatcherItems.Count > 0)
            {
                // 先移除
                foreach (var watcherItem in m_WatcherItems)
                {
                    if (watcherItem.parent != null)
                    {
                        watcherItem.parent.children.Remove(watcherItem);
                    }

                    watcherItem.parent = null;

                    var replacedetInfo = GereplacedemreplacedetInfo(watcherItem);
                    if (replacedetInfo != null)
                    {
                        if (replacedetInfo.parent != null)
                        {
                            replacedetInfo.parent.children.Remove(replacedetInfo);
                        }

                        replacedetInfo.parent = null;
                    }
                }

                // 排序,以防止先处理了文件
                m_WatcherItems.Sort((a, b) =>
                {
                    var aa = GereplacedemreplacedetInfo(a);
                    var bb = GereplacedemreplacedetInfo(b);
                    if (aa != null && bb != null)
                    {
                        return EditorUtility.NaturalCompare(aa.fileRelativePath, bb.fileRelativePath);
                    }

                    return EditorUtility.NaturalCompare(a.displayName, b.displayName);
                });

                foreach (var watcherItem in m_WatcherItems)
                {
                    var replacedetInfo = GereplacedemreplacedetInfo(watcherItem);
                    if (replacedetInfo == null)
                    {
                        continue;
                    }
                    var item = FindItemByreplacedetPath(rooreplacedem, Path.GetDirectoryName(replacedetInfo.fileRelativePath));
                    if (item == null)
                    {
                        continue;
                    }
                    var replacedetInfo2 = GereplacedemreplacedetInfo(item);
                    if (replacedetInfo2 == null)
                    {
                        continue;
                    }

                    item.AddChild(watcherItem);
                    replacedetInfo2.AddChild(replacedetInfo);
                }
                SetupDepthsFromParentsAndChildren(rooreplacedem);
                SortTreeViewNaturalCompare(rooreplacedem);
            }

            bool ret = OnWatcherImportedreplacedetsEvent(importedreplacedets.ToArray(), resorreplacedem);
            return m_WatcherItems.Count > 0 || ret;
        }

19 View Source File : EntitiesModel.cs
License : Apache License 2.0
Project Creator : Aguafrommars

protected void OnItemSelected(string id, bool isSelected)
        {
            if (isSelected)
            {
                _selectedIdList.Add(id);
                return;
            }
            var selectId = _selectedIdList.FirstOrDefault(i => i == id);
            if (selectId != null)
            {
                _selectedIdList.Remove(selectId);
            }
        }

19 View Source File : DLLCreatorWindow.cs
License : MIT License
Project Creator : adrenak

void DrawReferences() {
			EditorGUILayout.BeginHorizontal();
			{
				EditorGUILayout.LabelField("References");

				if (GUILayout.Button("Add")) {
					string path = EditorUtility.OpenFilePanel("Select Reference", GetUnityDLLPath(), "*");
					if(!string.IsNullOrEmpty(path))
						references.Add(path);
				}

				EditorGUILayout.BeginVertical();
				{
					for (int i = 0; i < references.Count; i++) {
						var reference = references[i];
						EditorGUILayout.BeginHorizontal();
						{
							reference = EditorGUILayout.TextField(reference);
							if (GUILayout.Button("Remove"))
								references.Remove(reference);
						}
						EditorGUILayout.EndHorizontal();
					}
				}
				EditorGUILayout.EndVertical();
			}
			EditorGUILayout.EndHorizontal();
		}

19 View Source File : DependencyChecker.cs
License : GNU General Public License v3.0
Project Creator : Albo1125

public static bool DependencyCheckMain(string CallingPlugin, Version Albo1125CommonVer, float MinimumRPHVersion, string installationVideoURL, Version MadeForGTAVersion = null, Version MadeForLSPDFRVersion = null, Version RAGENativeUIVersion = null, string[] AudioFilesToCheckFor = null, string[] OtherRequiredFilesToCheckFor = null)
        {
            bool CheckPreplacededSuccessfully = true;
            Game.LogTrivial("Albo1125.Common.dll " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() + " starting standard dependency check for " + CallingPlugin);
            if (scid == null)
            {
                scid = NativeFunction.Natives.GET_PLAYER_NAME<string>(Game.LocalPlayer);
                Game.LogTrivial("SCID:/" + scid + "/");
            }
            if (File.Exists("Albo1125.Common.dll"))
            {
                Version InstalledCommonVer = new Version(FileVersionInfo.GetVersionInfo("Albo1125.Common.dll").ProductVersion);
                if (InstalledCommonVer.CompareTo(Albo1125CommonVer) >= 0)
                {
                    if (MadeForGTAVersion != null)
                    {
                        Game.LogTrivial("GAME VERSION: " + Game.ProductVersion.ToString());
                        int compare = Game.ProductVersion.CompareTo(MadeForGTAVersion);
                        if (compare > 0)
                        {
                            Game.LogTrivial(CallingPlugin + " compatibility warning: The current game version is newer than " + MadeForGTAVersion.ToString() + " and may or may not be incompatible due to RPH changes. Use at own risk.");
                        }
                    }

                    if (MadeForLSPDFRVersion != null)
                    {
                        if (File.Exists("Plugins/LSPD First Response.dll"))
                        {
                            Version InstalledLSPDFRVer = new Version(FileVersionInfo.GetVersionInfo("Plugins/LSPD First Response.dll").ProductVersion);
                            if (InstalledLSPDFRVer.CompareTo(MadeForLSPDFRVersion) != 0)
                            {
                                Game.LogTrivial(CallingPlugin + " compatibility warning: Different LSPD First Response.dll version detected, use at your own risk! This mod was made for LSPDFR " + MadeForLSPDFRVersion.ToString());
                                Game.DisplayNotification(CallingPlugin + " compatibility warning: Different LSPD First Response.dll version detected, use at your own risk! This mod was made for LSPDFR " + MadeForLSPDFRVersion.ToString());
                                //Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "Detected invalid LSPD First Response.dll version. To run this mod, you need LSPDFR " + MadeForLSPDFRVersion.ToString());
                                //CheckPreplacededSuccessfully = false;
                            }
                        }
                        else
                        {
                            Game.LogTrivial("LSPD First Response.dll not installed.");
                            Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "Couldn't detect required LSPD First Response.dll. You must install it.");
                            CheckPreplacededSuccessfully = false;
                        }

                    }
                    if (RAGENativeUIVersion != null)
                    {
                        if (File.Exists("RAGENativeUI.dll"))
                        {
                            Version InstalledNativeUIVer = new Version(FileVersionInfo.GetVersionInfo("RAGENativeUI.dll").ProductVersion);
                            if (InstalledNativeUIVer.CompareTo(RAGENativeUIVersion) < 0)
                            {
                                Game.LogTrivial("RAGENativeUI.dll out of date. Required version of RAGENativeUI to run this mod: " + RAGENativeUIVersion);
                                Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "RAGENativeUI.dll out of date. Required version of RAGENativeUI to run this mod: " + RAGENativeUIVersion);
                                CheckPreplacededSuccessfully = false;
                            }
                        }
                        else
                        {
                            Game.LogTrivial("RAGENativeUI.dll is not installed. You must install it to run this mod.");
                            Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "RAGENativeUI.dll is not installed. You must install it to run this mod.");
                            CheckPreplacededSuccessfully = false;
                        }
                    }
                    if (AudioFilesToCheckFor != null)
                    {
                        foreach (string s in AudioFilesToCheckFor)
                        {
                            if (!File.Exists(s))
                            {
                                Game.LogTrivial("Couldn't find the required audio file at " + s);
                                Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "You are missing required (new) audio files. Path is: " + s);

                                CheckPreplacededSuccessfully = false;
                            }
                        }
                    }
                    if (OtherRequiredFilesToCheckFor != null)
                    {
                        foreach (string s in OtherRequiredFilesToCheckFor)
                        {
                            if (!File.Exists(s))
                            {
                                Game.LogTrivial("Couldn't find the required file at " + s);
                                Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "You are missing required (new) files. Path is: " + s);
                                CheckPreplacededSuccessfully = false;
                            }
                        }

                    }
                    if (!CheckForRageVersion(MinimumRPHVersion))
                    {
                        CheckPreplacededSuccessfully = false;
                        Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "RAGEPluginHook is out of date. This mod requires RPH " + MinimumRPHVersion);
                    }

                }
                else
                {
                    Game.LogTrivial("Albo1125.Common.dll is out of date. This mod requires Albo1125.Common " + Albo1125CommonVer);
                    Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "Albo1125.Common.dll is out of date. This mod requires Albo1125.Common " + Albo1125CommonVer);
                    CheckPreplacededSuccessfully = false;
                }
            }
            else
            {
                CheckPreplacededSuccessfully = false;
                Game.LogTrivial("Albo1125.Common.dll is not installed. This mod requires Albo1125.Common to be installed. You've successfully run this without actually having it on your PC...spooky.");
                Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "Albo1125.Common.dll is not installed. This mod requires Albo1125.Common to be installed. You've successfully run this without actually having it on your PC...spooky.");
            }
            if (RegisteredPluginsForDependencyChecks.Contains(CallingPlugin)) { RegisteredPluginsForDependencyChecks.Remove(CallingPlugin); }
            if (RegisteredPluginsForDependencyChecks.Count == 0 && Plugins_URL_Errors.Count > 0) { DisplayDependencyErrors(); }

            Game.LogTrivial("Dependency check for " + CallingPlugin + " successful: " + CheckPreplacededSuccessfully);
            return CheckPreplacededSuccessfully;

        }

19 View Source File : LeapMotionConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

[MenuItem("Mixed Reality Toolkit/Utilities/Leap Motion/Configure CSC File for Leap Motion")]
        static void UpdateCSC()
        {
            // The csc file will always be in the root of replacedets
            string cscFilePath = Path.Combine(Application.dataPath, "csc.rsp");

            // Each line of the csc file
            List<string> cscFileLines = new List<string>();

            // List of the warning numbers after "-nowarn: " in the csc file
            List<string> warningNumbers = new List<string>();

            // List of new warning numbers to add to the csc file
            List<string> warningNumbersToAdd = new List<string>()
            {
                "618",
                "649"
            };

            using (StreamReader streamReader = new StreamReader(cscFilePath))
            {
                while (streamReader.Peek() > -1)
                {
                    string cscFileLine = streamReader.ReadLine();

                    if (cscFileLine.Contains("-nowarn"))
                    {
                        string[] currentWarningNumbers = cscFileLine.Split(',', ':');
                        warningNumbers = currentWarningNumbers.ToList();

                        // Remove "nowarn" from the warningNumbers list
                        warningNumbers.Remove("-nowarn");

                        foreach (string warningNumberToAdd in warningNumbersToAdd)
                        {
                            // Add the new warning numbers if they are not already in the file
                            if (!warningNumbers.Contains(warningNumberToAdd))
                            {
                                warningNumbers.Add(warningNumberToAdd);
                            }
                        }

                        cscFileLines.Add(string.Join(",", warningNumbers));
                    }
                    else
                    {
                        cscFileLines.Add(cscFileLine);
                    }
                }
            }

            using (StreamWriter streamWriter = new StreamWriter(cscFilePath))
            {
                foreach (string cscLine in cscFileLines)
                {
                    if (cscLine.StartsWith("1701"))
                    {
                        string warningNumbersJoined = string.Join(",", warningNumbers);
                        streamWriter.WriteLine(string.Concat("-nowarn:", warningNumbersJoined));
                    }
                    else
                    {
                        streamWriter.WriteLine(cscLine);
                    } 
                }
            }

            Debug.Log($"Saving {cscFilePath}");
        }

19 View Source File : Anchor.cs
License : MIT License
Project Creator : alelievr

public void RemoveLinkReference(NodeLink link)
		{
			if (!linkGUIDs.Remove(link.GUID))
				Debug.LogError("[Anchor] Tried to remove inexistant link GUID: " + link.GUID);
			if (!links.Remove(link))
				Debug.LogError("[Anchor] Tried to remove link: " + link);
			
			//set to null the object value if we're not anymore linked
			if (anchorType == AnchorType.Input && linkCount == 0)
				nodeRef.SetAnchorValue(this, null);
			
			//update anchor group
			anchorFieldRef.UpdateAnchors();
		}

19 View Source File : Chat.cs
License : GNU General Public License v3.0
Project Creator : aelariane

private static System.Collections.IEnumerator AddI(string message)
        {
            yield return new WaitForEndOfFrame();
            List<string> messages = Instance.messages;
            if (message == null)
            {
                yield break;
            }
            if (messages.Count > MessageCount.Value)
            {
                messages.Remove(messages.First());
            }
            messages.Add(message);
            AnarchyManager.ChatHistory.AddMessage(message);
        }

19 View Source File : TileJsonData.cs
License : MIT License
Project Creator : alen-smajic

public void ProcessTileJSONData(TileJSONResponse tjr)
		{
			tileJSONLoaded = true;
			List<string> layerPropertiesList = new List<string>();

			if (tjr == null || tjr.VectorLayers == null || tjr.VectorLayers.Length == 0)
			{
				return;
			}

			ClearData();

			var propertyName = "";
			var propertyDescription = "";
			var layerSource = "";

			foreach (var layer in tjr.VectorLayers)
			{
				//load layer names
				var layerName = layer.Id;
				layerPropertiesList = new List<string>();
				layerSource = layer.Source;

				//loading layer sources
				if (LayerSourcesDictionary.ContainsKey(layerName))
				{
					LayerSourcesDictionary[layerName].Add(layerSource);
				}
				else
				{
					LayerSourcesDictionary.Add(layerName, new List<string>() { layerSource });
				}

				//loading layers to a data source
				if (SourceLayersDictionary.ContainsKey(layerSource))
				{
					List<string> sourceList = new List<string>();
					LayerSourcesDictionary.TryGetValue(layerName, out sourceList);

					if (sourceList.Count > 1 && sourceList.Contains(layerSource)) // the current layerName has more than one source
					{
						if (SourceLayersDictionary.ContainsKey(commonLayersKey))
						{
							SourceLayersDictionary[commonLayersKey].Add(layerName);
						}
						else
						{
							SourceLayersDictionary.Add(commonLayersKey, new List<string>() { layerName });
						}

						if (LayerDisplayNames.Contains(layerName))
						{
							LayerDisplayNames.Remove(layerName);
						}
						LayerDisplayNames.Add(layerName);
					}
					else
					{
						SourceLayersDictionary[layerSource].Add(layerName);
						LayerDisplayNames.Add(layerName);
					}
				}
				else
				{
					SourceLayersDictionary.Add(layerSource, new List<string>() { layerName });
					LayerDisplayNames.Add(layerName);
				}


				//Load properties
				foreach (var property in layer.Fields)
				{
					propertyName = property.Key;
					propertyDescription = property.Value;
					layerPropertiesList.Add(propertyName);

					//adding property descriptions
					if (LayerPropertyDescriptionDictionary.ContainsKey(layerName))
					{
						if (!LayerPropertyDescriptionDictionary[layerName].ContainsKey(propertyName))
						{
							LayerPropertyDescriptionDictionary[layerName].Add(propertyName, propertyDescription);
						}
					}
					else
					{
						LayerPropertyDescriptionDictionary.Add(layerName, new Dictionary<string, string>() { { propertyName, propertyDescription } });
					}

					//Loading display names for properties
					if (PropertyDisplayNames.ContainsKey(layerName))
					{
						if (!PropertyDisplayNames[layerName].Contains(propertyName))
						{
							PropertyDisplayNames[layerName].Add(propertyName);

							//logic to add the list of masked properties from all sources that are not #1
							if (LayerSourcesDictionary[layerName].Count > 1 && !string.IsNullOrEmpty(tjr.Source))
							{
								var firstSource = tjr.Source.Split(new string[] { "," }, System.StringSplitOptions.None)[0].Trim();
								if (layerSource != firstSource)
								{
									if (PropertyDisplayNames[layerName].Contains(propertyName))
									{
										PropertyDisplayNames[layerName].Remove(propertyName);
									}

									PropertyDisplayNames[layerName].Add(propertyName);
								}
							}
						}
					}
					else
					{
						PropertyDisplayNames.Add(layerName, new List<string> { propertyName });
					}
				}

				if (PropertyDisplayNames.ContainsKey(layerName) && PropertyDisplayNames[layerName].Count > 1)
				{
					PropertyDisplayNames[layerName].Sort();
				}
			}


			if (LayerDisplayNames.Count > 1)
			{
				LayerDisplayNames.Sort();
			}
		}

19 View Source File : AssetBundleManager.cs
License : Apache License 2.0
Project Creator : A7ocin

void ProcessFinishedOperation(replacedetBundleLoadOperation operation)
		{
			replacedetBundleDownloadOperation download = operation as replacedetBundleDownloadOperation;
			if (download == null)
				return;

			if (String.IsNullOrEmpty(download.error))
			{
				//Debug.Log("[replacedetBundleManager] processed downloaded bundle " + download.replacedetBundleName);
				m_LoadedreplacedetBundles.Add(download.replacedetBundleName, download.replacedetBundle);
			}
			else
			{
				string msg = string.Format("Failed downloading bundle {0} from {1}: {2}",
						download.replacedetBundleName, download.GetSourceURL(), download.error);
				m_DownloadingErrors.Add(download.replacedetBundleName, msg);
			}
			m_DownloadingBundles.Remove(download.replacedetBundleName);
		}

19 View Source File : DefineSymbols.cs
License : Apache License 2.0
Project Creator : Algoryx

public static void Remove( string symbol, BuildTargetGroup group = BuildTargetGroup.Standalone )
    {
      if ( !Contains( symbol, group ) )
        return;

      var symbolsList = GetSymbolsList( group );
      symbolsList.Remove( symbol );
      SetSymbols( symbolsList, group );
    }

19 View Source File : WebSocketNotify.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

private async Task EchoLoop()
        {
            var buffer = new byte[BufferSize];
            var seg = new ArraySegment<byte>(buffer);
            while (this.socket.State == WebSocketState.Open)
            {
                try
                {
                    string value;
                    using (var mem = new MemoryStream())
                    {
                        var incoming = await this.socket.ReceiveAsync(seg, CancellationToken.None);
                        if (!incoming.EndOfMessage)
                        {
                            await socket.CloseAsync(WebSocketCloseStatus.MessageTooBig, "Message too big", CancellationToken.None);
                            break;
                        }
                        if (incoming.Count == 0)
                            continue;
                        mem.Write(seg.Array, 0, incoming.Count);
                        mem.Flush();
                        mem.Position = 0;
                        TextReader reader = new StreamReader(mem);
                        value = reader.ReadToEnd();
                    }
                    if (string.IsNullOrEmpty(value) || value.Length <= 1)
                        continue;

                    string replacedle = value.Length == 0 ? "" : value.Substring(1);
                    if (value[0] == '+')
                    {
                        if (!Subscriber.Contains(replacedle))
                            Subscriber.Add(replacedle);
                    }
                    else if (value[0] == '-')
                    {
                        Subscriber.Remove(replacedle);
                    }
                }
                catch (WebSocketException)
                {
                    break;
                }
                catch (Exception)
                {
                    break;
                }
            }
        }

19 View Source File : EditStatus.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

public void SetUnModify(string propertyName)
        {
            if (this._modifiedProperties == null || this._modifiedProperties.Count == 0)
                return;
            if (this._modifiedProperties.Contains(propertyName))
            {
                this._modifiedProperties.Remove(propertyName);
            }
        }

19 View Source File : UMABonePoseEditor.cs
License : Apache License 2.0
Project Creator : A7ocin

public override void OnInspectorGUI()
        {
            serializedObject.Update();
			SerializedProperty poses = serializedObject.FindProperty("poses");

			if (doBoneAdd)
			{
				int addedIndex = poses.arraySize;
				poses.InsertArrayElementAtIndex(addedIndex);
				var pose = poses.GetArrayElementAtIndex(addedIndex);
				SerializedProperty bone = pose.FindPropertyRelative("bone");
				bone.stringValue = addBoneName;
				SerializedProperty hash = pose.FindPropertyRelative("hash");
				hash.intValue = UMASkeleton.StringToHash(addBoneName);
				SerializedProperty position = pose.FindPropertyRelative("position");
				position.vector3Value = Vector3.zero;
				SerializedProperty rotation = pose.FindPropertyRelative("rotation");
				rotation.quaternionValue = Quaternion.idenreplacedy;
				SerializedProperty scale = pose.FindPropertyRelative("scale");
				scale.vector3Value = Vector3.one;

				activeBoneIndex = BAD_INDEX;
				editBoneIndex = BAD_INDEX;
				mirrorBoneIndex = BAD_INDEX;
				addBoneIndex = 0;
				addBoneName = "";
				doBoneAdd = false;
			}
			if (doBoneRemove)
			{
				poses.DeleteArrayElementAtIndex(removeBoneIndex - 1);

				activeBoneIndex = BAD_INDEX;
				editBoneIndex = BAD_INDEX;
				mirrorBoneIndex = BAD_INDEX;
				removeBoneIndex = 0;
				doBoneRemove = false;
			}

			// HACK
			if (!dynamicDNAConverterMode)
			{
				sourceUMA = EditorGUILayout.ObjectField("Source UMA", sourceUMA, typeof(UMAData), true) as UMAData;
				if (sourceUMA != null)
				{
					if (context == null)
					{
						context = new UMABonePoseEditorContext();
					}
					if (context.activeUMA != sourceUMA)
					{
						context.activeUMA = sourceUMA;
					}
				}
			}

			// Weight of pose on preview model
			if (haveValidContext && !dynamicDNAConverterMode)
			{
				EditorGUILayout.BeginHorizontal();
				GUILayout.Space(addRemovePadding);
				EditorGUI.BeginDisabledGroup(haveEditTarget);
				previewWeight = EditorGUILayout.Slider(previewGUIContent, previewWeight, 0f, 1f);
				EditorGUI.EndDisabledGroup();
				GUILayout.Space(addRemovePadding);
				EditorGUILayout.EndHorizontal();
			}

			GUILayout.Space(EditorGUIUtility.singleLineHeight / 2f);

//			string controlName = GUI.GetNameOfFocusedControl();
//			if ((controlName != null) && (controlName.Length > 0))
//				Debug.Log(controlName);

			// These can get corrupted by undo, so just rebuild them
			string[] removeBoneOptions = new string[targetPose.poses.Length + 1];
			removeBoneOptions[0] = " ";
			for (int i = 0; i < targetPose.poses.Length; i++)
			{
				removeBoneOptions[i + 1] = targetPose.poses[i].bone;
			}
			string[] addBoneOptions = new string[1];
			if (haveValidContext)
			{
				List<string> addList = new List<string>(context.boneList);
				addList.Insert(0, " ");
				for (int i = 0; i < targetPose.poses.Length; i++)
				{
					addList.Remove(targetPose.poses[i].bone);
				}

				addBoneOptions = addList.ToArray();
			}

			// List of existing bones
			poses.isExpanded = EditorGUILayout.Foldout(poses.isExpanded, "Pose Bones ("+poses.arraySize+")");
			if (poses.isExpanded)
			{
				for (int i = 0; i < poses.arraySize; i++)
				{
					SerializedProperty pose = poses.GetArrayElementAtIndex(i);
					drawBoneIndex = i;
					PoseBoneDrawer(pose);
				}
			}

			GUILayout.Space(EditorGUIUtility.singleLineHeight);

			// Controls for adding a new bone
			EditorGUILayout.BeginHorizontal();
			GUILayout.Space(addRemovePadding);
			if (haveValidContext)
			{
				EditorGUI.BeginDisabledGroup(addBoneIndex < 1);
				if (GUILayout.Button(addBoneGUIContent, GUILayout.Width(90f)))
				{
					addBoneName = addBoneOptions[addBoneIndex];
					doBoneAdd = true;
				}
				EditorGUI.EndDisabledGroup();

				EditorGUILayout.BeginVertical();
				GUILayout.Space(buttonVerticalOffset);
				addBoneIndex = EditorGUILayout.Popup(addBoneIndex, addBoneOptions);
				EditorGUILayout.EndVertical();
			}
			else
			{
				EditorGUI.BeginDisabledGroup(addBoneName.Length < minBoneNameLength);
				if (GUILayout.Button(addBoneGUIContent, GUILayout.Width(90f)))
				{
					doBoneAdd = true;
				}
				EditorGUI.EndDisabledGroup();

				EditorGUILayout.BeginVertical();
				GUILayout.Space(buttonVerticalOffset);
				addBoneName = EditorGUILayout.TextField(addBoneName);
				EditorGUILayout.EndVertical();
			}
			GUILayout.Space(addRemovePadding);
			EditorGUILayout.EndHorizontal();

			// Controls for removing existing bone
			EditorGUILayout.BeginHorizontal();
			GUILayout.Space(addRemovePadding);
			EditorGUI.BeginDisabledGroup(removeBoneIndex < 1);
			if (GUILayout.Button(removeBoneGUIContent, GUILayout.Width(90f)))
			{
				doBoneRemove = true;
			}
			EditorGUI.EndDisabledGroup();
			EditorGUILayout.BeginVertical();
			GUILayout.Space(buttonVerticalOffset);
			removeBoneIndex = EditorGUILayout.Popup(removeBoneIndex, removeBoneOptions);
			EditorGUILayout.EndVertical();
			GUILayout.Space(addRemovePadding);
			EditorGUILayout.EndHorizontal();

            serializedObject.ApplyModifiedProperties();
        }

19 View Source File : NetManager.cs
License : GNU General Public License v3.0
Project Creator : aglab2

public override bool CheckInvalidated()
        {
            bool invalidated = false;
            if (deadWatch.ElapsedMilliseconds > 30000)
            {
                if (deadPlayers.Count() != 0)
                {
                    invalidated = true;
                    mustReload = true;
                    foreach (var player in deadPlayers)
                    {
                        players.Remove(player);
                    }
                }
                deadPlayers = new List<string>(players);
                deadWatch.Restart();
            }

            {
                var elapsed = watch.ElapsedMilliseconds;
                if(elapsed > 30)
                {
                    invalidated = true;
                    watch.Restart();
                }
            }

            return invalidated;
        }

19 View Source File : XRSDKConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void UpdateAsmDef()
        {
            FileInfo[] asmDefFiles = FileUtilities.FindFilesInreplacedets(AsmDefFileName);

            if (asmDefFiles.Length == 0)
            {
                Debug.LogWarning($"Unable to locate file: {AsmDefFileName}");
                return;
            }
            if (asmDefFiles.Length > 1)
            {
                Debug.LogWarning($"Multiple ({asmDefFiles.Length}) {AsmDefFileName} instances found. Modifying only the first.");
            }

            replacedemblyDefinition asmDef = replacedemblyDefinition.Load(asmDefFiles[0].FullName);
            if (asmDef == null)
            {
                Debug.LogWarning($"Unable to load file: {AsmDefFileName}");
                return;
            }

            List<string> references = new List<string>();
            if (asmDef.References != null)
            {
                references.AddRange(asmDef.References);
            }

            bool changed = false;

#if UNITY_2019_3_OR_NEWER
            List<VersionDefine> versionDefines = new List<VersionDefine>();
            if (asmDef.VersionDefines != null)
            {
                versionDefines.AddRange(asmDef.VersionDefines);
            }

            if (!references.Contains(XRManagementReference))
            {
                // Add a reference to the ARFoundation replacedembly
                references.Add(XRManagementReference);
                changed = true; 
            }
            if (!references.Contains(SpatialTrackingReference))
            {
                // Add a reference to the spatial tracking replacedembly
                references.Add(SpatialTrackingReference);
                changed = true;
            }

            if (!versionDefines.Contains(XRManagementDefine))
            {
                // Add the XRManagement #define
                versionDefines.Add(XRManagementDefine);
                changed = true;
            }
            if (!versionDefines.Contains(SpatialTrackingDefine))
            {
                // Add the spatial tracking #define
                versionDefines.Add(SpatialTrackingDefine);
                changed = true;
            }
#else
            if (references.Contains(XRManagementReference))
            {
                // Remove the reference to the XRManagement replacedembly
                references.Remove(XRManagementReference);
                changed = true;
            }
            if (references.Contains(SpatialTrackingReference))
            {
                // Remove the reference to the spatial tracking replacedembly
                references.Remove(SpatialTrackingReference);
                changed = true;
            }
#endif

            if (changed)
            {
                asmDef.References = references.ToArray();
#if UNITY_2019_3_OR_NEWER
                asmDef.VersionDefines = versionDefines.ToArray();
#endif // UNITY_2019_3_OR_NEWER
                asmDef.Save(asmDefFiles[0].FullName);
            }
        }

19 View Source File : MissionGeneratorObjectives.cs
License : GNU General Public License v3.0
Project Creator : akaAgar

internal Coordinates GenerateObjective(DCSMission mission, MissionTemplate template, DBEntryTheater theaterDB, int objectiveIndex, Coordinates lastCoordinates, DBEntryAirbase playerAirbase, bool useObjectivePreset, out string objectiveName, out UnitFamily objectiveTargetUnitFamily)
        {
            MissionTemplateObjective objectiveTemplate = template.Objectives[objectiveIndex];

            string[] featuresID = objectiveTemplate.Features.ToArray();
            DBEntryObjectiveTarget targetDB = Database.Instance.GetEntry<DBEntryObjectiveTarget>(objectiveTemplate.Target);
            DBEntryObjectiveTargetBehavior targetBehaviorDB = Database.Instance.GetEntry<DBEntryObjectiveTargetBehavior>(objectiveTemplate.TargetBehavior);
            DBEntryObjectiveTask taskDB = Database.Instance.GetEntry<DBEntryObjectiveTask>(objectiveTemplate.Task);
            ObjectiveOption[] objectiveOptions = objectiveTemplate.Options.ToArray();

            if (useObjectivePreset)
            {
                DBEntryObjectivePreset presetDB = Database.Instance.GetEntry<DBEntryObjectivePreset>(objectiveTemplate.Preset);
                if (presetDB != null)
                {
                    featuresID = presetDB.Features.ToArray();
                    targetDB = Database.Instance.GetEntry<DBEntryObjectiveTarget>(Toolbox.RandomFrom(presetDB.Targets));
                    targetBehaviorDB = Database.Instance.GetEntry<DBEntryObjectiveTargetBehavior>(Toolbox.RandomFrom(presetDB.TargetsBehaviors));
                    taskDB = Database.Instance.GetEntry<DBEntryObjectiveTask>(Toolbox.RandomFrom(presetDB.Tasks));
                    objectiveOptions = presetDB.Options.ToArray();
                }
            }

            if (targetDB == null) throw new BriefingRoomException($"Target \"{targetDB.UIDisplayName}\" not found for objective #{objectiveIndex + 1}.");
            if (targetBehaviorDB == null) throw new BriefingRoomException($"Target behavior \"{targetBehaviorDB.UIDisplayName}\" not found for objective #{objectiveIndex + 1}.");
            if (taskDB == null) throw new BriefingRoomException($"Task \"{taskDB.UIDisplayName}\" not found for objective #{objectiveIndex + 1}.");

            if (!taskDB.ValidUnitCategories.Contains(targetDB.UnitCategory))
                throw new BriefingRoomException($"Task \"{taskDB.UIDisplayName}\" not valid for objective #{objectiveIndex + 1} targets, which belong to category \"{targetDB.UnitCategory}\".");

            // Add feature ogg files
            foreach (string oggFile in taskDB.IncludeOgg)
                mission.AddMediaFile($"l10n/DEFAULT/{oggFile}", $"{BRPaths.INCLUDE_OGG}{oggFile}");

            int objectiveDistance = template.FlightPlanObjectiveDistance;
            if (objectiveDistance < 1) objectiveDistance = Toolbox.RandomInt(40, 160);

            int objectiveSeperation = template.FlightPlanObjectiveSeperation;
            if (objectiveSeperation < 1) objectiveSeperation = Toolbox.RandomInt(10, 100);

            Coordinates? spawnPoint = UnitMaker.SpawnPointSelector.GetRandomSpawnPoint(
                targetDB.ValidSpawnPoints, playerAirbase.Coordinates,
                new MinMaxD(
                    objectiveDistance * OBJECTIVE_DISTANCE_VARIATION_MIN,
                    objectiveDistance * OBJECTIVE_DISTANCE_VARIATION_MAX),
                lastCoordinates,
                new MinMaxD(
                    objectiveSeperation * OBJECTIVE_DISTANCE_VARIATION_MIN,
                    objectiveSeperation * OBJECTIVE_DISTANCE_VARIATION_MAX),
                GeneratorTools.GetSpawnPointCoalition(template, Side.Enemy));

            if (!spawnPoint.HasValue)
                throw new BriefingRoomException($"Failed to spawn objective unit group. {String.Join(",", targetDB.ValidSpawnPoints.Select(x => x.ToString()).ToList())} Please try again (Consider Adusting Flight Plan)");

            Coordinates objectiveCoordinates = spawnPoint.Value;

            // Spawn target on airbase
            int airbaseID = 0;
            var parkingSpotIDsList = new List<int>();
            var parkingSpotCoordinatesList = new List<Coordinates>();
            var unitCount = targetDB.UnitCount[(int)objectiveTemplate.TargetCount].GetValue();
            switch (targetBehaviorDB.Location)
            {
                case DBEntryObjectiveTargetBehaviorLocation.SpawnOnAirbase:
                case DBEntryObjectiveTargetBehaviorLocation.SpawnOnAirbaseParking:
                case DBEntryObjectiveTargetBehaviorLocation.SpawnOnAirbaseParkingNoHardenedShelter:
                    DBEntryAirbase targetAirbase =
                        (from DBEntryAirbase airbaseDB in theaterDB.GetAirbases()
                         where airbaseDB.DCSID != playerAirbase.DCSID
                         select airbaseDB).OrderBy(x => x.Coordinates.GetDistanceFrom(objectiveCoordinates)).FirstOrDefault();
                    objectiveCoordinates = targetAirbase.Coordinates;
                    airbaseID = targetAirbase.DCSID;

                    if ((targetBehaviorDB.Location != DBEntryObjectiveTargetBehaviorLocation.SpawnOnAirbase) && targetDB.UnitCategory.IsAircraft())
                    {
                        Coordinates? lastParkingCoordinates = null;

                        for (int i = 0; i < unitCount; i++)
                        {
                            int parkingSpot = UnitMaker.SpawnPointSelector.GetFreeParkingSpot(
                                targetAirbase.DCSID,
                                out Coordinates parkingSpotCoordinates,
                                lastParkingCoordinates,
                                targetBehaviorDB.Location == DBEntryObjectiveTargetBehaviorLocation.SpawnOnAirbaseParkingNoHardenedShelter);
                            if (parkingSpot < 0) throw new BriefingRoomException("No parking spot found for aircraft.");
                            lastParkingCoordinates = parkingSpotCoordinates;

                            parkingSpotIDsList.Add(parkingSpot);
                            parkingSpotCoordinatesList.Add(parkingSpotCoordinates);
                        }
                    }

                    break;
            }

            // Pick a name, then remove it from the list
            objectiveName = Toolbox.RandomFrom(ObjectiveNames);
            ObjectiveNames.Remove(objectiveName);

            UnitMakerGroupFlags groupFlags = 0;
            if (objectiveOptions.Contains(ObjectiveOption.ShowTarget)) groupFlags = UnitMakerGroupFlags.NeverHidden;
            else if (objectiveOptions.Contains(ObjectiveOption.HideTarget)) groupFlags = UnitMakerGroupFlags.AlwaysHidden;
            if (objectiveOptions.Contains(ObjectiveOption.EmbeddedAirDefense)) groupFlags |= UnitMakerGroupFlags.EmbeddedAirDefense;

            objectiveTargetUnitFamily = Toolbox.RandomFrom(targetDB.UnitFamilies);

            // Set destination point for moving unit groups
            Coordinates destinationPoint = objectiveCoordinates;
            switch (targetDB.UnitCategory)
            {
                default:
                    destinationPoint += Coordinates.CreateRandom(10, 20) * Toolbox.NM_TO_METERS;
                    break;
                case UnitCategory.Plane:
                    destinationPoint += Coordinates.CreateRandom(30, 60) * Toolbox.NM_TO_METERS;
                    break;
            }

            switch (targetBehaviorDB.Location)
            {
                case DBEntryObjectiveTargetBehaviorLocation.GoToPlayerAirbase:
                    destinationPoint = playerAirbase.Coordinates;
                    break;
            }

            var extraSettings = new List<KeyValuePair<string, object>>{
                "GroupX2".ToKeyValuePair(destinationPoint.X),
                "GroupY2".ToKeyValuePair(destinationPoint.Y),
                "GroupAirbaseID".ToKeyValuePair(airbaseID),
                "ParkingID".ToKeyValuePair(parkingSpotIDsList.ToArray())
            };
            if (parkingSpotCoordinatesList.Count > 1)
            {
                extraSettings.Add("UnitX".ToKeyValuePair((from Coordinates coordinates in parkingSpotCoordinatesList select coordinates.X).ToArray()));
                extraSettings.Add("UnitY".ToKeyValuePair((from Coordinates coordinates in parkingSpotCoordinatesList select coordinates.Y).ToArray()));
            }
            UnitMakerGroupInfo? targetGroupInfo = UnitMaker.AddUnitGroup(
                objectiveTargetUnitFamily, unitCount,
                taskDB.TargetSide,
                targetBehaviorDB.GroupLua[(int)targetDB.UnitCategory], targetBehaviorDB.UnitLua[(int)targetDB.UnitCategory],
                objectiveCoordinates,
                null, groupFlags,
                "default",
                extraSettings.ToArray());

            if (!targetGroupInfo.HasValue) // Failed to generate target group
                throw new BriefingRoomException($"Failed to generate group for objective {objectiveIndex + 1}");

            // Static targets (aka buildings) need to have their "embedded" air defenses spawned in another group
            if (objectiveOptions.Contains(ObjectiveOption.EmbeddedAirDefense) && (targetDB.UnitCategory == UnitCategory.Static))
            {
                string[] airDefenseUnits = GeneratorTools.GetEmbeddedAirDefenseUnits(template, taskDB.TargetSide);

                if (airDefenseUnits.Length > 0)
                    UnitMaker.AddUnitGroup(
                        airDefenseUnits,
                        taskDB.TargetSide, UnitFamily.VehicleAAA,
                        targetBehaviorDB.GroupLua[(int)targetDB.UnitCategory], targetBehaviorDB.UnitLua[(int)targetDB.UnitCategory],
                        objectiveCoordinates + Coordinates.CreateRandom(100, 500),
                        null, groupFlags,
                        "default",
                        extraSettings.ToArray());
            }

            // Get tasking string for the briefing
            int pluralIndex = targetGroupInfo.Value.UnitsID.Length == 1 ? 0 : 1; // 0 for singular, 1 for plural. Used for task/names arrays.
            string taskString = GeneratorTools.ParseRandomString(taskDB.BriefingTask[pluralIndex]).Replace("\"", "''");
            if (string.IsNullOrEmpty(taskString)) taskString = "Complete objective $OBJECTIVENAME$";
            GeneratorTools.ReplaceKey(ref taskString, "ObjectiveName", objectiveName);
            GeneratorTools.ReplaceKey(ref taskString, "UnitFamily", Database.Instance.Common.Names.UnitFamilies[(int)objectiveTargetUnitFamily][pluralIndex]);
            mission.Briefing.AddItem(DCSMissionBriefingItemType.Task, taskString);

            // Add Lua table for this objective
            string objectiveLua = $"briefingRoom.mission.objectives[{objectiveIndex + 1}] = {{ ";
            objectiveLua += $"complete = false, ";
            objectiveLua += $"groupID = {targetGroupInfo.Value.GroupID}, ";
            objectiveLua += $"hideTargetCount = false, ";
            objectiveLua += $"name = \"{objectiveName}\", ";
            objectiveLua += $"targetCategory = Unit.Category.{targetDB.UnitCategory.ToLuaName()}, ";
            objectiveLua += $"task = \"{taskString}\", ";
            objectiveLua += $"unitsCount = {targetGroupInfo.Value.UnitsID.Length}, ";
            objectiveLua += $"unitsID = {{ {string.Join(", ", targetGroupInfo.Value.UnitsID)} }} ";
            objectiveLua += "}\n";

            // Add F10 sub-menu for this objective
            objectiveLua += $"briefingRoom.f10Menu.objectives[{objectiveIndex + 1}] = missionCommands.addSubMenuForCoalition(coalition.side.{template.ContextPlayerCoalition.ToString().ToUpperInvariant()}, \"Objective {objectiveName}\", nil)\n";
            mission.AppendValue("ScriptObjectives", objectiveLua);

            // Add objective trigger Lua for this objective
            string triggerLua = Toolbox.ReadAllTextIfFileExists($"{BRPaths.INCLUDE_LUA_OBJECTIVETRIGGERS}{taskDB.CompletionTriggerLua}");
            GeneratorTools.ReplaceKey(ref triggerLua, "ObjectiveIndex", objectiveIndex + 1);
            mission.AppendValue("ScriptObjectivesTriggers", triggerLua);

            // Add briefing remarks for this objective task
            if (taskDB.BriefingRemarks.Length > 0)
            {
                string remark = Toolbox.RandomFrom(taskDB.BriefingRemarks);
                GeneratorTools.ReplaceKey(ref remark, "ObjectiveName", objectiveName);
                GeneratorTools.ReplaceKey(ref remark, "UnitFamily", Database.Instance.Common.Names.UnitFamilies[(int)objectiveTargetUnitFamily][pluralIndex]);
                mission.Briefing.AddItem(DCSMissionBriefingItemType.Remark, remark);
            }

            // Add objective features Lua for this objective
            mission.AppendValue("ScriptObjectivesFeatures", ""); // Just in case there's no features
            foreach (string featureID in featuresID)
                FeaturesGenerator.GenerateMissionFeature(mission, featureID, objectiveName, objectiveIndex, targetGroupInfo.Value.GroupID, objectiveCoordinates, taskDB.TargetSide);

            return objectiveCoordinates;
        }

19 View Source File : ValidationPropertyChangedBase.cs
License : MIT License
Project Creator : ahmed-abdelrazek

protected void RemoveError(string propertyName, string error)
        {
            if (_errors.TryGetValue(propertyName, out List<string> propertyErrors))
            {
                if (propertyErrors.Contains(error))
                {
                    propertyErrors.Remove(error);
                    if (!propertyErrors.Any())
                    {
                        _errors.Remove(propertyName);
                    }
                    OnErrorsChanged(propertyName);
                }
            }
        }

19 View Source File : PipelineDirectoryManager.cs
License : MIT License
Project Creator : actions

public TrackingConfig PrepareDirectory(
            IExecutionContext executionContext,
            WorkspaceOptions workspace)
        {
            // Validate parameters.
            Trace.Entering();
            ArgUtil.NotNull(executionContext, nameof(executionContext));
            var trackingManager = HostContext.GetService<ITrackingManager>();

            var repoFullName = executionContext.GetGitHubContext("repository");
            ArgUtil.NotNullOrEmpty(repoFullName, nameof(repoFullName));

            // Load the existing tracking file if one already exists.
            string trackingFile = Path.Combine(
                HostContext.GetDirectory(WellKnownDirectory.Work),
                Constants.Pipeline.Path.PipelineMappingDirectory,
                repoFullName,
                Constants.Pipeline.Path.TrackingConfigFile);
            Trace.Info($"Loading tracking config if exists: {trackingFile}");
            TrackingConfig trackingConfig = trackingManager.LoadIfExists(executionContext, trackingFile);

            // Create a new tracking config if required.
            if (trackingConfig == null)
            {
                Trace.Info("Creating a new tracking config file.");
                trackingConfig = trackingManager.Create(
                    executionContext,
                    trackingFile);
                ArgUtil.NotNull(trackingConfig, nameof(trackingConfig));
            }
            else
            {
                // For existing tracking config files, update the job run properties.
                Trace.Info("Updating job run properties.");
                trackingConfig.LastRunOn = DateTimeOffset.Now;
                trackingManager.Update(executionContext, trackingConfig, trackingFile);
            }

            // Prepare the pipeline directory.
            if (string.Equals(workspace?.Clean, PipelineConstants.WorkspaceCleanOptions.All, StringComparison.OrdinalIgnoreCase))
            {
                CreateDirectory(
                    executionContext,
                    description: "pipeline directory",
                    path: Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), trackingConfig.PipelineDirectory),
                    deleteExisting: true);

                CreateDirectory(
                    executionContext,
                    description: "workspace directory",
                    path: Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), trackingConfig.WorkspaceDirectory),
                    deleteExisting: true);
            }
            else if (string.Equals(workspace?.Clean, PipelineConstants.WorkspaceCleanOptions.Resources, StringComparison.OrdinalIgnoreCase))
            {
                foreach (var repository in trackingConfig.Repositories)
                {
                    CreateDirectory(
                        executionContext,
                        description: $"directory {repository.Value.RepositoryPath} for repository {repository.Key}",
                        path: Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), repository.Value.RepositoryPath),
                        deleteExisting: true);
                }
            }
            else if (string.Equals(workspace?.Clean, PipelineConstants.WorkspaceCleanOptions.Outputs, StringComparison.OrdinalIgnoreCase))
            {
                var allDirectories = Directory.GetDirectories(Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), trackingConfig.PipelineDirectory)).ToList();
                foreach (var repository in trackingConfig.Repositories)
                {
                    allDirectories.Remove(Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), repository.Value.RepositoryPath));
                }

                foreach (var deleteDir in allDirectories)
                {
                    executionContext.Debug($"Delete existing untracked directory '{deleteDir}'");
                    DeleteDirectory(executionContext, "untracked dir", deleteDir);
                }
            }
            else
            {
                CreateDirectory(
                    executionContext,
                    description: "pipeline directory",
                    path: Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), trackingConfig.PipelineDirectory),
                    deleteExisting: false);

                CreateDirectory(
                    executionContext,
                    description: "workspace directory",
                    path: Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Work), trackingConfig.WorkspaceDirectory),
                    deleteExisting: false);
            }

            return trackingConfig;
        }

19 View Source File : ItemsService.cs
License : MIT License
Project Creator : aksoftware98

public void RemoveItemFromCart(string itemId)
        {
            var item = _items.SingleOrDefault(i => i.Id == itemId);
            if (item == null)
                throw new ArgumentException("Item not found");
            var carreplacedems = _carreplacedems.Where(i => i == itemId).ToArray();
            item.Quanreplacedy += carreplacedems.Count();
            foreach (var carreplacedem in carreplacedems)
            {
                _carreplacedems.Remove(carreplacedem);
            }
        }

19 View Source File : Database.cs
License : Apache License 2.0
Project Creator : aadreja

internal virtual void CreateAddCommand(IDbCommand cmd, object enreplacedy, IAuditTrail audit = null, string columnNames = null, bool doNotAppendCommonFields = false, bool overrideCreatedUpdatedOn = false)
        {
            TableAttribute tableInfo = EnreplacedyCache.Get(enreplacedy.GetType());

            if (tableInfo.NeedsHistory && tableInfo.IsCreatedByEmpty(enreplacedy))
                throw new MissingFieldException("CreatedBy is required when Audit Trail is enabled");

            List<string> columns = new List<string>();

            if (!string.IsNullOrEmpty(columnNames)) columns.AddRange(columnNames.Split(','));
            else columns.AddRange(tableInfo.DefaultInsertColumns);//Get columns from Enreplacedy attributes loaded in TableInfo

            bool isPrimaryKeyEmpty = false;

            foreach(ColumnAttribute pkCol in tableInfo.Columns.Where(p=>p.Value.IsPrimaryKey).Select(p=>p.Value))
            {
                if (pkCol.PrimaryKeyInfo.IsIdenreplacedy && tableInfo.IsKeyIdEmpty(enreplacedy, pkCol))
                {
                    isPrimaryKeyEmpty = true;
                    //if idenreplacedy remove keyfield if added in field list
                    columns.Remove(pkCol.Name);
                }
                else if (pkCol.Property.PropertyType == typeof(Guid) && tableInfo.IsKeyIdEmpty(enreplacedy, pkCol))
                {
                    isPrimaryKeyEmpty = true;
                    //if not idenreplacedy and key not generated, generate before save
                    tableInfo.SetKeyId(enreplacedy, pkCol, Guid.NewGuid());
                }
            }

            #region append common columns

            if (!doNotAppendCommonFields)
            {
                if (!tableInfo.NoIsActive)
                {
                    if (!columns.Contains(Config.ISACTIVE_COLUMN.Name))
                        columns.Add(Config.ISACTIVE_COLUMN.Name);

                    bool isActive = tableInfo.GetIsActive(enreplacedy) ?? true;
                    //when IsActive is not set then true for insert
                    cmd.AddInParameter("@" + Config.ISACTIVE_COLUMN.Name, Config.ISACTIVE_COLUMN.ColumnDbType, isActive);

                    if (tableInfo.NeedsHistory)
                        audit.AppendDetail(Config.ISACTIVE_COLUMN.Name, isActive, DbType.Boolean, null);

                    tableInfo.SetIsActive(enreplacedy, isActive); //Set IsActive value
                }

                if (!tableInfo.NoVersionNo)
                {
                    int versionNo = tableInfo.GetVersionNo(enreplacedy) ?? 1;  //set defualt versionno 1 for Insert
                    if (versionNo == 0) versionNo = 1; //set defualt versionno 1 for Insert even if its zero or null

                    if (!columns.Contains(Config.VERSIONNO_COLUMN.Name))
                        columns.Add(Config.VERSIONNO_COLUMN.Name);

                    cmd.AddInParameter("@" + Config.VERSIONNO_COLUMN.Name, Config.VERSIONNO_COLUMN.ColumnDbType, versionNo);

                    tableInfo.SetVersionNo(enreplacedy, versionNo); //Set VersionNo value
                }

                if (!tableInfo.NoCreatedBy)
                {
                    if (!columns.Contains(Config.CREATEDBY_COLUMN.Name))
                        columns.Add(Config.CREATEDBY_COLUMN.Name);

                    cmd.AddInParameter("@" + Config.CREATEDBY_COLUMN.Name, Config.CREATEDBY_COLUMN.ColumnDbType, tableInfo.GetCreatedBy(enreplacedy));
                }

                if (!tableInfo.NoCreatedOn & !columns.Contains(Config.CREATEDON_COLUMN.Name))
                {
                    columns.Add(Config.CREATEDON_COLUMN.Name);
                }

                if (!tableInfo.NoUpdatedBy)
                {
                    if (!columns.Contains(Config.UPDATEDBY_COLUMN.Name))
                        columns.Add(Config.UPDATEDBY_COLUMN.Name);

                    cmd.AddInParameter("@" + Config.UPDATEDBY_COLUMN.Name, Config.UPDATEDBY_COLUMN.ColumnDbType, tableInfo.GetCreatedBy(enreplacedy));
                }

                if (!tableInfo.NoUpdatedOn & !columns.Contains(Config.UPDATEDON_COLUMN.Name))
                {
                    columns.Add(Config.UPDATEDON_COLUMN.Name);
                }
            }

            #endregion

            //append @ before each fields to add as parameter
            List<string> parameters = columns.Select(c => "@" + c).ToList();

            int pIndex = parameters.FindIndex(c => c == "@" + Config.CREATEDON_COLUMN.Name);
            if (pIndex >= 0)
            {
                var createdOn = Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetCreatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
                if (createdOn is string)
                {
                    parameters[pIndex] = (string)createdOn;
                }
                else
                {
                    cmd.AddInParameter(parameters[pIndex], Config.CREATEDON_COLUMN.ColumnDbType, createdOn);
                }
                //parameters[pIndex] = (string)Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetCreatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
            }

            pIndex = parameters.FindIndex(c => c == "@" + Config.UPDATEDON_COLUMN.Name);
            if (pIndex >= 0)
            {
                var updatedOn = Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetUpdatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
                if (updatedOn is string)
                {
                    parameters[pIndex] = (string)updatedOn;
                }
                else
                {
                    cmd.AddInParameter(parameters[pIndex], Config.CREATEDON_COLUMN.ColumnDbType, updatedOn);
                }
                //parameters[pIndex] = (string)Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetUpdatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
            }

            StringBuilder cmdText = new StringBuilder();
            cmdText.Append($"INSERT INTO {tableInfo.FullName} ({string.Join(",", columns)}) VALUES({string.Join(",", parameters)});");

            if (tableInfo.IsKeyIdenreplacedy() && isPrimaryKeyEmpty)
            {
                //add query to get inserted id
                cmdText.Append(LASTINSERTEDROWIDSQL);
            }

            //remove common columns and parameters already added above
            columns.RemoveAll(c => c == Config.CREATEDON_COLUMN.Name || c == Config.CREATEDBY_COLUMN.Name
                                    || c == Config.UPDATEDON_COLUMN.Name || c == Config.UPDATEDBY_COLUMN.Name
                                    || c == Config.VERSIONNO_COLUMN.Name || c == Config.ISACTIVE_COLUMN.Name);

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = cmdText.ToString();

            for (int i = 0; i < columns.Count(); i++)
            {
                tableInfo.Columns.TryGetValue(columns[i], out ColumnAttribute columnInfo); //find column attribute

                DbType dbType = DbType.Object;
                object columnValue = null;

                if (columnInfo != null && columnInfo.GetMethod != null)
                {
                    dbType = columnInfo.ColumnDbType;
                    columnValue = columnInfo.GetAction(enreplacedy);

                    if (tableInfo.NeedsHistory) audit.AppendDetail(columns[i], columnValue, dbType, null);
                }
                cmd.AddInParameter("@" + columns[i], dbType, columnValue);
            }
        }

19 View Source File : CrossPlatformInputInitialize.cs
License : MIT License
Project Creator : alanplotko

private static void SetEnabled(string defineName, bool enable, bool mobile)
        {
            //Debug.Log("setting "+defineName+" to "+enable);
            foreach (var group in mobile ? mobileBuildTargetGroups : buildTargetGroups)
            {
                var defines = GetDefinesList(group);
                if (enable)
                {
                    if (defines.Contains(defineName))
                    {
                        return;
                    }
                    defines.Add(defineName);
                }
                else
                {
                    if (!defines.Contains(defineName))
                    {
                        return;
                    }
                    while (defines.Contains(defineName))
                    {
                        defines.Remove(defineName);
                    }
                }
                string definesString = string.Join(";", defines.ToArray());
                PlayerSettings.SetScriptingDefineSymbolsForGroup(group, definesString);
            }
        }

19 View Source File : LocationPatches.cs
License : GNU General Public License v3.0
Project Creator : aedenthorn

private static void GetSpouseRooms(FarmHouse fh, List<string> orderableSpouses, out List<string> orderedSpouses, out List<string> customSpouses)
		{
			customSpouses = new List<string>();
			for (int i = orderableSpouses.Count - 1; i >= 0; i--)
			{
				if (ModEntry.customRoomData.ContainsKey(orderableSpouses[i]) &&
					(ModEntry.customRoomData[orderableSpouses[i]].upgradeLevel == fh.upgradeLevel || ModEntry.customRoomData[orderableSpouses[i]].upgradeLevel < 0) &&
					ModEntry.customRoomData[orderableSpouses[i]].startPos.X > -1
				)
				{
					customSpouses.Add(orderableSpouses[i]);
					orderableSpouses.RemoveAt(i);
				}
			}

			orderedSpouses = new List<string>();
			string[] roomOrder = Config.SpouseRoomOrder.Split(',');
			foreach (string str in roomOrder)
			{
				string s = str.Trim();
				if (orderableSpouses.Contains(s))
				{
					orderedSpouses.Add(s);
					orderableSpouses.Remove(s);
				}
			}
			foreach (string str in orderableSpouses)
			{
				orderedSpouses.Add(str);
				Config.SpouseRoomOrder += (Config.SpouseRoomOrder.Trim().Length > 0 ? "," : "") + str;
			}
			Helper.WriteConfig(Config);
		}

19 View Source File : MicroSplatShaderGUI_Compiler.cs
License : MIT License
Project Creator : alelievr

public void Compile(Material m, string shaderName = null)
      {
         int hash = 0;
         for (int i = 0; i < m.shaderKeywords.Length; ++i)
         {
            hash += 31 + m.shaderKeywords[i].GetHashCode();
         }
         var path = replacedetDatabase.GetreplacedetPath(m.shader);
         string nm = m.shader.name;
         if (!string.IsNullOrEmpty(shaderName))
         {
            nm = shaderName;
         }
         string baseName = "Hidden/" + nm + "_Base" + hash.ToString();

         string terrainShader = Compile(m.shaderKeywords, nm, baseName);

         string blendShader = null;

         // strip extra feature from terrain blending to make it cheaper
         if (m.IsKeywordEnabled("_TERRAINBLENDING"))
         {
            List<string> blendKeywords = new List<string>(m.shaderKeywords);
            if (m.IsKeywordEnabled("_TBDISABLE_DETAILNOISE") && blendKeywords.Contains("_DETAILNOISE"))
            {
               blendKeywords.Remove("_DETAILNOISE");
            }
            if (m.IsKeywordEnabled("_TBDISABLE_DISTANCENOISE") && blendKeywords.Contains("_DISTANCENOISE"))
            {
               blendKeywords.Remove("_DISTANCENOISE");
            }
            if (m.IsKeywordEnabled("_TBDISABLE_DISTANCERESAMPLE") && blendKeywords.Contains("_DISTANCERESAMPLE"))
            {
               blendKeywords.Remove("_DISTANCERESAMPLE");
            }

            blendShader = Compile(blendKeywords.ToArray(), nm, null, true);
         }


         // generate fallback
         string[] oldKeywords = new string[m.shaderKeywords.Length];
         System.Array.Copy(m.shaderKeywords, oldKeywords, m.shaderKeywords.Length);
         m.DisableKeyword("_TESSDISTANCE");
         m.DisableKeyword("_TESSEDGE");
         m.DisableKeyword("_PARALLAX");
         m.DisableKeyword("_DETAILNOISE");

         // maybe reduce layers in distance? can cause a pop though..
         //m.DisableKeyword("_MAX3LAYER");
         //m.EnableKeyword("_MAX2LAYER");


         string fallback = Compile(m.shaderKeywords, baseName);
         m.shaderKeywords = oldKeywords;

         System.IO.File.WriteAllText(path, terrainShader);
         string fallbackPath = path.Replace(".shader", "_Base.shader");
         string terrainBlendPath = path.Replace(".shader", "_TerrainObjectBlend.shader");
         System.IO.File.WriteAllText(fallbackPath, fallback);
         if (blendShader != null)
         {
            System.IO.File.WriteAllText(terrainBlendPath, blendShader); 
         }

         EditorUtility.SetDirty(m);
         replacedetDatabase.Refresh();
         MicroSplatTerrain.SyncAll(); 
      }

19 View Source File : UMAAssetIndexer.cs
License : Apache License 2.0
Project Creator : A7ocin

void ISerializationCallbackReceiver.OnAfterDeserialize()
        {
            var st = StartTimer();
            #region typestuff
            List<System.Type> newTypes = new List<System.Type>()
        {
        (typeof(SlotDatareplacedet)),
        (typeof(OverlayDatareplacedet)),
        (typeof(RaceData)),
        (typeof(UMATextRecipe)),
        (typeof(UMAWardrobeRecipe)),
        (typeof(UMAWardrobeCollection)),
        (typeof(RuntimeAnimatorController)),
#if UNITY_EDITOR
        (typeof(AnimatorController)),
#endif
        (typeof(DynamireplacedADnareplacedet)),
        (typeof(Textreplacedet))
        };

            TypeToLookup = new Dictionary<System.Type, System.Type>()
        {
        { (typeof(SlotDatareplacedet)),(typeof(SlotDatareplacedet)) },
        { (typeof(OverlayDatareplacedet)),(typeof(OverlayDatareplacedet)) },
        { (typeof(RaceData)),(typeof(RaceData)) },
        { (typeof(UMATextRecipe)),(typeof(UMATextRecipe)) },
        { (typeof(UMAWardrobeRecipe)),(typeof(UMAWardrobeRecipe)) },
        { (typeof(UMAWardrobeCollection)),(typeof(UMAWardrobeCollection)) },
        { (typeof(RuntimeAnimatorController)),(typeof(RuntimeAnimatorController)) },
#if UNITY_EDITOR
        { (typeof(AnimatorController)),(typeof(RuntimeAnimatorController)) },
#endif
        {  typeof(Textreplacedet), typeof(Textreplacedet) },
        { (typeof(DynamireplacedADnareplacedet)), (typeof(DynamireplacedADnareplacedet)) }
        };

            List<string> invalidTypeNames = new List<string>();
            // Add the additional Types.
            foreach (string s in IndexedTypeNames)
            {
                if (s == "")
                    continue;
                System.Type sType = System.Type.GetType(s);
                if (sType == null)
                {
                    invalidTypeNames.Add(s);
                    Debug.LogWarning("Could not find type for " + s);
                    continue;
                }
                newTypes.Add(sType);
                if (!TypeToLookup.ContainsKey(sType))
                {
                    TypeToLookup.Add(sType, sType);
                }
            }

            Types = newTypes.ToArray();

            if (invalidTypeNames.Count > 0)
            {
                foreach (string ivs in invalidTypeNames)
                {
                    IndexedTypeNames.Remove(ivs);
                }
            }
            BuildStringTypes();
            #endregion
            UpdateSerializedDictionaryItems();
            StopTimer(st, "Before Serialize");
        }

19 View Source File : MicroSplatTerrainEditor_Baking.cs
License : MIT License
Project Creator : alelievr

static void RemoveKeyword(List<string> keywords, string keyword)
   {
      if (keywords.Contains(keyword))
      {
         keywords.Remove(keyword);
      }
   }

19 View Source File : Utils.cs
License : GNU General Public License v3.0
Project Creator : aedenthorn

public static void RemoveZombie(string name)
        {
            List<string> zombies = helper.Data.ReadSaveData<List<string>>("zombies") ?? new List<string>();
            zombies.Remove(name);
            helper.Data.WriteSaveData("zombies", zombies);
            ModEntry.zombieTextures.Remove(name);
            ModEntry.zombiePortraits.Remove(name);
            ModEntry.curedNPCs.Add(name);
            NPC npc = Game1.getCharacterFromName(name);
            helper.Reflection.GetField<Texture2D>(npc.sprite.Value, "spriteTexture").SetValue(helper.Content.Load<Texture2D>($"Characters/{name}", ContentSource.GameContent));
            helper.Content.InvalidateCache($"Portraits/{name}");
            monitor.Log($"{name} was cured of zombification!");
        }

19 View Source File : BaseNode.cs
License : MIT License
Project Creator : alelievr

public void RemoveMessage(string message)
		{
			onMessageRemoved?.Invoke(message);
			messages.Remove(message);
		}

19 View Source File : EditorProjectUtilities.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void ApplyARFoundationUWPCompileFix()
        {
#if !UNITY_2019_1_OR_NEWER
            bool reloadLocked = EditorreplacedemblyReloadManager.LockReloadreplacedemblies;
            if (reloadLocked)
            {
                EditorreplacedemblyReloadManager.LockReloadreplacedemblies = false;
            }

            DirectoryInfo packageCache = FileUtilities.GetPackageCache();

            if (packageCache.Exists)
            {
                string uwpPlatformName = "WSA";

                FileInfo arFoundation = GetPackageCachereplacedemblyDefinitionFile(
                    packageCache,
                    "[email protected]*",
                    "Unity.XR.ARFoundation.asmdef");
                if (arFoundation != null)
                {
                    bool changed = false;

                    replacedemblyDefinition asmDef = replacedemblyDefinition.Load(arFoundation.FullName);

                    if (asmDef.IncludePlatforms.Contains(uwpPlatformName))
                    {
                        Debug.Log($"Removing Universal Windows Platform from the {arFoundation.FullName} included platforms list.");
                        List<string> list = new List<string>(asmDef.IncludePlatforms);
                        list.Remove(uwpPlatformName);
                        asmDef.IncludePlatforms = list.ToArray();
                        changed = true;
                    }
                    else if (!asmDef.ExcludePlatforms.Contains(uwpPlatformName))
                    {
                        Debug.Log($"Adding Universal Windows Platform to the {arFoundation.FullName} excluded platforms list.");
                        List<string> list = new List<string>(asmDef.ExcludePlatforms);
                        list.Add(uwpPlatformName);
                        asmDef.ExcludePlatforms = list.ToArray();
                        changed = true;
                    }

                    if (changed)
                    {
                        asmDef.Save(arFoundation.FullName);
                    }
                }

                FileInfo arSubsystems = GetPackageCachereplacedemblyDefinitionFile(
                    packageCache,
                    "[email protected]*",
                    "Unity.XR.ARSubsystems.asmdef");
                if (arSubsystems != null)
                {
                    bool changed = false;

                    replacedemblyDefinition asmDef = replacedemblyDefinition.Load(arSubsystems.FullName);

                    if (asmDef.IncludePlatforms.Contains(uwpPlatformName))
                    {
                        Debug.Log($"Removing Universal Windows Platform from the {arSubsystems.FullName} included platforms list.");
                        List<string> list = new List<string>(asmDef.IncludePlatforms);
                        list.Remove(uwpPlatformName);
                        asmDef.IncludePlatforms = list.ToArray();
                        changed = true;
                    }
                    else if (!asmDef.ExcludePlatforms.Contains(uwpPlatformName))
                    {
                        Debug.Log($"Adding Universal Windows Platform to the {arSubsystems.FullName} excluded platforms list.");
                        List<string> list = new List<string>(asmDef.ExcludePlatforms);
                        list.Add(uwpPlatformName);
                        asmDef.ExcludePlatforms = list.ToArray();
                        changed = true;
                    }

                    if (changed)
                    {
                        asmDef.Save(arSubsystems.FullName);
                    }
                }
            }

            if (reloadLocked)
            {
                EditorreplacedemblyReloadManager.LockReloadreplacedemblies = true;
            }

#endif // !UNITY_2019_OR_NEWER
        }

19 View Source File : TileJsonData.cs
License : MIT License
Project Creator : alen-smajic

public void ProcessTileJSONData(TileJSONResponse tjr)
		{
			tileJSONLoaded = true;
			List<string> layerPropertiesList = new List<string>();

			if (tjr == null || tjr.VectorLayers == null || tjr.VectorLayers.Length == 0)
			{
				return;
			}

			ClearData();

			var propertyName = "";
			var propertyDescription = "";
			var layerSource = "";

			foreach (var layer in tjr.VectorLayers)
			{
				//load layer names
				var layerName = layer.Id;
				layerPropertiesList = new List<string>();
				layerSource = layer.Source;

				//loading layer sources
				if (LayerSourcesDictionary.ContainsKey(layerName))
				{
					LayerSourcesDictionary[layerName].Add(layerSource);
				}
				else
				{
					LayerSourcesDictionary.Add(layerName, new List<string>() { layerSource });
				}

				//loading layers to a data source
				if (SourceLayersDictionary.ContainsKey(layerSource))
				{
					List<string> sourceList = new List<string>();
					LayerSourcesDictionary.TryGetValue(layerName, out sourceList);

					if (sourceList.Count > 1 && sourceList.Contains(layerSource)) // the current layerName has more than one source
					{
						if (SourceLayersDictionary.ContainsKey(commonLayersKey))
						{
							SourceLayersDictionary[commonLayersKey].Add(layerName);
						}
						else
						{
							SourceLayersDictionary.Add(commonLayersKey, new List<string>() { layerName });
						}

						if (LayerDisplayNames.Contains(layerName))
						{
							LayerDisplayNames.Remove(layerName);
						}
						LayerDisplayNames.Add(layerName);
					}
					else
					{
						SourceLayersDictionary[layerSource].Add(layerName);
						LayerDisplayNames.Add(layerName);
					}
				}
				else
				{
					SourceLayersDictionary.Add(layerSource, new List<string>() { layerName });
					LayerDisplayNames.Add(layerName);
				}


				//Load properties
				foreach (var property in layer.Fields)
				{
					propertyName = property.Key;
					propertyDescription = property.Value;
					layerPropertiesList.Add(propertyName);

					//adding property descriptions
					if (LayerPropertyDescriptionDictionary.ContainsKey(layerName))
					{
						if (!LayerPropertyDescriptionDictionary[layerName].ContainsKey(propertyName))
						{
							LayerPropertyDescriptionDictionary[layerName].Add(propertyName, propertyDescription);
						}
					}
					else
					{
						LayerPropertyDescriptionDictionary.Add(layerName, new Dictionary<string, string>() { { propertyName, propertyDescription } });
					}

					//Loading display names for properties
					if (PropertyDisplayNames.ContainsKey(layerName))
					{
						if (!PropertyDisplayNames[layerName].Contains(propertyName))
						{
							PropertyDisplayNames[layerName].Add(propertyName);

							//logic to add the list of masked properties from all sources that are not #1
							if (LayerSourcesDictionary[layerName].Count > 1 && !string.IsNullOrEmpty(tjr.Source))
							{
								var firstSource = tjr.Source.Split(new string[] { "," }, System.StringSplitOptions.None)[0].Trim();
								if (layerSource != firstSource)
								{
									if (PropertyDisplayNames[layerName].Contains(propertyName))
									{
										PropertyDisplayNames[layerName].Remove(propertyName);
									}

									PropertyDisplayNames[layerName].Add(propertyName);
								}
							}
						}
					}
					else
					{
						PropertyDisplayNames.Add(layerName, new List<string> { propertyName });
					}
				}

				if (PropertyDisplayNames.ContainsKey(layerName) && PropertyDisplayNames[layerName].Count > 1)
				{
					PropertyDisplayNames[layerName].Sort();
				}
			}


			if (LayerDisplayNames.Count > 1)
			{
				LayerDisplayNames.Sort();
			}
		}

19 View Source File : Chat.cs
License : GNU General Public License v3.0
Project Creator : aelariane

internal static void Add(string message)
        {
            if (Instance == null)
            {
                return;
            }
            List<string> messages = Instance.messages;
            if (message == null)
            {
                return;
            }
            if (messages.Count > MessageCount.Value)
            {
                messages.Remove(messages.First());
            }
            messages.Add(message);
        }

19 View Source File : FTXServer.cs
License : Apache License 2.0
Project Creator : AlexWan

private void HandleUnsubscribedMessage(JToken response)
        {
            var channel = response.SelectToken("channel").ToString();
            switch (channel)
            {
                case "trades":
                    var securityName = response.SelectToken("market").ToString();
                    _subscribedSecurities.Remove(securityName);
                    break;
                case "fills":
                    _isPortfolioSubscribed = false;
                    break;
                default:
                    break;
            }
        }

19 View Source File : HotfixEditorWindowBase.cs
License : MIT License
Project Creator : 404Lcc

[PropertySpace(10)]
        [LabelText("Mono模式"), Button]
        public void Mono()
        {
            BuildTargetGroup buildTargetGroup;
#if UNITY_STANDALONE
            buildTargetGroup = BuildTargetGroup.Standalone;
#endif
#if UNITY_ANDROID
            buildTargetGroup = BuildTargetGroup.Android;
#endif
#if UNITY_IOS
            buildTargetGroup = BuildTargetGroup.iOS;
#endif
            string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
            List<string> defineList = new List<string>(define.Split(';'));
            if (defineList.Contains("ILRuntime"))
            {
                defineList.Remove("ILRuntime");
                define = string.Empty;
                foreach (string item in defineList)
                {
                    define += $"{item};";
                }
                PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, define);
            }
        }

19 View Source File : Environment.cs
License : Apache License 2.0
Project Creator : Algoryx

public static bool RemoveFromPath( string dir )
    {
      var pathList = System.Environment.GetEnvironmentVariable( "PATH" ).Split( ';' ).ToList();
      if ( !pathList.Remove( dir ) )
        return false;
      System.Environment.SetEnvironmentVariable( "PATH",
                                                 string.Join( ";", pathList ) );
      return true;
    }

19 View Source File : AtomLockScope.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

public void Dispose()
        {
            if (AtomLock != null)
            {
                using (ThreadLockScope.Scope(AtomLock))
                {
                    if (LockName == null)
                        AtomLock.AtomLockNames.Clear();
                    else
                        AtomLock.AtomLockNames.Remove(LockName);
                }
            }
            else
            {
                using (ThreadLockScope.Scope(AtomLocks))
                {
                    AtomLocks.Remove(LockName);
                }
            }
        }

19 View Source File : UnityARConfigurationChecker.cs
License : Apache License 2.0
Project Creator : abist-co-ltd

private static void UpdateAsmDef(bool arFoundationPresent)
        {
            const string asmDefFileName = "Microsoft.MixedReality.Toolkit.Providers.UnityAR.asmdef";
            FileInfo[] asmDefFiles = FileUtilities.FindFilesInreplacedets(asmDefFileName);

            if (asmDefFiles.Length == 0)
            {
                Debug.LogWarning($"Unable to locate file: {asmDefFileName}");
                return;
            }
            if (asmDefFiles.Length > 1)
            {
                Debug.LogWarning($"Multiple ({asmDefFiles.Length}) {asmDefFileName} instances found. Modifying only the first.");
            }

            replacedemblyDefinition asmDef = replacedemblyDefinition.Load(asmDefFiles[0].FullName);
            if (asmDef == null)
            {
                Debug.LogWarning($"Unable to load file: {asmDefFileName}");
                return;
            }

            List<string> references = new List<string>();
            if (asmDef.References != null)
            {
                references.AddRange(asmDef.References);
            }

            // ARFoundation replacedembly names
            const string arFoundationReference = "Unity.XR.ARFoundation";
            const string spatialTrackingReference = "UnityEngine.SpatialTracking";
            bool changed = false;

            if (arFoundationPresent)
            {
#if UNITY_2018 || UNITY_2019_1_OR_NEWER
                if (!references.Contains(arFoundationReference))
                {
                    // Add a reference to the ARFoundation replacedembly
                    references.Add(arFoundationReference);
                    changed = true; 
                }
#endif
#if UNITY_2019_1_OR_NEWER
                if (!references.Contains(spatialTrackingReference))
                {
                    // Add a reference to the spatial tracking replacedembly
                    references.Add(spatialTrackingReference);
                    changed = true;
                }
#elif UNITY_2018
                if (references.Contains(spatialTrackingReference))
                {
                    // Remove the reference to the spatial tracking replacedembly
                    references.Remove(spatialTrackingReference);
                    changed = true;
                }
#endif
            }
            else
            {
                // Remove all ARFoundation related replacedembly references
                if (references.Contains(arFoundationReference))
                {
                    references.Remove(arFoundationReference);
                    changed = true;
                }
                if (references.Contains(spatialTrackingReference))
                {
                    references.Remove(spatialTrackingReference);
                    changed = true;
                }
            }

            if (changed)
            {
                asmDef.References = references.ToArray();
                asmDef.Save(asmDefFiles[0].FullName);
            }
        }

19 View Source File : AssetEditorWindowBase.cs
License : MIT License
Project Creator : 404Lcc

[PropertySpace(10)]
        [LabelText("Resources模式"), Button]
        public void Resources()
        {
            BuildTargetGroup buildTargetGroup;
#if UNITY_STANDALONE
            buildTargetGroup = BuildTargetGroup.Standalone;
#endif
#if UNITY_ANDROID
            buildTargetGroup = BuildTargetGroup.Android;
#endif
#if UNITY_IOS
            buildTargetGroup = BuildTargetGroup.iOS;
#endif
            string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
            List<string> defineList = new List<string>(define.Split(';'));
            if (defineList.Contains("replacedetBundle"))
            {
                defineList.Remove("replacedetBundle");
                define = string.Empty;
                foreach (string item in defineList)
                {
                    define += $"{item};";
                }
                PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, define);
            }
        }

19 View Source File : HotfixEditorWindowBase.cs
License : MIT License
Project Creator : 404Lcc

[PropertySpace(10)]
        [LabelText("Debug模式"), Button]
        public void Debug()
        {
            BuildTargetGroup buildTargetGroup;
#if UNITY_STANDALONE
            buildTargetGroup = BuildTargetGroup.Standalone;
#endif
#if UNITY_ANDROID
            buildTargetGroup = BuildTargetGroup.Android;
#endif
#if UNITY_IOS
            buildTargetGroup = BuildTargetGroup.iOS;
#endif
            string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
            List<string> defineList = new List<string>(define.Split(';'));
            if (defineList.Contains("Release"))
            {
                defineList.Remove("Release");
                define = string.Empty;
                foreach (string item in defineList)
                {
                    define += $"{item};";
                }
                PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, define);
            }
        }

19 View Source File : UMAAssetIndexer.cs
License : Apache License 2.0
Project Creator : A7ocin

public void RemoveType(System.Type sType)
        {
            string QualifiedName = sType.replacedemblyQualifiedName;
            if (!IsAdditionalIndexedType(QualifiedName)) return;

            TypeToLookup.Remove(sType);

            List<System.Type> newTypes = new List<System.Type>();
            newTypes.AddRange(Types);
            newTypes.Remove(sType);
            Types = newTypes.ToArray();
            TypeLookup.Remove(sType);
            IndexedTypeNames.Remove(sType.replacedemblyQualifiedName);
            BuildStringTypes();
        }

19 View Source File : SixCloudUser.cs
License : MIT License
Project Creator : Accelerider

private void SaveDownloadingFile(IDownloadingFile result)
        {
            _downloadingFiles.Add(result);
            ArddFilePaths.Add(result.ArddFilePath);

            var disposable1 = Subscribe(result.DownloadInfo.Where(item => item.Status == TransferStatus.Suspended || item.Status == TransferStatus.Faulted));
            var disposable2 = Subscribe(result.DownloadInfo.Sample(TimeSpan.FromMilliseconds(5000)));

            result.DownloadInfo
                .Where(item => item.Status == TransferStatus.Disposed)
                .Subscribe(async _ =>
                {
                    await ClearDownloadInfo(true);

                    Logger.Info($"Download Cancelled: {result.DownloadInfo.Context.LocalPath}. ");
                }, OnCompleted);

            File.WriteAllText(result.ArddFilePath.EnsureFileFolder(), result.ToJsonString());

            if (result.DownloadInfo.Status == TransferStatus.Completed)
            {
                OnCompleted();
            }

            async void OnCompleted()
            {
                await ClearDownloadInfo(false);
                var localDiskFile = LocalDiskFile.Create(result);
                _localDiskFiles.Add(localDiskFile);

                Logger.Info($"Download Completed: {result.DownloadInfo.Context.LocalPath}. ");
            }

            IDisposable Subscribe(IObservable<TransferNotification> observable)
            {
                return observable.Subscribe(_ => File.WriteAllText(result.ArddFilePath, result.ToJsonString()));
            }

            async Task ClearDownloadInfo(bool isCancelled)
            {
                disposable1.Dispose();
                disposable2.Dispose();

                ArddFilePaths.Remove(result.ArddFilePath);
                _downloadingFiles.Remove(result);

                await result.ArddFilePath.TryDeleteAsync();
                if (isCancelled) await result.DownloadInfo.Context.LocalPath.TryDeleteAsync();
            }
        }

19 View Source File : ConfigurationExtensions.cs
License : MIT License
Project Creator : Aiko-IT-Systems

public static replacedembly[] Findreplacedemblies(string[]? names)
        {

            /*
              There is a possibility that an replacedembly can be referenced in multiple replacedemblies.
              To alleviate duplicates we need to shrink our queue as we find things
             */
            List<replacedembly> results = new();

            if (names is null)
                return results.ToArray();

            List<string> queue = new(names);
            foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
            {
                if (!queue.Any())
                    break;

                var loadedreplacedemblyName = replacedembly.GetName().Name;

                // Kinda need the name to do our thing
                if (loadedreplacedemblyName == null)
                    continue;

                // Is this something we're looking for?
                if (queue.Contains(loadedreplacedemblyName))
                {
                    results.Add(replacedembly);

                    // Shrink queue so we don't accidentally add the same replacedembly > 1 times
                    queue.Remove(loadedreplacedemblyName);
                }

                // Time to check if one of the referenced replacedemblies is something we're looking for
                foreach(var referencedreplacedembly in replacedembly.GetReferencedreplacedemblies()
                                                          .Where(x => x.Name != null && queue.Contains(x.Name)))
                    try
                    {
                        // Must load the replacedembly into our workspace so we can do stuff with it later
                        results.Add(replacedembly.Load(referencedreplacedembly));

                        #pragma warning disable 8604
                        queue.Remove(referencedreplacedembly.Name);
                        #pragma warning restore 8604
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine($"Unable to load referenced replacedembly: '{referencedreplacedembly.Name}' \n\t{ex.Message}");
                    }
            }

            return results.ToArray();
        }

See More Examples