Esempio n. 1
0
        public JStruct FromServer(Net.ResponseBytes resp)
        {
            try
            {
                var js = this.JDeserializemyData(Encoding.ASCII.GetString(File.ReadAllBytes(resp.SavedDataPath)));
                return(js);
            }
            catch (Exception ex)
            {
                ex.Log("Error Reading json from Server");
            }

            return(null);
        }
Esempio n. 2
0
        private void ResolveTcpRequest(int code, TcpClient client, Net.ResponseBytes resp)
        {
            switch (code)
            {
            case Engine_Code.Message:
            {
                var js = new JStruct().FromServer(resp);
                DefaultScene.Actions.Add(() =>
                    {
                        new Urho3DNet.MessageBox(DefaultScene.scene.Context, js.JsMessage);
                        js           = new JStruct();
                        js.JsMessage = "Message Sent";
                        SendRequestToClient(js);
                    });
                break;
            }

            case Engine_Code.DrawGeometry:
            {
                try
                {
                    var js = new JStruct().FromServer(resp);
                    var geometryFolderPaths = "".JDeserializemyData(js.JsData);
                    var geometryFilePaths   = Directory.GetFiles(geometryFolderPaths).ToList();
                    DefaultScene.Actions.Add(() =>
                        {
                            DefaultScene.Instance.DrawGeometryFromRevit(geometryFilePaths);
                        });
                }
                catch (Exception ex)
                {
                    ex.Log("Error DrawingGeometry from TCP", Logger.ErrorType.Warrning);
                }

                break;
            }

            default:
                break;
            }
        }