예제 #1
0
 /// <summary>
 /// 构造参数集合
 /// </summary>
 /// <returns></returns>
 private Dictionary <string, ParamObject> CreateDate()
 {
     try
     {
         if (paramList == null)
         {
             paramList = new Dictionary <string, ParamObject>();
         }
         PropertyInfo[] propertys = tempEntity.GetType().GetProperties();
         foreach (PropertyInfo item in propertys)
         {
             ParamObject param = new ParamObject(item.Name, "", item.GetValue(tempEntity, null) == null ? "" : item.GetValue(tempEntity, null).ToString());
             if (!paramList.ContainsKey(item.Name))
             {
                 paramList.Add(item.Name, param);
             }
             else
             {
                 paramList[item.Name] = param;
             }
         }
         return(paramList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
 public AmbientLight(string name = "AmbientLight")
 {
     Parent    = new ParamObject();
     Enable    = true;
     Name      = name;
     Group     = "default";
     Intensity = 1.0f;
 }
예제 #3
0
        public void AbstractBase_PropertiesSet(TestClass model, ParameterDirection direction, OracleUdtInfo info)
        {
            var param = new ParamObject <TestClass>(model, direction, info);

            ParamObject paramObjBase = param;

            Assert.NotNull(paramObjBase);
            Assert.Equal(info, paramObjBase.UDTInfo);
        }
예제 #4
0
        void SetObjNode(ParamObject paramObj, TreeNode parentNode)
        {
            string name = paramObj.HashString;

            var objNode = new TreeNode(name);

            objNode.Tag = paramObj;
            parentNode.Nodes.Add(objNode);
        }
예제 #5
0
        public void ItShouldIdentifyArgumentValueByNew()
        {
            Expression <Action <ContainerObject> > expression = container => container.Run(new ParamObject());

            expression.GetMethodArguments().First().Value.NodeType.Should().Be(ExpressionType.New);
            var arguments   = expression.GetMethodArgumentValues();
            var expectation = new ParamObject();

            arguments.Single().Value.Should().BeEquivalentTo(expectation, options => options.RespectingRuntimeTypes());
        }
예제 #6
0
 private void LoadObjectDataList(ParamObject paramObj)
 {
     listViewCustom1.Items.Clear();
     foreach (var entry in paramObj.paramEntries)
     {
         ListViewItem item = new ListViewItem(entry.HashString);
         SetListItemParamObject(entry, item);
         listViewCustom1.Items.Add(item);
     }
 }
예제 #7
0
 public Fog(string name)
 {
     Parent    = new ParamObject();
     Enable    = true;
     Name      = name;
     Group     = "Course_area";
     Start     = 1000.0f;
     End       = 10000.0f;
     Color     = new STColor(1, 1, 1, 1);
     Direction = new Vector3F(0, 0, -1);
 }
예제 #8
0
 static Curve[] GetCurve(ParamObject ob, string hashName)
 {
     foreach (var entry in ob.paramEntries)
     {
         if (entry.HashString == hashName)
         {
             return((Curve[])entry.Value);
         }
     }
     return(new Curve[1]);
 }
 public HemisphereLight(string name)
 {
     Parent      = new ParamObject();
     Enable      = true;
     Name        = name;
     Group       = "Course_area";
     SkyColor    = new STColor(1.1f, 1.1f, 0.8f, 1);
     GroundColor = new STColor(0.927106f, 0.950518f, 1.194f, 1);
     Intensity   = 0.35f;
     Direction   = new Vector3F(0, 1, 0);
 }
예제 #10
0
 public StudentListVM GetStudents(ParamObject _params)
 {
     try
     {
         return(_repo.GetStudents(_params));
     }
     catch (Exception ex)
     {
         return(new StudentListVM());
     }
 }
예제 #11
0
 public CubeMapUint(string name)
 {
     Parent                   = new ParamObject();
     Name                     = name;
     Position                 = new Vector3F(0, 1000, 0);
     Near                     = 1.0f;
     Far                      = 500000.0f;
     IlluminantDistance       = -1;
     Gaussian_Repetition_Num  = 1;
     Rendering_Repetition_Num = 1;
     Enable                   = true;
 }
예제 #12
0
        /// <summary>
        /// 验证图片或者链接
        /// </summary>
        /// <param name="arg"></param>
        private void ChcekResource(object arg)
        {
            ParamObject obj         = arg as ParamObject;
            string      pageUrl     = obj.PageUrl;
            string      resourceUrl = obj.ResourceUrl;

            try
            {
                if (!checkedResourceList.Contains(resourceUrl))
                {
                    HttpWebResponse response = GetWebResponse(resourceUrl);
                    int             httpCode = (int)response.StatusCode;
                    if (httpCode != 200)
                    {
                        lock (errorList)
                        {
                            if (!errorList.Contains(resourceUrl))
                            {
                                errorList.Add(resourceUrl);
                                log.Error("发生错误链接:" + resourceUrl + "\r\n所在页面:" + pageUrl + "\r\n\r\n");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lock (errorList)
                {
                    if (!errorList.Contains(resourceUrl))
                    {
                        errorList.Add(resourceUrl);
                        log.Error("发生错误链接:" + resourceUrl + "\r\n所在页面:" + pageUrl + "\r\n错误原因:" + ex.Message + "\r\n\r\n");
                    }
                }
            }
            finally
            {
                lock (checkedResourceList)
                {
                    if (!checkedResourceList.Contains(resourceUrl))
                    {
                        checkedResourceList.Add(resourceUrl);
                    }
                }

                lock (locker)
                {
                    currentThreadCount--;
                }
            }
        }
 public StudentListVM GetStudents([FromBody] ParamObject _params)
 {
     try
     {
         return(_manager.GetStudents(_params));
     }
     catch (Exception ex)
     {
         return(new StudentListVM {
             status = -101, message = ex.Message, _studentList = null, _subjectList = null
         });
     }
 }
 public LightEnvObject(string type, string name, bool enable_mip0, bool enable_mip1)
 {
     Parent           = new ParamObject();
     Name             = name;
     LutName          = "Lambert";
     pow              = 1.0f;
     pow_mip_max      = 1.0f;
     effect           = 1.0f;
     calc_type        = 0;
     this.Type        = type;
     this.enable_mip0 = enable_mip0;
     this.enable_mip1 = enable_mip1;
 }
예제 #15
0
 public DirectionalLight(string name)
 {
     Parent         = new ParamObject();
     Enable         = true;
     Name           = name;
     Group          = "Course_area";
     DiffuseColor   = new STColor(1.05f, 1.05f, 0.9f, 1);
     SpecularColor  = new STColor(0, 0, 0, 1);
     BacksideColor  = new STColor(0, 0, 0, 1);
     Intensity      = 1.8f;
     Direction      = new Vector3F(-0.17101f, -0.866025f, 0.469846f);
     ViewCoordinate = false;
 }
예제 #16
0
        internal async Task LoadObjectMetadataAsync_Works(Mock <MetadataBuilder> builder, TestClass model, ParameterDirection direction, OracleUdtInfo info, MetadataOracleObject <TestClass> metadataObject)
        {
            builder.Setup(b => b.GetOrRegisterMetadataOracleObjectAsync <TestClass>(info))
            .ReturnsAsync(metadataObject)
            .Verifiable();


            var param = new ParamObject <TestClass>(model, direction, info);

            await param.LoadObjectMetadataAsync(builder.Object);

            builder.Verify();
            Assert.True(param.MetadataLoaded);
        }
        public void ShouldBeNotMatching_ParamProperty_Test()
        {
            var param = new ParamObject()
            {
                UserName     = "******",
                Age          = 255,
                NonAttribute = "Some Value"
            };

            var mapping = new ParamPropertyMappingProvider(param);
            var value   = mapping.Getter("NonAttribute");

            TestContext.WriteLine("NonAttribute Property : ", value);
        }
예제 #18
0
 public LightSettings(string name)
 {
     Parent        = new ParamObject();
     Name          = name;
     lighting_hint = 0;
     hdr_enable    = false;
     rim_light_ref = "";
     rim_effect    = 1.0f;
     rim_angle     = 1.0f;
     rim_pow       = 2.0f;
     parent_map    = "";
     copy_map      = "";
     mapping_type  = 0;
 }
        public void ParamMappingObject_Getter_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);
            TestContext.WriteLine(mapping.Getter("UserName").ToString());
            TestContext.WriteLine(mapping.Getter("Age").ToString());

            Assert.AreEqual("NCsoft", mapping.Getter("UserName"));
            Assert.AreEqual(255, mapping.Getter("Age"));
        }
예제 #20
0
        public void LoadObjectNodes(ParamObject paramObject, TreeNode parentNode)
        {
            TreeNode objNode = new TreeNode(paramObject.HashString);

            parentNode.Nodes.Add(objNode);

            foreach (var entry in paramObject.paramEntries)
            {
                EditableEntry entryNode = new EditableEntry($"{entry.HashString}");
                entryNode.entry = entry;
                objNode.Nodes.Add(entryNode);

                UpdateEntryNode(entryNode, entry);
            }
        }
        public void ParamMappingObject_Setter_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);

            mapping.Setter("UserName", "NCsoft NCsoft");
            mapping.Setter("Age", 0);

            Assert.AreEqual("NCsoft NCsoft", mapping.Getter("UserName"));
            Assert.AreEqual(0, mapping.Getter("Age"));
        }
        public void ParamMappingObject_Getter_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age      = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);

            TestContext.WriteLine(mapping.Getter("UserName").ToString());
            TestContext.WriteLine(mapping.Getter("Age").ToString());

            Assert.AreEqual("NCsoft", mapping.Getter("UserName"));
            Assert.AreEqual(255, mapping.Getter("Age"));
        }
        public void ParamMappingObject_Setter_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age      = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);

            mapping.Setter("UserName", "NCsoft NCsoft");
            mapping.Setter("Age", 0);

            Assert.AreEqual("NCsoft NCsoft", mapping.Getter("UserName"));
            Assert.AreEqual(0, mapping.Getter("Age"));
        }
예제 #24
0
        public void ItShouldIdentifyArgumentValueByCoalesce()
        {
            ParamObject nullObject = null;
            Expression <Action <ContainerObject> > expression = container =>
                                                                container.Run(nullObject ?? new ParamObject {
                Prop = "Bar"
            });

            expression.GetMethodArguments().First().Value.NodeType.Should().Be(ExpressionType.Coalesce);
            var arguments   = expression.GetMethodArgumentValues();
            var expectation = new ParamObject {
                Prop = "Bar"
            };

            arguments.Single().Value.Should().BeEquivalentTo(expectation, options => options.RespectingRuntimeTypes());
        }
        public void ShouldBeCanGetter_via_NameValue_NameProperty_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age      = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);

            Assert.AreEqual("NCsoft", mapping.Getter("username"));

            mapping.Setter("username", "NCsoft NCsoft");
            Assert.AreEqual("NCsoft NCsoft", mapping.Getter("username"));
            Assert.AreEqual("NCsoft NCsoft", param.UserName);
        }
 public ProjectionShadowParams()
 {
     Parent            = new ParamObject();
     BiasScale         = new Vector2F(1, 1);
     AnimTransVel      = new Vector2F(0, 0);
     AnimSwingCycleY   = 0;
     AnimSwingCycleX   = 0;
     AnimSwingCycleAmp = new Vector2F(0, 0);
     BiasTrans         = new Vector2F(0, 0.1f);
     AnimRotSpeed      = 0.0f;
     BiasRotate        = 1.0f;
     Repeat            = true;
     Name          = "Projection0";
     Color         = new STColor(1, 1, 1, 1);
     Density       = 0.2f;
     DensityDrc    = 1.0f;
     UseDesnityDrc = false;
 }
예제 #27
0
        internal void GetOracleParameters_Works(Mock <MetadataBuilder> builder, TestClass model, ParameterDirection direction, OracleUdtInfo info, Mock <MetadataOracleObject <TestClass> > metadataObject, OracleParameter[] parameters, int startNumber)
        {
            builder.Setup(b => b.GetOrRegisterMetadataOracleObject <TestClass>(info))
            .Returns(metadataObject.Object);

            metadataObject.Setup(b => b.GetOracleParameters(model, startNumber))
            .Returns(parameters)
            .Verifiable();

            var param = new ParamObject <TestClass>(model, direction, info);

            param.LoadObjectMetadata(builder.Object);

            var actual = param.GetOracleParameters(startNumber);

            metadataObject.Verify();
            Assert.Equal(parameters, actual);
        }
예제 #28
0
        internal void BuildQueryConstructorString_Works(Mock <MetadataBuilder> builder, TestClass model, ParameterDirection direction, OracleUdtInfo info, Mock <MetadataOracleObject <TestClass> > metadataObject, int lastNumber, string constructor, string name, int startNumber)
        {
            builder.Setup(b => b.GetOrRegisterMetadataOracleObject <TestClass>(info))
            .Returns(metadataObject.Object);

            metadataObject.Setup(b => b.BuildQueryConstructorString(model, name, startNumber))
            .Returns((constructor, lastNumber))
            .Verifiable();

            var param = new ParamObject <TestClass>(model, direction, info);

            param.LoadObjectMetadata(builder.Object);
            param.SetParameterName(name);

            var actual = param.BuildQueryConstructorString(startNumber);

            metadataObject.Verify();
            Assert.Equal((constructor, lastNumber), actual);
        }
예제 #29
0
        internal void SetParameterName_Works(Mock <MetadataBuilder> builder, TestClass model, ParameterDirection direction, OracleUdtInfo info, Mock <MetadataOracleObject <TestClass> > metadataObject, string name, string line)
        {
            builder.Setup(b => b.GetOrRegisterMetadataOracleObject <TestClass>(info))
            .Returns(metadataObject.Object);

            metadataObject.Setup(b => b.GetDeclareLine(typeof(TestClass), name, metadataObject.Object.OracleTypeNetMetadata.UDTInfo))
            .Returns(line)
            .Verifiable();


            var param = new ParamObject <TestClass>(model, direction, info);

            param.LoadObjectMetadata(builder.Object);

            param.SetParameterName(name);

            var result = param.GetDeclareLine();

            metadataObject.Verify();
        }
예제 #30
0
        public ParamObject testParamObject(ParamObject param)
        {
            ParamObject result = new ParamObject();
            Hashtable   test   = new Hashtable();

            if (param == null)
            {
                result = new ParamObject();
                result.setStringVar("ParamObject was empty");
                test.Add("Message", "No Message");
            }
            else
            {
                result.setStringVar("ParamObject was not empty");
                test.Add("Message", (param.getStringVar() != null) ? param.getStringVar():"No Message");
            }
            result.setHashVar(test);

            return(result);
        }
예제 #31
0
        public StudentListVM GetStudents(ParamObject _params)
        {
            StudentListVM report = new StudentListVM();

            try
            {
                var param = new
                {
                    @SearchValue  = _params.SearchValue,
                    @FilterTypeID = _params.FilterTypeID,
                    @PageNumber   = _params.PageNumber,
                    @PageSize     = _params.PageSize
                };
                using (IDbConnection db = new SqlConnection(connectionStr))
                {
                    using (var result = db.QueryMultiple("GetStudents", param: param, commandType: CommandType.StoredProcedure))
                    {
                        report.status       = 1;
                        report.message      = "Student list return Successfully.";
                        report._studentList = result.Read <StudentObject>().ToList();
                        report._subjectList = result.Read <SubjectObject>().ToList();
                    }
                }
            }
            catch (SqlException ex)
            {
                report.status  = -100;
                report.message = ex.Message;
            }
            catch (DataException ex)
            {
                report.status  = -100;
                report.message = ex.Message;
            }
            catch (Exception ex)
            {
                report.status  = -100;
                report.message = ex.Message.ToString();
            }
            return(report);
        }
예제 #32
0
        internal void SetOutputValue_Works(Mock <MetadataBuilder> builder, TestClass model, ParameterDirection direction, OracleUdtInfo info, Mock <MetadataOracleObject <TestClass> > metadataObject)
        {
            var refCursor = FormatterServices.GetUninitializedObject(
                typeof(OracleRefCursor));

            builder.Setup(b => b.GetOrRegisterMetadataOracleObject <TestClass>(info))
            .Returns(metadataObject.Object);

            metadataObject.Setup(b => b.GetValueFromRefCursor(typeof(TestClass), It.IsAny <OracleRefCursorWrapper>()))
            .Returns(model)
            .Verifiable();


            var param = new ParamObject <TestClass>(model, direction, info);

            param.LoadObjectMetadata(builder.Object);

            param.SetOutputValue(refCursor);

            metadataObject.Verify();
            Assert.Equal(model, param.Value);
        }
        public void ShouldBeNotMatching_ParamProperty_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age = 255,
                NonAttribute = "Some Value"
            };

            var mapping = new ParamPropertyMappingProvider(param);
            var value = mapping.Getter("NonAttribute");

            TestContext.WriteLine("NonAttribute Property : ", value);
        }
        public void ShouldBeCanGetter_via_NameValue_NameProperty_Test()
        {
            var param = new ParamObject()
            {
                UserName = "******",
                Age = 255
            };

            var mapping = new ParamPropertyMappingProvider(param);
            Assert.AreEqual("NCsoft", mapping.Getter("username"));

            mapping.Setter("username", "NCsoft NCsoft");
            Assert.AreEqual("NCsoft NCsoft", mapping.Getter("username"));
            Assert.AreEqual("NCsoft NCsoft", param.UserName);
        }