예제 #1
0
 private void button1_Click(object sender, RoutedEventArgs e)//send test request
 {
     button1.IsEnabled = false;
     cmd.command       = "Test";
     cmd.testAuthor    = author.Text.Replace(" ", "_");
     cmd.testName      = name.Text;
     cmd.dateTime      = DateTime.Now.ToString("MM_dd_yyyy_hh_mm_ss");
     //cmd.dateTime = "11_20_2016_09_00_00";
     cmd.xmlFile = System.IO.Path.GetFileName(xmlfile.Text);
     AddTestTime(xmlfile.Text, cmd);
     changeNameAndSendToRepo(xmlfile.Text, cmd);
     for (int i = 0; i < listBox.Items.Count; i++)
     {
         cmd.dllFiles.Add(System.IO.Path.GetFileName((string)listBox.Items.GetItemAt(i)));
         changeNameAndSendToRepo((string)listBox.Items.GetItemAt(i), cmd);
     }
     try
     {
         stringSender   sndr        = new stringSender("http://localhost:8080/THStrRcvr");
         CommandEncoder cmdEnocoder = new CommandEncoder(cmd);
         sndr.PostMessage(cmdEnocoder.encode());
         textBox7.Text += "\n the datetime for query is: " + cmd.dateTime;
         Thread th = new Thread(s => { IsFileExist((string)s); });
         th.Start("../../../log/" + cmd.testAuthor + "_" + cmd.dateTime + ".txt");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     button1.IsEnabled = true;
 }
예제 #2
0
        public void SetReport(ICommandReport ReportTarget)
        {
            _ReportTarget = ReportTarget;


            switch (ConnectionType.ToUpper())
            {
            case "SOCKET":
                //conn = new SocketClient(Config, this);
                conn = new SocketClient(this, this);
                break;

            case "COMPORT":
                conn = new ComPortClient(this, this);
                break;
            }
            _Decoder = new CommandConvert.CommandDecoder(Vendor);

            Encoder = new CommandEncoder(Vendor);


            this.Name         = DeviceName;
            this.Status       = "";
            this._IsConnected = false;
            ThreadPool.QueueUserWorkItem(new WaitCallback(Start));
        }
예제 #3
0
파일: Effect.cs 프로젝트: ElonGame/OpenSAGE
        public void Begin(CommandEncoder commandEncoder)
        {
            commandEncoder.SetPipelineLayout(_pipelineLayout);

            _dirtyFlags |= EffectDirtyFlags.PipelineState;

            OnBegin();
        }
 public RpcProtocolV2()
 {
     encoder          = new RpcCommandEncoderV2();
     decoder          = new RpcCommandDecoderV2();
     commandFactory   = new RpcCommandFactory();
     heartbeatTrigger = new RpcHeartbeatTrigger(commandFactory);
     commandHandler   = new RpcCommandHandler(commandFactory);
 }
예제 #5
0
        public void Begin(CommandEncoder commandEncoder)
        {
            _dirtyFlags |= EffectDirtyFlags.PipelineState;

            foreach (var parameter in _parameters.Values)
            {
                parameter.ResetDirty();
            }
        }
예제 #6
0
        void caseRequestQuary(CommandData cmdData)//command from client to ask a query
        {
            IFileService fs     = null;
            string       CFRcvr = cmdData.url + "/CFRcvr";
            int          count  = 0;

            while (true)
            {
                try
                {
                    fs = TestHarness.fileSender.CreateChannel(CFRcvr);
                    break;
                }
                catch
                {
                    Console.Write("\n  connection to service failed {0} times - trying again", ++count);
                    Thread.Sleep(500);
                    continue;
                }
            }
            Console.Write("\n  Connected to {0}\n", CFRcvr);
            string relativeFilePath = "../../../repo/";
            string filepath         = Path.GetFullPath(relativeFilePath);
            string file             = filepath + cmdData.testAuthor + "_" + cmdData.dateTime + ".txt";

            try
            {
                Console.Write("\n  sending file {0}", file);
                timer.Start();
                if (!fileSender.SendFile(fs, file))
                {
                    timer.Stop();
                    Console.Write("\n  could not send file");
                    cmdData.command = "NoResult";
                    cmdData.from    = "Repository";
                    cmdData.to      = "Client";
                    string csl = cmdData.url + "/CStrRcvr";
                    try{
                        sndr = new stringSender(csl);
                        CommandEncoder cmdEnocoder = new CommandEncoder(cmdData);
                        sndr.PostMessage(cmdEnocoder.encode());
                    }
                    catch (Exception ex) {
                        Console.WriteLine(ex.ToString());
                    }
                }
                else
                {
                    timer.Stop();
                    Console.WriteLine("send file :{0} in {1} ", file, timer.ElapsedTimeSpan);
                }
            }
            catch {}
        }
예제 #7
0
        public void SetReport(ICommandReport ReportTarget)
        {
            _ReportTarget = ReportTarget;


            Encoder = new CommandEncoder(Vendor);

            this.Name         = DeviceName;
            this.Status       = "";
            this._IsConnected = false;
        }
예제 #8
0
파일: Effect.cs 프로젝트: ElonGame/OpenSAGE
        public void Apply(CommandEncoder commandEncoder)
        {
            if (_dirtyFlags.HasFlag(EffectDirtyFlags.PipelineState))
            {
                commandEncoder.SetPipelineState(_pipelineState);

                _dirtyFlags &= ~EffectDirtyFlags.PipelineState;
            }

            OnApply(commandEncoder);
        }
예제 #9
0
        private void Draw(
            CommandEncoder commandEncoder,
            MeshEffect meshEffect,
            EffectPipelineStateHandle pipelineStateHandle,
            IEnumerable <ModelMeshMaterialPass> materialPasses,
            RenderInstanceData instanceData)
        {
            commandEncoder.SetVertexBuffer(2, instanceData.WorldBuffer);

            if (Skinned)
            {
                meshEffect.SetSkinningBuffer(instanceData.SkinningBuffer);
                meshEffect.SetNumBones(NumBones);
            }

            meshEffect.SetSkinningEnabled(Skinned);

            meshEffect.SetMaterials(_materialsBuffer);
            meshEffect.SetTextures(_textures);

            commandEncoder.SetVertexBuffer(0, _vertexBuffer);

            foreach (var materialPass in materialPasses)
            {
                meshEffect.SetTextureIndices(materialPass.TextureIndicesBuffer);
                meshEffect.SetMaterialIndices(materialPass.MaterialIndicesBuffer);
                meshEffect.SetNumTextureStages(materialPass.NumTextureStages);

                commandEncoder.SetVertexBuffer(1, materialPass.TexCoordVertexBuffer);

                foreach (var meshPart in materialPass.MeshParts)
                {
                    if (meshPart.PipelineStateHandle != pipelineStateHandle)
                    {
                        continue;
                    }

                    meshEffect.SetPrimitiveOffset(meshPart.StartIndex / 3);
                    meshEffect.SetAlphaTest(meshPart.AlphaTest);
                    meshEffect.SetTexturing(meshPart.Texturing);

                    meshEffect.Apply(commandEncoder);

                    commandEncoder.DrawIndexedInstanced(
                        PrimitiveType.TriangleList,
                        meshPart.IndexCount,
                        instanceData.NumInstances,
                        _indexBuffer,
                        meshPart.StartIndex);
                }
            }
        }
예제 #10
0
 private CommandBase TryGetCommand(byte[] payloadBytes)
 {
     try
     {
         var decryptedBytes = PayloadHelper.DecodePayloadBytes(payloadBytes, _listenerConfig.Secret);
         return(CommandEncoder.Decode(decryptedBytes));
     }
     catch (Exception ex)
     {
         _logger.LogWarning(ex, "Cannot read payload");
         return(null);
     }
 }
예제 #11
0
        protected override void OnApply(CommandEncoder commandEncoder)
        {
            if (_dirtyFlags.HasFlag(TerrainEffectDirtyFlags.TransformConstants))
            {
                _transformConstants.World = _world;
                _transformConstants.WorldViewProjection = _world * _view * _projection;

                _transformConstantBuffer.UpdateData(ref _transformConstants);

                commandEncoder.SetInlineConstantBuffer(0, _transformConstantBuffer);

                _dirtyFlags &= ~TerrainEffectDirtyFlags.TransformConstants;
            }

            if (_dirtyFlags.HasFlag(TerrainEffectDirtyFlags.LightingConstants))
            {
                Matrix4x4.Invert(_view, out var viewInverse);
                _lightingConstants.CameraPosition = viewInverse.Translation;

                _lightingConstantBuffer.UpdateData(ref _lightingConstants);

                commandEncoder.SetInlineConstantBuffer(1, _lightingConstantBuffer);

                _dirtyFlags &= ~TerrainEffectDirtyFlags.LightingConstants;
            }

            if (_dirtyFlags.HasFlag(TerrainEffectDirtyFlags.TileDataTexture))
            {
                commandEncoder.SetTexture(2, _tileDataTexture);
                _dirtyFlags &= ~TerrainEffectDirtyFlags.TileDataTexture;
            }

            if (_dirtyFlags.HasFlag(TerrainEffectDirtyFlags.CliffDetailsBuffer))
            {
                commandEncoder.SetStaticBuffer(3, _cliffDetailsBuffer);
                _dirtyFlags &= ~TerrainEffectDirtyFlags.CliffDetailsBuffer;
            }

            if (_dirtyFlags.HasFlag(TerrainEffectDirtyFlags.TextureDetailsBuffer))
            {
                commandEncoder.SetStaticBuffer(4, _textureDetailsBuffer);
                _dirtyFlags &= ~TerrainEffectDirtyFlags.TextureDetailsBuffer;
            }

            if (_dirtyFlags.HasFlag(TerrainEffectDirtyFlags.Textures))
            {
                commandEncoder.SetTextureSet(5, _textures);
                _dirtyFlags &= ~TerrainEffectDirtyFlags.Textures;
            }
        }
예제 #12
0
        public void Apply(CommandEncoder commandEncoder)
        {
            if (_dirtyFlags.HasFlag(EffectDirtyFlags.PipelineState))
            {
                commandEncoder.SetPipelineState(_pipelineState);

                _dirtyFlags &= ~EffectDirtyFlags.PipelineState;
            }

            foreach (var parameter in _parameters.Values)
            {
                parameter.ApplyChanges(commandEncoder);
            }
        }
예제 #13
0
        public MainWindow()
        {
            #if DEBUG
            System.Diagnostics.Debugger.Launch();
            #endif

            InitializeComponent();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Logger.OnLogData += Logger_OnLogData;

            _commandParser   = new CommandParser();
            _commandEncoder  = new CommandEncoder();
            _commandExecuter = new CommandExecuter();
        }
예제 #14
0
 void sendFileNotMatch(CommandData cmdData)//when we not find the match
 {
     cmdData.command = "FileNotMatch";
     cmdData.from    = "Repo";
     cmdData.to      = "TH";
     try
     {
         stringSender   sndr        = new stringSender("http://localhost:8080/THStrRcvr");
         CommandEncoder cmdEnocoder = new CommandEncoder(cmdData);
         sndr.PostMessage(cmdEnocoder.encode());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
예제 #15
0
 void sendRunTest(CommandData cmdData)//tell TH to run the test
 {
     cmdData.command = "RunTest";
     cmdData.from    = "Repo";
     cmdData.to      = "TH";
     try
     {
         stringSender   sndr        = new stringSender("http://localhost:8080/THStrRcvr");
         CommandEncoder cmdEnocoder = new CommandEncoder(cmdData);
         sndr.PostMessage(cmdEnocoder.encode());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
예제 #16
0
        public void SetReport(ICommandReport ReportTarget)
        {
            _ReportTarget = ReportTarget;



            _Decoder = new CommandConvert.CommandDecoder(Vendor);

            Encoder = new CommandEncoder(Vendor);


            this.Name   = DeviceName;
            this.Status = "";

            ThreadPool.QueueUserWorkItem(new WaitCallback(Start), NodeManagement.Get("CSTROBOT"));
        }
예제 #17
0
        protected override void OnApply(CommandEncoder commandEncoder)
        {
            if (_dirtyFlags.HasFlag(SpriteEffectDirtyFlags.TextureConstants))
            {
                _textureConstantBuffer.UpdateData(_textureConstants);

                commandEncoder.SetInlineConstantBuffer(0, _textureConstantBuffer);

                _dirtyFlags &= ~SpriteEffectDirtyFlags.TextureConstants;
            }

            if (_dirtyFlags.HasFlag(SpriteEffectDirtyFlags.Texture))
            {
                commandEncoder.SetTexture(1, _texture);
                _dirtyFlags &= ~SpriteEffectDirtyFlags.Texture;
            }
        }
예제 #18
0
        private void UpdateGlobalConstantBuffers(CommandEncoder commandEncoder, RenderContext context)
        {
            var cameraPosition = Matrix4x4Utility.Invert(context.Camera.View).Translation;

            _globalConstantBufferShared.Value.CameraPosition = cameraPosition;
            _globalConstantBufferShared.Update();

            _globalConstantBufferVS.Value.ViewProjection = context.Camera.View * context.Camera.Projection;
            _globalConstantBufferVS.Update();

            _globalConstantBufferPS.Value.TimeInSeconds = (float)context.GameTime.TotalGameTime.TotalSeconds;
            _globalConstantBufferPS.Value.ViewportSize  = context.Camera.Viewport.Size;
            _globalConstantBufferPS.Update();

            _globalLightingTerrainBuffer.Value = context.Scene.Settings.CurrentLightingConfiguration.TerrainLights;
            _globalLightingObjectBuffer.Value  = context.Scene.Settings.CurrentLightingConfiguration.ObjectLights;
            _globalLightingTerrainBuffer.Update();
            _globalLightingObjectBuffer.Update();
        }
예제 #19
0
        private void button5_Click(object sender, RoutedEventArgs e)//send the query request
        {
            cmd.command    = "Request Query";
            cmd.testAuthor = author.Text.Replace(" ", "_");
            cmd.dateTime   = datetime.Text;
            stringSender   sndr        = new stringSender("http://localhost:8081/RepoStrRcvr");
            CommandEncoder cmdEnocoder = new CommandEncoder(cmd);

            sndr.PostMessage(cmdEnocoder.encode());
            if (File.Exists("../../../log/" + cmd.testAuthor + "_" + cmd.dateTime + ".txt"))
            {
                try {
                    File.Delete("../../../log/" + cmd.testAuthor + "_" + cmd.dateTime + ".txt");
                }
                catch
                {
                }
            }
            Thread th = new Thread(s => { IsFileExist((string)s); });

            th.Start("../../../log/" + cmd.testAuthor + "_" + cmd.dateTime + ".txt");
            textBox7.Text += "----------------this is demo for requirement 9";
        }
예제 #20
0
        protected override void OnApply(CommandEncoder commandEncoder)
        {
            if (_dirtyFlags.HasFlag(ParticleEffectDirtyFlags.TransformConstants))
            {
                _transformConstants.World          = _world;
                _transformConstants.ViewProjection = _view * _projection;

                var result = Matrix4x4.Invert(_view, out var viewInverse);
                _transformConstants.CameraPosition = viewInverse.Translation;

                _transformConstantBuffer.UpdateData(_transformConstants);

                commandEncoder.SetInlineConstantBuffer(0, _transformConstantBuffer);

                _dirtyFlags &= ~ParticleEffectDirtyFlags.TransformConstants;
            }

            if (_dirtyFlags.HasFlag(ParticleEffectDirtyFlags.Texture))
            {
                commandEncoder.SetTexture(1, _texture);
                _dirtyFlags &= ~ParticleEffectDirtyFlags.Texture;
            }
        }
예제 #21
0
        static void Main(string[] args)
        {
            Repository repo = new Repository();

            repo.startRepository();
            //------------------test sub------------------
#if (TEST_REPOSITORY)
            CommandData cmd = new CommandData();
            cmd.from       = "client";
            cmd.to         = "repo";
            cmd.testAuthor = "me";
            cmd.testName   = "test";
            cmd.command    = "Request Query";
            DateTime tm = new DateTime(2016, 11, 20, 09, 00, 00);
            cmd.dateTime = tm.ToString("MM_dd_yyyy_hh_mm_ss");
            cmd.url      = "http://localhost:8082/";
            cmd.dllFiles.Add("tc1.dll");
            cmd.dllFiles.Add("tc2.dll");
            cmd.dllFiles.Add("td1.dll");
            cmd.dllFiles.Add("td2.dll");
            cmd.xmlFile = "XMLFile1.xml";
            try
            {
                stringSender   sndr        = new stringSender("http://localhost:8081/RepoStrRcvr");
                CommandEncoder cmdEnocoder = new CommandEncoder(cmd);
                sndr.PostMessage(cmdEnocoder.encode());
                cmd.testAuthor = "me1";
                cmdEnocoder    = new CommandEncoder(cmd);
                sndr.PostMessage(cmdEnocoder.encode());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
#endif
        }
예제 #22
0
        protected override void OnApply(CommandEncoder commandEncoder)
        {
            if (_dirtyFlags.HasFlag(MeshEffectDirtyFlags.SkinningConstants))
            {
                if (_skinningBuffer != null)
                {
                    commandEncoder.SetInlineStructuredBuffer(2, _skinningBuffer);
                }

                _dirtyFlags &= ~MeshEffectDirtyFlags.SkinningConstants;
            }

            if (_dirtyFlags.HasFlag(MeshEffectDirtyFlags.TransformConstants))
            {
                _transformConstants.ViewProjection = _view * _projection;

                _transformConstantBuffer.UpdateData(ref _transformConstants);

                commandEncoder.SetInlineConstantBuffer(1, _transformConstantBuffer);

                _dirtyFlags &= ~MeshEffectDirtyFlags.TransformConstants;
            }

            if (_dirtyFlags.HasFlag(MeshEffectDirtyFlags.LightingConstants))
            {
                Matrix4x4.Invert(_view, out var viewInverse);
                _lightingConstants.CameraPosition = viewInverse.Translation;

                _lightingConstantBuffer.UpdateData(ref _lightingConstants);

                commandEncoder.SetInlineConstantBuffer(3, _lightingConstantBuffer);

                _dirtyFlags &= ~MeshEffectDirtyFlags.LightingConstants;
            }

            if (_dirtyFlags.HasFlag(MeshEffectDirtyFlags.PerDrawConstants))
            {
                _perDrawConstantBuffer.UpdateData(ref _perDrawConstants);

                commandEncoder.SetInlineConstantBuffer(0, _perDrawConstantBuffer);

                _dirtyFlags &= ~MeshEffectDirtyFlags.PerDrawConstants;
            }

            if (_dirtyFlags.HasFlag(MeshEffectDirtyFlags.MaterialsBuffer))
            {
                commandEncoder.SetStaticBuffer(6, _materialsBuffer);
                _dirtyFlags &= ~MeshEffectDirtyFlags.MaterialsBuffer;
            }

            if (_dirtyFlags.HasFlag(MeshEffectDirtyFlags.Textures))
            {
                commandEncoder.SetTextureSet(7, _textures);
                _dirtyFlags &= ~MeshEffectDirtyFlags.Textures;
            }

            if (_dirtyFlags.HasFlag(MeshEffectDirtyFlags.TextureIndicesBuffer))
            {
                commandEncoder.SetStaticBuffer(5, _textureIndicesBuffer);
                _dirtyFlags &= ~MeshEffectDirtyFlags.TextureIndicesBuffer;
            }

            if (_dirtyFlags.HasFlag(MeshEffectDirtyFlags.MaterialIndicesBuffer))
            {
                commandEncoder.SetStaticBuffer(4, _materialIndicesBuffer);
                _dirtyFlags &= ~MeshEffectDirtyFlags.MaterialIndicesBuffer;
            }
        }
예제 #23
0
        private byte[] CreatePayloadBytes(CommandBase command)
        {
            var commandBytes = CommandEncoder.Encode(command);

            return(PayloadHelper.CreatePayloadBytes(commandBytes, RemoteEndPoint.Secret));
        }
예제 #24
0
파일: Effect.cs 프로젝트: ElonGame/OpenSAGE
 protected abstract void OnApply(CommandEncoder commandEncoder);
예제 #25
0
        public void ApplyChanges(CommandEncoder commandEncoder)
        {
            if (!_isDirty)
            {
                return;
            }

            switch (ResourceBinding.ResourceType)
            {
            case ShaderResourceType.ConstantBuffer:
                switch (ResourceBinding.ShaderType)
                {
                case ShaderType.VertexShader:
                    commandEncoder.SetVertexShaderConstantBuffer(ResourceBinding.Slot, (Buffer)_data);
                    break;

                case ShaderType.PixelShader:
                    commandEncoder.SetPixelShaderConstantBuffer(ResourceBinding.Slot, (Buffer)_data);
                    break;

                default:
                    throw new InvalidOperationException();
                }
                break;

            case ShaderResourceType.StructuredBuffer:
                switch (ResourceBinding.ShaderType)
                {
                case ShaderType.VertexShader:
                    commandEncoder.SetVertexShaderStructuredBuffer(ResourceBinding.Slot, (Buffer)_data);
                    break;

                case ShaderType.PixelShader:
                    commandEncoder.SetPixelShaderStructuredBuffer(ResourceBinding.Slot, (Buffer)_data);
                    break;

                default:
                    throw new InvalidOperationException();
                }
                break;

            case ShaderResourceType.Texture:
                switch (ResourceBinding.ShaderType)
                {
                case ShaderType.VertexShader:
                    commandEncoder.SetVertexShaderTexture(ResourceBinding.Slot, (Texture)_data);
                    break;

                case ShaderType.PixelShader:
                    commandEncoder.SetPixelShaderTexture(ResourceBinding.Slot, (Texture)_data);
                    break;

                default:
                    throw new InvalidOperationException();
                }
                break;

            case ShaderResourceType.Sampler:
                switch (ResourceBinding.ShaderType)
                {
                case ShaderType.VertexShader:
                    commandEncoder.SetVertexShaderSampler(ResourceBinding.Slot, (SamplerState)_data);
                    break;

                case ShaderType.PixelShader:
                    commandEncoder.SetPixelShaderSampler(ResourceBinding.Slot, (SamplerState)_data);
                    break;

                default:
                    throw new InvalidOperationException();
                }
                break;

            default:
                throw new InvalidOperationException();
            }

            _isDirty = false;
        }