Common.Customizer/VI.Common.Customizer/DialogRichMail.cs
Decompiler Source FileCommon.Customizer.DialogRichMailDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- Function registration: Copy at line 374
- Method registration: CopyAndSave at line 375
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 saves entities references DB/Dialog objects
Summary: classes DialogRichMail, _003C_003Ec__DisplayClass1_0; methods MoveNext, SetStateMachine, _003C_CopyAsync_003Eb__1, _CopyAsync; references DialogParameter, DialogParameterSet, DialogRichMail, DialogRichMailBody, DialogRichMailImage; markers reads entity values, saves entities, references DB/Dialog objects
Classes
DialogRichMail _003C_003Ec__DisplayClass1_0DB/Dialog object references
OIM key/entity markers
UID_DialogRichMail UID_DialogRichMailBody UID_DialogParameterSetAPI/entity calls
SaveAsync GetValueAsyncRegistrations / handlers
None extracted.
Complete Source
1using System;2using System.Collections;3using System.Collections.Generic;4using System.Diagnostics;5using System.Linq;6using System.Runtime.CompilerServices;7using System.Runtime.InteropServices;8using System.Threading;9using System.Threading.Tasks;10using VI.Base;11using VI.DB;12using VI.DB.Entities;1314namespace VI.Common.Customizer;1516public class DialogRichMail : StateLessEntityLogic17{18 [StructLayout((LayoutKind)3)]19 [CompilerGenerated]20 private struct _003C_003C_002Dctor_003Eb__0_1_003Ed : IAsyncStateMachine21 {22 public int _003C_003E1__state;2324 public AsyncTaskMethodBuilder _003C_003Et__builder;2526 public DialogRichMail _003C_003E4__this;2728 public ISession s;2930 public IEntity e;3132 public string ident;3334 public CancellationToken ct;3536 private ConfiguredTaskAwaiter<IEntity[]> _003C_003Eu__1;3738 private ConfiguredTaskAwaiter _003C_003Eu__2;3940 private void MoveNext()41 {42 //IL_0072: Unknown result type (might be due to invalid IL or missing references)43 //IL_0077: Unknown result type (might be due to invalid IL or missing references)44 //IL_007e: Unknown result type (might be due to invalid IL or missing references)45 //IL_00a9: Unknown result type (might be due to invalid IL or missing references)46 //IL_00b5: Unknown result type (might be due to invalid IL or missing references)47 //IL_00ba: Unknown result type (might be due to invalid IL or missing references)48 //IL_00be: Unknown result type (might be due to invalid IL or missing references)49 //IL_00c3: Unknown result type (might be due to invalid IL or missing references)50 //IL_00f0: Unknown result type (might be due to invalid IL or missing references)51 //IL_00f5: Unknown result type (might be due to invalid IL or missing references)52 //IL_00fd: Unknown result type (might be due to invalid IL or missing references)53 //IL_002c: Unknown result type (might be due to invalid IL or missing references)54 //IL_0037: Unknown result type (might be due to invalid IL or missing references)55 //IL_003c: Unknown result type (might be due to invalid IL or missing references)56 //IL_003f: Unknown result type (might be due to invalid IL or missing references)57 //IL_0044: Unknown result type (might be due to invalid IL or missing references)58 //IL_00d8: Unknown result type (might be due to invalid IL or missing references)59 //IL_00da: Unknown result type (might be due to invalid IL or missing references)60 //IL_0058: Unknown result type (might be due to invalid IL or missing references)61 //IL_0059: Unknown result type (might be due to invalid IL or missing references)62 int num = _003C_003E1__state;63 DialogRichMail dialogRichMail = _003C_003E4__this;64 try65 {66 ConfiguredTaskAwaiter val;67 ConfiguredTaskAwaiter<IEntity[]> val2;68 if (num != 0)69 {70 if (num == 1)71 {72 val = _003C_003Eu__2;73 _003C_003Eu__2 = default(ConfiguredTaskAwaiter);74 num = (_003C_003E1__state = -1);75 goto IL_010c;76 }77 val2 = dialogRichMail._CopyAsync(s, e, ident, ct).ConfigureAwait(false).GetAwaiter();78 if (!val2.IsCompleted)79 {80 num = (_003C_003E1__state = 0);81 _003C_003Eu__1 = val2;82 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity[]>, _003C_003C_002Dctor_003Eb__0_1_003Ed>(ref val2, ref this);83 return;84 }85 }86 else87 {88 val2 = _003C_003Eu__1;89 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntity[]>);90 num = (_003C_003E1__state = -1);91 }92 ConfiguredTaskAwaitable val3 = val2.GetResult().SaveAsync(s, new PutOptions93 {94 Flags = PutFlags.IgnoreValuesWithoutCanEdit95 }, ignoreSaveErrors: false, null, ct).ConfigureAwait(false);96 val = ((ConfiguredTaskAwaitable)(ref val3)).GetAwaiter();97 if (!((ConfiguredTaskAwaiter)(ref val)).IsCompleted)98 {99 num = (_003C_003E1__state = 1);100 _003C_003Eu__2 = val;101 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, _003C_003C_002Dctor_003Eb__0_1_003Ed>(ref val, ref this);102 return;103 }104 goto IL_010c;105 IL_010c:106 ((ConfiguredTaskAwaiter)(ref val)).GetResult();107 }108 catch (System.Exception exception)109 {110 _003C_003E1__state = -2;111 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetException(exception);112 return;113 }114 _003C_003E1__state = -2;115 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetResult();116 }117118 [DebuggerHidden]119 private void SetStateMachine(IAsyncStateMachine stateMachine)120 {121 ((AsyncTaskMethodBuilder)(ref _003C_003Et__builder)).SetStateMachine(stateMachine);122 }123 }124125 [CompilerGenerated]126 private sealed class _003C_003Ec__DisplayClass1_0127 {128 public IDictionary<string, string> replacements;129130 internal void _003C_CopyAsync_003Eb__1(IDictionary<string, string> rpl)131 {132 replacements = rpl;133 }134 }135136 [StructLayout((LayoutKind)3)]137 [CompilerGenerated]138 private struct _003C_CopyAsync_003Ed__1 : IAsyncStateMachine139 {140 public int _003C_003E1__state;141142 public AsyncTaskMethodBuilder<IEntity[]> _003C_003Et__builder;143144 public IEntity richMail;145146 public ISession session;147148 public CancellationToken ct;149150 private _003C_003Ec__DisplayClass1_0 _003C_003E8__1;151152 public string newIdent;153154 private IEntity[] _003Ccopy_003E5__2;155156 private ConfiguredTaskAwaiter<IEntity[]> _003C_003Eu__1;157158 private ConfiguredValueTaskAwaiter<ApplyResult> _003C_003Eu__2;159160 private System.Collections.Generic.IEnumerator<IEntity> _003C_003E7__wrap2;161162 private IEntity _003Cbody_003E5__4;163164 private ConfiguredValueTaskAwaiter<string> _003C_003Eu__3;165166 private void MoveNext()167 {168 //IL_009b: Unknown result type (might be due to invalid IL or missing references)169 //IL_00a0: Unknown result type (might be due to invalid IL or missing references)170 //IL_00a7: Unknown result type (might be due to invalid IL or missing references)171 //IL_012a: Unknown result type (might be due to invalid IL or missing references)172 //IL_012f: Unknown result type (might be due to invalid IL or missing references)173 //IL_0136: Unknown result type (might be due to invalid IL or missing references)174 //IL_01d9: Unknown result type (might be due to invalid IL or missing references)175 //IL_01de: Unknown result type (might be due to invalid IL or missing references)176 //IL_01e6: Unknown result type (might be due to invalid IL or missing references)177 //IL_0054: Unknown result type (might be due to invalid IL or missing references)178 //IL_0060: Unknown result type (might be due to invalid IL or missing references)179 //IL_0065: Unknown result type (might be due to invalid IL or missing references)180 //IL_0068: Unknown result type (might be due to invalid IL or missing references)181 //IL_006d: Unknown result type (might be due to invalid IL or missing references)182 //IL_00e4: Unknown result type (might be due to invalid IL or missing references)183 //IL_00ef: Unknown result type (might be due to invalid IL or missing references)184 //IL_00f4: Unknown result type (might be due to invalid IL or missing references)185 //IL_00f7: Unknown result type (might be due to invalid IL or missing references)186 //IL_00fc: Unknown result type (might be due to invalid IL or missing references)187 //IL_0081: Unknown result type (might be due to invalid IL or missing references)188 //IL_0082: Unknown result type (might be due to invalid IL or missing references)189 //IL_0110: Unknown result type (might be due to invalid IL or missing references)190 //IL_0111: Unknown result type (might be due to invalid IL or missing references)191 //IL_018c: Unknown result type (might be due to invalid IL or missing references)192 //IL_019b: Unknown result type (might be due to invalid IL or missing references)193 //IL_01a0: Unknown result type (might be due to invalid IL or missing references)194 //IL_01a4: Unknown result type (might be due to invalid IL or missing references)195 //IL_01a9: Unknown result type (might be due to invalid IL or missing references)196 //IL_02ad: Unknown result type (might be due to invalid IL or missing references)197 //IL_02b2: Unknown result type (might be due to invalid IL or missing references)198 //IL_02ba: Unknown result type (might be due to invalid IL or missing references)199 //IL_01be: Unknown result type (might be due to invalid IL or missing references)200 //IL_01c0: Unknown result type (might be due to invalid IL or missing references)201 //IL_0360: Unknown result type (might be due to invalid IL or missing references)202 //IL_0365: Unknown result type (might be due to invalid IL or missing references)203 //IL_036d: Unknown result type (might be due to invalid IL or missing references)204 //IL_0313: Unknown result type (might be due to invalid IL or missing references)205 //IL_0322: Unknown result type (might be due to invalid IL or missing references)206 //IL_0327: Unknown result type (might be due to invalid IL or missing references)207 //IL_032b: Unknown result type (might be due to invalid IL or missing references)208 //IL_0330: Unknown result type (might be due to invalid IL or missing references)209 //IL_0345: Unknown result type (might be due to invalid IL or missing references)210 //IL_0347: Unknown result type (might be due to invalid IL or missing references)211 //IL_0260: Unknown result type (might be due to invalid IL or missing references)212 //IL_026f: Unknown result type (might be due to invalid IL or missing references)213 //IL_0274: Unknown result type (might be due to invalid IL or missing references)214 //IL_0278: Unknown result type (might be due to invalid IL or missing references)215 //IL_027d: Unknown result type (might be due to invalid IL or missing references)216 //IL_0292: Unknown result type (might be due to invalid IL or missing references)217 //IL_0294: Unknown result type (might be due to invalid IL or missing references)218 int num = _003C_003E1__state;219 IEntity[] result4;220 try221 {222 ConfiguredTaskAwaiter<IEntity[]> val2;223 IEntity[] result;224 IEntity[] result2;225 ConfiguredValueTaskAwaiter<ApplyResult> val;226 switch (num)227 {228 default:229 _003C_003E8__1 = new _003C_003Ec__DisplayClass1_0();230 val2 = richMail.CollectGraphAsync(session, new global::_003C_003Ez__ReadOnlyArray<string>(new string[2] { "DialogRichMailBody.UID_DialogRichMail", "DialogRichMailImage.UID_DialogRichMailBody" }), ct).ConfigureAwait(false).GetAwaiter();231 if (!val2.IsCompleted)232 {233 num = (_003C_003E1__state = 0);234 _003C_003Eu__1 = val2;235 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity[]>, _003C_CopyAsync_003Ed__1>(ref val2, ref this);236 return;237 }238 goto IL_00b6;239 case 0:240 val2 = _003C_003Eu__1;241 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntity[]>);242 num = (_003C_003E1__state = -1);243 goto IL_00b6;244 case 1:245 val2 = _003C_003Eu__1;246 _003C_003Eu__1 = default(ConfiguredTaskAwaiter<IEntity[]>);247 num = (_003C_003E1__state = -1);248 goto IL_0145;249 case 2:250 val = _003C_003Eu__2;251 _003C_003Eu__2 = default(ConfiguredValueTaskAwaiter<ApplyResult>);252 num = (_003C_003E1__state = -1);253 goto IL_01f5;254 case 3:255 case 4:256 break;257 IL_0145:258 result = val2.GetResult();259 _003Ccopy_003E5__2 = result;260 val = Enumerable.First<IEntity>((System.Collections.Generic.IEnumerable<IEntity>)_003Ccopy_003E5__2, (Func<IEntity, bool>)((IEntity e) => string.Equals(e.Tablename, "DialogRichMail", (StringComparison)5))).PutValueAsync("Ident_DialogRichMail", newIdent, ct).ConfigureAwait(false)261 .GetAwaiter();262 if (!val.IsCompleted)263 {264 num = (_003C_003E1__state = 2);265 _003C_003Eu__2 = val;266 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<ApplyResult>, _003C_CopyAsync_003Ed__1>(ref val, ref this);267 return;268 }269 goto IL_01f5;270 IL_00b6:271 result2 = val2.GetResult();272 _003C_003E8__1.replacements = null;273 val2 = result2.CopyAsync(session, EntityCreationType.DelayedLogic, null, null, delegate(IDictionary<string, string> rpl)274 {275 _003C_003E8__1.replacements = rpl;276 }, ct).ConfigureAwait(false).GetAwaiter();277 if (!val2.IsCompleted)278 {279 num = (_003C_003E1__state = 1);280 _003C_003Eu__1 = val2;281 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<IEntity[]>, _003C_CopyAsync_003Ed__1>(ref val2, ref this);282 return;283 }284 goto IL_0145;285 IL_01f5:286 val.GetResult();287 _003C_003E7__wrap2 = Enumerable.Where<IEntity>((System.Collections.Generic.IEnumerable<IEntity>)_003Ccopy_003E5__2, (Func<IEntity, bool>)((IEntity e) => string.Equals(e.Tablename, "DialogRichMailBody", (StringComparison)5))).GetEnumerator();288 break;289 }290 try291 {292 if (num != 3)293 {294 if (num != 4)295 {296 goto IL_038b;297 }298 val = _003C_003Eu__2;299 _003C_003Eu__2 = default(ConfiguredValueTaskAwaiter<ApplyResult>);300 num = (_003C_003E1__state = -1);301 goto IL_037c;302 }303 ConfiguredValueTaskAwaiter<string> val3 = _003C_003Eu__3;304 _003C_003Eu__3 = default(ConfiguredValueTaskAwaiter<string>);305 num = (_003C_003E1__state = -1);306 goto IL_02c9;307 IL_037c:308 val.GetResult();309 _003Cbody_003E5__4 = null;310 goto IL_038b;311 IL_038b:312 if (((System.Collections.IEnumerator)_003C_003E7__wrap2).MoveNext())313 {314 _003Cbody_003E5__4 = _003C_003E7__wrap2.Current;315 val3 = _003Cbody_003E5__4.GetValueAsync<string>("RichMailBody", ct).ConfigureAwait(false).GetAwaiter();316 if (!val3.IsCompleted)317 {318 num = (_003C_003E1__state = 3);319 _003C_003Eu__3 = val3;320 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<string>, _003C_CopyAsync_003Ed__1>(ref val3, ref this);321 return;322 }323 goto IL_02c9;324 }325 goto end_IL_0233;326 IL_02c9:327 string result3 = val3.GetResult();328 result3 = Enumerable.Aggregate<KeyValuePair<string, string>, string>((System.Collections.Generic.IEnumerable<KeyValuePair<string, string>>)_003C_003E8__1.replacements, result3, (Func<string, KeyValuePair<string, string>, string>)((string current, KeyValuePair<string, string> mapping) => current.Replace(mapping.Key, mapping.Value)));329 val = _003Cbody_003E5__4.PutValueAsync("RichMailBody", result3, ct).ConfigureAwait(false).GetAwaiter();330 if (!val.IsCompleted)331 {332 num = (_003C_003E1__state = 4);333 _003C_003Eu__2 = val;334 _003C_003Et__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<ApplyResult>, _003C_CopyAsync_003Ed__1>(ref val, ref this);335 return;336 }337 goto IL_037c;338 end_IL_0233:;339 }340 finally341 {342 if (num < 0 && _003C_003E7__wrap2 != null)343 {344 ((System.IDisposable)_003C_003E7__wrap2).Dispose();345 }346 }347 _003C_003E7__wrap2 = null;348 result4 = _003Ccopy_003E5__2;349 }350 catch (System.Exception exception)351 {352 _003C_003E1__state = -2;353 _003C_003E8__1 = null;354 _003Ccopy_003E5__2 = null;355 _003C_003Et__builder.SetException(exception);356 return;357 }358 _003C_003E1__state = -2;359 _003C_003E8__1 = null;360 _003Ccopy_003E5__2 = null;361 _003C_003Et__builder.SetResult(result4);362 }363364 [DebuggerHidden]365 private void SetStateMachine(IAsyncStateMachine stateMachine)366 {367 _003C_003Et__builder.SetStateMachine(stateMachine);368 }369 }370371 public DialogRichMail()372 {373 CanEdit("UID_DialogParameterSet").From("MailDesignType").As<int>((Func<int, bool>)((int tp) => tp == 1 || tp == 2)).ClearValueOnFalse();374 RegisterFunction("Copy").As<string, IEntity[]>(_CopyAsync).Behavior(MethodBehavior.SingleObject | MethodBehavior.ChangesExternalState);375 RegisterMethod("CopyAndSave").As<string>([AsyncStateMachine(typeof(_003C_003C_002Dctor_003Eb__0_1_003Ed))] [CompilerGenerated] (ISession s, IEntity e, string ident, CancellationToken ct) =>376 {377 //IL_0002: Unknown result type (might be due to invalid IL or missing references)378 //IL_0007: Unknown result type (might be due to invalid IL or missing references)379 //IL_002e: Unknown result type (might be due to invalid IL or missing references)380 //IL_0030: Unknown result type (might be due to invalid IL or missing references)381 _003C_003C_002Dctor_003Eb__0_1_003Ed _003C_003C_002Dctor_003Eb__0_1_003Ed = default(_003C_003C_002Dctor_003Eb__0_1_003Ed);382 _003C_003C_002Dctor_003Eb__0_1_003Ed._003C_003Et__builder = AsyncTaskMethodBuilder.Create();383 _003C_003C_002Dctor_003Eb__0_1_003Ed._003C_003E4__this = this;384 _003C_003C_002Dctor_003Eb__0_1_003Ed.s = s;385 _003C_003C_002Dctor_003Eb__0_1_003Ed.e = e;386 _003C_003C_002Dctor_003Eb__0_1_003Ed.ident = ident;387 _003C_003C_002Dctor_003Eb__0_1_003Ed.ct = ct;388 _003C_003C_002Dctor_003Eb__0_1_003Ed._003C_003E1__state = -1;389 ((AsyncTaskMethodBuilder)(ref _003C_003C_002Dctor_003Eb__0_1_003Ed._003C_003Et__builder)).Start<_003C_003C_002Dctor_003Eb__0_1_003Ed>(ref _003C_003C_002Dctor_003Eb__0_1_003Ed);390 return ((AsyncTaskMethodBuilder)(ref _003C_003C_002Dctor_003Eb__0_1_003Ed._003C_003Et__builder)).Task;391 }).Behavior(MethodBehavior.SingleObject | MethodBehavior.ChangesExternalState);392 }393394 [AsyncStateMachine(typeof(_003C_CopyAsync_003Ed__1))]395 private async System.Threading.Tasks.Task<IEntity[]> _CopyAsync(ISession session, IEntity richMail, string newIdent, CancellationToken ct)396 {397 //IL_0002: Unknown result type (might be due to invalid IL or missing references)398 //IL_0007: Unknown result type (might be due to invalid IL or missing references)399 //IL_0026: Unknown result type (might be due to invalid IL or missing references)400 //IL_0028: Unknown result type (might be due to invalid IL or missing references)401 IEntity[] graph = await richMail.CollectGraphAsync(session, new global::_003C_003Ez__ReadOnlyArray<string>(new string[2] { "DialogRichMailBody.UID_DialogRichMail", "DialogRichMailImage.UID_DialogRichMailBody" }), ct).ConfigureAwait(false);402 IDictionary<string, string> replacements = null;403 IEntity[] copy = await graph.CopyAsync(session, EntityCreationType.DelayedLogic, null, null, delegate(IDictionary<string, string> rpl)404 {405 replacements = rpl;406 }, ct).ConfigureAwait(false);407 await Enumerable.First<IEntity>((System.Collections.Generic.IEnumerable<IEntity>)copy, (Func<IEntity, bool>)((IEntity e) => string.Equals(e.Tablename, "DialogRichMail", (StringComparison)5))).PutValueAsync("Ident_DialogRichMail", newIdent, ct).ConfigureAwait(false);408 System.Collections.Generic.IEnumerator<IEntity> enumerator = Enumerable.Where<IEntity>((System.Collections.Generic.IEnumerable<IEntity>)copy, (Func<IEntity, bool>)((IEntity e) => string.Equals(e.Tablename, "DialogRichMailBody", (StringComparison)5))).GetEnumerator();409 try410 {411 while (((System.Collections.IEnumerator)enumerator).MoveNext())412 {413 IEntity body = enumerator.Current;414 string text = await body.GetValueAsync<string>("RichMailBody", ct).ConfigureAwait(false);415 text = Enumerable.Aggregate<KeyValuePair<string, string>, string>((System.Collections.Generic.IEnumerable<KeyValuePair<string, string>>)replacements, text, (Func<string, KeyValuePair<string, string>, string>)((string current, KeyValuePair<string, string> mapping) => current.Replace(mapping.Key, mapping.Value)));416 await body.PutValueAsync("RichMailBody", text, ct).ConfigureAwait(false);417 }418 }419 finally420 {421 ((System.IDisposable)enumerator)?.Dispose();422 }423 return copy;424 }425}426