Example #1
0
        //must be 1 reference only
        public static async Task CreateOutputWF()
        {
            //STEP_.RESULT #99 CreateOutputWF
            var stringContent = File.ReadAllText(FileEndPointManager.InputWFFilePath);

            var cmd     = ReadInputWFCmdJsonFile();
            var payload = cmd; //(RunWFCmdParam)cmd.Payload;

            var result = FileEndPointManager.ReadMyGrabValueFile();

            var @event = new DevNoteIntegrationEvent
            {
                GuidId          = cmd.GuidId,
                EventParameters = cmd.EventParameters,
                EventName       = cmd.EventName,
                OuputResponse   = result,
                RetryCount      = payload.RetryCount,
                ErrorCode       = payload.ErrorCode
            };

            stringContent = JsonConvert.SerializeObject(@event);



            // var stringContent = JsonConvert.SerializeObject(cmd); //new StringContent(JsonConvert.SerializeObject(cmd), Encoding.UTF8, "application/json");
            var file = Path.Combine(FileEndPointManager.MyWaitOneDirectory, EnumFiles.WFOutput);



            //_HACK safe to delete
            #region ---TEST ONLY: Compiler will  automatically erase this in RELEASE mode and it will not run if Global.GlobalTestMode is not set to TestMode.Simulation
#if OVERRIDE || DEBUG
            //System.Diagnostics.Debug.WriteLine("HACK-TEST -");
            //await BotHttpClient.Log("FileEndPointManager.MyWaitOneDirectory:" + FileEndPointManager.MyWaitOneDirectory);
            //await BotHttpClient.Log("OuputResponse:" + result);
#endif
            #endregion //////////////END TEST



            await BotHttpClient.Log("OuputValue:" + result);



            File.WriteAllText(file, stringContent);

            if (!string.IsNullOrEmpty(cmd.EventFilePath))
            {
                try
                {
                    if (File.Exists(cmd.EventFilePath))
                    {
                        File.Delete(cmd.EventFilePath);
                    }
                }
                catch (Exception err)
                {
                    await BotHttpClient.Log(err.Message, true);
                }
            }

            //STEP_.RESULT #6 save to OUTCOME
            var fName = Path.GetFileName(cmd.EventFilePath);
            fName = fName.Replace(EnumFiles.WFInput, EnumFiles.WFOutput);

            file = Path.Combine(FileEndPointManager.MyOutcomeFolder, fName);
            File.WriteAllText(file, stringContent);

            await BotHttpClient.Log("EventOutputStatus: " + Environment.NewLine + stringContent);


            //var fileIn = Path.Combine(FileEndPointManager.MyWaitOneDirectory, EnumFiles.WFInput);
            //if (File.Exists(fileIn))
            //    File.Delete(fileIn);
            ClearInputWF();

            //delete Eventfile
            if (!string.IsNullOrEmpty(cmd.EventFilePath))
            {
                try
                {
                    if (File.Exists(cmd.EventFilePath))
                    {
                        File.Delete(cmd.EventFilePath);
                    }
                }
                catch (Exception err)
                {
                    await BotHttpClient.Log(err.Message, true);
                }
            }
        }
Example #2
0
 //STEP_.Player #891 RESULTS
 public static async Task CreateWFOutput()
 {
     //var IsWeb= AutoPlayPolicy.AssertWFOutputCreatedByPlayer();
     await FileEndPointManager.CreateOutputWF();
 }