Back to OIM Explorer

VI.Transport/VI.Transport/FileTransport.cs

Decompiler Source FileVI.Transport.FileTransportDecompiled Source

1 extracted method/event/call references in FileTransport.

Source: F:\Claude\.tmp\oim-decompiled-full\1279_One_Identity_Manager_VI.Transport.dll\VI.Transport\FileTransport.cs

Source size: 8.658 characters

Interpretation

  • Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.

Relations

  • CallMethod: LoadFromFile at line 116

Typed Edges

  • No typed edges extracted for this source.

References

  • No direct source references extracted.

Referenced By

  • No direct source references extracted.

C# source-derived context

Generated by pattern extraction from the decompiled C# source and decompile index. This is factual source evidence, not inferred behavior.

reads entity values references DB/Dialog objects

Summary: classes FileTransport; methods CostEvaluation, Export, Import, _ExportFiles, _ImportFiles, colData_ProgressChanged; references QBMFileRevision; markers reads entity values, references DB/Dialog objects

Classes

FileTransport

DB/Dialog object references

OIM key/entity markers

ObjectKeyList

API/entity calls

GetValue Source GetValue CallMethod GetObjectKey

Registrations / handlers

None extracted.

Complete Source

C#240 lines
1using System;2using System.Collections.Generic;3using System.Collections.ObjectModel;4using System.IO;5using System.Threading;6using System.Xml;7using ICSharpCode.SharpZipLib.Zip;8using NLog;9using VI.Base;10using VI.DB;11using VI.DB.Entities;12using VI.DB.Entities.Transport;13using VI.DB.Sync;14using VI.Transport.Base;1516namespace VI.Transport;1718public class FileTransport : TransportTask, ITransportTemplate19{20	private readonly ObjectKeyList _lSelected = new ObjectKeyList();2122	private ObjectCollection _colData;2324	private readonly Dictionary<DbObjectKey, string> _dicPatches = new Dictionary<DbObjectKey, string>();2526	public override string Display => LanguageManager.Instance["FileTransport_Display"];2728	public ObjectKeyList Selection => _lSelected;2930	public Dictionary<DbObjectKey, string> Patches => _dicPatches;3132	public string TaskId => "FileTransport";3334	public FileTransport(IResolve iocContainer)35		: base(iocContainer)36	{37	}3839	public override TransportCosts CostEvaluation(TransportTaskArguments args)40	{41		TransportCosts transportCosts = base.CostEvaluation(args);42		if (base.IsExport)43		{44			transportCosts.Common += ((List<DbObjectKey>)Selection).Count;45			Parameter.SetCosts(transportCosts);46		}47		return transportCosts;48	}4950	public override void Export(TransportTaskArguments args)51	{52		base.Export(args);53		if (((List<DbObjectKey>)Selection).Count == 0)54		{55			throw new System.Exception(LanguageManager.Instance["FileTransport_NoFiles"]);56		}57		SetTaskPath(GetUniqueSubDirName("FileTransport"), bCreate: true);58		args.Parts |= TransportParts.Common;59		_ExportFiles();60	}6162	public override void Import(TransportTaskArguments args)63	{64		base.Import(args);65		if (args.Parts == TransportParts.Common)66		{67			SetTaskPath(Parameter["TaskPath"], bCreate: false);68			_ImportFiles();69		}70	}7172	private void _ExportFiles()73	{74		//IL_0057: Unknown result type (might be due to invalid IL or missing references)75		//IL_005c: Unknown result type (might be due to invalid IL or missing references)76		//IL_0072: Unknown result type (might be due to invalid IL or missing references)77		//IL_0077: Unknown result type (might be due to invalid IL or missing references)78		try79		{80			IEntity entity = null;81			ObjectCollection objectCollection = new ObjectCollection(this);82			SetProgress(LM["FileTransport_ExportingFiles"], 0, 0);83			LogSessionId sessionId = new LogSessionId("FileTransport");84			using (Logger.InfoBlock(sessionId, LM["FileTransport_ExportingFiles"]))85			{86				int num = 0;87				Enumerator<DbObjectKey> enumerator = ((List<DbObjectKey>)Selection).GetEnumerator();88				try89				{90					while (enumerator.MoveNext())91					{92						DbObjectKey current = enumerator.Current;93						CancellationToken cancellationToken = base.Transport.CancellationToken;94						if (((CancellationToken)(ref cancellationToken)).IsCancellationRequested)95						{96							return;97						}98						try99						{100							entity = Session.Source().Get(current, EntityLoadType.Interactive);101							string text = entity.GetValue("FileName").String;102							LanguageManager lM = LM;103							object obj = text;104							SetProgress(lM.FormatString("FileTransport_ExportingFile", new System.ReadOnlySpan<object>(ref obj)), num, ((List<DbObjectKey>)Selection).Count + 1);105							Logger logger = Logger;106							LanguageManager lM2 = LM;107							object obj2 = text;108							logger.Info(lM2.FormatString("FileTransport_ExportingFile", new System.ReadOnlySpan<object>(ref obj2)));109							if (Patches.ContainsKey(current))110							{111								string text2 = Patches[current];112								Logger logger2 = Logger;113								LanguageManager lM3 = LM;114								object obj3 = text2;115								logger2.Info(lM3.FormatString("FileTransport_ApplyPatch", new System.ReadOnlySpan<object>(ref obj3)));116								entity.CallMethod("LoadFromFile", text2);117							}118							objectCollection.Add(Session, entity);119						}120						catch (System.Exception ex)121						{122							HandleException(ex, entity);123						}124						num++;125					}126				}127				finally128				{129					((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();130				}131				SetProgress(LM["FileTransport_SavingFile"], ((List<DbObjectKey>)Selection).Count, ((List<DbObjectKey>)Selection).Count);132				Logger.Info(LM["FileTransport_SavingFile"]);133				objectCollection.ToFile(Path.Combine(((FileSystemInfo)base.TaskPath).FullName, "FileTransport.xml"), base.Transport.Options.ToExportOptions());134				base.Arguments.Modules.AddRange(objectCollection.GetRequiredModules());135			}136		}137		catch (System.Exception ex2)138		{139			HandleException(ex2, null);140		}141	}142143	private void _ImportFiles()144	{145		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)146		//IL_0109: Expected O, but got Unknown147		//IL_0095: Unknown result type (might be due to invalid IL or missing references)148		//IL_009f: Expected O, but got Unknown149		LanguageManager instance = LanguageManager.Instance;150		SetProgress(instance["FileTransport_ImportLoad"], 0, 2);151		Logger.Info(instance["FileTransport_ImportLoad"]);152		ZipEntry zipFile = GetZipFile("FileTransport/FileTransport\\.xml");153		if (zipFile == null)154		{155			LanguageManager instance2 = LanguageManager.Instance;156			object obj = "FileTransport/FileTransport.xml";157			throw new System.Exception(instance2.FormatString("Transport_FileNotFound", new System.ReadOnlySpan<object>(ref obj)));158		}159		XmlDocument xmlDocument = GetXmlDocument(zipFile);160		SetProgress(instance["FileTransport_ImportSave"], 1, 2);161		try162		{163			_colData = new ObjectCollection(this, xmlDocument);164			_colData.ProcessedChanged += new EventHandler(colData_ProgressChanged);165			if (((System.Enum)base.Transport.Options).HasFlag((System.Enum)TransportOptions.ModulePatch))166			{167				((System.Collections.Generic.IEnumerable<EntityData>)_colData).ReplaceModuleOwner(Session);168			}169			_colData.Save(Session, base.Transport.Options.ToTolerances());170		}171		finally172		{173			_colData.ProcessedChanged -= new EventHandler(colData_ProgressChanged);174		}175	}176177	private void colData_ProgressChanged(object sender, EventArgs e)178	{179		base.Transport.Progress.SetCurrent(_colData.Processed, ((Collection<EntityData>)(object)_colData).Count);180	}181182	public void Save(TransportParameterCollection colParams)183	{184		//IL_0017: Unknown result type (might be due to invalid IL or missing references)185		//IL_001c: Unknown result type (might be due to invalid IL or missing references)186		TransportParameter transportParameter = new TransportParameter("Files", new TransportParameter[0]);187		Enumerator<DbObjectKey> enumerator = ((List<DbObjectKey>)Selection).GetEnumerator();188		try189		{190			string strValue = default(string);191			while (enumerator.MoveNext())192			{193				DbObjectKey current = enumerator.Current;194				TransportParameter transportParameter2 = new TransportParameter("PK", current.KeyWithoutTable);195				if (Patches.TryGetValue(current, ref strValue))196				{197					TransportParameterCollection transportParameterCollection = new TransportParameterCollection();198					((List<TransportParameter>)transportParameterCollection).Add(new TransportParameter("Patch", strValue));199					transportParameter2.Parameters = transportParameterCollection;200				}201				((List<TransportParameter>)transportParameter.Parameters).Add(transportParameter2);202			}203		}204		finally205		{206			((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();207		}208		((List<TransportParameter>)colParams).Add(transportParameter);209	}210211	public void Load(TransportParameterCollection colParams)212	{213		//IL_001c: Unknown result type (might be due to invalid IL or missing references)214		//IL_0021: Unknown result type (might be due to invalid IL or missing references)215		((List<DbObjectKey>)Selection).Clear();216		Enumerator<TransportParameter> enumerator = ((List<TransportParameter>)colParams.Get("Files", bThrowOnMissing: true).Parameters).GetEnumerator();217		try218		{219			while (enumerator.MoveNext())220			{221				TransportParameter current = enumerator.Current;222				if (current.Name == "PK")223				{224					DbObjectKey objectKey = DbObjectKey.GetObjectKey("QBMFileRevision", current.Value);225					((List<DbObjectKey>)Selection).Add(objectKey);226					TransportParameter transportParameter = current.Parameters?.Get("Patch", bThrowOnMissing: false);227					if (transportParameter != null)228					{229						Patches.Add(objectKey, transportParameter.Value);230					}231				}232			}233		}234		finally235		{236			((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();237		}238	}239}240