コード例 #1
0
        protected async override Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            IInvoker invoker    = JavaScope.GetJavaInvoker(context);
            var      fieldName  = FieldName.Get(context) ?? throw new ArgumentNullException(Resources.FieldName);
            var      javaObject = TargetObject.Get(context);
            var      className  = TargetType.Get(context);

            if (javaObject == null && className == null)
            {
                throw new InvalidOperationException(Resources.InvokationObjectException);
            }

            JavaObject instance;

            try
            {
                instance = await invoker.InvokeGetField(javaObject, fieldName, className, cancellationToken);
            }
            catch (Exception e)
            {
                Trace.TraceError($"Could not get java field: {e}");
                throw new InvalidOperationException(Resources.GetFieldException, e);
            }

            return(asyncCodeActivityContext =>
            {
                Result.Set(asyncCodeActivityContext, instance);
            });
        }
コード例 #2
0
ファイル: MapJumpO.cs プロジェクト: Sebanisu/OpenVIII
 public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services) => sw.Format(formatterContext, services)
 .CommentLine(FieldName.Get(_fieldMapId))
 .StaticType(nameof(IFieldService))
 .Method(nameof(IFieldService.GoTo))
 .Enum(_fieldMapId)
 .Argument("walkmeshId", _walkmeshId)
 .Comment(nameof(MapJumpO));
コード例 #3
0
ファイル: PREMAPJUMP2.cs プロジェクト: hollow87/OpenVIII
 public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     sw.Format(formatterContext, services)
     .CommentLine(FieldName.Get(_fieldMapId))
     .StaticType(nameof(IFieldService))
     .Method(nameof(IFieldService.PrepareGoTo))
     .Enum(_fieldMapId)
     .Comment(nameof(PREMAPJUMP2));
 }