System.Collections.Generic.Dictionary.ContainsKey(uint)

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

692 Examples 7

19 Source : IntegrityAnalyzer.cs
with MIT License
from aerosoul94

public List<DatabaseFile> GetClusterOccupants(uint cluster)
        {
            List<DatabaseFile> occupants;

            if (clusterMap.ContainsKey(cluster))
            {
                occupants = clusterMap[cluster];
            }
            else
            {
                occupants = null;
            }

            return occupants;
        }

19 Source : RecoveryResults.cs
with MIT License
from aerosoul94

public void PopulateTreeView(List<DatabaseFile> results)
        {
            // Remove all nodes
            treeView1.BeginUpdate();
            treeView1.Nodes.Clear();
            clusterNodes.Clear();

            foreach (var result in results)
            {
                var cluster = result.Cluster;
                if (!clusterNodes.ContainsKey(cluster))
                {
                    List<DatabaseFile> list = new List<DatabaseFile>()
                    {
                        result
                    };

                    clusterNodes.Add(cluster, list);
                }
                else
                {
                    var list = clusterNodes[cluster];
                    list.Add(result);
                }

                var clusterNodeText = "Cluster " + result.Cluster;
                TreeNode clusterNode;
                if (!treeView1.Nodes.ContainsKey(clusterNodeText))
                {
                    clusterNode = treeView1.Nodes.Add(clusterNodeText, clusterNodeText);
                    clusterNode.Tag = new NodeTag(clusterNodes[cluster], NodeType.Cluster);
                }
                else
                {
                    clusterNode = treeView1.Nodes[clusterNodeText];
                }

                if (result.IsDirectory())
                {
                    var rootNode = clusterNode.Nodes.Add(result.FileName);
                    rootNode.Tag = new NodeTag(result, NodeType.Dirent);
                    PopulateFolder(result.Children, rootNode);
                }
            }

            treeView1.EndUpdate();
        }

19 Source : PlayerViewControllerBase.cs
with MIT License
from AgoraIO

protected virtual void OnVideoSizeChanged(uint uid, int width, int height, int rotation)
    {
        Debug.LogWarningFormat("uid:{3} OnVideoSizeChanged width = {0} height = {1} for rotation:{2}", width, height, rotation, uid);
         
        if (UserVideoDict.ContainsKey(uid))
        {
            GameObject go = UserVideoDict[uid].gameObject;
            Vector2 v2 = new Vector2(width, height);
            RawImage image = go.GetComponent<RawImage>();
            if (_enforcing360p)
            {
                v2 = AgoraUIUtils.GetScaledDimension(width, height, 240f);
            }

            if (IsPortraitOrientation(rotation))
            {
                v2 = new Vector2(v2.y, v2.x);
            }
            image.rectTransform.sizeDelta = v2;
        }
    }

19 Source : PlayerViewControllerBase.cs
with MIT License
from AgoraIO

protected virtual void OnUserOffline(uint uid, USER_OFFLINE_REASON reason)
    {
        // remove video stream
        Debug.Log("onUserOffline: uid = " + uid + " reason = " + reason);
        if (UserVideoDict.ContainsKey(uid))
        {
            var surface = UserVideoDict[uid];
            surface.SetEnable(false);
            UserVideoDict.Remove(uid);
            GameObject.Destroy(surface.gameObject);
        }
    }

19 Source : Natives.cs
with GNU General Public License v3.0
from ahmed605

public static string Get(uint hash)
        {
            return HashToNative.ContainsKey(hash) ? HashToNative[hash] : string.Format("0x{0:x}", hash);
        }

19 Source : HashResolver.cs
with GNU General Public License v3.0
from ahmed605

private static void LoadFromResource(string filename)
        {
            using (var s = replacedembly.GetExecutingreplacedembly().GetManifestResourceStream(typeof(HashResolver), filename))
            {
                var sw = new StreamReader(s);

                string name;
                while ((name = sw.ReadLine()) != null)
                {
                    uint hash = Hasher.Hash(name);
                    if (!_knownNames.ContainsKey(hash))
                    {
                        _knownNames.Add(hash, name);
                    }
                }
            }
        }

19 Source : HashResolver.cs
with GNU General Public License v3.0
from ahmed605

public static string Resolve(uint hash)
        {
            if (_knownNames.ContainsKey(hash))
            {
                return _knownNames[hash];
            }
            else
            {
                return string.Format("0x{0:x}", hash);
            }
        }

19 Source : RPFFileSystem.cs
with GNU General Public License v3.0
from ahmed605

private string GetName(TOCEntry entry)
        {
            string name;
            if (_rpfFile.Header.Identifier < MagicId.Version3)
            {
                name = _rpfFile.TOC.GetName(entry.NameOffset);
            }
            else
            {
                if (entry == _rpfFile.TOC[0])
                {
                    name = "/";
                }
                else if (_knownFilenames.ContainsKey((uint)entry.NameOffset))
                {
                    name = _knownFilenames[(uint)entry.NameOffset];
                }
                else
                {
                    name = string.Format("0x{0:x}", entry.NameOffset);   
                }

                if (replacedumeVer3FilesAsAudio && entry is FileEntry)
                {
                    name += "." + AudioFilesExtension;
                }
            }
            return name;
        }

19 Source : RenderingExtensions.cs
with MIT License
from AlexGyver

public static void DrawMarkers(
            this IRenderContext rc,
            IList<ScreenPoint> markerPoints,
            OxyRect clippingRect,
            MarkerType markerType,
            IList<ScreenPoint> markerOutline,
            IList<double> markerSize,
            OxyColor markerFill,
            OxyColor markerStroke,
            double markerStrokeThickness,
            int resolution = 0,
            ScreenPoint binOffset = new ScreenPoint())
        {
            if (markerType == MarkerType.None)
            {
                return;
            }

            int n = markerPoints.Count;
            var ellipses = new List<OxyRect>(n);
            var rects = new List<OxyRect>(n);
            var polygons = new List<IList<ScreenPoint>>(n);
            var lines = new List<ScreenPoint>(n);

            var hashset = new Dictionary<uint, bool>();

            int i = 0;

            double minx = clippingRect.Left;
            double maxx = clippingRect.Right;
            double miny = clippingRect.Top;
            double maxy = clippingRect.Bottom;

            foreach (var p in markerPoints)
            {
                if (resolution > 1)
                {
                    var x = (int)((p.X - binOffset.X) / resolution);
                    var y = (int)((p.Y - binOffset.Y) / resolution);
                    uint hash = (uint)(x << 16) + (uint)y;
                    if (hashset.ContainsKey(hash))
                    {
                        i++;
                        continue;
                    }

                    hashset.Add(hash, true);
                }

                bool outside = p.x < minx || p.x > maxx || p.y < miny || p.y > maxy;
                if (!outside)
                {
                    int j = i < markerSize.Count ? i : 0;
                    AddMarkerGeometry(p, markerType, markerOutline, markerSize[j], ellipses, rects, polygons, lines);
                }

                i++;
            }

            if (ellipses.Count > 0)
            {
                rc.DrawEllipses(ellipses, markerFill, markerStroke, markerStrokeThickness);
            }

            if (rects.Count > 0)
            {
                rc.DrawRectangles(rects, markerFill, markerStroke, markerStrokeThickness);
            }

            if (polygons.Count > 0)
            {
                rc.DrawPolygons(polygons, markerFill, markerStroke, markerStrokeThickness);
            }

            if (lines.Count > 0)
            {
                rc.DrawLineSegments(lines, markerStroke, markerStrokeThickness);
            }
        }

19 Source : SparseMatrixReader.cs
with MIT License
from altimesh

private static void InsertValue(Dictionary<uint, Dictionary<uint, float>> res, uint row, uint col, float data)
        {
            if (!res.ContainsKey(row))
            {
                res.Add(row, new Dictionary<uint, float>());
                res[row].Add(col, data);
            }
        }

19 Source : SparseMatrixReader.cs
with MIT License
from altimesh

private static Dictionary<uint, float>[] BuildRawSparseMatrix(int rowCount, Dictionary<uint, Dictionary<uint, float>> tmp)
        {
            Dictionary<uint, float>[] res = new Dictionary<uint, float>[rowCount];

            for (uint i = 0; i < rowCount; ++i)
            {
                if (tmp.ContainsKey(i))
                {
                    res[i] = tmp[i];
                }
                else
                {
                    res[i] = new Dictionary<uint, float>();
                }
            }

            return res;
        }

19 Source : TMP_SpriteAsset.cs
with MIT License
from Alword

public void UpdateLookupTables()
        {
            //Debug.Log("Updating [" + this.name + "] Lookup tables.");

            // Check version number of sprite replacedet to see if it needs to be upgraded.
            if (this.material != null && string.IsNullOrEmpty(m_Version))
                UpgradeSpritereplacedet();

            // Initialize / Clear glyph index lookup dictionary.
            if (m_GlyphIndexLookup == null)
                m_GlyphIndexLookup = new Dictionary<uint, int>();
            else
                m_GlyphIndexLookup.Clear();

            for (int i = 0; i < m_SpriteGlyphTable.Count; i++)
            {
                uint glyphIndex = m_SpriteGlyphTable[i].index;

                if (m_GlyphIndexLookup.ContainsKey(glyphIndex) == false)
                    m_GlyphIndexLookup.Add(glyphIndex, i);
            }

            if (m_NameLookup == null)
                m_NameLookup = new Dictionary<int, int>();
            else
                m_NameLookup.Clear();

            if (m_UnicodeLookup == null)
                m_UnicodeLookup = new Dictionary<uint, int>();
            else
                m_UnicodeLookup.Clear();

            for (int i = 0; i < m_SpriteCharacterTable.Count; i++)
            {
                int nameHashCode = m_SpriteCharacterTable[i].hashCode;

                if (m_NameLookup.ContainsKey(nameHashCode) == false)
                    m_NameLookup.Add(nameHashCode, i);

                uint unicode = m_SpriteCharacterTable[i].unicode;

                if (m_UnicodeLookup.ContainsKey(unicode) == false)
                    m_UnicodeLookup.Add(unicode, i);

                // Update glyph reference which is not serialized
                uint glyphIndex = m_SpriteCharacterTable[i].glyphIndex;

                if (m_GlyphIndexLookup.TryGetValue(glyphIndex, out int index))
                    m_SpriteCharacterTable[i].glyph = m_SpriteGlyphTable[index];
            }

            m_IsSpritereplacedetLookupTablesDirty = false;
        }

19 Source : CombatantsManager.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public CombatantEx GetCombatantMain(
            uint id)
        {
            lock (LockObject)
            {
                return this.MainDictionary.ContainsKey(id) ?
                    this.MainDictionary[id] :
                    null;
            }
        }

19 Source : CombatantsManager.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

private IEnumerable<CombatantEx> RefreshCore(
            IEnumerable<Combatant> source,
            bool isDummy = false)
        {
            var isFirstCombatant = true;
            var partyIDList = new List<uint>(32);
            var addeds = new List<CombatantEx>(128);

            this.OtherList.Clear();

            var count = 0;
            var countPC = 0;
            var countOther = 0;

            foreach (var combatant in source)
            {
                var actorType = CombatantExtensions.GetActorType(combatant);
                switch (actorType)
                {
                    // 必要なCombatant
                    case Actor.Type.PC:
                        countPC++;
                        break;

                    // 必要なCombatant
                    case Actor.Type.Monster:
                    case Actor.Type.NPC:
                    case Actor.Type.Aetheryte:
                    case Actor.Type.Gathering:
                    case Actor.Type.EventObject:
                        break;

                    // 上記以外は捨てる
                    default:
                        Thread.Yield();
                        continue;
                }

                var isMain = actorType switch
                {
                    Actor.Type.PC => true,
                    Actor.Type.Monster => true,
                    _ => false,
                };

                if (isMain)
                {
                    count++;

                    var dic = this.MainDictionary;
                    var key = combatant.ID;
                    var isNew = !dic.ContainsKey(key);

                    var ex = isNew ?
                        new CombatantEx() :
                        dic[key];

                    CombatantEx.CopyToEx(combatant, ex);

                    if (isDummy)
                    {
                        ex.IsDummy = true;
                        ex.PartyType = PartyTypeEnum.Party;
                    }

                    if (isFirstCombatant)
                    {
                        isFirstCombatant = false;
                        CombatantEx.CopyToEx(ex, this.Player);
                    }

                    if (isNew)
                    {
                        addeds.Add(ex);
                        dic[key] = ex;
                    }

                    if (ex.PartyType == PartyTypeEnum.Party)
                    {
                        partyIDList.Add(ex.ID);
                    }
                }
                else
                {
                    countOther++;

                    var ex = new CombatantEx();
                    CombatantEx.CopyToEx(combatant, ex);
                    this.OtherList.Add(ex);
                }

                Thread.Yield();
            }

19 Source : XIVApi.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public XIVApiAction FindAction(
            uint ID)
        {
            if (this.actionList.ContainsKey(ID))
            {
                return this.actionList[ID];
            }

            return null;
        }

19 Source : SharlayanHelper.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

private void GetEnmity()
        {
            if (this.IsSkipEnmity)
            {
                if (this.EnmityDictionary.Count > 0)
                {
                    lock (this.EnmityDictionary)
                    {
                        this.EnmityDictionary.Clear();
                    }
                }

                return;
            }

            lock (this.EnmityDictionary)
            {
                if (this.TargetInfo == null ||
                    !this.TargetInfo.EnmityItems.Any())
                {
                    this.EnmityDictionary.Clear();
                    return;
                }

                var currents = this.EnmityDictionary.Values.ToArray();
                foreach (var current in currents)
                {
                    if (!this.TargetInfo.EnmityItems.Any(x => x.ID == current.ID))
                    {
                        this.EnmityDictionary.Remove(current.ID);
                    }
                }

                var max = this.TargetInfo.EnmityItems.Max(x => x.Enmity);
                var player = CombatantsManager.Instance.Player;
                var first = default(EnmityEntry);

                var combatantDictionary = CombatantsManager.Instance.GetCombatantMainDictionary();

                var count = 0;
                foreach (var source in this.TargetInfo.EnmityItems)
                {
                    if (count >= this.EnmityMaxCount)
                    {
                        break;
                    }

                    Thread.Yield();

                    var existing = false;
                    var enmity = default(EnmityEntry);

                    if (this.EnmityDictionary.ContainsKey(source.ID))
                    {
                        existing = true;
                        enmity = this.EnmityDictionary[source.ID];
                    }
                    else
                    {
                        existing = false;
                        enmity = new EnmityEntry() { ID = source.ID };
                    }

                    enmity.Enmity = source.Enmity;
                    enmity.HateRate = (int)(((double)enmity.Enmity / (double)max) * 100d);
                    enmity.IsMe = enmity.ID == player?.ID;

                    if (first == null)
                    {
                        first = enmity;
                    }

                    if (!existing)
                    {
                        var combatant = combatantDictionary.ContainsKey(enmity.ID) ?
                            combatantDictionary[enmity.ID] :
                            null;

                        enmity.Name = combatant?.Name;
                        enmity.OwnerID = combatant?.OwnerID ?? 0;
                        enmity.Job = (byte)(combatant?.Job ?? 0);

                        if (string.IsNullOrEmpty(enmity.Name))
                        {
                            enmity.Name = CombatantEx.UnknownName;
                        }

                        this.EnmityDictionary[enmity.ID] = enmity;
                    }

                    count++;
                }

                if (first != null)
                {
                    this.IsFirstEnmityMe = first.IsMe;
                }
            }
        }

19 Source : XIVApi.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

private void LoadAction()
        {
            if (!File.Exists(this.SkillFile))
            {
                return;
            }

            var sw = Stopwatch.StartNew();

            var userList = this.UserActionList;

            var obj = new object();
            lock (this.actionList)
            {
                this.actionList.Clear();

                var lines = CSVParser.LoadFromPath(this.SkillFile, encoding: new UTF8Encoding(true));

                Parallel.ForEach(lines, (fields) =>
                {
                    if (fields.Count < 2)
                    {
                        return;
                    }

                    if (!uint.TryParse(fields[0], out uint id) ||
                        string.IsNullOrEmpty(fields[1]))
                    {
                        return;
                    }

                    var entry = new XIVApiAction()
                    {
                        ID = id,
                        Name = fields[1],
                        AttackTypeName = fields[XIVApiAction.AttackTypeIndex]
                    };

                    entry.SetAttackTypeEnum();

                    if (userList.ContainsKey(entry.ID))
                    {
                        entry.Name = userList[entry.ID].Name;
                    }

                    lock (obj)
                    {
                        this.actionList[entry.ID] = entry;
                    }
                });
            }

            sw.Stop();
            this.AppLogger.Trace($"xivapi action list loaded. {sw.Elapsed.TotalSeconds:N0}s {this.SkillFile}");
        }

19 Source : Mesh.cs
with MIT License
from ansel86castro

public void DefragmentParts()
        {
            if (_vb == null || _ib == null || _layers == null ||  _layers.Length == 1)
                return;

            var vds = _vb.Pin();
            var ids = _ib.Pin();

            byte[] newIndices = new byte[_ib.Length];
            List<uint> vertList = new List<uint>(_vertexCount);

            var is16BitIndices = _ib.Is16BitsIndices;
            //guarda para el viejo indice el nuevo indice 
            Dictionary<uint, uint> indexHash = new Dictionary<uint, uint>(newIndices.Length);

            int componentCount = _layers.Length;
            int k = 0;

            unsafe
            {
                byte* indices = (byte*)ids;
                fixed (byte* pNewIndices = newIndices)
                {
                    foreach (var c in _layers)
                    {
                        int vertCount = 0;
                        uint oldindex = 0;
                        uint newIndex = 0;
                        uint oldStartIndex = (uint)c.StartIndex;

                        c.startIndex = k;
                        c.startVertex = vertList.Count;

                        //recorrer cada indice de la componente.
                        for (int i = 0; i < c.PrimitiveCount * 3; i++)
                        {
                            //antiguo indice
                            oldindex = _ib.Is16BitsIndices ? ((ushort*)indices)[oldStartIndex + i] : ((uint*)indices)[oldStartIndex + i];

                            if (!indexHash.ContainsKey(oldindex))
                            {
                                newIndex = (uint)vertList.Count;
                                indexHash.Add(oldindex, newIndex);
                                if (is16BitIndices)
                                    ((ushort*)pNewIndices)[k] = (ushort)newIndex;
                                else
                                    ((uint*)pNewIndices)[k] = newIndex;

                                vertList.Add(oldindex);
                                vertCount++;
                            }
                            else
                            {
                                newIndex = indexHash[oldindex];
                                if (is16BitIndices)
                                    ((ushort*)pNewIndices)[k] = (ushort)newIndex;
                                else
                                    ((uint*)pNewIndices)[k] = newIndex;
                            }
                            k++;
                        }

                        c.vertexCount = vertCount;
                        indexHash.Clear();
                    }
                }


                int size = _vd.Size;
                byte[] vertexes = new byte[vertList.Count * size];
                fixed (byte* pVertexes = vertexes)
                {
                    for (int i = 0; i < vertList.Count; i++)
                    {
                        byte* pVertex = (byte*)((uint)vds + vertList[i] * (uint)size);
                        byte* pDestVertex = pVertexes + i * size;
                        for (int j = 0; j < size; j++)
                        {
                            *(pDestVertex + j) = *(pVertex + j);
                        }
                    }
                }

                _vb.UnPin();
                _ib.UnPin();

                _vb.SetData(vertexes);
                _ib.SetData(newIndices);
            }
        }

19 Source : SharlayanHelper.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public ActorItem GetActor(uint id)
        {
            if (this.ActorDictionary.ContainsKey(id))
            {
                return this.ActorDictionary[id];
            }

            return null;
        }

19 Source : SharlayanHelper.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

public ActorItem GetNPCActor(uint id)
        {
            if (this.NPCActorDictionary.ContainsKey(id))
            {
                return this.NPCActorDictionary[id];
            }

            return null;
        }

19 Source : SharlayanHelper.cs
with BSD 3-Clause "New" or "Revised" License
from anoyetta

private CombatantEx TryGetOrNewCombatant(
            ActorItem actor)
        {
            if (actor == null)
            {
                return null;
            }

            var combatant = default(CombatantEx);
            var dictionary = !actor.IsNPC() ?
                this.CombatantsDictionary :
                this.NPCCombatantsDictionary;
            var key = actor.GetKey();

            if (dictionary.ContainsKey(key))
            {
                combatant = dictionary[key];
                this.CreateCombatant(actor, combatant);
            }
            else
            {
                combatant = this.CreateCombatant(actor);
                dictionary[key] = combatant;
            }

            return combatant;
        }

19 Source : MetaData.cs
with GNU General Public License v3.0
from anydream

void InitializeNestedClreplacedesDictionary() {
			var table = tablesStream.NestedClreplacedTable;
			var destTable = tablesStream.TypeDefTable;

			Dictionary<uint, bool> validTypeDefRids = null;
			var typeDefRidList = GetTypeDefRidList();
			if (typeDefRidList.Length != destTable.Rows) {
				validTypeDefRids = new Dictionary<uint, bool>((int)typeDefRidList.Length);
				for (uint i = 0; i < typeDefRidList.Length; i++)
					validTypeDefRids[typeDefRidList[i]] = true;
			}

			var nestedRidsDict = new Dictionary<uint, bool>((int)table.Rows);
			var nestedRids = new List<uint>((int)table.Rows);	// Need it so we add the rids in correct order
			for (uint rid = 1; rid <= table.Rows; rid++) {
				if (validTypeDefRids != null && !validTypeDefRids.ContainsKey(rid))
					continue;
				var row = tablesStream.ReadNestedClreplacedRow(rid);
				if (row == null)
					continue;	// Should never happen since rid is valid
				if (!destTable.IsValidRID(row.NestedClreplaced) || !destTable.IsValidRID(row.EnclosingClreplaced))
					continue;
				if (nestedRidsDict.ContainsKey(row.NestedClreplaced))
					continue;
				nestedRidsDict[row.NestedClreplaced] = true;
				nestedRids.Add(row.NestedClreplaced);
			}

			var newTypeDefRidToNestedClreplacedes = new Dictionary<uint, RandomRidList>();
			foreach (var nestedRid in nestedRids) {
				var row = tablesStream.ReadNestedClreplacedRow(GetNestedClreplacedRid(nestedRid));
				if (row == null)
					continue;
				RandomRidList ridList;
				if (!newTypeDefRidToNestedClreplacedes.TryGetValue(row.EnclosingClreplaced, out ridList))
					newTypeDefRidToNestedClreplacedes[row.EnclosingClreplaced] = ridList = new RandomRidList();
				ridList.Add(nestedRid);
			}

			var newNonNestedTypes = new RandomRidList((int)(destTable.Rows - nestedRidsDict.Count));
			for (uint rid = 1; rid <= destTable.Rows; rid++) {
				if (validTypeDefRids != null && !validTypeDefRids.ContainsKey(rid))
					continue;
				if (nestedRidsDict.ContainsKey(rid))
					continue;
				newNonNestedTypes.Add(rid);
			}

			Interlocked.CompareExchange(ref nonNestedTypes, newNonNestedTypes, null);

			// Initialize this one last since it's tested by the callers of this method
			Interlocked.CompareExchange(ref typeDefRidToNestedClreplacedes, newTypeDefRidToNestedClreplacedes, null);
		}

19 Source : MetaData.cs
with GNU General Public License v3.0
from anydream

void InitializeNestedClreplacedesDictionary() {
			var table = tablesStream.NestedClreplacedTable;
			var destTable = tablesStream.TypeDefTable;

			Dictionary<uint, bool> validTypeDefRids = null;
			var typeDefRidList = GetTypeDefRidList();
			if (typeDefRidList.Length != destTable.Rows) {
				validTypeDefRids = new Dictionary<uint, bool>((int)typeDefRidList.Length);
				for (uint i = 0; i < typeDefRidList.Length; i++)
					validTypeDefRids[typeDefRidList[i]] = true;
			}

			var nestedRidsDict = new Dictionary<uint, bool>((int)table.Rows);
			var nestedRids = new List<uint>((int)table.Rows);	// Need it so we add the rids in correct order
			for (uint rid = 1; rid <= table.Rows; rid++) {
				if (validTypeDefRids != null && !validTypeDefRids.ContainsKey(rid))
					continue;
				var row = tablesStream.ReadNestedClreplacedRow(rid);
				if (row == null)
					continue;	// Should never happen since rid is valid
				if (!destTable.IsValidRID(row.NestedClreplaced) || !destTable.IsValidRID(row.EnclosingClreplaced))
					continue;
				if (nestedRidsDict.ContainsKey(row.NestedClreplaced))
					continue;
				nestedRidsDict[row.NestedClreplaced] = true;
				nestedRids.Add(row.NestedClreplaced);
			}

			var newTypeDefRidToNestedClreplacedes = new Dictionary<uint, RandomRidList>();
			foreach (var nestedRid in nestedRids) {
				var row = tablesStream.ReadNestedClreplacedRow(GetNestedClreplacedRid(nestedRid));
				if (row == null)
					continue;
				RandomRidList ridList;
				if (!newTypeDefRidToNestedClreplacedes.TryGetValue(row.EnclosingClreplaced, out ridList))
					newTypeDefRidToNestedClreplacedes[row.EnclosingClreplaced] = ridList = new RandomRidList();
				ridList.Add(nestedRid);
			}

			var newNonNestedTypes = new RandomRidList((int)(destTable.Rows - nestedRidsDict.Count));
			for (uint rid = 1; rid <= destTable.Rows; rid++) {
				if (validTypeDefRids != null && !validTypeDefRids.ContainsKey(rid))
					continue;
				if (nestedRidsDict.ContainsKey(rid))
					continue;
				newNonNestedTypes.Add(rid);
			}

			Interlocked.CompareExchange(ref nonNestedTypes, newNonNestedTypes, null);

			// Initialize this one last since it's tested by the callers of this method
			Interlocked.CompareExchange(ref typeDefRidToNestedClreplacedes, newTypeDefRidToNestedClreplacedes, null);
		}

19 Source : MOAction.cs
with GNU General Public License v3.0
from attickdoor

private (uint action, uint target) GetActionTarget(uint ActionID)
        {
            if (Stacks.ContainsKey(ActionID))
            {
                List<StackEntry> stack = Stacks[ActionID];
                foreach (StackEntry t in stack)
                {
                    if (CreplacedeAction(t)) return (t.actionID, t.target.GetTargetActorId());
                }
            }
            return (0, 0);
        }

19 Source : StaticGeometry.cs
with GNU Lesser General Public License v2.1
from axiom3d

protected Region GetRegion(uint index)
        {
            if (this.regionMap.ContainsKey(index))
            {
                return this.regionMap[index];
            }
            else
            {
                return null;
            }
        }

19 Source : Font.cs
with GNU Lesser General Public License v2.1
from axiom3d

[Obsolete("Use Glyphs property")]
        public void GetGlyphTexCoords(CodePoint c, out Real u1, out Real v1, out Real u2, out Real v2)
        {
            if (this.codePoints.ContainsKey(c))
            {
                var glyph = this.codePoints[c];
                u1 = glyph.uvRect.Top;
                v1 = glyph.uvRect.Left;
                u2 = glyph.uvRect.Bottom;
                v2 = glyph.uvRect.Right;
            }
            else
            {
                u1 = v1 = u2 = v2 = 0.0f;
            }
        }

19 Source : Font.cs
with GNU Lesser General Public License v2.1
from axiom3d

[Obsolete("Use Glyphs property")]
        public void SetGlyphTexCoords(CodePoint c, Real u1, Real v1, Real u2, Real v2, Real aspect)
        {
            var glyph = new GlyphInfo(c, new UVRect(v1, u1, v2, u2), aspect * (u2 - u1) / (v2 - v1));
            if (this.codePoints.ContainsKey(c))
            {
                this.codePoints[c] = glyph;
            }
            else
            {
                this.codePoints.Add(c, glyph);
            }
        }

19 Source : Font.cs
with GNU Lesser General Public License v2.1
from axiom3d

[Obsolete("Use Glyphs property")]
        public float GetGlyphAspectRatio(char c)
        {
            if (this.codePoints.ContainsKey(c))
            {
                return this.codePoints[c].aspectRatio;
            }

            return 1.0f;
        }

19 Source : StoringAsyncEndpointExecutor.cs
with MIT License
from Azure

public async Task UpdatePriorities(IList<uint> priorities, Option<Endpoint> newEndpoint)
        {
            Preconditions.CheckArgument(priorities.Count > 0);
            Events.UpdatePriorities(this, priorities);

            if (this.closed)
            {
                throw new InvalidOperationException($"Endpoint executor for endpoint {this.Endpoint} is closed.");
            }

            // Update priorities by merging the new ones with the existing.
            // We don't ever remove stale priorities, otherwise stored messages
            // pending for a removed priority will never get sent.
            ImmutableDictionary<uint, EndpointExecutorFsm> snapshot = this.prioritiesToFsms;
            Dictionary<uint, EndpointExecutorFsm> updatedSnapshot = new Dictionary<uint, EndpointExecutorFsm>(snapshot);
            foreach (uint priority in priorities)
            {
                if (!updatedSnapshot.ContainsKey(priority))
                {
                    string id = MessageQueueIdHelper.GetMessageQueueId(this.Endpoint.Id, priority);

                    // Create a message queue in the store for every priority we have
                    await this.messageStore.AddEndpoint(id);

                    // Create a checkpointer and a FSM for every message queue
                    ICheckpointer checkpointer = await this.checkpointerFactory.CreateAsync(id, this.Endpoint.Id, priority);
                    EndpointExecutorFsm fsm = new EndpointExecutorFsm(this.Endpoint, checkpointer, this.config);

                    // Get current known count from offset and initialize the queue length count.
                    // It is possible that there is no checkpoint for this priority yet, in which case
                    // the value will be InvalidOffset, so we need to initialize the queue length to 0 in that case.
                    var count = 0ul;
                    if (checkpointer.Offset != Checkpointer.InvalidOffset)
                    {
                        count = await this.messageStore.GetMessageCountFromOffset(id, checkpointer.Offset);
                    }

                    Checkpointer.Metrics.SetQueueLength(count, this.Endpoint.Id, priority);

                    // Add it to our dictionary
                    updatedSnapshot.Add(priority, fsm);
                }
                else
                {
                    // Update the existing FSM with the new endpoint
                    EndpointExecutorFsm fsm = updatedSnapshot[priority];
                    await newEndpoint.ForEachAsync(e => fsm.RunAsync(Commands.UpdateEndpoint(e)));
                }
            }

            if (this.prioritiesToFsms.CompareAndSet(snapshot, updatedSnapshot.ToImmutableDictionary()))
            {
                Events.UpdatePrioritiesSuccess(this, updatedSnapshot.Keys.ToList());

                // Update the lastUsedFsm to be the initial one, we always
                // have at least one priority->FSM pair at this point.
                this.lastUsedFsm = updatedSnapshot[priorities[0]];
            }
            else
            {
                Events.UpdatePrioritiesFailure(this, updatedSnapshot.Keys.ToList());
            }
        }

19 Source : EvtcParser.cs
with MIT License
from baaron4

private bool IsValid(Combareplacedem combareplacedem, ParserController operation)
        {
            if (combareplacedem.IsStateChange == ArcDPSEnums.StateChange.HealthUpdate && combareplacedem.DstAgent > 20000)
            {
                // DstAgent should be target health % times 100, values higher than 10000 are unlikely. 
                // If it is more than 200% health ignore this record
                return false;
            }
            if (combareplacedem.IsExtension)
            {
                // Generic versioning check, we expect that the first event that'll be sent by an addon will always be meta data
                if (combareplacedem.Pad == 0)
                {
                    AbstractExtensionHandler handler = ExtensionHelper.GetExtensionHandler(combareplacedem);
                    if (handler != null)
                    {
                        _enabledExtensions[handler.Signature] = handler;
                        operation.UpdateProgressWithCancellationCheck("Encountered supported extension " + handler.Name + " on " + handler.Version);
                    }
                    // No need to keep that event, it'll be immediately parsed by the handler
                    return false;
                } 
                else
                {
                    return _enabledExtensions.ContainsKey(combareplacedem.Pad);
                }
            }
            if (combareplacedem.SrcInstid == 0 && combareplacedem.DstAgent == 0 && combareplacedem.SrcAgent == 0 && combareplacedem.DstInstid == 0 && combareplacedem.IFF == ArcDPSEnums.IFF.Unknown)
            {
                return false;
            }
            return combareplacedem.IsStateChange != ArcDPSEnums.StateChange.Unknown && combareplacedem.IsStateChange != ArcDPSEnums.StateChange.ReplInfo && combareplacedem.IsStateChange != ArcDPSEnums.StateChange.StatReset && combareplacedem.IsStateChange != ArcDPSEnums.StateChange.APIDelayed;
        }

19 Source : StoryTellerDumper.cs
with The Unlicense
from BAndysc

protected override bool Process(PacketBase basePacket, PacketGossipSelect packet)
        {
            if (gossips.ContainsKey(packet.MenuId) && gossips[packet.MenuId].ContainsKey(packet.OptionId))
                AppendLine(basePacket, packet.GossipUnit, "Player choose option: " + gossips[packet.MenuId][packet.OptionId]);
            return base.Process(basePacket, packet);
        }

19 Source : CommandsDocumentViewModel.cs
with The Unlicense
from BAndysc

private async Task Load()
        {
            IsLoading = true;

            var permissions = await authDatabaseProvider.GetRbacPermissionsAsync();
            var links = await authDatabaseProvider.GetLinkedPermissionsAsync();

            Dictionary<uint, string> rbacEnumMapping = rbacSourceParser.ParseRbacEnum();
            Dictionary<string, uint> reverseRbacEnumMapping =
                rbacEnumMapping.ToDictionary(pair => pair.Value, pair => pair.Key);

            var databaseDefinedRbac = new HashSet<uint>(permissions.Select(p => p.Id));
            
            Dictionary<uint, PermissionViewModel> permissionViewModels = permissions.ToDictionary(p => p.Id, p =>
            {
                rbacEnumMapping.TryGetValue(p.Id, out var enumName);
                return new PermissionViewModel(p.Id, enumName ?? "UNKNOWN_ENUM", p);
            });
            
            PossibleParentPermissions.Clear();
            PossibleParentPermissions.AddRange(permissionViewModels.Values
                .Where(p => p.PermissionReadableName.StartsWith("Role:") && p.PermissionReadableName.EndsWith("Commands")));
            
            foreach (var pair in rbacEnumMapping)
            {
                if (!permissionViewModels.ContainsKey(pair.Key))
                    permissionViewModels[pair.Key] = new PermissionViewModel(pair.Key, pair.Value, "");
            }

            foreach (var link in links)
            {
                var parent = permissionViewModels[link.Id];
                var child = permissionViewModels[link.LinkedId];
                child.Parent = parent;
            }

            Dictionary<string, string?> existing = databaseProvider.GetCommands().ToDictionary(d => d.Name, d => d.Help);

            Commands.Clear();
            CommandsNoRbac.Clear();
            foreach (var cmd in commandsSourceParser.GetAllCommands())
            {
                if (!reverseRbacEnumMapping.TryGetValue(cmd.RbacPermission, out var rbacId))
                    continue;
                
                if (!permissionViewModels.TryGetValue(rbacId, out var permission))
                    continue;

                var hasDatabaseRbac = databaseDefinedRbac.Contains(rbacId);
                var hasDatabaseCommand = existing.ContainsKey(cmd.Command);

                if (!hasDatabaseRbac || !hasDatabaseCommand)
                {
                    var vm = new CommandViewModel(cmd.Command, permission);
                    if (vm.IsRbacDefined)
                        Commands.Add(vm);
                    else
                    {
                        vm.PermissionViewModel.PermissionReadableName = "Command: " + vm.Name;
                        CommandsNoRbac.Add(vm);
                    }
                }
            }
            
            IsLoading = false;
        }

19 Source : WrathSpellService.cs
with The Unlicense
from BAndysc

public bool Exists(uint spellId)
        {
            return spells.ContainsKey(spellId);
        }

19 Source : SteamVR_TrackingReferenceManager.cs
with GNU General Public License v3.0
from brandonmousseau

private void OnNewPoses(TrackedDevicePose_t[] poses)
        {
            if (poses == null)
                return;

            for (uint deviceIndex = 0; deviceIndex < poses.Length; deviceIndex++)
            {
                if (trackingReferences.ContainsKey(deviceIndex) == false)
                {
                    ETrackedDeviceClreplaced deviceClreplaced = OpenVR.System.GetTrackedDeviceClreplaced(deviceIndex);

                    if (deviceClreplaced == ETrackedDeviceClreplaced.TrackingReference)
                    {
                        TrackingReferenceObject trackingReference = new TrackingReferenceObject();
                        trackingReference.trackedDeviceClreplaced = deviceClreplaced;
                        trackingReference.gameObject = new GameObject("Tracking Reference " + deviceIndex.ToString());
                        trackingReference.gameObject.transform.parent = this.transform;
                        trackingReference.trackedObject = trackingReference.gameObject.AddComponent<SteamVR_TrackedObject>();
                        trackingReference.renderModel = trackingReference.gameObject.AddComponent<SteamVR_RenderModel>();
                        trackingReference.renderModel.createComponents = false;
                        trackingReference.renderModel.updateDynamically = false;

                        trackingReferences.Add(deviceIndex, trackingReference);

                        trackingReference.gameObject.SendMessage("SetDeviceIndex", (int)deviceIndex, SendMessageOptions.DontRequireReceiver);
                    }
                    else
                    {
                        trackingReferences.Add(deviceIndex, new TrackingReferenceObject() { trackedDeviceClreplaced = deviceClreplaced });
                    }
                }
            }
        }

19 Source : MemoryDebugger.cs
with MIT License
from bryanperris

public String GetMemName(uint address)
        {
            switch (address)
            {
                default: break;
                case 0x300: return "osTvType";
                case 0x304: return "osRomType";
                case 0x308: return "osRomBase";
                case 0x30C: return "osResetType";
                case 0x310: return "osCicId";
                case 0x314: return "osVersion";
                case 0x318: return "osMemSize";
                case 0x31C: return "osAppNMIBuffer";
            }

            if (m_Cache.Count >= 30000)
            {
                m_Cache.Clear();
            }

            if (m_Cache.ContainsKey(address))
            {
                return m_Cache[address].Name;
            }

            foreach (var section in s_NamedPSections)
            {
                if (address >= section.Start && address <= section.End)
                {
                    m_Cache.Add(address, section);
                    return section.Name;
                }
            }

            return "Unknown";
        }

19 Source : MipsDebugger.cs
with MIT License
from bryanperris

public void AppendBranchBreakpoint(uint address, BranchCondition condition)
        {
            if (!m_BranchBreakpoints.ContainsKey(address))
            {
                m_BranchBreakpoints.Add(address, condition);
            }
        }

19 Source : MipsDebugger.cs
with MIT License
from bryanperris

public virtual void ActivateDebugger() {
            m_Probe_OnInstruction = (inst) => {
                if (m_BreakActive) return;

                ThrowBreakpoint(m_InstByCodeBreakpoints.Contains(inst.Inst.inst));
                ThrowBreakpoint(m_InstByAddressBreakpoints.Contains((uint)inst.Address));
            };

            m_Probe_OnGprWrite = (i) => {
                if (m_BreakActive) return;

                ThrowBreakpoint(m_GPRWriteBreakpoints.Contains(i));
            };

            m_Probe_OnBranch = (target, taken) => {
                if (m_BreakActive) return;

                if (m_BranchBreakpoints.ContainsKey(target))
                {
                    var kind = m_BranchBreakpoints[target];

                    if (kind == BranchCondition.Any)
                    {
                        ThrowBreakpoint(true);
                    }
                    else if (kind == BranchCondition.Taken && taken)
                    {
                        ThrowBreakpoint(true);
                    }
                    else if (kind == BranchCondition.NotTaken && !taken)
                    {
                        ThrowBreakpoint(true);
                    }
                }
            };
        }

19 Source : CurvedImage.cs
with MIT License
from Caeden117

private int GetNewVertex4(Dictionary<uint, int> newVectices, List<Vector3> vertices, List<Vector2> uvs, int i1, int i2)
		{
			int newIndex = vertices.Count;
			uint t1 = ((uint)i1 << 16) | (uint)i2;
			uint t2 = ((uint)i2 << 16) | (uint)i1;
			if (newVectices.ContainsKey(t2))
				return newVectices[t2];
			if (newVectices.ContainsKey(t1))
				return newVectices[t1];

			newVectices.Add(t1, newIndex);

			vertices.Add((vertices[i1] + vertices[i2]) * 0.5f);
			uvs.Add((uvs[i1] + uvs[i2]) * 0.5f);

			return newIndex;
		}

19 Source : Party.cs
with GNU General Public License v3.0
from caioavidal

public bool IsMember(IPlayer player)
        {
            return members.ContainsKey(player.CreatureId);
        }

19 Source : Party.cs
with GNU General Public License v3.0
from caioavidal

public bool IsMember(uint creatureId)
        {
            return members.ContainsKey(creatureId);
        }

19 Source : ProcessMon.cs
with MIT License
from cameyo

void OnProcessProcStop(object sender, EventArrivedEventArgs e)
        {
            var logprefix = "ProcessMon.ProcStop: ";
            var pid = (uint)e.NewEvent.Properties["ProcessID"].Value;
            lock (processInfosLock)
            {
                if (processInfos.ContainsKey(pid))
                {
                    processInfos.Remove(pid);
                    Log(logprefix + $"{pid} ({e.NewEvent.Properties["ProcessName"].Value}): forgetting");
                    return;
                }
            }
            Log(logprefix + $"{pid} ({e.NewEvent.Properties["ProcessName"].Value}): UNKNOWN, skipping");
        }

19 Source : ZerodhaSymbolMapper.cs
with Apache License 2.0
from Capnode

public string GetZerodhaExchangeFromToken(uint Token)
        {   
            string exchange = string.Empty;
            if (ZerodhaInstrumentsExchangeMapping.ContainsKey(Token))
            {
                ZerodhaInstrumentsExchangeMapping.TryGetValue(Token, out exchange);
            }
            return exchange;
        }

19 Source : ExcelSheetDebugging.cs
with GNU Affero General Public License v3.0
from Caraxi

public override void Draw() {

            if (ImGui.Checkbox("Enable Logging", ref enabled)) {
                byNameHook?.Disable();
                byIndexHook?.Disable();
                if (enabled) {

                    byNameHook ??= Common.Hook<ByNameDelegate>("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 83 EC 20 48 8B D9 48 8B F2", ByNameDetour);
                    byIndexHook ??= Common.Hook<ByIndexDelegate>("4C 8B 81 ?? ?? ?? ?? 4D 85 C0 74 07", ByIndexDetour);

                    byNameHook?.Enable();
                    byIndexHook?.Enable();


                }
            }

            ImGui.SameLine();
            if (ImGui.Button("Reset")) {
                byNameCounts.Clear();
                byIndexCounts.Clear();
            }

            ImGui.Separator();


            if (ImGui.BeginTable("resultsTable_excelSheetDebugging", 5)) {

                ImGui.TableSetupColumn("Request ID/Name", ImGuiTableColumnFlags.WidthFixed, 200);
                ImGui.TableSetupColumn("Hit Count", ImGuiTableColumnFlags.WidthFixed, 80);
                ImGui.TableSetupColumn("Sheet Name", ImGuiTableColumnFlags.WidthFixed, 200);
                ImGui.TableSetupColumn("Address", ImGuiTableColumnFlags.WidthFixed, 80);
                ImGui.TableSetupColumn("Data");

                ImGui.TableHeadersRow();

                foreach (var (key, value) in byIndexCounts) {
                    ImGui.TableNextColumn();
                    ImGui.Text($"{key}");
                    ImGui.TableNextColumn();
                    ImGui.Text($"{value}");
                    ImGui.TableNextColumn();
                    if (byIndexValues.ContainsKey(key)) {
                        var e = (ExcelSheet*)byIndexValues[key];
                        var name = Encoding.UTF8.GetString(e->SheetName, 16).TrimEnd();
                        ImGui.Text($"{name}");
                        ImGui.TableNextColumn();

                        DebugManager.ClickToCopyText($"{byIndexValues[key]:X}");
                        ImGui.TableNextColumn();
                        DebugManager.PrintOutObject(e);
                    } else {
                        ImGui.TableNextRow();
                    }
                }

                ImGui.TableNextRow();
                ImGui.Separator();
                ImGui.TableNextRow();



                foreach (var (key, value) in byNameCounts) {
                    ImGui.TableNextColumn();
                    ImGui.Text($"{key}");
                    ImGui.TableNextColumn();
                    ImGui.Text($"{value}");
                    ImGui.TableNextColumn();
                    if (byNameValues.ContainsKey(key)) {
                        var e = (ExcelSheet*)byNameValues[key];
                        if (e->SheetName == null) {
                            ImGui.Text($"[no name]");
                        } else {
                            var name = Encoding.UTF8.GetString(e->SheetName, 32).TrimEnd();
                            ImGui.Text($"{name}");
                        }


                        ImGui.TableNextColumn();
                        DebugManager.ClickToCopyText($"{byNameValues[key]:X}");
                        ImGui.TableNextColumn();
                        DebugManager.PrintOutObject(e);
                    } else {
                        ImGui.TableNextRow();
                    }

                }



                ImGui.EndTable();
            }
        }

19 Source : ExcelSheetDebugging.cs
with GNU Affero General Public License v3.0
from Caraxi

private ExcelSheet* ByIndexDetour(ExcelModule* excelModule, uint index) {
            if (!byIndexCounts.ContainsKey(index)) byIndexCounts.Add(index, 0);
            byIndexCounts[index]++;
            var ret = byIndexHook.Original(excelModule, index);
            if (byIndexValues.ContainsKey(index))
                byIndexValues[index] = (ulong) ret;
            else
                byIndexValues.Add(index, (ulong) ret);
            return ret;
        }

19 Source : IconManager.cs
with GNU Affero General Public License v3.0
from Caraxi

public TextureWrap GetActionIcon(Action action) {
            return GetIconTexture(actionCustomIcons.ContainsKey(action.RowId) ? actionCustomIcons[action.RowId] : action.Icon);
        }

19 Source : IconManager.cs
with GNU Affero General Public License v3.0
from Caraxi

public ushort GetActionIconId(Action action) {
            return actionCustomIcons.ContainsKey(action.RowId) ? actionCustomIcons[action.RowId] : action.Icon;
        }

19 Source : MateriaStats.cs
with GNU Affero General Public License v3.0
from Caraxi

public override unsafe void OnGenerateItemTooltip(NumberArrayData* numberArrayData, StringArrayData* stringArrayData) {
            if (!(Config.Delta || Config.Total == false)) Config.Total = true; // Config invalid check
            try {
                var item = itemSheet.GetRow(Item.ItemId);
                if (item == null) return;
                if (item.MateriaSlotCount == 0) return;
                var itemLevel = itemLevelSheet.GetRow(item.LevelItem.Row);
                if (itemLevel == null) return;
                var baseParams = new Dictionary<uint, ExtendedBaseParam>();
                var baseParamDeltas = new Dictionary<uint, int>();
                var baseParamOriginal = new Dictionary<uint, int>();
                var baseParamLimits = new Dictionary<uint, int>();
                foreach (var bp in item.BaseParam) {
                    if (bp.Value == 0 || bp.BaseParam.Row == 0) continue;
                    baseParamDeltas.Add(bp.BaseParam.Row, 0);
                    baseParamOriginal.Add(bp.BaseParam.Row, bp.Value);
                    if (bp.BaseParam.Value != null) {
                        baseParamLimits.Add(bp.BaseParam.Row, (int)Math.Ceiling(itemLevel.BaseParam[bp.BaseParam.Row] * (bp.BaseParam.Value.EquipSlotCategoryPct[item.EquipSlotCategory.Row] / 100f)));
                        baseParams.Add(bp.BaseParam.Row, bp.BaseParam.Value);
                    }
                }

                if (Item.IsHQ) {
                    foreach (var bp in item.BaseParamSpecial) {
                        if (bp.Value == 0 || bp.BaseParam.Row == 0) continue;
                        if (baseParamOriginal.ContainsKey(bp.BaseParam.Row)) baseParamOriginal[bp.BaseParam.Row] += bp.Value;
                    }
                }

                if (baseParamDeltas.Count == 0) return;
                
                foreach (var (materiaId, level) in Item.Materia()) {
                    if (level >= 10) continue;
                    var materia = materiaSheet.GetRow(materiaId);
                    if (materia == null) continue;
                    if (materia.BaseParam.Row == 0) continue;
                    if (materia.BaseParam.Value == null) continue;
                    if (!baseParamDeltas.ContainsKey(materia.BaseParam.Row)) {
                        var bp = Service.Data.Excel.GetSheet<ExtendedBaseParam>()?.GetRow(materia.BaseParam.Row);
                        if (bp == null) continue;
                        baseParams.Add(materia.BaseParam.Row, bp);
                        baseParamDeltas.Add(materia.BaseParam.Row, materia.Value[level]);
                        baseParamOriginal.Add(materia.BaseParam.Row, 0);
                        baseParamLimits.Add(materia.BaseParam.Row, (int) Math.Ceiling(itemLevel.BaseParam[materia.BaseParam.Row] * (bp.EquipSlotCategoryPct[item.EquipSlotCategory.Row] / 100f)));
                        continue;
                    }
                    baseParamDeltas[materia.BaseParam.Row] += materia.Value[level];
                }
                foreach (var bp in baseParamDeltas) {
                    var param = baseParams[bp.Key];
                    if (bp.Value == 0) continue;
                    var hasApplied = false;
                    foreach (var field in Fields().Take(numberArrayData->IntArray[21])) {
                        var data = GetTooltipString(stringArrayData, field);
                        if (data == null) continue;
                        if (data.TextValue.Contains(param.Name)) {
                            hasApplied = true;
                            if (data.TextValue.EndsWith("]")) continue;
                            ApplyMateriaDifference(data, baseParamDeltas[param.RowId], baseParamOriginal[param.RowId], baseParamLimits[param.RowId]);
                            SetTooltipString(stringArrayData, field, data);
                        }

                    }

                    if (!hasApplied) {
                        var baseParamLines = numberArrayData->IntArray[21];
                        if (baseParamLines < 8) {
                            var seString = new SeString();
                            seString.Payloads.Add(new TextPayload(param.Name));
                            seString.Payloads.Add(new TextPayload($" +{baseParamOriginal[param.RowId]}"));
                            ApplyMateriaDifference(seString, baseParamDeltas[param.RowId], baseParamOriginal[param.RowId], baseParamLimits[param.RowId]);

                            SetTooltipString(stringArrayData, (TooltipTweaks.ItemTooltipField) (37 + baseParamLines), seString);
                            numberArrayData->IntArray[21] += 1;
                        }
                    }
                }

            } catch (Exception ex) {
                SimpleLog.Error(ex);
            }

        }

19 Source : ComboTimer.cs
with GNU Affero General Public License v3.0
from Caraxi

private void Update(bool reset = false) {
            var addon = usingScreenText ? "_ScreenText" : "_ParameterWidget";
            if (usingScreenText != Config.UseScreenText) {
                reset = true;
                usingScreenText = Config.UseScreenText;
            }

            var paramWidget = Common.GetUnitBase(addon);
            if (paramWidget == null) return;
            
            AtkTextNode* textNode = null;
            for (var i = 0; i < paramWidget->UldManager.NodeListCount; i++) {
                if (paramWidget->UldManager.NodeList[i] == null) continue;
                if (paramWidget->UldManager.NodeList[i]->NodeID == CustomNodes.ComboTimer) {
                    textNode = (AtkTextNode*)paramWidget->UldManager.NodeList[i];
                    if (reset) {
                        paramWidget->UldManager.NodeList[i]->ToggleVisibility(false);
                        continue;
                    }
                    break;
                }
            }

            if (textNode == null && reset) return;

            if (textNode == null) {

                var newTextNode = (AtkTextNode*)IMemorySpace.GetUISpace()->Malloc((ulong)sizeof(AtkTextNode), 8);
                if (newTextNode != null) {

                    var lastNode = paramWidget->RootNode;
                    if (lastNode == null) return;

                    IMemorySpace.Memset(newTextNode, 0, (ulong)sizeof(AtkTextNode));
                    newTextNode->Ctor();
                    textNode = newTextNode;

                    newTextNode->AtkResNode.Type = NodeType.Text;
                    newTextNode->AtkResNode.Flags = (short)(NodeFlags.AnchorLeft | NodeFlags.AnchorTop);
                    newTextNode->AtkResNode.DrawFlags = 0;
                    newTextNode->AtkResNode.SetPositionShort(1, 1);
                    newTextNode->AtkResNode.SetWidth(200);
                    newTextNode->AtkResNode.SetHeight(14);

                    newTextNode->LineSpacing = 24;
                    newTextNode->AlignmentFontType = 0x14;
                    newTextNode->FontSize = 12;
                    newTextNode->TextFlags = (byte)(TextFlags.Edge);
                    newTextNode->TextFlags2 = 0;

                    newTextNode->AtkResNode.NodeID = CustomNodes.ComboTimer;

                    newTextNode->AtkResNode.Color.A = 0xFF;
                    newTextNode->AtkResNode.Color.R = 0xFF;
                    newTextNode->AtkResNode.Color.G = 0xFF;
                    newTextNode->AtkResNode.Color.B = 0xFF;

                    if (lastNode->ChildNode != null) {
                        lastNode = lastNode->ChildNode;
                        while (lastNode->PrevSiblingNode != null) {
                            lastNode = lastNode->PrevSiblingNode;
                        }

                        newTextNode->AtkResNode.NextSiblingNode = lastNode;
                        newTextNode->AtkResNode.ParentNode = paramWidget->RootNode;
                        lastNode->PrevSiblingNode = (AtkResNode*) newTextNode;
                    } else {
                        lastNode->ChildNode = (AtkResNode*)newTextNode;
                        newTextNode->AtkResNode.ParentNode = lastNode;
                    }

                    textNode->TextColor.A = 0xFF;
                    textNode->TextColor.R = 0xFF;
                    textNode->TextColor.G = 0xFF;
                    textNode->TextColor.B = 0xFF;

                    textNode->EdgeColor.A = 0xFF;
                    textNode->EdgeColor.R = 0xF0;
                    textNode->EdgeColor.G = 0x8E;
                    textNode->EdgeColor.B = 0x37;

                    paramWidget->UldManager.UpdateDrawNodeList();
                }
            }

            if (reset) {
                UiHelper.Hide(textNode);
                return;
            }

            if (combo->Action != 0 && !comboActions.ContainsKey(combo->Action)) {
                comboActions.Add(combo->Action, Service.Data.Excel.GetSheet<Action>().OrderBy(a => a.ClreplacedJobLevel).FirstOrDefault(a => a.ActionCombo.Row == combo->Action)?.ClreplacedJobLevel ?? 255);
            }
            
            var comboAvailable = Service.ClientState?.LocalPlayer != null && combo->Timer > 0 && combo->Action != 0 && comboActions.ContainsKey(combo->Action) && comboActions[combo->Action] <= Service.ClientState.LocalPlayer.Level;
            
            if (Config.AlwaysVisible || comboAvailable) {
                UiHelper.Show(textNode);
                UiHelper.SetPosition(textNode, -45 + Config.OffsetX, 15 + Config.OffsetY);
                textNode->AlignmentFontType = 0x14;
                textNode->TextFlags |= (byte) TextFlags.MultiLine;
                
                textNode->EdgeColor.R = (byte) (this.Config.EdgeColor.X * 0xFF);
                textNode->EdgeColor.G = (byte) (this.Config.EdgeColor.Y * 0xFF);
                textNode->EdgeColor.B = (byte) (this.Config.EdgeColor.Z * 0xFF);
                textNode->EdgeColor.A = (byte) (this.Config.EdgeColor.W * 0xFF);
                
                textNode->TextColor.R = (byte) (this.Config.Color.X * 0xFF);
                textNode->TextColor.G = (byte) (this.Config.Color.Y * 0xFF);
                textNode->TextColor.B = (byte) (this.Config.Color.Z * 0xFF);
                textNode->TextColor.A = (byte) (this.Config.Color.W * 0xFF);

                textNode->FontSize = (byte) (this.Config.FontSize);
                textNode->LineSpacing = (byte) (this.Config.FontSize);
                textNode->CharSpacing = 1;
                var comboTimer = (comboAvailable ? combo->Timer : 0.0f).ToString($"{(Config.LeadingZero ? "00" : "0")}{(Config.DecimalPlaces>0 ? "." + new string('0', Config.DecimalPlaces) : "")}");
                textNode->SetText(Config.NoComboText ? $"{comboTimer}" : $"Combo\n{comboTimer}");
            } else { 
                UiHelper.Hide(textNode);
            }
        }

19 Source : AssetsManager.cs
with GNU General Public License v3.0
from cc004

public replacedetTypeTemplateField GetTemplateBaseField(replacedetsFile file, replacedetFileInfoEx info, bool forceFromCldb = false)
        {
            ushort scriptIndex = replacedetHelper.GetScriptIndex(file, info);
            uint fixedId = replacedetHelper.FixAudioID(info.curFileType);

            bool hasTypeTree = file.typeTree.hasTypeTree;
            replacedetTypeTemplateField baseField;
            if (useTemplateFieldCache && templateFieldCache.ContainsKey(fixedId))
            {
                baseField = templateFieldCache[fixedId];
            }
            else
            {
                baseField = new replacedetTypeTemplateField();
                if (hasTypeTree && !forceFromCldb)
                {
                    baseField.From0D(replacedetHelper.FindTypeTreeTypeByID(file.typeTree, fixedId, scriptIndex), 0);
                }
                else
                {
                    baseField.FromClreplacedDatabase(clreplacedFile, replacedetHelper.FindreplacedetClreplacedByID(clreplacedFile, fixedId), 0);
                }

                if (useTemplateFieldCache)
                {
                    templateFieldCache[fixedId] = baseField;
                }
            }

            return baseField;
        }

19 Source : SmartHeaderChain.cs
with GNU General Public License v3.0
from chaincase-app

public bool TryGetHeader(uint height, out SmartHeader header)
		{
			header = null;
			lock (Lock)
			{
				if (Chain.ContainsKey(height))
				{
					header = Chain[height];
					return true;
				}
				else
				{
					return false;
				}
			}
		}

See More Examples