Exemplo n.º 1
0
        private static void XmlSerializer(DiscoveryResultBase data)
        {
            Type type = typeof(DiscoveryResultBase);

            using (FileStream fileStream = new FileStream(DiscoveryResultManager.GetFilename(type), FileMode.Create))
            {
                new DataContractSerializer(type).WriteObject(XmlDictionaryWriter.CreateTextWriter((Stream)fileStream), (object)data);
                fileStream.Flush();
                fileStream.Close();
            }
        }
        // Token: 0x060002C3 RID: 707 RVA: 0x00011648 File Offset: 0x0000F848
        private static void XmlSerializer(DiscoveryResultBase data)
        {
            Type typeFromHandle = typeof(DiscoveryResultBase);
            DataContractSerializer dataContractSerializer = new DataContractSerializer(typeFromHandle);

            using (FileStream fileStream = new FileStream(DiscoveryResultManager.GetFilename(typeFromHandle), FileMode.Create))
            {
                XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(fileStream);
                dataContractSerializer.WriteObject(writer, data);
                fileStream.Flush();
                fileStream.Close();
            }
        }
Exemplo n.º 3
0
        private static void BinarySerializer(DiscoveryResultBase data)
        {
            FileStream      fileStream      = new FileStream(DiscoveryResultManager.GetFilename(typeof(DiscoveryResultBase)), FileMode.Create);
            BinaryFormatter binaryFormatter = new BinaryFormatter();

            try
            {
                binaryFormatter.Serialize((Stream)fileStream, (object)data);
            }
            finally
            {
                fileStream.Close();
            }
        }
 // Token: 0x060002BE RID: 702 RVA: 0x000111C4 File Offset: 0x0000F3C4
 internal static void UpdateRoutine(int profileID)
 {
     if (profileID <= 0)
     {
         throw new ArgumentException("Invalid ProfileID", "profileID");
     }
     using (LocaleThreadState.EnsurePrimaryLocale())
     {
         try
         {
             IEnumerable <IScheduledDiscoveryPlugin> enumerable = DiscoveryHelper.GetOrderedDiscoveryPlugins().OfType <IScheduledDiscoveryPlugin>();
             if (enumerable.Count <IScheduledDiscoveryPlugin>() > 0)
             {
                 DiscoveryResultBase discoveryResult = DiscoveryResultManager.GetDiscoveryResult(profileID, enumerable.Cast <IDiscoveryPlugin>().ToList <IDiscoveryPlugin>());
                 using (IEnumerator <IScheduledDiscoveryPlugin> enumerator = enumerable.GetEnumerator())
                 {
                     Action <string, double> < > 9__0;
                     while (enumerator.MoveNext())
                     {
                         IScheduledDiscoveryPlugin scheduledDiscoveryPlugin = enumerator.Current;
                         DiscoveryResultBase       discoveryResultBase      = discoveryResult;
                         Action <string, double>   action;
                         if ((action = < > 9__0) == null)
                         {
                             action = (< > 9__0 = delegate(string message, double phaseProgress)
                             {
                                 if (DiscoveryNetObjectStatusManager.log.IsInfoEnabled)
                                 {
                                     DiscoveryNetObjectStatusManager.log.InfoFormat("Updating Discovered Net Object Statuses for profile {0}: {1} - {2}", profileID, phaseProgress, message);
                                 }
                             });
                         }
                         scheduledDiscoveryPlugin.UpdateImportStatuses(discoveryResultBase, action);
                     }
                     goto IL_CC;
                 }
             }
             if (DiscoveryNetObjectStatusManager.log.IsInfoEnabled)
             {
                 DiscoveryNetObjectStatusManager.log.InfoFormat("Skipping Discovered Net Object Status update for profile {0}", profileID);
             }
             IL_CC :;
         }
         catch (Exception ex)
         {
             DiscoveryNetObjectStatusManager.log.Error(string.Format("Update Discovered Net Object Statuses for profile {0} failed", profileID), ex);
         }
     }
 }
Exemplo n.º 5
0
 internal static void UpdateRoutine(int profileID)
 {
     if (profileID <= 0)
     {
         throw new ArgumentException("Invalid ProfileID", nameof(profileID));
     }
     using (LocaleThreadState.EnsurePrimaryLocale())
     {
         try
         {
             IEnumerable <IScheduledDiscoveryPlugin> source = ((IEnumerable)DiscoveryHelper.GetOrderedDiscoveryPlugins()).OfType <IScheduledDiscoveryPlugin>();
             if (source.Count <IScheduledDiscoveryPlugin>() > 0)
             {
                 DiscoveryResultBase discoveryResult = DiscoveryResultManager.GetDiscoveryResult(profileID, (IList <IDiscoveryPlugin>)((IEnumerable)source).Cast <IDiscoveryPlugin>().ToList <IDiscoveryPlugin>());
                 using (IEnumerator <IScheduledDiscoveryPlugin> enumerator = source.GetEnumerator())
                 {
                     while (((IEnumerator)enumerator).MoveNext())
                     {
                         enumerator.Current.UpdateImportStatuses(discoveryResult, (Action <string, double>)((message, phaseProgress) =>
                         {
                             if (!DiscoveryNetObjectStatusManager.log.get_IsInfoEnabled())
                             {
                                 return;
                             }
                             DiscoveryNetObjectStatusManager.log.InfoFormat("Updating Discovered Net Object Statuses for profile {0}: {1} - {2}", (object)profileID, (object)phaseProgress, (object)message);
                         }));
                     }
                 }
             }
             else
             {
                 if (!DiscoveryNetObjectStatusManager.log.get_IsInfoEnabled())
                 {
                     return;
                 }
                 DiscoveryNetObjectStatusManager.log.InfoFormat("Skipping Discovered Net Object Status update for profile {0}", (object)profileID);
             }
         }
         catch (Exception ex)
         {
             DiscoveryNetObjectStatusManager.log.Error((object)string.Format("Update Discovered Net Object Statuses for profile {0} failed", (object)profileID), ex);
         }
     }
 }