private void Next(object obj) { if (OllElement.Count > 0) { int index = OllElement.IndexOf(CurrentElement); if (index < (OllElement.Count - 1) && OllElement.Count > 1 && index >= 0) { CurrentElement = OllElement[++index]; Index = index; MyProperty.Stop(); } } }
/// <summary> /// 属性表入口的构造函数 /// </summary> internal SelectByAttributesForm(MyProperty property) { InitializeComponent(); this.property = property; listBoxFields.Items.Clear(); Dictionary <string, Type> .KeyCollection keyColl = property.Fields.Keys; foreach (string s in keyColl) { listBoxFields.Items.Add(s); } lblSQL.Text = "Select * From " + property.FeatureName + " Where "; comboBoxLayers.Enabled = false; }
private void Preview(object obj) { if (OllElement.Count > 0) { int index = OllElement.IndexOf(CurrentElement); if (index > 0) { CurrentElement = OllElement[--index]; Index = index; MyProperty.Stop(); } } }
public ActionResult Fh(int id) { List <salary_grantModel> sj = MyProperty.SelectById(id); List <salary_grant_detailsModel> list = MyProperty2.SelectById(sj[0].salary_grant_id); List <salary_standard_detailsModel> kk = MyProperty4.BJSelectBy2(list[0].salary_standard_id.ToString()); int j = 0; foreach (salary_grant_detailsModel item in list) { for (int i = 0; i < kk.Count; i++) { if (kk[i].item_name == "基本工资") { item.jb = kk[i].salary; } if (kk[i].item_name == "岗位工资") { item.gw = kk[i].salary; } if (kk[i].item_name == "交通补助") { item.jt = kk[i].salary; } if (kk[i].item_name == "午餐补助") { item.wc = kk[i].salary; } if (kk[i].item_name == "五险一金") { item.wx = kk[i].salary; } } item.jl = list[j].bouns_sum; item.jx = list[j].sale_sum; item.yk = list[j].deduct_sum; item.sf = list[j].salary_paid_sum; item.zq = list[j].salary_standard_sum; item.grid = list[j].grd_id; item.sgrd = sj[0].sgr_id; j++; } ViewData["list"] = list; ViewData["xcbh"] = id; ViewData["jgrs"] = sj[0].human_amount; ViewData["jbze"] = sj[0].salary_standard_sum; ViewData["sfze"] = sj[0].salary_paid_sum; return(View()); }
public ActionResult Index2(int id) { int pagesize = 5; Dictionary <int, List <salary_standardModel> > list = MyProperty.Fenye(id, pagesize); Dictionary <object, object> dic = new Dictionary <object, object>(); foreach (KeyValuePair <int, List <salary_standardModel> > item1 in list) { dic["dt"] = item1.Value; int row = item1.Key; dic["fy"] = row; } string zhi = JsonConvert.SerializeObject(dic); return(Content(zhi)); }
public ActionResult Fh(FormCollection collection) { string zid = collection["sgrid22"]; List <string> ll = new List <string>(zid.Split(',')); string zq = collection["sfzq"]; string time = collection["time"]; string name = collection["salaryGrant.checker"]; string xcid = collection["xcid"]; string row = collection["row"]; List <salary_grantModel> sj = MyProperty.SelectById2(Convert.ToInt32(xcid)); sj[0].salary_paid_sum = Convert.ToDouble(zq); sj[0].check_time = Convert.ToDateTime(time); sj[0].checker = name; sj[0].sgr_id = Convert.ToInt32(ll[0]); sj[0].salary_grant_id = Convert.ToInt32(xcid); if (MyProperty.BJEdit(sj[0]) > 0) { for (int i = 1; i <= Convert.ToInt32(row); i++) { string grdidp = "grdid" + i; string grdid = collection[grdidp]; string jlidp = "jlid" + i; string jlid = collection[jlidp]; string jxidp = "jxid" + i; string jxid = collection[jxidp]; string ykidp = "ykid" + i; string ykid = collection[ykidp]; string sfidp = "sfid" + i; string sfid = collection[sfidp]; List <salary_grant_detailsModel> list = MyProperty2.SelectById2(sj[0].salary_standard_id, sj[0].salary_grant_id); list[i - 1].grd_id = Convert.ToInt32(grdid); list[i - 1].bouns_sum = Convert.ToDouble(jlid); list[i - 1].sale_sum = Convert.ToDouble(jxid); list[i - 1].deduct_sum = Convert.ToDouble(ykid); list[i - 1].salary_paid_sum = Convert.ToDouble(sfid); MyProperty2.BJEdit(list[i - 1]); } return(Content("<script>alert('复核成功');window.location.href='/GrantCheck/Index'</script>")); } else { return(Content("<script>alert('复核失败');window.location.href='/GrantCheck/Index'</script>")); } }
private MyProperty GetProperty(PropertyInfo propertySymbol, Assembly definingAssembly, ISymbol parent) { var property = new MyProperty(propertySymbol.Name) { Parent = parent }; property.Type = GetType(propertySymbol.PropertyType, definingAssembly, property); property.Modifiers = GetModifiers(propertySymbol); foreach (var attributeData in propertySymbol.GetCustomAttributesData()) { var attribute = GetAttribute(attributeData, property); property.Attributes.Add(attribute); } return(property); }
private static MyProperty GetPropertySettings(Type classType, PropertyInfo propertyInfo) { var property = new MyProperty { MemberInfo = propertyInfo, DataInfo = Attribute.GetCustomAttribute(propertyInfo, typeof(DataAttribute)) as DataAttribute }; if (memberMappings.TryGetValue(classType, out var classMapping)) { if (classMapping.TryGetValue(propertyInfo.Name, out var func)) { property.GetLengthFunc = func; } } return(property); }
public static void CopyRenderSettings() { CustomRenderSettings r = new CustomRenderSettings(); r.name = Path.GetFileNameWithoutExtension(EditorApplication.currentScene); int i = resEditor.renderSettings.FindIndex(a => a.name == r.name); if (i == -1) { resEditor.renderSettings.Add(r); } else { resEditor.renderSettings[i] = r; } r.fog = RenderSettings.fog; r.ambientLight = RenderSettings.ambientLight; r.flareStrength = RenderSettings.flareStrength; r.fogColor = RenderSettings.fogColor; r.fogDensity = RenderSettings.fogDensity; r.fogEndDistance = RenderSettings.fogEndDistance; r.fogMode = RenderSettings.fogMode; r.fogStartDistance = RenderSettings.fogStartDistance; r.haloStrength = RenderSettings.haloStrength; r.skybox = RenderSettings.skybox; var monoBehaviours = Camera.main.GetComponents <MonoBehaviour>(); for (int index = 0; index < monoBehaviours.Length; index++) { MonoBehaviour a = monoBehaviours[index]; foreach (var f in a.GetType().GetFields()) { var mp = new MyProperty().SetValue(f.Name, f.GetValue(a), a.GetType().Name); if (mp != null) { r.properties.Add(mp); } } } EditorUtility.SetDirty(res); }
/// <summary> /// 选择图层改变事件 /// </summary> private void comboBoxLayers_SelectedIndexChanged(object sender, EventArgs e) { listBoxFields.Items.Clear(); listBoxUniqueValue.Items.Clear(); btnGetUniqueValues.Enabled = false; if (map.Layers[comboBoxLayers.SelectedIndex].DataType != MySpaceDataType.MyGrid) { property = map.Layers[comboBoxLayers.SelectedIndex].SpaceData.Property; Dictionary <string, Type> .KeyCollection keyColl = property.Fields.Keys; foreach (string s in keyColl) { listBoxFields.Items.Add(s); } lblSQL.Text = "Select * From " + property.FeatureName + " Where "; } else { MessageBox.Show("不能对栅格图层进行操作!"); listBoxFields.SelectedIndex = -1; } }
public ActionResult Fh(salary_standardModel sa) { var errors = ModelState.Values.SelectMany(v => v.Errors).ToList(); if (ModelState.IsValid) { if (MyProperty.BJEdit(sa) > 0) { return(Content("<script>alert('修改成功');window.location.href='/CheckList/Index'</script>")); } else { return(Content("<script>alert('修改失败');window.location.href='/CheckList/Index'</script>")); } } else { return(Content("<script>alert('请输入完整再提交');window.location.href='/CheckList/Fh/" + sa.ssd_id + "'</script>")); } }
private void WriteObject(MappingWriteArgs args, object value, Type listType, MyProperty property) { var writer = args.Writer; var oldPosition = (int)writer.BaseStream.Position; WriteProperty(args, value, listType, property); var newPosition = writer.BaseStream.Position; var stride = property.DataInfo.Stride; if (stride > 0) { var missingBytes = stride - (int)(newPosition - oldPosition); if (missingBytes < 0) { throw new InvalidOperationException($"The stride is smaller than {listType.Name} definition."); } else if (missingBytes > 0) { writer.BaseStream.Position += missingBytes; } } }
public MyProperty StructParamMethod(MyProperty p) { return(p); }
set => SetValue(MyProperty, value);
public void Pause(object parametr) { MyProperty.Pause(); }
public void Stop(object parametr) { MyProperty.Stop(); }
public void Play(object parametr) { MyProperty.Play(); }
public MyPropertyDescriptor(MyProperty prop, object parent) : base(prop.PropertyName, null) { _prop = prop; _parent = parent; }
public void getData() { MyProperty.connect(); Console.WriteLine("data"); }
// Update is called once per frame void Update() { // c# call lua function with value type but no gc (using delegate) intParam(1024); // primitive type Vector3 v3 = new Vector3(1, 2, 3); // vector3 vector3Param(v3); MyProperty mystruct = new MyProperty("Hello", 1, 2.2, 3M, new UnitID()); // custom complex value type customValueTypeParam(mystruct); enumParam(MyTypeEnum.God); //enum decimal d = -32132143143100109.00010001010M; decimal dr = decimalParam(d); Debug.Log(string.Format("decimal:{0} match:{1}", d, d == dr)); // using LuaFunction.Func<T1, T2, TResult> var addA = add.Func <int, int, int>(34, 56); var addB = (34 + 56); Debug.Log(string.Format("{0}=={1}?{2}", addA, addB, addA == addB)); // lua access c# value type array no gc var a = swapArray(my_double); //primitive value type array swapArray(my_vector3); //vector3 array swapArray(my_myProperty); //custom struct array swapArray(my_myTypeEnum); //enum arry swapArray(myDecimal); //decimal arry // lua call c# no gc with value type actionTest(); //c# call lua using interface changeTest.ExChange(my_double); changeTest.NoChange(my_vector3); //no gc LuaTable use luaenv.Global.Set("g_int", 2333); int i; luaenv.Global.Get("g_int", out i); Debug.Log(string.Format("g_int:{0}==2333?{1}", i, i == 2333)); luaenv.Global.Set(123.0001, mystruct); MyProperty mystruct2; luaenv.Global.Get(123.0001, out mystruct2); Debug.Log(string.Format("mystruct.name:{0}=={1}?{2}", mystruct.name, mystruct2.name, mystruct.name == mystruct2.name)); decimal dr2 = 0.0000001M; luaenv.Global.Set((byte)12, d); luaenv.Global.Get((byte)12, out dr2); Debug.Log(string.Format("decimal:{0}=={1}?", d, dr2, d == dr2)); int number = luaenv.Global.Get <int>("number"); luaenv.Global.SetInPath("number", number + 1); //Debug.Log("number_int:" + number); double abc = luaenv.Global.GetInPath <double>("A.B.C"); luaenv.Global.SetInPath("A.B.C", abc + 1.1); //Debug.Log("abc_double:" + abc); luaenv.Tick(); }
private static void WriteProperty(MappingWriteArgs args, object value, Type type, MyProperty property) { if (type != typeof(bool)) { FlushBitField(args); } if (mappings.TryGetValue(type, out var mapping)) { args.Item = value; args.DataAttribute = property.DataInfo; mapping.Writer(args); } else if (type.IsEnum) { var underlyingType = Enum.GetUnderlyingType(type); if (!mappings.TryGetValue(underlyingType, out mapping)) { throw new InvalidDataException($"The enum {type.Name} has an unsupported size."); } args.DataAttribute = property.DataInfo; args.Item = value; mapping.Writer(args); } else if (type.CanEnumerate()) { Type itemType; if (type.IsArray) { itemType = type? .GetMethod("Get")? .ReturnType; } else { itemType = type.GetGenericArguments().FirstOrDefault(); } if (itemType == null) { throw new InvalidDataException($"The list {property.MemberInfo.Name} does not have any specified type."); } var missing = args.Count; foreach (var item in value as IEnumerable) { if (missing-- < 1) { break; } WriteObject(args, item, itemType, property); } while (missing-- > 0) { var item = Activator.CreateInstance(itemType); WriteObject(args, item, itemType, property); } } else { WriteObject(args.Writer, value, (int)args.Writer.BaseStream.Position); } }
public bool DataEquals(MyClass other) { return(MyProperty.Equals(other.MyProperty)); }
public ActionResult Index2(int id) { if (id == 1) { List <DataBag> sou = new List <DataBag>(); List <config_file_first_kindModel> list = MyProperty.BJSelect(); int countr = 0; double zq = 0; foreach (config_file_first_kindModel item in list) { List <HumenModel> lhu = hu.SelectById(item.first_kind_id); double sum = 0; List <int> sid = new List <int>(); foreach (HumenModel sl in lhu) { sum += sl.salary_sum; sid.Add(sl.human_id); } DataBag ss = new DataBag() { name = item.first_kind_name, count = lhu.Count, moneysum = sum, id = sid }; countr += ss.count; zq += ss.moneysum; sou.Add(ss); } ViewData["list"] = sou; ViewData["xcz"] = sou.Count; ViewData["countr"] = countr; ViewData["zq"] = zq; ViewData["jg"] = 1; } if (id == 2) { List <DataBag> sou = new List <DataBag>(); List <config_file_second_kindModel> list = MyProperty2.BJSelect(); int countr = 0; double zq = 0; foreach (config_file_second_kindModel item in list) { List <HumenModel> lhu = hu.SelectById2(item.second_kind_id); double sum = 0; List <int> sid = new List <int>(); foreach (HumenModel sl in lhu) { sum += sl.salary_sum; sid.Add(sl.human_id); } DataBag ss = new DataBag() { name = item.second_kind_name, count = lhu.Count, moneysum = sum, id = sid }; countr += ss.count; zq += ss.moneysum; sou.Add(ss); } ViewData["list"] = sou; ViewData["xcz"] = sou.Count; ViewData["countr"] = countr; ViewData["zq"] = zq; ViewData["jg"] = 2; } if (id == 3) { List <DataBag> sou = new List <DataBag>(); List <config_file_third_kindModel> list = MyProperty3.BJSelect(); int countr = 0; double zq = 0; foreach (config_file_third_kindModel item in list) { List <HumenModel> lhu = hu.SelectById3(item.third_kind_id); double sum = 0; List <int> sid = new List <int>(); foreach (HumenModel sl in lhu) { sum += sl.salary_sum; sid.Add(sl.human_id); } DataBag ss = new DataBag() { name = item.third_kind_name, count = lhu.Count, moneysum = sum, id = sid }; countr += ss.count; zq += ss.moneysum; sou.Add(ss); } ViewData["list"] = sou; ViewData["xcz"] = sou.Count; ViewData["countr"] = countr; ViewData["zq"] = zq; ViewData["jg"] = 3; } return(View()); }
private object ReadProperty(MappingReadArgs args, Type type, MyProperty property) { if (type != typeof(bool)) { args.BitIndex = 0; } if (mappings.TryGetValue(type, out var mapping)) { args.DataAttribute = property.DataInfo; return(mapping.Reader(args)); } else if (type.IsEnum) { var underlyingType = Enum.GetUnderlyingType(type); if (!mappings.TryGetValue(underlyingType, out mapping)) { throw new InvalidDataException($"The enum {type.Name} has an unsupported size."); } args.DataAttribute = property.DataInfo; return(mapping.Reader(args)); } else if (type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(List <>))) { var listType = type.GetGenericArguments().FirstOrDefault(); if (listType == null) { throw new InvalidDataException($"The list {property.MemberInfo.Name} does not have any specified type."); } var addMethod = type.GetMethod("Add"); var list = Activator.CreateInstance(typeof(List <>).MakeGenericType(listType)); for (int i = 0; i < args.Count; i++) { var oldPosition = (int)args.Reader.BaseStream.Position; var item = ReadProperty(args, listType, property); addMethod.Invoke(list, new[] { item }); var newPosition = args.Reader.BaseStream.Position; args.Reader.BaseStream.Position += Math.Max(0, property.DataInfo.Stride - (newPosition - oldPosition)); } return(list); } else if (type.IsArray) { if (type.GetArrayRank() > 1) { throw new NotImplementedException("Arrays with a rank greater than one are not currently supported."); } var arrayType = type.GetElementType(); if (arrayType == null) { throw new InvalidDataException($"Unable to get the underlying type of {type.Name}."); } var array = Array.CreateInstance(arrayType, args.Count); if (arrayType.IsEnum) { for (var i = 0; i < args.Count; i++) { var oldPosition = (int)args.Reader.BaseStream.Position; var item = ReadProperty(args, arrayType, property); array.SetValue(Enum.ToObject(arrayType, item), i); var newPosition = args.Reader.BaseStream.Position; args.Reader.BaseStream.Position += Math.Max(0, property.DataInfo.Stride - (newPosition - oldPosition)); } } else { for (var i = 0; i < args.Count; i++) { var oldPosition = (int)args.Reader.BaseStream.Position; var item = ReadProperty(args, arrayType, property); array.SetValue(item, i); var newPosition = args.Reader.BaseStream.Position; args.Reader.BaseStream.Position += Math.Max(0, property.DataInfo.Stride - (newPosition - oldPosition)); } } return(array); } else { return(ReadRawObject(args.Reader, Activator.CreateInstance(type), (int)args.Reader.BaseStream.Position)); } }
public static void CopyRenderSettings() { CustomRenderSettings r = new CustomRenderSettings(); r.name = Path.GetFileNameWithoutExtension(EditorApplication.currentScene); int i = resEditor.renderSettings.FindIndex(a => a.name == r.name); if (i == -1) resEditor.renderSettings.Add(r); else resEditor.renderSettings[i] = r; r.fog = RenderSettings.fog; r.ambientLight = RenderSettings.ambientLight; r.flareStrength = RenderSettings.flareStrength; r.fogColor = RenderSettings.fogColor; r.fogDensity = RenderSettings.fogDensity; r.fogEndDistance = RenderSettings.fogEndDistance; r.fogMode = RenderSettings.fogMode; r.fogStartDistance = RenderSettings.fogStartDistance; r.haloStrength = RenderSettings.haloStrength; r.skybox = RenderSettings.skybox; var monoBehaviours = Camera.main.GetComponents<MonoBehaviour>(); for (int index = 0; index < monoBehaviours.Length; index++) { MonoBehaviour a = monoBehaviours[index]; foreach (var f in a.GetType().GetFields()) { var mp = new MyProperty().SetValue(f.Name, f.GetValue(a), a.GetType().Name); if (mp != null) r.properties.Add(mp); } } EditorUtility.SetDirty(res); }
public string GetData(MyProperty property) { return(myData[property]); }
static void Main(string[] args) { // 解决控制台中文乱码 //Console.OutputEncoding = Encoding.GetEncoding(936); // 常量 //const double PI = 3.14159; const string Const_Str = "Welcome to the C# Wrold."; Console.WriteLine(Const_Str); //Console.WriteLine(PI); // Array.cs //MyArray ar = new MyArray(); var ar = new MyArray(); ar.Run(); //ReferenceTypes Rer = new ReferenceTypes(); //Rer.DynamicType(); // Enum.cs MyEnum e = new MyEnum(); e.Run(); // Interface.cs MyInterface Inter = new MyInterface(); Inter.Run(); // Method.cs MyMethod Met = new MyMethod(); Met.Run(); // Operators.cs MyOperators OP = new MyOperators(); OP.Run(); // RegularExpression.cs 正则表达式 MyRegularExpression RE = new MyRegularExpression(); RE.Run(); // StringTest.cs MyString str = new MyString(); str.Run(); // StrucTest.cs MyStruc st = new MyStruc(); st.Run(); // VariAblesConst.cs InputCustomers i = new InputCustomers(); i.InputCustomer("Please input Int:"); // NameSpace.cs MyNameSpace NS = new MyNameSpace(); NS.Run(); // DataTypes.cs MyDataType DT = new MyDataType(); DT.Run(); // MultipleInherit.cs InheritClass02 Inh02 = new InheritClass02(); Inh02.Run(); // RectangleText RT = new RectangleText(10, 20); // Polymorphism.cs MyPolymorphism PP = new MyPolymorphism(); PP.Run(); // FilesTest.cs MyFiles file = new MyFiles(); file.Run(); // DirectoryTest.cs MyDirectory Dir = new MyDirectory(); Dir.Run(); // AttributeTest.cs MyAttributes AB = new MyAttributes(); AB.Run(); // PropertyTest.cs MyProperty pp = new MyProperty(); pp.Run(); // IndexerTest.cs var id = new MyIndexer(5); id.Run(); // DelegateTest.cs var DL = new MyDelegate(); DL.Run(); // MyEvent ee = new MyEvent(); ee.Run(); // CollectionTest.cs MyCollection cc = new MyCollection(); cc.Run(); #region 预处理指令 // #define 定义一个符号,这个符号会作为一个表达式传递给 #if 指令,这个判断会得到 ture 的 结果。 //#if (PI) // Console.WriteLine("PI is defined"); //#else // Console.WriteLine("PI is not defined"); //#endif //#if (DEBUG && !VC_V10) // Console.WriteLine("DEBUG is defined"); //#elif (!DEBUG && VC_V10) // Console.WriteLine("VC_V10 is defined"); //#elif (DEBUG && VC_V10) // Console.WriteLine("DEBUG and VC_V10 are defined"); //#else // Console.WriteLine("DEBUG and VC_V10 are not defined"); //#endif #endregion // RandomNumber.cs MyRandom rd = new MyRandom(); rd.Run(); // MyTest tt = new MyTest(); tt.Test(); Console.ReadKey(); }
public void Increase() { MyProperty++; _stringClass.MyProperty = MyProperty.ToString(); _stringClass.WriteToLog(); }