public async Task <Tuple <bool, string, RegisterKey> > RegisterKeyGenearation(RegisterKey obj)
        {
            Tuple <bool, string, RegisterKey> objKey = null;
            RegisterKey regkey = new RegisterKey();

            try
            {
                var regKey = Helper.GenerateSecretKey();

                var parameters = new DynamicParameters();
                using (SqlConnection cxn = new SqlConnection(_dcDb))
                {
                    parameters.Add("@PhoneNumber", obj.PhoneNumber, DbType.String);
                    parameters.Add("@RegKey", regKey, DbType.String);
                    parameters.Add("@CreatedBy", userID, DbType.String);
                    parameters.Add("@CreatedDate", DateTime.Now, DbType.DateTime);
                    parameters.Add("@RegKeyStatus", "Issued", DbType.String);

                    var resultObj = await cxn.QueryAsync <RegisterKey>("dbo.Insert_RegisterKey", parameters, commandType : CommandType.StoredProcedure);

                    regkey = resultObj.Single() as RegisterKey;

                    cxn.Close();
                }
                objKey = Tuple.Create(true, "Register key generated successfully.", regkey);
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
                objKey = Tuple.Create(false, "Oops! Register key generation failed.Please try again.", regkey);
            }

            return(objKey);
        }
Ejemplo n.º 2
0
        public int GetRegisterFullLength(RegisterKey registerKey)
        {
            if (registerKey.Type == RegisterType.Const)
            {
                var constant = FindConstant(ParameterType.Float, registerKey.Number);
                return(constant.Columns);
            }

            RegisterDeclaration decl = _registerDeclarations[registerKey];

            switch (decl.TypeName)
            {
            case "float":
                return(1);

            case "float2":
                return(2);

            case "float3":
                return(3);

            case "float4":
                return(4);

            default:
                throw new InvalidOperationException();
            }
        }
        private TextureLoadOutputNode CreateTextureLoadOutputNode(Instruction instruction, int outputComponent)
        {
            const int TextureCoordsIndex = 1;
            const int SamplerIndex       = 2;

            RegisterKey samplerRegister = instruction.GetParamRegisterKey(SamplerIndex);

            if (!_samplers.TryGetValue(samplerRegister, out HlslTreeNode samplerInput))
            {
                throw new InvalidOperationException();
            }
            var samplerRegisterInput       = (RegisterInputNode)samplerInput;
            int numSamplerOutputComponents = samplerRegisterInput.SamplerTextureDimension;

            IList <HlslTreeNode> texCoords = new List <HlslTreeNode>();

            for (int component = 0; component < numSamplerOutputComponents; component++)
            {
                RegisterComponentKey textureCoordsKey = GetParamRegisterComponentKey(instruction, TextureCoordsIndex, component);
                HlslTreeNode         textureCoord     = _activeOutputs[textureCoordsKey];
                texCoords.Add(textureCoord);
            }

            return(new TextureLoadOutputNode(samplerRegisterInput, texCoords, outputComponent));
        }
        private static RegisterComponentKey GetParamRegisterComponentKey(Instruction instruction, int paramIndex, int component)
        {
            RegisterKey registerKey = instruction.GetParamRegisterKey(paramIndex);

            byte[] swizzle        = instruction.GetSourceSwizzleComponents(paramIndex);
            int    componentIndex = swizzle[component];

            return(new RegisterComponentKey(registerKey, componentIndex));
        }
Ejemplo n.º 5
0
        public string GetDestinationName(Instruction instruction)
        {
            int         destIndex   = instruction.GetDestinationParamIndex();
            RegisterKey registerKey = instruction.GetParamRegisterKey(destIndex);

            string registerName = GetRegisterName(registerKey);

            registerName = registerName ?? instruction.GetParamRegisterName(destIndex);
            int    registerLength = GetRegisterFullLength(registerKey);
            string writeMaskName  = instruction.GetDestinationWriteMaskName(registerLength, true);

            return(string.Format("{0}{1}", registerName, writeMaskName));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// validateDB
        /// </summary>
        /// <param name="dsConfig"></param>
        /// <param name="outPut"></param>
        /// <param name="progress"></param>
        private void ValidateDB(DataSet dsConfig, string outPut, string progress)
        {
            if (progress.ToLower() == "")
            {
                RegisterKey.UpdateRegistryPropertyValue(NewRegistryPath + @"\eFPInstaller", "InstallStep", "validateDB").ToString();
            }
            DataSet dsPreReqConfig = ReadPreReqConfigXML();

            Validation.dsConfig       = dsConfig;
            Validation.dsPreReqConfig = dsPreReqConfig;
            Validation.systemName     = outPut;
            Validation.validateDB();
        }
        public async Task <Tuple <bool, string, string> > VerifySecretKey(RegisterKey resKey)
        {
            Tuple <bool, string, string> result = null;

            try
            {
                result = await _srepo.VerifySecretKey(resKey);
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
            }

            return(result);
        }
Ejemplo n.º 8
0
        public async Task <Tuple <bool, string> > ShareRegisterKey(RegisterKey registerKey)
        {
            Tuple <bool, string> result = null;

            try
            {
                result = await _repo.ShareRegisterKey(registerKey);
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
            }

            return(result);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Constructor
        /// </summary>
        public InstallPage()
        {
            //string NewRegistryPath = @"HKCU:\software";

            InitializeComponent();
            LoadGridData();
            imgPictureBox.Visible = true;
            timer       = new System.Windows.Forms.Timer();
            timer.Tick += timerTick;
            RegisterKey.UpdateRegistryPropertyValue(NewRegistryPath + @"\eFPInstaller", "InstallStep", "").ToString();
            var progress = RegisterKey.GetRegistryPropertyValue(NewRegistryPath + @"\eFPInstaller", "InstallStep");

            if (progress == null | progress == string.Empty)
            {
                RegisterKey.SetRegistry("eFPInstaller", "InstallerStep", NewRegistryPath);
                RegisterKey.SetRegistryProperty(NewRegistryPath + @"\eFPInstaller", "InstallStep", string.Empty, "String");
            }
        }
        public async Task <Tuple <bool, string> > ReSendSMS(RegisterKey resKey)
        {
            Tuple <bool, string> result = null;

            try
            {
                result = await _srepo.SendSMS(resKey.PhoneNumber, resKey.RegKey);

                if (result.Item1)
                {
                    await _srepo.UpdatePhonenumber(resKey.PhoneNumber, resKey.RegKey);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
            }

            return(result);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Step 3
        /// </summary>
        private void StepThree()
        {
            try
            {
                this.dicExceptionAtSteps["Step1"] = "Processing";
                string progress = RegisterKey.GetRegistryPropertyValue(NewRegistryPath + @"\eFPInstaller", "InstallStep");
                if (progress.ToLower() == "checkfordbserver")
                {
                    RegisterKey.UpdateRegistryPropertyValue(NewRegistryPath + @"\eFPInstaller", "InstallStep", "checkforApp").ToString();
                }

                LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + Constants.NEWLINE + " INSTALLING APPLICATION SERVER: " + Constants.CARRIAGERETURNEWLINE);
                if (checkIsItDBServer == false && checkIsAppServer == true)
                {
                    LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + DateTime.Now.ToString("HH:mm:ss") + " The current machine is a Application server " + Constants.CARRIAGERETURNEWLINE);
                }
                else
                {
                    LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + DateTime.Now.ToString("HH:mm:ss") + " The current machine is not a Application server " + Constants.CARRIAGERETURNEWLINE);
                }

                LogFile.Instance.LogMessage("\r\n\n INSTALLING WORKFLOW SERVER: \r\n");
                if (checkIsItDBServer == false && checkIsWFServer == true)
                {
                    LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + DateTime.Now.ToString("HH:mm:ss") + " The current machine is a Workflow server " + Constants.CARRIAGERETURNEWLINE);
                }
                else
                {
                    LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + DateTime.Now.ToString("HH:mm:ss") + " The current machine is not a Workflow server " + Constants.CARRIAGERETURNEWLINE);
                }

                throw new Exception("Exception occured in Step 3.");
            }
            catch (Exception ex)
            {
                // isExceptonOccured = true;
                UpdateProgressBarValueIfExceptionOccurs(ex, 3);
            }

            this.dicExceptionAtSteps["Step3"] = "Processed";
        }
Ejemplo n.º 12
0
        private static IEnumerable <RegisterComponentKey> GetDestinationKeys(Instruction instruction)
        {
            int         index       = instruction.GetDestinationParamIndex();
            RegisterKey registerKey = instruction.GetParamRegisterKey(index);

            if (registerKey.Type == RegisterType.Sampler)
            {
                yield break;
            }

            int mask = instruction.GetDestinationWriteMask();

            for (int component = 0; component < 4; component++)
            {
                if ((mask & (1 << component)) == 0)
                {
                    continue;
                }

                yield return(new RegisterComponentKey(registerKey, component));
            }
        }
        public async Task <Tuple <bool, string> > ShareRegisterKey(RegisterKey registerKey)
        {
            Tuple <bool, string> resultShareKey = null;
            int insertStatus = -1;

            try
            {
                var parameters = new DynamicParameters();
                using (SqlConnection cxn = new SqlConnection(_dcDb))
                {
                    parameters.Add("@RegKey", registerKey.RegKey, DbType.String);
                    parameters.Add("@ToUserID", registerKey.ToUserID, DbType.Int32);
                    parameters.Add("@SharedUserID", registerKey.SharedUserID, DbType.Int32);
                    parameters.Add("@PhoneNumber", registerKey.PhoneNumber, DbType.String);

                    insertStatus = await cxn.ExecuteScalarAsync <int>("dbo.Update_ShareRegKey", parameters, commandType : CommandType.StoredProcedure);

                    cxn.Close();
                }

                if (insertStatus == 0)
                {
                    resultShareKey = Tuple.Create(true, "Register key shared successfully.");
                }
                else
                {
                    Tuple.Create(false, "Register key shared failed.Please try again.");
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
                resultShareKey = Tuple.Create(false, "Oops! Register key shared failed.Please try again.");
            }

            return(resultShareKey);
        }
Ejemplo n.º 14
0
        public async Task <Tuple <bool, string, string> > VerifySecretKey(RegisterKey obj)
        {
            Tuple <bool, string, string> objKey = null;
            RegisterKey regkey = new RegisterKey();

            try
            {
                var parameters = new DynamicParameters();
                using (SqlConnection cxn = new SqlConnection(_dvDb))
                {
                    parameters.Add("@PhoneNumber", obj.PhoneNumber, DbType.String);
                    parameters.Add("@RegKey", obj.RegKey, DbType.String);
                    var resultObj = await cxn.QueryAsync <RegisterKey>("dbo.Validate_RegisterKey", parameters, commandType : CommandType.StoredProcedure);

                    regkey = resultObj.Single() as RegisterKey;

                    if (!string.IsNullOrEmpty(regkey.RegKey))
                    {
                        objKey = Tuple.Create(true, "", regkey.KeyType);
                    }
                    else
                    {
                        objKey = Tuple.Create(false, "Please enter valid key and mobile number.", "");
                    }

                    cxn.Close();
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
                objKey = Tuple.Create(false, "Oops! Please enter valid key and mobile number.", "");
            }

            return(objKey);
        }
Ejemplo n.º 15
0
        private void LoadConstantOutputs(ShaderModel shader)
        {
            IList <ConstantDeclaration> constantTable = shader.ParseConstantTable();

            foreach (var constant in constantTable)
            {
                if (constant.RegisterSet == RegisterSet.Sampler)
                {
                    var registerKey    = new RegisterKey(RegisterType.Sampler, constant.RegisterIndex);
                    var destinationKey = new RegisterComponentKey(registerKey, 0);
                    int samplerTextureDimension;
                    switch (constant.ParameterType)
                    {
                    case ParameterType.Sampler1D:
                        samplerTextureDimension = 1;
                        break;

                    case ParameterType.Sampler2D:
                        samplerTextureDimension = 2;
                        break;

                    case ParameterType.Sampler3D:
                    case ParameterType.SamplerCube:
                        samplerTextureDimension = 3;
                        break;

                    default:
                        throw new InvalidOperationException();
                    }
                    var shaderInput = new RegisterInputNode(destinationKey, samplerTextureDimension);
                    _samplers.Add(registerKey, shaderInput);
                }
                else
                {
                    for (int r = 0; r < constant.RegisterCount; r++)
                    {
                        RegisterType registerType;
                        switch (constant.ParameterType)
                        {
                        case ParameterType.Bool:
                            registerType = RegisterType.ConstBool;
                            break;

                        case ParameterType.Float:
                            registerType = RegisterType.Const;
                            break;

                        default:
                            throw new NotImplementedException();
                        }
                        var registerKey = new RegisterKey(registerType, constant.RegisterIndex + r);
                        for (int i = 0; i < 4; i++)
                        {
                            var destinationKey = new RegisterComponentKey(registerKey, i);
                            var shaderInput    = new RegisterInputNode(destinationKey);
                            _activeOutputs.Add(destinationKey, shaderInput);
                        }
                    }
                }
            }
        }
Ejemplo n.º 16
0
        private void Load(ShaderModel shader)
        {
            ConstantDeclarations = shader.ParseConstantTable();
            foreach (var constantDeclaration in ConstantDeclarations)
            {
                RegisterType registerType;
                switch (constantDeclaration.RegisterSet)
                {
                case RegisterSet.Bool:
                    registerType = RegisterType.ConstBool;
                    break;

                case RegisterSet.Float4:
                    registerType = RegisterType.Const;
                    break;

                case RegisterSet.Int4:
                    registerType = RegisterType.Input;
                    break;

                case RegisterSet.Sampler:
                    registerType = RegisterType.Sampler;
                    break;

                default:
                    throw new InvalidOperationException();
                }
                if (registerType == RegisterType.Sampler)
                {
                    // Use declaration from declaration instruction instead
                    continue;
                }
                for (int r = 0; r < constantDeclaration.RegisterCount; r++)
                {
                    var registerKey         = new RegisterKey(registerType, constantDeclaration.RegisterIndex + r);
                    var registerDeclaration = new RegisterDeclaration(registerKey);
                    _registerDeclarations.Add(registerKey, registerDeclaration);
                }
            }

            if (shader.MajorVersion <= 3)
            {
                foreach (D3D9Instruction instruction in shader.Instructions)
                {
                    if (!instruction.HasDestination)
                    {
                        if (instruction.Opcode == Opcode.Loop)
                        {
                            RegisterKey registerKey = new RegisterKey(RegisterType.Loop, 0);
                            if (!_registerDeclarations.TryGetValue(registerKey, out _))
                            {
                                var registerDeclaration = new RegisterDeclaration(registerKey);
                                _registerDeclarations.Add(registerKey, registerDeclaration);
                            }
                        }
                        continue;
                    }

                    if (instruction.Opcode == Opcode.Dcl)
                    {
                        var         registerDeclaration = new RegisterDeclaration(instruction);
                        RegisterKey registerKey         = registerDeclaration.RegisterKey;

                        _registerDeclarations.Add(registerKey, registerDeclaration);

                        switch (registerKey.Type)
                        {
                        case RegisterType.Input:
                        case RegisterType.MiscType:
                            MethodInputRegisters.Add(registerKey, registerDeclaration);
                            break;

                        case RegisterType.Output:
                        case RegisterType.ColorOut:
                            MethodOutputRegisters.Add(registerKey, registerDeclaration);
                            break;
                        }
                        switch (registerKey.OperandType)
                        {
                        case OperandType.Output:
                            MethodOutputRegisters.Add(registerKey, registerDeclaration);
                            break;
                        }
                    }
                    else if (instruction.Opcode == Opcode.Def)
                    {
                        var constant = new ConstantRegister(
                            instruction.GetParamRegisterNumber(0),
                            instruction.GetParamSingle(1),
                            instruction.GetParamSingle(2),
                            instruction.GetParamSingle(3),
                            instruction.GetParamSingle(4));
                        _constantDefinitions.Add(constant);
                    }
                    else if (instruction.Opcode == Opcode.DefI)
                    {
                        var constantInt = new ConstantIntRegister(instruction.GetParamRegisterNumber(0),
                                                                  instruction.Params[1],
                                                                  instruction.Params[2],
                                                                  instruction.Params[3],
                                                                  instruction.Params[4]);
                        _constantIntDefinitions.Add(constantInt);
                    }
                    else
                    {
                        int          destIndex    = instruction.GetDestinationParamIndex();
                        RegisterType registerType = instruction.GetParamRegisterType(destIndex);
                        // Find assignments to color outputs, since pixel shader outputs are not pre-declared
                        if (registerType == RegisterType.ColorOut)
                        {
                            if (shader.Type == ShaderType.Pixel)
                            {
                                int registerNumber = instruction.GetParamRegisterNumber(destIndex);
                                var registerKey    = new RegisterKey(registerType, registerNumber);
                                if (MethodOutputRegisters.ContainsKey(registerKey) == false)
                                {
                                    var reg = new RegisterDeclaration(registerKey);
                                    MethodOutputRegisters[registerKey] = reg;

                                    if (!_registerDeclarations.TryGetValue(registerKey, out _))
                                    {
                                        var registerDeclaration = new RegisterDeclaration(registerKey);
                                        _registerDeclarations.Add(registerKey, registerDeclaration);
                                    }
                                }
                            }
                        }
                        // Find assignments to temporary registers, since they are not pre-declared
                        else if (registerType == RegisterType.Temp)
                        {
                            int         registerNumber = instruction.GetParamRegisterNumber(destIndex);
                            RegisterKey registerKey    = new RegisterKey(registerType, registerNumber);
                            if (!_registerDeclarations.TryGetValue(registerKey, out _))
                            {
                                var registerDeclaration = new RegisterDeclaration(registerKey);
                                _registerDeclarations.Add(registerKey, registerDeclaration);
                            }
                        }
                    }
                }
            }
            else
            {
                foreach (D3D10Instruction instruction in shader.Instructions)
                {
                    if (!instruction.HasDestination)
                    {
                        if (instruction.Opcode == D3D10Opcode.Loop)
                        {
                            RegisterKey registerKey = new RegisterKey(RegisterType.Loop, 0);
                            if (!_registerDeclarations.TryGetValue(registerKey, out _))
                            {
                                var registerDeclaration = new RegisterDeclaration(registerKey);
                                _registerDeclarations.Add(registerKey, registerDeclaration);
                            }
                        }
                        continue;
                    }

                    if (instruction.Opcode == D3D10Opcode.DclOutput)
                    {
                        var         registerDeclaration = new RegisterDeclaration(instruction);
                        RegisterKey registerKey         = registerDeclaration.RegisterKey;

                        _registerDeclarations.Add(registerKey, registerDeclaration);

                        switch (registerKey.OperandType)
                        {
                        case OperandType.Output:
                            MethodOutputRegisters.Add(registerKey, registerDeclaration);
                            break;
                        }
                    }
                    else if (instruction.Opcode == D3D10Opcode.DclInputPS)
                    {
                        var         registerDeclaration = new RegisterDeclaration(instruction);
                        RegisterKey registerKey         = registerDeclaration.RegisterKey;

                        _registerDeclarations.Add(registerKey, registerDeclaration);

                        switch (registerKey.OperandType)
                        {
                        case OperandType.Input:
                            MethodInputRegisters.Add(registerKey, registerDeclaration);
                            break;
                        }
                    }
                    else
                    {
                        int         destIndex   = instruction.GetDestinationParamIndex();
                        OperandType operandType = instruction.GetOperandType(destIndex);
                        // Find assignments to color outputs, since pixel shader outputs are not pre-declared
                        if (operandType == OperandType.Output)
                        {
                            if (shader.Type == ShaderType.Pixel)
                            {
                                int registerNumber = instruction.GetParamRegisterNumber(destIndex);
                                var registerKey    = new RegisterKey(operandType, registerNumber);
                                if (MethodOutputRegisters.ContainsKey(registerKey) == false)
                                {
                                    var reg = new RegisterDeclaration(registerKey);
                                    MethodOutputRegisters[registerKey] = reg;

                                    if (!_registerDeclarations.TryGetValue(registerKey, out _))
                                    {
                                        var registerDeclaration = new RegisterDeclaration(registerKey);
                                        _registerDeclarations.Add(registerKey, registerDeclaration);
                                    }
                                }
                            }
                        }
                        // Find assignments to temporary registers, since they are not pre-declared
                        else if (operandType == OperandType.Temp)
                        {
                            int         registerNumber = instruction.GetParamRegisterNumber(destIndex);
                            RegisterKey registerKey    = new RegisterKey(operandType, registerNumber);
                            if (!_registerDeclarations.TryGetValue(registerKey, out _))
                            {
                                var registerDeclaration = new RegisterDeclaration(registerKey);
                                _registerDeclarations.Add(registerKey, registerDeclaration);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
        public string GetSourceName(Instruction instruction, int srcIndex)
        {
            string sourceRegisterName;

            var registerType = instruction.GetParamRegisterType(srcIndex);

            switch (registerType)
            {
            case RegisterType.Const:
            case RegisterType.Const2:
            case RegisterType.Const3:
            case RegisterType.Const4:
            case RegisterType.ConstBool:
            case RegisterType.ConstInt:
                sourceRegisterName = GetSourceConstantName(instruction, srcIndex);
                if (sourceRegisterName != null)
                {
                    return(sourceRegisterName);
                }

                ParameterType parameterType;
                switch (registerType)
                {
                case RegisterType.Const:
                case RegisterType.Const2:
                case RegisterType.Const3:
                case RegisterType.Const4:
                    parameterType = ParameterType.Float;
                    break;

                case RegisterType.ConstBool:
                    parameterType = ParameterType.Bool;
                    break;

                case RegisterType.ConstInt:
                    parameterType = ParameterType.Int;
                    break;

                default:
                    throw new NotImplementedException();
                }
                int registerNumber       = instruction.GetParamRegisterNumber(srcIndex);
                ConstantDeclaration decl = FindConstant(parameterType, registerNumber);
                if (decl == null)
                {
                    // Constant register not found in def statements nor the constant table
                    throw new NotImplementedException();
                }

                if (decl.ParameterClass == ParameterClass.MatrixRows)
                {
                    sourceRegisterName = string.Format("{0}[{1}]", decl.Name, registerNumber - decl.RegisterIndex);
                }
                else
                {
                    sourceRegisterName = decl.Name;
                }
                break;

            default:
                RegisterKey registerKey = instruction.GetParamRegisterKey(srcIndex);
                sourceRegisterName = GetRegisterName(registerKey);
                break;
            }

            sourceRegisterName = sourceRegisterName ?? instruction.GetParamRegisterName(srcIndex);

            sourceRegisterName += instruction.GetSourceSwizzleName(srcIndex);
            return(ApplyModifier(instruction.GetSourceModifier(srcIndex), sourceRegisterName));
        }
Ejemplo n.º 18
0
        public string GetSourceName(D3D9Instruction instruction, int srcIndex)
        {
            string sourceRegisterName;

            var registerType = instruction.GetParamRegisterType(srcIndex);

            switch (registerType)
            {
            case RegisterType.Const:
            case RegisterType.Const2:
            case RegisterType.Const3:
            case RegisterType.Const4:
            case RegisterType.ConstBool:
            case RegisterType.ConstInt:
                sourceRegisterName = GetSourceConstantName(instruction, srcIndex);
                if (sourceRegisterName != null)
                {
                    return(sourceRegisterName);
                }

                ParameterType parameterType;
                switch (registerType)
                {
                case RegisterType.Const:
                case RegisterType.Const2:
                case RegisterType.Const3:
                case RegisterType.Const4:
                    parameterType = ParameterType.Float;
                    break;

                case RegisterType.ConstBool:
                    parameterType = ParameterType.Bool;
                    break;

                case RegisterType.ConstInt:
                    parameterType = ParameterType.Int;
                    break;

                default:
                    throw new NotImplementedException();
                }
                int registerNumber       = instruction.GetParamRegisterNumber(srcIndex);
                ConstantDeclaration decl = FindConstant(parameterType, registerNumber);
                if (decl == null)
                {
                    // Constant register not found in def statements nor the constant table
                    throw new NotImplementedException();
                }

                if ((decl.ParameterClass == ParameterClass.MatrixRows && ColumnMajorOrder) ||
                    (decl.ParameterClass == ParameterClass.MatrixColumns && !ColumnMajorOrder))
                {
                    int row = registerNumber - decl.RegisterIndex;
                    sourceRegisterName = $"{decl.Name}[{row}]";
                }
                else if ((decl.ParameterClass == ParameterClass.MatrixColumns && ColumnMajorOrder) ||
                         (decl.ParameterClass == ParameterClass.MatrixRows && !ColumnMajorOrder))
                {
                    int column = registerNumber - decl.RegisterIndex;
                    sourceRegisterName = $"transpose({decl.Name})[{column}]";
                }
                else
                {
                    sourceRegisterName = decl.Name;
                }
                break;

            default:
                RegisterKey registerKey = instruction.GetParamRegisterKey(srcIndex);
                sourceRegisterName = GetRegisterName(registerKey);
                break;
            }

            sourceRegisterName = sourceRegisterName ?? instruction.GetParamRegisterName(srcIndex);

            sourceRegisterName += GetRelativeAddressingName(instruction, srcIndex);
            sourceRegisterName += instruction.GetSourceSwizzleName(srcIndex);
            return(ApplyModifier(instruction.GetSourceModifier(srcIndex), sourceRegisterName));
        }
Ejemplo n.º 19
0
        private void Load(ShaderModel shader)
        {
            ConstantDeclarations = shader.ParseConstantTable();
            foreach (var constantDeclaration in ConstantDeclarations)
            {
                RegisterType registerType;
                switch (constantDeclaration.RegisterSet)
                {
                case RegisterSet.Bool:
                    registerType = RegisterType.ConstBool;
                    break;

                case RegisterSet.Float4:
                    registerType = RegisterType.Const;
                    break;

                case RegisterSet.Int4:
                    registerType = RegisterType.Input;
                    break;

                case RegisterSet.Sampler:
                    registerType = RegisterType.Sampler;
                    break;

                default:
                    throw new InvalidOperationException();
                }
                if (registerType == RegisterType.Sampler)
                {
                    // Use declaration from declaration instruction instead
                    continue;
                }
                for (int r = 0; r < constantDeclaration.RegisterCount; r++)
                {
                    var registerKey         = new RegisterKey(registerType, constantDeclaration.RegisterIndex + r);
                    var registerDeclaration = new RegisterDeclaration(registerKey);
                    _registerDeclarations.Add(registerKey, registerDeclaration);
                }
            }

            foreach (var instruction in shader.Instructions.Where(i => i.HasDestination))
            {
                if (instruction.Opcode == Opcode.Dcl)
                {
                    var         registerDeclaration = new RegisterDeclaration(instruction);
                    RegisterKey registerKey         = registerDeclaration.RegisterKey;

                    _registerDeclarations.Add(registerKey, registerDeclaration);

                    switch (registerKey.Type)
                    {
                    case RegisterType.Input:
                    case RegisterType.MiscType:
                        MethodInputRegisters.Add(registerKey, registerDeclaration);
                        break;

                    case RegisterType.Output:
                    case RegisterType.ColorOut:
                        MethodOutputRegisters.Add(registerKey, registerDeclaration);
                        break;
                    }
                }
                else if (instruction.Opcode == Opcode.Def)
                {
                    var constant = new Constant(
                        instruction.GetParamRegisterNumber(0),
                        instruction.GetParamSingle(1),
                        instruction.GetParamSingle(2),
                        instruction.GetParamSingle(3),
                        instruction.GetParamSingle(4));
                    _constantDefinitions.Add(constant);
                }
                else if (instruction.Opcode == Opcode.DefI)
                {
                    var constantInt = new ConstantInt(instruction.GetParamRegisterNumber(0),
                                                      instruction.Params[1],
                                                      instruction.Params[2],
                                                      instruction.Params[3],
                                                      instruction.Params[4]);
                    _constantIntDefinitions.Add(constantInt);
                }
                else if (shader.Type == ShaderType.Pixel)
                {
                    // Find all assignments to color outputs, because pixel shader outputs are not declared.
                    int          destIndex    = instruction.GetDestinationParamIndex();
                    RegisterType registerType = instruction.GetParamRegisterType(destIndex);
                    if (registerType == RegisterType.ColorOut)
                    {
                        int registerNumber = instruction.GetParamRegisterNumber(destIndex);
                        var registerKey    = new RegisterKey(registerType, registerNumber);
                        if (MethodOutputRegisters.ContainsKey(registerKey) == false)
                        {
                            var reg = new RegisterDeclaration(registerKey);
                            MethodOutputRegisters[registerKey] = reg;
                        }
                    }
                }
            }
        }
Ejemplo n.º 20
0
        public string GetRegisterName(RegisterKey registerKey)
        {
            var decl = _registerDeclarations[registerKey];

            switch (registerKey.Type)
            {
            case RegisterType.Texture:
                return(decl.Name);

            case RegisterType.Input:
                return((MethodInputRegisters.Count == 1) ? decl.Name : ("i." + decl.Name));

            case RegisterType.Output:
                return((MethodOutputRegisters.Count == 1) ? "o" : ("o." + decl.Name));

            case RegisterType.Const:
                var constDecl = FindConstant(ParameterType.Float, registerKey.Number);
                if (ColumnMajorOrder)
                {
                    if (constDecl.Rows == 1)
                    {
                        return(constDecl.Name);
                    }
                    string col = (registerKey.Number - constDecl.RegisterIndex).ToString();
                    return($"transpose({constDecl.Name})[{col}]");
                }
                if (constDecl.Rows == 1)
                {
                    return(constDecl.Name);
                }
                string row = (registerKey.Number - constDecl.RegisterIndex).ToString();
                return(constDecl.Name + $"[{row}]");

            case RegisterType.Sampler:
                ConstantDeclaration samplerDecl = FindConstant(RegisterSet.Sampler, registerKey.Number);
                if (samplerDecl != null)
                {
                    return(samplerDecl.Name);
                }
                else
                {
                    throw new NotImplementedException();
                }

            case RegisterType.MiscType:
                switch (registerKey.Number)
                {
                case 0:
                    return("vFace");

                case 1:
                    return("vPos");

                default:
                    throw new NotImplementedException();
                }

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Starting piont of installation
        /// </summary>
        private void Installation()
        {
            DataSet dsConfig       = null;
            string  outPut         = string.Empty;
            bool    isErrorOccured = false;

            try
            {
                this.isExceptonOccured = false;
                timer.Start();
                if (!this.btnResume.Enabled)
                {
                    LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + "DATE: " + DateTime.Now.ToString("MM/dd/yyyy") + Constants.CARRIAGERETURNEWLINE);
                    //LogFile.Instance.LogMessage("\r\n " + DateTime.Now.ToString("MM/dd/yyyy") + " \r\n");
                    outPut = obj.RunScript("get-content env:computername").Trim().ToString();
                    LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + Constants.NEWLINE + DateTime.Now.ToString("HH:mm:ss") + " Installation Process Started on " + outPut + Constants.CARRIAGERETURNEWLINE);

                    LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + Constants.NEWLINE + " VALIDATING SERVERS:  \r\n");
                    this.btnResume.Enabled = false;
                }
                //GetSqlConnectionCmdlet objs = new GetSqlConnectionCmdlet();
                dsConfig = ReadConfigXML();
                var progress = RegisterKey.GetRegistryPropertyValue(NewRegistryPath + @"\eFPInstaller", "InstallStep");
                //installing step 1
                this.ProcessingText.Text = "Reading XML File..";
                this.ProcessingText.Text = "Validate DB Started...";
                this.ValidateDB(dsConfig, outPut, progress);
                //this.ProcessingText.Text = string.Empty;
                //installing step 2
                this.ProcessingText.Text = "Validate DB Completed...";
                this.checkForDBServer(dsConfig);
                //this.ProcessingText.Text = string.Empty;
                //installing step 3
                this.ProcessingText.Text = "Check for DB Server completed...";
                this.ProcessingText.Text = "Check for App/WF Server Started...";

                if (dicExceptionAtSteps.Count == 0 || dicExceptionAtSteps["Step3"] == "Processing")
                {
                    this.StepThree();
                }
                this.ProcessingText.Text = "Check for App/WF Server Completed...";
                //this.ProcessingText.Text = string.Empty;

                LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + DateTime.Now.ToString("HH:mm:ss") + " - Install process completed successfully");
            }
            catch (Exception ex)
            {
                string error = ex.InnerException != null ? ex.InnerException.Message : ex.ToString();
                System.Windows.MessageBox.Show(error, "Exception Info", MessageBoxButton.OK);
                //LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + "Error in script:" + error.Message + Constants.CARRIAGERETURNEWLINE + "StackTrace : " + error.StackTrace + Constants.CARRIAGERETURNEWLINE + "InnerException:" + error.InnerException, LogFileType.ExceptionLog);
                LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + DateTime.Now.ToString("HH:mm:ss") + " Error in script:" + ex.Message + Constants.CARRIAGERETURNEWLINE + "StackTrace : " + ex.StackTrace + Constants.CARRIAGERETURNEWLINE + "InnerException:" + error, LogFileType.ExceptionLog);
                isErrorOccured = true;
                throw new TerminateInstallationException(Constants.CARRIAGERETURNEWLINE + DateTime.Now.ToString("HH:mm:ss") + " Error in script:" + ex.Message + Constants.CARRIAGERETURNEWLINE + "StackTrace : " + ex.StackTrace + Constants.CARRIAGERETURNEWLINE + "InnerException:" + ex.InnerException, ex);
            }

            if (isErrorOccured)
            {
                this.isExceptonOccured = true;
                // this.timer.Stop();
                //  this.btnInstall.Text = "Start Over";
            }
        }
Ejemplo n.º 22
0
        public async Task <Tuple <bool, string, RegisterKey> > RegisterKeyGenearation(RegisterKey obj)
        {
            Tuple <bool, string, RegisterKey> result = null;

            try
            {
                result = await _repo.RegisterKeyGenearation(obj);

                if (result.Item1)
                {
                    await _srepo.SendSMS(result.Item3.PhoneNumber, result.Item3.RegKey);
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
            }

            return(result);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// checkDBServer
        /// </summary>
        private void checkForDBServer(DataSet dsConfig)
        {
            try
            {
                string progress = RegisterKey.GetRegistryPropertyValue(NewRegistryPath + @"\eFPInstaller", "InstallStep");
                if (progress.ToLower() == "validatedb")
                {
                    RegisterKey.UpdateRegistryPropertyValue(NewRegistryPath + @"\eFPInstaller", "InstallStep", "checkForDBServer").ToString();
                }
                checkIsItDBServer = Validation.checkIsItDBServer;
                checkIsAppServer  = Validation.checkIsAppServer;
                checkIsWFServer   = Validation.checkIsWFServer;

                LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + Constants.NEWLINE + " INSTALLING DATABASE SERVER:" + Constants.CARRIAGERETURNEWLINE);
                if (checkIsItDBServer == true)
                {
                    LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + Constants.NEWLINE + " The current machine is a database server: " + Constants.CARRIAGERETURNEWLINE);
                    string SuccessPath = string.Empty;
                    bool   validatePreRequisiteStatus = false;
                    foreach (DataGridViewRow row in StatusGrid.Rows)
                    {
                        SuccessPath = System.AppDomain.CurrentDomain.BaseDirectory + "/Images/Success.png";
                        Image img = System.Drawing.Image.FromFile(SuccessPath);
                        if (row.Index == 0)
                        {
                            LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + Constants.NEWLINE + " VALIDATING PREREQUISITES: " + Constants.CARRIAGERETURNEWLINE);

                            validatePreRequisiteStatus = Validation.validatePreRequisites();
                            if (validatePreRequisiteStatus == true)
                            {
                                row.Cells[0].Value = img;
                            }
                            else
                            {
                            }
                        }

                        if (row.Index == 1)
                        {
                            LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + Constants.NEWLINE + " CONFIGURING DATABASE SERVER: " + Constants.CARRIAGERETURNEWLINE);

                            validatePreRequisiteStatus = Validation.RestoreDB();
                            DBConnections.SaveDBConnections(dsConfig);
                            if (validatePreRequisiteStatus == true)
                            {
                                row.Cells[0].Value = img;
                            }
                        }

                        if (row.Index == 2)
                        {
                            // LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + Constants.NEWLINE + " Create SQLServer Job: " + Constants.CARRIAGERETURNEWLINE);

                            validatePreRequisiteStatus = Validation.CreateSQLServerJob();;
                            if (validatePreRequisiteStatus == true)
                            {
                                row.Cells[0].Value = img;
                            }
                        }
                    }



                    //Save the DB Connections
                }
                else
                {
                    LogFile.Instance.LogMessage(Constants.CARRIAGERETURNEWLINE + DateTime.Now.ToString("HH:mm:ss") + " The current machine is not a database server " + Constants.CARRIAGERETURNEWLINE);
                }
            }
            catch (Exception ex)
            {
            }
        }