Example #1
0
 private static void UpdateProgress(
     Guid importId,
     string text,
     double progress,
     double phaseProgress,
     string phaseName,
     bool finished)
 {
     lock (((ICollection)DiscoveryImportManager.imports).SyncRoot)
     {
         if (!DiscoveryImportManager.imports.ContainsKey(importId))
         {
             DiscoveryImportManager.imports[importId] = new DiscoveryImportProgressInfo();
         }
         DiscoveryImportProgressInfo import = DiscoveryImportManager.imports[importId];
         import.get_LogBuilder().AppendLine(text);
         import.set_Finished(finished);
         import.set_OverallProgress(progress);
         import.set_PhaseProgress(phaseProgress);
         import.set_PhaseName(phaseName);
         if (!DiscoveryImportManager.log.get_IsInfoEnabled())
         {
             return;
         }
         DiscoveryImportManager.log.InfoFormat("{0} {1}/{2}: {3}", new object[4]
         {
             (object)phaseName,
             (object)progress,
             (object)phaseProgress,
             (object)text
         });
     }
 }
        // Token: 0x060002AA RID: 682 RVA: 0x000106EC File Offset: 0x0000E8EC
        private static void UpdateProgress(Guid importId, string text, double progress, double phaseProgress, string phaseName, bool finished)
        {
            object syncRoot = ((ICollection)DiscoveryImportManager.imports).SyncRoot;

            lock (syncRoot)
            {
                if (!DiscoveryImportManager.imports.ContainsKey(importId))
                {
                    DiscoveryImportManager.imports[importId] = new DiscoveryImportProgressInfo();
                }
                DiscoveryImportProgressInfo discoveryImportProgressInfo = DiscoveryImportManager.imports[importId];
                discoveryImportProgressInfo.LogBuilder.AppendLine(text);
                discoveryImportProgressInfo.Finished        = finished;
                discoveryImportProgressInfo.OverallProgress = progress;
                discoveryImportProgressInfo.PhaseProgress   = phaseProgress;
                discoveryImportProgressInfo.PhaseName       = phaseName;
                if (DiscoveryImportManager.log.IsInfoEnabled)
                {
                    DiscoveryImportManager.log.InfoFormat("{0} {1}/{2}: {3}", new object[]
                    {
                        phaseName,
                        progress,
                        phaseProgress,
                        text
                    });
                }
            }
        }
        // Token: 0x060002A9 RID: 681 RVA: 0x000105BC File Offset: 0x0000E7BC
        public static DiscoveryImportProgressInfo GetImportProgress(Guid importId)
        {
            object syncRoot = ((ICollection)DiscoveryImportManager.imports).SyncRoot;
            DiscoveryImportProgressInfo result;

            lock (syncRoot)
            {
                if (DiscoveryImportManager.imports.ContainsKey(importId))
                {
                    DiscoveryImportProgressInfo discoveryImportProgressInfo = DiscoveryImportManager.imports[importId];
                    if (discoveryImportProgressInfo.LogBuilder.Length > 131072)
                    {
                        StringBuilder stringBuilder  = new StringBuilder();
                        StringBuilder stringBuilder2 = new StringBuilder();
                        using (StringReader stringReader = new StringReader(discoveryImportProgressInfo.NewLogText))
                        {
                            bool   flag2 = false;
                            string text;
                            while ((text = stringReader.ReadLine()) != null)
                            {
                                if ((stringBuilder.Length + text.Length <= 131072 || stringBuilder.Length == 0) && !flag2)
                                {
                                    stringBuilder.AppendLine(text);
                                }
                                else
                                {
                                    flag2 = true;
                                    stringBuilder2.AppendLine(text);
                                }
                            }
                        }
                        discoveryImportProgressInfo.NewLogText = stringBuilder2.ToString();
                        result = new DiscoveryImportProgressInfo(discoveryImportProgressInfo)
                        {
                            NewLogText = stringBuilder.ToString(),
                            Finished   = false
                        };
                    }
                    else
                    {
                        DiscoveryImportManager.imports.Remove(importId);
                        result = discoveryImportProgressInfo;
                    }
                }
                else
                {
                    result = null;
                }
            }
            return(result);
        }
Example #4
0
 public static DiscoveryImportProgressInfo GetImportProgress(
     Guid importId)
 {
     lock (((ICollection)DiscoveryImportManager.imports).SyncRoot)
     {
         if (!DiscoveryImportManager.imports.ContainsKey(importId))
         {
             return((DiscoveryImportProgressInfo)null);
         }
         DiscoveryImportProgressInfo import = DiscoveryImportManager.imports[importId];
         if (import.get_LogBuilder().Length > 131072)
         {
             StringBuilder stringBuilder1 = new StringBuilder();
             StringBuilder stringBuilder2 = new StringBuilder();
             using (StringReader stringReader = new StringReader(import.get_NewLogText()))
             {
                 bool   flag = false;
                 string str;
                 while ((str = stringReader.ReadLine()) != null)
                 {
                     if ((stringBuilder1.Length + str.Length <= 131072 || stringBuilder1.Length == 0) && !flag)
                     {
                         stringBuilder1.AppendLine(str);
                     }
                     else
                     {
                         flag = true;
                         stringBuilder2.AppendLine(str);
                     }
                 }
             }
             import.set_NewLogText(stringBuilder2.ToString());
             DiscoveryImportProgressInfo importProgressInfo = new DiscoveryImportProgressInfo(import);
             importProgressInfo.set_NewLogText(stringBuilder1.ToString());
             importProgressInfo.set_Finished(false);
             return(importProgressInfo);
         }
         DiscoveryImportManager.imports.Remove(importId);
         return(import);
     }
 }