예제 #1
0
        public async Task <IActionResult> PutHead(long id, [FromBody] HeadModel headMoved)
        {
            RobotModel robot = await _context.Robots.FindAsync(id);

            if (robot is null)
            {
                return(NotFound());
            }

            var robotVO     = _mapper.Map <RobotVO>(robot);
            var headMovedVO = _mapper.Map <HeadVO>(headMoved);

            var canMoveHead = _headMovement.CanMoveHead(robotVO, headMovedVO);

            if (canMoveHead == false)
            {
                return(BadRequest(new { canMoveHead }));
            }

            robot.Head = headMoved;

            _context.Entry(robot).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(Ok(new { canMoveHead }));
        }
예제 #2
0
        public async Task PushBlockHeader(HeadModel model)
        {
            //await _hubContext.Clients.All.SendAsync("block_headers", new PushMessage(model));
            await _hubContext.Clients.Groups("block_headers").SendAsync("block_headers", new PushMessage(model));

            _log.LogDebug($"Processing block {model.level}. Block header messages have been sent.");
        }
예제 #3
0
    public void SetData(HeadModel model)
    {
        _model       = model;
        _curHeadPath = model.GetCurPlayerHeadPath();
        var userData = GlobalData.PlayerModel.PlayerVo.UserOther;

        _headId      = userData.Avatar;
        _headFrameId = userData.AvatarBox;


        CreateHeadItem(model.GetAllUserHeadData());
        SetFontColor("All");
        CreateHeadFrameItem(model.UserHeadFrameData);

        var curHeadVo      = model.GetHeadInfo(_headId);
        var curHeadFrameVo = model.GetHeadFrameVo(_headFrameId);



        _headImg.texture      = ResourceManager.Load <Texture>(curHeadVo.Path);
        _headFrameImg.texture = ResourceManager.Load <Texture>(curHeadFrameVo.Path);

        _headContent.GetText("Text").text      = "";
        _headFrameContent.GetText("Text").text = "";
        SetHeadFrameRedDot();
    }
예제 #4
0
        /// <summary>
        /// 记录请求日志并转把head中的transactionId和timestamp做格式校验,通过则赋值给request
        /// </summary>
        /// <param name="context">上下文</param>
        /// <param name="requestJsonBody">请求jsonBody</param>
        /// <param name="ip">调用方接收方ip地址</param>
        /// <param name="url">url地址</param>
        /// <param name="function">方法名称</param>
        public void RecordRequestLog(ActionExecutingContext context, string requestJsonBody, string ip, string url, string function)
        {
            var    heads = context.HttpContext.Request.Headers;
            string appId = "", transactionId = "", token = "", timestamp = "", sign = "", version = "";

            foreach (var item in heads)
            {
                switch (item.Key.ToUpper())
                {
                case "APPID":
                    appId = item.Value;
                    break;

                case "TRANSACTIONID":
                    transactionId = item.Value;
                    break;

                case "TOKEN":
                    token = item.Value;
                    break;

                case "TIMESTAMP":
                    timestamp = item.Value;
                    break;

                case "SIGN":
                    sign = item.Value;
                    break;

                case "VERSION":
                    version = item.Value;
                    break;

                default:
                    break;
                }
            }
            HeadModel headModel = new HeadModel();

            headModel.AppId         = appId;
            headModel.Token         = token;
            headModel.Timestamp     = timestamp;
            headModel.Sign          = sign;
            headModel.Version       = version;
            headModel.TransactionId = transactionId;
            RequestLog request = new RequestLog();

            request.URI     = "url";
            request.Method  = function;
            request.IP      = ip;
            request.LogData = requestJsonBody;
            request.Head    = headModel;

            string logInfo = string.Format("请求Url{0},请求参数{1}", url, JsonConvert.SerializeObject(request));

            _Log4Net.Info(logInfo);
            //var app_SysLogDomainService = IoC.Resolve<IAPP_SysLogDomainService>();
            //app_SysLogDomainService.AddLogInfo("RecordRequestLog", logInfo);
        }
예제 #5
0
        public static HeadModel CreateNormalModel()
        {
            HeadModel model = new HeadModel();

            model.DescriptionRow = 2;
            model.DataRow        = 3;
            model.SideRow        = -1;
            return(model);
        }
예제 #6
0
        public override void Generate(ISheet sheet, Schema schema, HeadModel headModel, Side side, string outputFile)
        {
            DataReader dataReader = new DataReader();

            dataReader.headModel = headModel;
            dataReader.side      = side;

            object list = dataReader.ReadList(sheet, schema, headModel);

            string folder = Path.GetDirectoryName(outputFile);

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            SaveToJsonFile(outputFile, list);
        }
예제 #7
0
    public void SetData(PlayerVo vo)
    {
        data = vo;

        _name.text  = vo.UserName;
        _id.text    = vo.UserId.ToString();
        _level.text = I18NManager.Get("Common_Level", vo.Level);

        _exp.text             = I18NManager.Get("Common_LevelProportion", vo.CurrentLevelExp, vo.NeedExp);
        _progressBar.Progress = (int)((float)vo.CurrentLevelExp / vo.NeedExp * 100);

        SetStarPos();

        _headModel = new HeadModel();
        SetHeadImg();
        SetHeadRedDot();
    }
예제 #8
0
        public static Task Message(
            [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req,
            [SignalR(HubName = "broadcast")] IAsyncCollector <SignalRMessage> signalRMessages,
            ILogger log)
        {
            try
            {
                JsonConvert.DefaultSettings = () => new JsonSerializerSettings
                {
                    NullValueHandling = NullValueHandling.Ignore
                };

                var requestBody = new StreamReader(req.Body).ReadToEnd();

                if (string.IsNullOrEmpty(requestBody))
                {
                    log.LogError("Payload was null or empty");
                    return(Task.CompletedTask);
                }
                log.LogTrace($"Message with payload {requestBody}");

                var model = JsonConvert.DeserializeObject <BlockRpcEntity>(requestBody);
                log.LogInformation($"Message with block level {model.header.level}");

                var blockHeader = new HeadModel(model);
                signalRMessages.AddAsync(new SignalRMessage
                {
                    Target    = "block_headers",
                    Arguments = new object[] { new PushMessage(blockHeader) }
                });

                var operations = model.GetOperations();
                PushTransactions(signalRMessages, operations, model);
                PushDelegations(signalRMessages, operations, model);
                PushOriginations(signalRMessages, operations, model);
            }
            catch (Exception e)
            {
                log.LogError(e, "Error during running message function");
            }

            return(Task.CompletedTask);
        }
예제 #9
0
        public void SetHat(GorillaHat hat)
        {
            Hat = hat;
            if (previewHat != null)
            {
                Destroy(previewHat);
                previewHat = null;
            }
            if (Hat != null)
            {
                previewHat = Hat.GetCleanAsset();
                HeadModel controlledModel = wardrobeItemButton.controlledModel;
                previewHat.transform.parent = controlledModel.gameObject.transform;
                // TODO: Get the actual proper numbers
                previewHat.transform.localPosition = Constants.PreviewHatLocalPosition;
                previewHat.transform.localRotation = Constants.PreviewHatLocalRotation;
                previewHat.transform.localScale    = Constants.PreviewHatLocalScale;
            }

            UpdateButton();
        }
예제 #10
0
        public async Task <object> createHeadModel([FromBody] HeadModelData data)
        {
            var study = protocol.Studies.FirstOrDefault(x => x.Id == data.StudyID);
            var obj   = new HeadModel(data)
            {
                Study = study
            };

            //set parent url
            obj.Parent.Url = mapUrl(protocol.Id.ToString(), study.Id.ToString(), obj.Parent.Id.ToString(), "data");

            context.HeadModels.Add(obj);
            context.FunctionalFiles.Add(obj.Parent);
            history.HistoryEvent += $"create {obj.GetType().Name} {study.Id} {obj.Id}";
            await context.SaveChangesAsync();

            return(new Uploadinfo
            {
                Uploadid = FileController.createFunctionalFileQueueItem(obj, session, data.Md5, data.FileName).ToString(),
                Fid = obj.Parent.Id.ToString()
            });
        }
예제 #11
0
        public async Task PushBlockHeader(IClientProxy clientsCaller, HeadModel model)
        {
            await clientsCaller.SendAsync("block_headers", new PushMessage(model));

            _log.LogDebug($"Processing history block {model.level}. Block header message have been sent.");
        }
예제 #12
0
 public virtual void Generate(ISheet sheet, Schema schema, HeadModel headModel, Side side, string outputFile)
 {
 }
예제 #13
0
        public static HeadModel CreateModel()
        {
            HeadModel model = new HeadModel();

            return(model);
        }
예제 #14
0
파일: Program.cs 프로젝트: trarck/ExcelData
        static void Main(string[] args)
        {
            string excelFile     = null;
            string dataFile      = null;
            Side   side          = Side.All;
            string headModel     = null;
            string dataFormatStr = null;
            string dataType      = "List<Dictionary<string, object>>";

            optionSet = new OptionSet()
            {
                { "excelFile=", "Excel folder path", s => excelFile = s },
                { "dataFile=", "The code out folder", s => dataFile = s },
                { "headModel=", "The last export info.", s => headModel = s },
                { "side=", "The last export info.", s => side = (Side)Enum.Parse(typeof(Side), s) },
                { "dataFormat=", "Data format", s => dataFormatStr = s },
                { "dataType=", "Data Type", s => dataType = s },
            };

            optionSet.Parse(args);

            if (string.IsNullOrEmpty(excelFile))
            {
                Console.WriteLine("Excel file is null");
                return;
            }

            if (string.IsNullOrEmpty(dataFile))
            {
                Console.WriteLine("Code out path is null");
                return;
            }

            if (!Path.IsPathRooted(excelFile))
            {
                excelFile = Path.Combine(Directory.GetCurrentDirectory(), excelFile);
            }

            if (!Path.IsPathRooted(dataFile))
            {
                dataFile = Path.Combine(Directory.GetCurrentDirectory(), dataFile);
            }

            ImportSetting setting = new ImportSetting();

            if (!string.IsNullOrEmpty(headModel))
            {
                switch (headModel)
                {
                case "Normal":
                    setting.headModel = HeadModel.CreateNormalModel();
                    break;

                case "Simple":
                    setting.headModel = HeadModel.CreateSimpleModel();
                    break;

                //use default have side
                case "All":
                default:
                    break;
                }
            }

            ExcelImport import = new ExcelImport(setting);

            import.side = side;


            DataFormat dataFormat = (DataFormat)Enum.Parse(typeof(DataFormat), dataFormatStr);

            import.dataFormat = dataFormat;
            import.dataType   = TypeInfo.Parse(dataType).ToSystemType();

            import.Import(dataFile, excelFile);
        }
예제 #15
0
파일: Program.cs 프로젝트: trarck/ExcelData
        static void Main(string[] args)
        {
            string excelDir       = null;
            string codeOutPath    = null;
            string dataOutPath    = null;
            string codeNamespace  = "";
            string exportInfo     = null;
            Side   side           = Side.All;
            string headModel      = null;
            string templateFolder = null;

            List <string> codeFormats = new List <string>();
            List <string> dataFormats = new List <string>();

            optionSet = new OptionSet()
            {
                { "excelDir=", "Excel folder path", s => excelDir = s },
                { "codeOutDir=", "The code out folder", s => codeOutPath = s },
                { "dataOutPath=", "The data out folder", s => dataOutPath = s },
                { "codeNamespace=", "The code namspace", s => codeNamespace = s },
                { "codeFormat=", "Code language[CSharp,Cpp,Lua,Javascript]", s => codeFormats.Add(s) },
                { "dataFormat=", "Aata type [Json,Xml,Binary,LuaTable,UnityScriptable]", s => dataFormats.Add(s) },
                { "exportInfo=", "The last export info.", s => exportInfo = s },
                { "side=", "The last export info.", s => side = (Side)Enum.Parse(typeof(Side), s) },
                { "headModel=", "The last export info.", s => headModel = s },
                { "templatePath=", "The last export info.", s => templateFolder = s }
            };

            optionSet.Parse(args);

            if (string.IsNullOrEmpty(excelDir))
            {
                System.Console.WriteLine("Excel path is null");
                return;
            }

            if (string.IsNullOrEmpty(codeOutPath))
            {
                System.Console.WriteLine("Code out path is null");
                return;
            }

            if (string.IsNullOrEmpty(dataOutPath))
            {
                System.Console.WriteLine("Data out path is null");
                return;
            }


            if (!Path.IsPathRooted(excelDir))
            {
                excelDir = Path.Combine(Directory.GetCurrentDirectory(), excelDir);
            }

            if (!Path.IsPathRooted(codeOutPath))
            {
                codeOutPath = Path.Combine(Directory.GetCurrentDirectory(), codeOutPath);
            }

            if (!Path.IsPathRooted(dataOutPath))
            {
                dataOutPath = Path.Combine(Directory.GetCurrentDirectory(), dataOutPath);
            }

            if (!string.IsNullOrEmpty(exportInfo) && !Path.IsPathRooted(exportInfo))
            {
                exportInfo = Path.Combine(Directory.GetCurrentDirectory(), exportInfo);
            }

            ExportSetting setting = new ExportSetting();

            if (!string.IsNullOrEmpty(headModel))
            {
                switch (headModel)
                {
                case "Normal":
                    setting.headModel = HeadModel.CreateNormalModel();
                    break;

                case "Simple":
                    setting.headModel = HeadModel.CreateSimpleModel();
                    break;

                default:    //All
                    //use default have side
                    break;
                }
            }

            if (!string.IsNullOrEmpty(templateFolder))
            {
                setting.templateFolder = templateFolder;
            }

            ExcelExport export = new ExcelExport(setting);

            export.excelFolderPath   = excelDir;
            export.codeOutFolderPath = codeOutPath;
            export.dataOutFolderPath = dataOutPath;
            export.codeNamespace     = codeNamespace;
            export.side = side;


            CodeFomat codeFormat = CodeFomat.None;

            foreach (string format in codeFormats)
            {
                codeFormat |= (CodeFomat)Enum.Parse(typeof(CodeFomat), format);
            }
            export.codeFormat = codeFormat;

            DataFormat dataFormat = DataFormat.None;

            foreach (string format in dataFormats)
            {
                dataFormat |= (DataFormat)Enum.Parse(typeof(DataFormat), format);
            }
            export.dataFormat = dataFormat;

            export.exportInfoFile = exportInfo;
            Console.WriteLine("Start exporting.......");
            export.Start();
        }