Esempio n. 1
0
 private void MapUid(Guid uid)
 {
     if (!UidMap.ContainsKey(uid))
     {
         UidMap[uid] = NextIndex();
     }
 }
Esempio n. 2
0
        public int Translate(Guid uid)
        {
            if (!UidMap.ContainsKey(uid))
            {
                Debugger.Launch();
            }

            return(UidMap[uid]);
        }
Esempio n. 3
0
        public void SetExternalXRefSpec()
        {
            var result = new Dictionary <string, XRefSpec>();

            // remove internal xref.
            var xref = XRef.Where(s => !UidMap.ContainsKey(s.Key)).ToDictionary(s => s.Key, s => s.Value);

            if (xref.Count == 0)
            {
                return;
            }

            var missingUids = new List <KeyValuePair <string, HashSet <string> > >();

            if (ExternalReferencePackages.Length > 0)
            {
                using (var externalReferences = new ExternalReferencePackageCollection(ExternalReferencePackages))
                {
                    foreach (var uid in xref.Keys)
                    {
                        var spec = GetExternalReference(externalReferences, uid);
                        if (spec != null)
                        {
                            result[uid] = spec;
                        }
                        else
                        {
                            if (missingUids.Count < 100)
                            {
                                missingUids.Add(new KeyValuePair <string, HashSet <string> >(uid, xref[uid]));
                            }
                        }
                    }
                }
            }
            else
            {
                missingUids.AddRange(xref.Take(100));
            }
            if (missingUids.Count > 0)
            {
                var uidLines = string.Join(Environment.NewLine + "\t", missingUids.Select(s => "@" + s.Key + " in files \"" + string.Join(",", s.Value.Select(p => p.ToDisplayPath())) + "\""));
                if (missingUids.Count < 100)
                {
                    Logger.LogWarning($"Missing following definitions of cross-reference:{Environment.NewLine}\t{uidLines}");
                }
                else
                {
                    Logger.LogWarning($"Too many missing definitions of cross-reference, following is top 100:{Environment.NewLine}\t{uidLines}");
                }
            }
            ExternalXRefSpec = result;
        }