public override string ToString(MyDictionary ProcList, VarDictionary VarDict, Dictionary<ulong, TFunc> NewSubs) { string s = "$"+ins.ToAsmString(); if (bytes[0] == 0xE8) if (ins.Operand1.ValueType == TUP.AsmResolver.ASM.OperandType.Normal) s = AddProc(((Offset)ins.Operand1.Value).FileOffset + Addr, ProcList, NewSubs); if (bytes[0] == 0xFF) if (bytes[1] == 0x15) if (ins.Operand1.ValueType == TUP.AsmResolver.ASM.OperandType.DwordPointer) s = AddProc(((Offset)ins.Operand1.Value).Va, ProcList, NewSubs); if (bytes[0] == 0xA3)//mov somevar, EAX { TVar Var1 = new TVar(((Offset)ins.Operand1.Value).Va, "", 4); if (!VarDict.ContainsKey(((Offset)ins.Operand1.Value).Va)) { VarDict.AddVar(Var1); }; s = VarDict[((Offset)ins.Operand1.Value).Va].FName + " = EAX;"; } if ((bytes[0] == 0xC2) |//retn (bytes[0] == 0xC3))//ret s = "$ret"; return s; }
public void TestConcurrentInsert() { IEntry<char, char>[] entries = new Entry<char, char>[] { new Entry<char,char> ('a', 'b'), new Entry<char,char> ('c', 'd'), new Entry<char,char> ('e', 'f'), new Entry<char,char> ('h', 'k'), new Entry<char,char> ('l', 'm'), new Entry<char,char> ((char)('a' + 16), (char)('b' + 16)) }; IMyDictionary<char, char> d = new MyDictionary<char, char>(); Parallel.ForEach(entries, (e) => { d.Insert(e.Key, e.Value); }); Parallel.ForEach(entries, (e) => { char val; Assert.IsTrue(d.TryGet(e.Key, out val)); Assert.AreEqual(val , e.Value); } ); Trace.WriteLine(d.ToString()); Parallel.ForEach(entries, (e) => { char val; d.Remove(e.Key); Assert.IsFalse(d.TryGet(e.Key, out val)); } ); }
private static MyDictionary CreateDictionary(int count) { var dictionary = new MyDictionary(); for (int i = 0; i < count; i++) { dictionary.Add(CreateKey(i), CreateValue(i)); } return dictionary; }
static void Main(string[] args) { MyDictionary<string, int> ageMap = new MyDictionary<string, int>(); ageMap.Add("Oksana", 21); ageMap.Add("Vasya", 45); ageMap.Add("Katya", 13); Console.WriteLine(String.Format("There are {0} people in data base", ageMap.Count)); Console.WriteLine(String.Format("Oksana is {0}", ageMap["Oksana"])); Console.ReadKey(); }
static void Main(string[] args) { MyDictionary<string, Auto> auto = new MyDictionary<string, Auto>(); Auto car = new Auto(); auto.Add("Car", car); auto["Car"].Name = "Audi"; Console.WriteLine(auto["Car"].Name); Console.WriteLine(); Console.ReadLine(); }
static void Main(string[] args) { MyDictionary<int,int> dictionary = new MyDictionary<int, int>(); dictionary.Add(4,20); dictionary.Add(5, 22); Console.WriteLine("Введите key в словаре:"); int key = int.Parse(Console.ReadLine()); Console.WriteLine("{0} -> {1}", key, dictionary[key]); }
public void WorkCollectionInheritedClasses() { //throw new NotImplementedException(); Student student1 = new Student("Имя", "Фамилия", 11, new DateTime(1967, 1, 1), 1); Student student2 = new Student("Имя", "Фамилия", 22, new DateTime(1967, 1, 1), 2); Student student3 = new Student("Имя", "Фамилия", 33, new DateTime(1967, 1, 1), 3); Student student4 = new Student("Имя", "Фамилия", 44, new DateTime(1967, 1, 1), 4); MyDictionary groupForDictionary = new MyDictionary(); groupForDictionary.Add(student1); groupForDictionary.Add(student2); groupForDictionary.Add(student3); groupForDictionary.Add(student4); Tuple<string, string, int, DateTime> workKey = Tuple.Create<string, string, int, DateTime>("Имя", "Фамилия", 22, new DateTime(1967, 1, 1)); if (!groupForDictionary.Contains(workKey)) { Console.WriteLine("Нет такого студента"); } MyCollection<Student> groupForCollection = new MyCollection<Student>(); groupForCollection.Add(student1); groupForCollection.Add(student3); Console.WriteLine("Студент 1,3"); foreach (Student workStudent in groupForCollection) { Console.WriteLine("{0} {1} : {2}, {3}, {4} ", workStudent.firstName, workStudent.secondName, workStudent.birthDate, workStudent.rating, workStudent.personalCode); } groupForCollection.Insert(1, student2); groupForCollection.Remove(student1); groupForCollection.Add(student4); Console.WriteLine("+ Студент2, -Студент1,+ Студент4"); foreach (Student workStudent in groupForCollection) { Console.WriteLine("{0} {1} : {2}, {3}, {4} ", workStudent.firstName, workStudent.secondName, workStudent.birthDate, workStudent.rating, workStudent.personalCode); } Console.ReadKey(); }
internal Room() { dispatcher_ = new Dispatcher(); seat_player_dict_ = new MyDictionary<string, uint>(); disconnected_users_ = new List<User>(); request_delete_users_ = new List<User>(); can_close_time_ = 0; room_users_ = new List<User>(); for (int i = 0; i < room_observers_.Length; ++i) { room_observers_[i] = new Observer(); room_observers_[i].OwnRoom = this; } }
protected virtual MyDictionary GetData(string label) { MyDictionary table = new MyDictionary(); XYECOM.Business.Label le = new XYECOM.Business.Label(); XYECOM.Model.LabelInfo el = null; if (!string.IsNullOrEmpty(label)) { long labelId = XYECOM.Core.MyConvert.GetInt64(label); if (labelId > 0) { el = le.GetItem(labelId); } } if (el != null) { if (el.LabelRange == XYECOM.Model.LabelRange.User) { userid = XYECOM.Core.MyConvert.GetInt32(el.GroupIdOrUserId); } string content = el.LabelContent; content = content.Substring(1, content.Length - 2); string[] strayy = content.Split(new char[] { '┆' }, StringSplitOptions.RemoveEmptyEntries); foreach (string str in strayy) { string[] tmparr = str.Split(new char[] { '$' }, StringSplitOptions.None); if (tmparr.Length == 2) { string s = tmparr[1]; if (s.Contains(@"\")) { s = s.Replace(@"\", @"\\"); } //if(s==@"MM\dd") //{ // s = @"MM\\dd"; //} table.Add(tmparr[0].ToUpper(), s); } } } return table; }
static IEnumerable<KeyValue<char, int>> CountSymbols(string text) { var counter = new MyDictionary<char, int>(); foreach (var character in text) { int sequence = 0; if (counter.ContainsKey(character)) { sequence = counter.Get(character); } counter.AddOrReplace(character, ++sequence); } return counter; }
public void WorkCollectionInheritedClasses() { MyDictionary studentsBase = new MyDictionary(); Student st1 = new Student() {firstName = "1", lastName = "2", birthDate = new DateTime(12,12,2012) }; Tuple<string, string, DateTime> st1Key = new Tuple<string, string, DateTime>("1", "2", new DateTime(12, 12, 2012)); if (studentsBase.Contains(st1)) { studentsBase.Add(st1); Student st1Copy = studentsBase[st1Key]; } else { Console.WriteLine("Student is not found"); } }
static void Main(string[] args) { MyDictionary<int,string> myDictionary = new MyDictionary<int,string>(); myDictionary.Add(1, "one"); myDictionary.Add(2, "two"); myDictionary.Add(3, "three"); myDictionary.Add(4, "four"); myDictionary.Add(5, "five"); foreach (var item in myDictionary) { Console.WriteLine(item); // ToString not working? } Console.ReadKey(); }
private static string GenerateLinks(MyDictionary d, string baseindstr, string indstr) { string rval = ""; if (indstr == null || indstr.Length <= 0) rval = "<br><div style=\"font-size:larger;font-weight:bold;\">Links</div>"; if (!string.IsNullOrEmpty(indstr)) { if (d.Keys.Length <= 0 || d["name"].Value == null || d["name"].Value.ToString().Length <= 0) return ""; rval += "<div>" + baseindstr + indstr + "<a href=\"#\" onclick=\"window.external.ShowPage('" + baseindstr + indstr + "');\" style=\"color:#0000FF;cursor:pointer;\">" + d["name"] + "</a></div>"; } int[] ik = d.IKeys; if (ik.Length <= 0) return rval; rval += "<div style=\"padding:0px;padding-left:20px;\">"; rval = ik.Aggregate(rval, (current, i) => current + GenerateLinks(d[i], baseindstr, (((indstr == null || indstr.Length <= 0) && (baseindstr == null || baseindstr.Length <= 0)) ? "" : indstr + ".") + i)); rval += "</div>"; return rval; }
public static void Add() { var dictBase = new MyDictionary(); for (int i = 0; i < 100; i++) { FooKey key = CreateKey(i); dictBase.Add(key, CreateValue(i)); Assert.True(dictBase.Contains(key)); } Assert.Equal(100, dictBase.Count); for (int i = 0; i < dictBase.Count; i++) { Assert.Equal(CreateValue(i), dictBase[CreateKey(i)]); } FooKey nullKey = CreateKey(101); dictBase.Add(nullKey, null); Assert.Equal(null, dictBase[nullKey]); }
public void DictionaryInitialization() { //dictionaries can be initialized like this with any type var a = new Dictionary<int, int> { {1, 1}, {1, 2} }; //any class that implements IEnumerable and has a 2 parameter Add() method can be initialized like this var b = new MyDictionary() { {1, 1}, {2, 2} }; //any class that implements IEnumerable and has an Add() method with any number of parameters can be initialized var c = new MyThreeParameterAdd() { {"a", 2, 'c'} }; }
/// <summary> /// 2015-July-1 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("CheckDeferredVested", "True"); /// dic.Add("UseDeprecatedCOLAMethod", "True"); /// pMethods_DE._PopVerify_Methods_DE(dic); /// </summary> /// <param name="dic"></param> public void _PopVerify_Methods_DE(MyDictionary dic) { string sFunctionName = "_PopVerify_Main"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin("CheckDeferredVested", this.wRetirementStudio.wCheckDeferredVested.chk, dic["CheckDeferredVested"], 0); _gLib._SetSyncUDWin("UseDeprecatedCOLAMethod", this.wRetirementStudio.wUseDeprecatedCOLAMethod.chk, dic["UseDeprecatedCOLAMethod"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._VerifySyncUDWin("CheckDeferredVested", this.wRetirementStudio.wCheckDeferredVested.chk, dic["CheckDeferredVested"], 0); _gLib._VerifySyncUDWin("UseDeprecatedCOLAMethod", this.wRetirementStudio.wUseDeprecatedCOLAMethod.chk, dic["UseDeprecatedCOLAMethod"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
/// <summary> /// 2016-Mar-10 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("BenefitCapacityFactor", ""); /// dic.Add("PICO", ""); /// dic.Add("BenefitPICO", ""); /// dic.Add("MinimumSalaryPICO", ""); /// dic.Add("SSContributionCeilingPICO", ""); /// dic.Add("NumberOfBenefitPayments", ""); /// dic.Add("NumberofSalaryPeriod", ""); /// dic.Add("NumberofContributions", ""); /// dic.Add("MinmumSalary", ""); /// dic.Add("SocialSecurityContributionCeiling", ""); /// dic.Add("SocialSecurityMaximumBenefit", ""); /// pOtherEconomicAssumption._PopVerify_Main_BR(dic); /// </summary> /// <param name="dic"></param> public void _PopVerify_Main_BR(MyDictionary dic) { string sFunctionName = "_PopVerify_Main_BR"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin_ByClipboard("BenefitCapacityFactor", this.wRetirementStudio.wBenefitCapacityFactor.txt, dic["BenefitCapacityFactor"], 0); _gLib._SetSyncUDWin_ByClipboard("PICO", this.wRetirementStudio.wPICO.txt, dic["PICO"], 0); _gLib._SetSyncUDWin_ByClipboard("BenefitPICO", this.wRetirementStudio.wBenefitPICO.txt, dic["BenefitPICO"], 0); _gLib._SetSyncUDWin_ByClipboard("MinimumSalaryPICO", this.wRetirementStudio.wMinSalaryPICO.txt, dic["MinimumSalaryPICO"], 0); _gLib._SetSyncUDWin_ByClipboard("SSContributionCeilingPICO", this.wRetirementStudio.wSSContributionCeiling.txt, dic["SSContributionCeilingPICO"], 0); _gLib._SetSyncUDWin_ByClipboard("NumberOfBenefitPayments", this.wRetirementStudio.wNumBenefitPayment.txt, dic["NumberOfBenefitPayments"], 0); _gLib._SetSyncUDWin_ByClipboard("NumberofSalaryPeriod", this.wRetirementStudio.wNumSalaryPeriods.txt, dic["NumberofSalaryPeriod"], 0); _gLib._SetSyncUDWin_ByClipboard("NumberofContributions", this.wRetirementStudio.wNumContributions.txt, dic["NumberofContributions"], 0); _gLib._SetSyncUDWin_ByClipboard("MinmumSalary", this.wRetirementStudio.wMinSalary.txt, dic["MinmumSalary"], 0); _gLib._SetSyncUDWin_ByClipboard("SocialSecurityContributionCeiling", this.wRetirementStudio.wSocialSecurityContributionCeiling.txt, dic["SocialSecurityContributionCeiling"], 0); _gLib._SetSyncUDWin_ByClipboard("SocialSecurityMaximumBenefit", this.wRetirementStudio.wSocialSecurityMaximumBenefit.txt, dic["SocialSecurityMaximumBenefit"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
public override string ToString(MyDictionary ProcList, VarDictionary VarDict, Dictionary <ulong, TFunc> NewSubs) { string s = "$" + ins.ToAsmString(); if (bytes[0] == 0xE8) { if (ins.Operand1.ValueType == TUP.AsmResolver.ASM.OperandType.Normal) { s = AddProc(((Offset)ins.Operand1.Value).FileOffset + Addr, ProcList, NewSubs); } } if (bytes[0] == 0xFF) { if (bytes[1] == 0x15) { if (ins.Operand1.ValueType == TUP.AsmResolver.ASM.OperandType.DwordPointer) { s = AddProc(((Offset)ins.Operand1.Value).Va, ProcList, NewSubs); } } } if (bytes[0] == 0xA3)//mov somevar, EAX { TVar Var1 = new TVar(((Offset)ins.Operand1.Value).Va, "", 4); if (!VarDict.ContainsKey(((Offset)ins.Operand1.Value).Va)) { VarDict.AddVar(Var1); } ; s = VarDict[((Offset)ins.Operand1.Value).Va].FName + " = EAX;"; } if ((bytes[0] == 0xC2) | //retn (bytes[0] == 0xC3)) //ret { s = "$ret"; } return(s); }
public override string GetParametersToJosn() { MyDictionary parameters = new MyDictionary(); parameters.Add("autoAddUser", this.AutoAddUser); parameters.Add("createDeptGroup", this.CreateDeptGroup); parameters.Add("deptHiding", this.DeptHiding); parameters.Add("deptManagerUseridList", this.DeptManagerUseridList); parameters.Add("deptPerimits", this.DeptPerimits); parameters.Add("id", this.Id); parameters.Add("lang", this.Lang); parameters.Add("name", this.Name); parameters.Add("order", this.Order); parameters.Add("orgDeptOwner", this.OrgDeptOwner); parameters.Add("outerDept", this.OuterDept); parameters.Add("outerPermitDepts", this.OuterPermitDepts); parameters.Add("outerPermitUsers", this.OuterPermitUsers); parameters.Add("parentid", this.Parentid); parameters.Add("sourceIdentifier", this.SourceIdentifier); parameters.Add("userPerimits", this.UserPerimits); return(parameters.ToJson()); }
/// <summary> /// 2015-Nov-27 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("TradeLiability_SameMethodforAllVOs", "True"); /// dic.Add("IntAccLiability_SameMethodforAllVOs", "True"); /// pMethods_DE._Methods_Pension_DE006(dic); /// </summary> /// <param name="dic"></param> public void _Methods_Pension_DE006(MyDictionary dic) { string sFunctionName = "_PopVerify_Main"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin("TradeLiability_SameMethodforAllVOs", this.wRetirementStudio.wTradeLiability_SameMethods.chx, dic["TradeLiability_SameMethodforAllVOs"], 0); _gLib._SetSyncUDWin("IntAccLiability_SameMethodforAllVOs", this.wRetirementStudio.wIntermationalAccounting_SameMethods.chx, dic["IntAccLiability_SameMethodforAllVOs"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._VerifySyncUDWin("TradeLiability_SameMethodforAllVOs", this.wRetirementStudio.wTradeLiability_SameMethods.chx, dic["TradeLiability_SameMethodforAllVOs"], 0); _gLib._VerifySyncUDWin("IntAccLiability_SameMethodforAllVOs", this.wRetirementStudio.wIntermationalAccounting_SameMethods.chx, dic["IntAccLiability_SameMethodforAllVOs"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
private ArenaPrizeConfig GetAwardConfig(int rank) { ArenaPrizeConfig config = null; MyDictionary <int, object> dic = ArenaConfigProvider.Instance.PrizeConfig.GetData(); m_configList.Clear(); foreach (object o in dic.Values) { ArenaPrizeConfig apc = (ArenaPrizeConfig)o; m_configList.Add(apc); } m_configList.Sort(SortConfigList); for (int i = 0; i < m_configList.Count; i++) { if (rank < m_configList[i].FitBegin) { break; } config = m_configList[i]; } return(config); }
static void Main(string[] args) { newClass1 s = MyClass <newClass1> .FactoryMethod(); MyList <int> lst = new MyList <int>(); for (int i = 0; i < 5; i++) { lst.Add(i); } Console.WriteLine(lst[3]); MyDictionary <string, int> dictionary = new MyDictionary <string, int>(); dictionary.Add("A", 3); dictionary.Add("B", 54); dictionary.Add("C", 1); dictionary.Add("D", 2); dictionary.Add("E", 76); Console.WriteLine(dictionary["E"]); }
public void GetItemWorks() { var d = new MyDictionary(new Dictionary <int, string> { { 3, "b" }, { 6, "z" }, { 9, "x" } }); var di = (IDictionary <int, string>)d; var di2 = (IDictionary <int, string>)d; Assert.AreEqual("x", d[9]); Assert.AreEqual("b", di[3]); Assert.AreEqual("z", di2[6]); try { var x = d[1]; Assert.Fail("Should throw"); } catch (Exception) { } try { var x = di[1]; Assert.Fail("Should throw"); } catch (Exception) { } try { var x = di2[1]; Assert.Fail("Should throw"); } catch (Exception) { } }
public void TryGetValue() { var count = 5; var dict = new MyDictionary(count); GC.Collect(); GC.WaitForPendingFinalizers(); ConsoleEx.WriteLine("- {0}", dict); Assert.AreEqual(count, dict.Count); Person key = new Person("WhatEver"); Engine value = null; var r = dict.TryGetValue(key, out value); Assert.IsFalse(r); Assert.IsNull(value); key = new Person("1"); r = dict.TryGetValue(key, out value); Assert.IsTrue(r); Assert.IsNotNull(value); }
/// <summary> /// 2015-May-25 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("iRow", "1"); /// dic.Add("NumberOfYears", "10"); /// dic.Add("Rate", "4.75"); /// pPayIncrease._TimeBased_Table(dic); /// </summary> /// <param name="dic"></param> public void _TimeBased_Table(MyDictionary dic) { string sFunctionName = "_TimeBased_Table"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); _gLib._SetSyncUDWin("FPGrid", this.wRetirementStudio.wTimeBased_Table.grid, "Click", 0, false, 94, 28); _gLib._SendKeysUDWin("FPGrid", this.wRetirementStudio.wTimeBased_Table.grid, "{PageUp}{PageUp}{Home}"); int iRow = Convert.ToInt32(dic["iRow"]); string sRow = ""; for (int i = 1; i < iRow; i++) { sRow = sRow + "{Down}"; } _gLib._SendKeysUDWin("FPGrid", this.wRetirementStudio.wTimeBased_Table.grid, sRow, 0); if (dic["NumberOfYears"] != "") { _gLib._SendKeysUDWin("FPGrid", this.wRetirementStudio.wTimeBased_Table.grid, "{space}", 0); _gLib._SetSyncUDWin_ByClipboard(iRow.ToString() + ": NumberOfYears", this.wRetirementStudio.wCom_Edit.txt.UICtlNumEditorEdit1, dic["NumberOfYears"], 0); } if (dic["Rate"] != "") { _gLib._SendKeysUDWin("FPGrid", this.wRetirementStudio.wTimeBased_Table.grid, "{Tab}{space}", 0); _gLib._SetSyncUDWin_ByClipboard(iRow.ToString() + ": Rate", this.wRetirementStudio.wCom_Edit.txt.UICtlNumEditorEdit1, dic["Rate"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
/// <summary> /// 2016-Mar-04 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("VestingRule", ""); /// dic.Add("VestingRatio", ""); /// pVesting._PopVerify_Standard_DE(dic); /// </summary> /// <param name="dic"></param> public void _PopVerify_Standard_DE(MyDictionary dic) { string sFunctionName = "_PopVerify_Standard_DE"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin("VestingRule", this.wRetirementStudio.wVestingRule.cbo, dic["VestingRule"], 0); _gLib._SetSyncUDWin("VestingRatio", this.wRetirementStudio.wVestingRadio.cbo, dic["VestingRatio"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._MsgBox("", "function is not complete yet."); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
/// <summary> /// 2015-July-01 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("Calculate", "True"); /// dic.Add("FromData", ""); /// dic.Add("CustomCode", ""); /// pAssumedRetirementAge._PopVerify_Main(dic); /// </summary> /// <param name="dic"></param> public void _PopVerify_Main(MyDictionary dic) { string sFunctionName = "_PopVerify_FromData"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin("Calculate", this.wRetirementStudio.wCalculate.rd, dic["Calculate"], 0); _gLib._SetSyncUDWin("FromData", this.wRetirementStudio.wFromData.rd, dic["FromData"], 0); _gLib._SetSyncUDWin("CustomCode", this.wRetirementStudio.wCustomCode.rd, dic["CustomCode"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._VerifySyncUDWin("Calculate", this.wRetirementStudio.wCalculate.rd, dic["Calculate"], 0); _gLib._VerifySyncUDWin("FromData", this.wRetirementStudio.wFromData.rd, dic["FromData"], 0); _gLib._VerifySyncUDWin("CustomCode", this.wRetirementStudio.wCustomCode.rd, dic["CustomCode"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
/// <summary> /// 2015-Dec-9 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("LongName", ""); /// dic.Add("ShortName", ""); /// dic.Add("OK", ""); /// pActuarialReport._SI_TreeViewAddItem(dic); /// </summary> /// <param name="dic"></param> public void _SI_TreeViewAddItem(MyDictionary dic) { string sFunctionName = "_PopVerify_Main"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); int X = this.wRetirementStudio.wTreeView.Tree.Width / 2; int Y = this.wRetirementStudio.wTreeView.Tree.Height / 2; // Mouse.Click(this.wRetirementStudio.wFlowTree.flowTree, MouseButtons.Right, ModifierKeys.None, new Point(iPosX, iPosY)); try { Mouse.Click(this.wRetirementStudio.wTreeView.Tree, MouseButtons.Right, ModifierKeys.None, new Point(X, Y)); } catch (Exception ex) { _gLib._Report(_PassFailStep.Fail, "Function <" + sFunctionName + "> fail to Right Click on Node Flow Tree. Because of Exception thrown: " + Environment.NewLine + ex.Message); _gLib._MsgBoxYesNo("Continue Testing?", "Fail: Function <" + sFunctionName + "> fail to Right Click on Node Flow Tree. Because of Exception thrown: " + Environment.NewLine + ex.Message); } WinWindow wWin = new WinWindow(); wWin.SearchProperties.Add(WinWindow.PropertyNames.AccessibleName, "DropDown"); wWin.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains); wWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch); wWin.SearchConfigurations.Add(SearchConfiguration.VisibleOnly); MyDictionary dicTmp = new MyDictionary(); dicTmp.Clear(); dicTmp.Add("Level_1", "Add"); _gLib._MenuSelectWin(0, wWin, dicTmp); _gLib._SetSyncUDWin("FPGrid", this.wAddSubsidiary.wLongName.txt, dic["LongName"], 0); _gLib._SetSyncUDWin("FPGrid", this.wAddSubsidiary.wShortName.txt, dic["ShortName"], 0); _gLib._SetSyncUDWin("FPGrid", this.wAddSubsidiary.wOK.btn, dic["OK"], 0); }
public override string GetParametersToJosn() { MyDictionary parameters = new MyDictionary(); parameters.Add("department", this.Department); parameters.Add("email", this.Email); parameters.Add("extattr", this.Extattr); parameters.Add("isHide", this.IsHide); parameters.Add("isSenior", this.IsSenior); parameters.Add("jobnumber", this.Jobnumber); parameters.Add("mobile", this.Mobile); parameters.Add("name", this.Name); parameters.Add("orderInDepts", this.OrderInDepts); parameters.Add("orgEmail", this.OrgEmail); parameters.Add("position", this.Position); parameters.Add("remark", this.Remark); parameters.Add("tel", this.Tel); parameters.Add("userid", this.Userid); parameters.Add("workPlace", this.WorkPlace); return(parameters.ToJson()); }
/// <summary> /// 2015-June-22 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("UseCurrentYearPayRateFrom", "SalaryCurrentYear"); /// dic.Add("PayIncreaseAssumption", "PayIncrease1"); /// pPayoutProjection._PopVerify_PresentYear(dic); /// </summary> /// <param name="dic"></param> public void _PopVerify_PresentYear(MyDictionary dic) { string sFunctionName = "_PopVerify_PresentYear"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin("UseCurrentYearPayRateFrom", this.wRetirementStudio.wPresentYear_UseCurrentYearPayRateFrom.cbo, dic["UseCurrentYearPayRateFrom"], 0); _gLib._SetSyncUDWin("PayIncreaseAssumption", this.wRetirementStudio.wHistory_PayIncreaseAssumption.cboPayIncreaseAssumption, dic["PayIncreaseAssumption"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._VerifySyncUDWin("UseCurrentYearPayRateFrom", this.wRetirementStudio.wPresentYear_UseCurrentYearPayRateFrom.cbo, dic["UseCurrentYearPayRateFrom"], 0); _gLib._VerifySyncUDWin("PayIncreaseAssumption", this.wRetirementStudio.wHistory_PayIncreaseAssumption.cboPayIncreaseAssumption, dic["PayIncreaseAssumption"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
/// <summary> /// 2019-Feb-20 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("TheFundingPolicyOfThePlanIs", "to contribute at least the minimum but no more than the unfunded ABO."); /// dic.Add("TheInvestmentPolicyOfThePlanIs", "create a diversified portfolio bond favorable."); /// dic.Add("Cash", "5.00"); /// dic.Add("USGovSecurities", "15.00"); /// dic.Add("PreferredCorpDebtInstruments", "5.00"); /// dic.Add("AllOtherCorpDebtInstruments", "45.00"); /// dic.Add("PreferredCorpStocks", "5.00"); /// dic.Add("CommonCorpStocks", "5.00"); /// dic.Add("PartnershipJointVentureInterests", "15.00"); /// dic.Add("RealEstate", "5.00"); /// dic.Add("EmployerSecurities", "5.00"); /// pAnnualFundingNotice._PopVerify_Policies(dic); /// /// </summary> /// <param name="dic"></param> public void _PopVerify_Policies(MyDictionary dic) { string sFunctionName = "_PopVerify_Policies"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin_ByClipboard("TheFundingPolicyOfThePlanIs", this.wRetirementStudio.wPolicies_FundingPolicy.txt, dic["TheFundingPolicyOfThePlanIs"], 0); _gLib._SetSyncUDWin_ByClipboard("TheInvestmentPolicyOfThePlanIs", this.wRetirementStudio.wPolicies_InvestmentPolicy.txt, dic["TheInvestmentPolicyOfThePlanIs"], 0); _gLib._SetSyncUDWin_ByClipboard("Cash", this.wRetirementStudio.wPolicies_AssetAllocationPct_Cash.txt, dic["Cash"], 0); _gLib._SetSyncUDWin_ByClipboard("USGovSecurities", this.wRetirementStudio.wPolicies_AssetAllocationPct_USGov.txt, dic["USGovSecurities"], 0); _gLib._SetSyncUDWin_ByClipboard("PreferredCorpDebtInstruments", this.wRetirementStudio.wPolicies_AssetAllocationPct_PreferredCorpDebt.txt, dic["PreferredCorpDebtInstruments"], 0); _gLib._SetSyncUDWin_ByClipboard("AllOtherCorpDebtInstruments", this.wRetirementStudio.wPolicies_AssetAllocationPct_AllOtherCorp.txt, dic["AllOtherCorpDebtInstruments"], 0); _gLib._SetSyncUDWin_ByClipboard("PreferredCorpStocks", this.wRetirementStudio.wPolicies_AssetAllocationPct_PreferredCorpStocks.txt, dic["PreferredCorpStocks"], 0); _gLib._SetSyncUDWin_ByClipboard("CommonCorpStocks", this.wRetirementStudio.wPolicies_AssetAllocationPct_CommonCorpStocks.txt, dic["CommonCorpStocks"], 0); _gLib._SetSyncUDWin_ByClipboard("PartnershipJointVentureInterests", this.wRetirementStudio.wPolicies_AssetAllocationPct_PartnershipJoint.txt, dic["PartnershipJointVentureInterests"], 0); _gLib._SetSyncUDWin_ByClipboard("RealEstate", this.wRetirementStudio.wPolicies_AssetAllocationPct_RealEstate.txt, dic["RealEstate"], 0); _gLib._SetSyncUDWin_ByClipboard("EmployerSecurities", this.wRetirementStudio.wPolices_AssetAllocationPct_EmployerSecurities.txt, dic["EmployerSecurities"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._VerifySyncUDWin("TheFundingPolicyOfThePlanIs", this.wRetirementStudio.wPolicies_FundingPolicy.txt, dic["TheFundingPolicyOfThePlanIs"], 0); _gLib._VerifySyncUDWin("TheInvestmentPolicyOfThePlanIs", this.wRetirementStudio.wPolicies_InvestmentPolicy.txt, dic["TheInvestmentPolicyOfThePlanIs"], 0); _gLib._VerifySyncUDWin("Cash", this.wRetirementStudio.wPolicies_AssetAllocationPct_Cash.txt, dic["Cash"], 0); _gLib._VerifySyncUDWin("USGovSecurities", this.wRetirementStudio.wPolicies_AssetAllocationPct_USGov.txt, dic["USGovSecurities"], 0); _gLib._VerifySyncUDWin("PreferredCorpDebtInstruments", this.wRetirementStudio.wPolicies_AssetAllocationPct_PreferredCorpDebt.txt, dic["PreferredCorpDebtInstruments"], 0); _gLib._VerifySyncUDWin("AllOtherCorpDebtInstruments", this.wRetirementStudio.wPolicies_AssetAllocationPct_AllOtherCorp.txt, dic["AllOtherCorpDebtInstruments"], 0); _gLib._VerifySyncUDWin("PreferredCorpStocks", this.wRetirementStudio.wPolicies_AssetAllocationPct_PreferredCorpStocks.txt, dic["PreferredCorpStocks"], 0); _gLib._VerifySyncUDWin("CommonCorpStocks", this.wRetirementStudio.wPolicies_AssetAllocationPct_CommonCorpStocks.txt, dic["CommonCorpStocks"], 0); _gLib._VerifySyncUDWin("PartnershipJointVentureInterests", this.wRetirementStudio.wPolicies_AssetAllocationPct_PartnershipJoint.txt, dic["PartnershipJointVentureInterests"], 0); _gLib._VerifySyncUDWin("RealEstate", this.wRetirementStudio.wPolicies_AssetAllocationPct_RealEstate.txt, dic["RealEstate"], 0); _gLib._VerifySyncUDWin("EmployerSecurities", this.wRetirementStudio.wPolices_AssetAllocationPct_EmployerSecurities.txt, dic["EmployerSecurities"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
public static void Add() { var dictBase = new MyDictionary(); for (int i = 0; i < 100; i++) { FooKey key = CreateKey(i); dictBase.Add(key, CreateValue(i)); Assert.True(dictBase.Contains(key)); } Assert.Equal(100, dictBase.Count); for (int i = 0; i < dictBase.Count; i++) { Assert.Equal(CreateValue(i), dictBase[CreateKey(i)]); } FooKey nullKey = CreateKey(101); dictBase.Add(nullKey, null); Assert.Null(dictBase[nullKey]); }
/// <summary> /// 2015-Aug-28 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("ProjectedSalary", ""); /// dic.Add("ServiceBasedOn", ""); /// pPayCredit._PopVerify_Standard(dic); /// </summary> /// <param name="dic"></param> public void _PopVerify_Standard(MyDictionary dic) { string sFunctionName = "_PopVerify_Standard"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin("ProjectedSalary", this.wRetirementStudio.wProjectedSalary.cbo, dic["ProjectedSalary"], 0); _gLib._SetSyncUDWin("ServiceBasedOn", this.wRetirementStudio.wServiceBasedOn.cbo, dic["ServiceBasedOn"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._VerifySyncUDWin("ProjectedSalary", this.wRetirementStudio.wProjectedSalary.cbo, dic["ProjectedSalary"], 0); _gLib._VerifySyncUDWin("ServiceBasedOn", this.wRetirementStudio.wServiceBasedOn.cbo, dic["ServiceBasedOn"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
public void AddWorks() { var d = new MyDictionary(); var di = (IDictionary <int, string>)d; d.Add(5, "aa"); Assert.AreEqual("aa", d[5]); Assert.AreEqual(1, d.Count); di.Add(3, "bb"); Assert.AreEqual("bb", di[3]); Assert.AreEqual(2, di.Count); try { d.Add(5, "zz"); Assert.Fail("Should throw"); } catch (Exception) { } }
/// <summary> /// 2015-Dec-23 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("ClientLongName", "true"); /// dic.Add("ClientLongName_txt", "A. & C KOSIK GmbH"); /// dic.Add("ClientShortName", "true"); /// dic.Add("ClientShortName_txt", "A. & C KOSIK GmbH"); /// dic.Add("ClientCode", ""); /// dic.Add("AddressLine1", "true"); /// dic.Add("AddressLine1_txt", "Hirschberger Str. 1"); /// dic.Add("AddressLine2", "true"); /// dic.Add("AddressLine2_txt", ""); /// dic.Add("City", "true"); /// dic.Add("City_txt", "Kelheim"); /// dic.Add("PostalCode", "true"); /// dic.Add("PostalCode_txt", "93309"); /// dic.Add("Country", "true"); /// dic.Add("Country_txt", "Deutschland"); /// pActuarialReport._SubsidiaryInformation(dic); /// </summary> /// <param name="dic"></param> public void _SubsidiaryInformation(MyDictionary dic) { string sFunctionName = "_PopVerify_Main"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); _gLib._SetSyncUDWin("ClientLongName", this.wRetirementStudio.wSI_LongName.chx, dic["ClientLongName"], 0); _gLib._SetSyncUDWin("ClientLongName_txt", this.wRetirementStudio.wSI_LongName_txt.txt, dic["ClientLongName_txt"], 0); _gLib._SetSyncUDWin("ClientShortName", this.wRetirementStudio.wSI_ShortName.chx, dic["ClientShortName"], 0); _gLib._SetSyncUDWin("ClientShortName_txt", this.wRetirementStudio.wSI_ShortName_txt.txt, dic["ClientShortName_txt"], 0); _gLib._SetSyncUDWin("ClientCode", this.wRetirementStudio.wSI_ClientCode.txt, dic["ClientCode"], 0); _gLib._SetSyncUDWin("AddressLine1", this.wRetirementStudio.wSI_AddressLine1.chx, dic["AddressLine1"], 0); _gLib._SetSyncUDWin("AddressLine1_txt", this.wRetirementStudio.wSI_AddressLine1_txt.txt, dic["AddressLine1_txt"], 0); _gLib._SetSyncUDWin("AddressLine2", this.wRetirementStudio.wAddressLine2.chx, dic["AddressLine2"], 0); _gLib._SetSyncUDWin("AddressLine2_txt", this.wRetirementStudio.wAddressLine2_txt.txt, dic["AddressLine2_txt"], 0); _gLib._SetSyncUDWin("City", this.wRetirementStudio.wSI_City.chx, dic["City"], 0); _gLib._SetSyncUDWin("City_txt", this.wRetirementStudio.wSI_City_txt.txt, dic["City_txt"], 0); _gLib._SetSyncUDWin("PostalCode", this.wRetirementStudio.wSI_PostalCode.chx, dic["PostalCode"], 0); _gLib._SetSyncUDWin("PostalCode_txt", this.wRetirementStudio.wSI_PostalCode_txt.txt, dic["PostalCode_txt"], 0); _gLib._SetSyncUDWin("Country", this.wRetirementStudio.wSI_Country.chx, dic["Country"], 0); _gLib._SetSyncUDWin("Country_txt", this.wRetirementStudio.wSI_Country_txt.txt, dic["Country_txt"], 0); }
/// <summary> /// 2013-May-21 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("iRow", "1"); /// dic.Add("BreakFieldValue", "REN2"); /// dic.Add("SubstitutionText", "The Second Plan Ren"); /// dic.Add("OK", ""); /// pBreakFieldTextSubstitution._Table(dic); /// </summary> /// <param name="dic"></param> public void _Table(MyDictionary dic) { string sFunctionName = "_Table"; _gLib._Report(_PassFailStep.Step, "Funcon <" + sFunctionName + "> Starts:"); int iRow = Convert.ToInt32(dic["iRow"]); _gLib._SetSyncUDWin("FPGrid", this.wBreakfieldtextsubstitution.wTextSubstitution_FPGrid.grid, "Click", 0, false, 90, 30); _gLib._SendKeysUDWin("FPGrid", this.wBreakfieldtextsubstitution.wTextSubstitution_FPGrid.grid, "{PgUp}{PgUp}{PgUp}{PgUp}{Home}"); string sKeys = ""; for (int i = 1; i < iRow; i++) { sKeys = sKeys + "{Down}"; } _gLib._SendKeysUDWin("FPGrid", this.wBreakfieldtextsubstitution.wTextSubstitution_FPGrid.grid, sKeys); if (dic["BreakFieldValue"] != "") { _gLib._SendKeysUDWin("BreakFieldValue", this.wBreakfieldtextsubstitution.wTextSubstitution_FPGrid.grid, dic["BreakFieldValue"]); _gLib._SendKeysUDWin("FPGrid", this.wBreakfieldtextsubstitution.wTextSubstitution_FPGrid.grid, "{Tab}"); } if (dic["SubstitutionText"] != "") { _gLib._SendKeysUDWin("SubstitutionText", this.wBreakfieldtextsubstitution.wTextSubstitution_FPGrid.grid, dic["SubstitutionText"]); _gLib._SendKeysUDWin("FPGrid", this.wBreakfieldtextsubstitution.wTextSubstitution_FPGrid.grid, "{Tab}"); } _gLib._SetSyncUDWin("OK", this.wBreakfieldtextsubstitution.wOK.btn, dic["OK"], 0); _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
/// <summary> /// 归还书籍 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonSubmit_Click(object sender, EventArgs e) { string sql = "select uBan from users where uId=@uID"; MyDictionary dic3 = new MyDictionary(); dic3.Add("@uID", TextBoxUserID2.Text.Trim()); if (SqlHelper.ExecuteScalar(sql, dic3).ToString() == "1") { MessageBox.Show("因逾期未还书账户被锁定,请及时解锁,并缴纳罚款"); return; } else { // 办理借书手续 // 删除借书记录 sql = "delete from borrow where ID=@ID"; MyDictionary dic4 = new MyDictionary(); dic4.Add("@ID", TextBoxBorrowID.Text.Trim()); SqlHelper.ExecuteNonQuery(sql, dic4); // 得到书籍库存量 并+1 sql = "select bTag from books where bNum=@bNum"; MyDictionary dic5 = new MyDictionary(); dic5.Add("@bNum", TextBoxBookNum.Text.Trim()); int n = Convert.ToInt32(SqlHelper.ExecuteScalar(sql, dic5)) + 1; sql = "update books set bTag=@bTag where bNum=@bNum"; MyDictionary dic6 = new MyDictionary(); dic6.Add("@bTag", n.ToString()); dic6.Add("@bNum", TextBoxBookNum.Text.Trim()); SqlHelper.ExecuteNonQuery(sql, dic6); MessageBox.Show("还书提交完成"); // 刷新借书单 ShowBorrowList(); } }
/// <summary> /// 2016-Jan-21 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("PreDecrement", ""); /// dic.Add("PreCommencement", ""); /// dic.Add("PostCommencement", ""); /// /// dic.Add("PreDecrement_SetBack_M", ""); /// dic.Add("PreDecrement_SetBack_F", ""); /// dic.Add("PreDecrement_Weighting_M", ""); /// dic.Add("PreDecrement_Weighting_F", ""); /// /// dic.Add("PreCommencement_SetBack_M", ""); /// dic.Add("PreCommencement_SetBack_F", ""); /// dic.Add("PreCommencement_Weighting_M", ""); /// dic.Add("PreCommencement_Weighting_F", ""); /// /// dic.Add("PostCommencement_SetBack_M", ""); /// dic.Add("PostCommencement_SetBack_F", ""); /// dic.Add("PostCommencement_Weighting_M", ""); /// dic.Add("PostCommencement_Weighting_F", ""); /// pMortalityDecrement._PrePostCommencement(dic); /// </summary> /// <param name="dic"></param> public void _PrePostCommencement(MyDictionary dic) { string sFunctionName = "_PrePostCommencement"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin("PreDecrement", this.wRetirementStudio.wPreDecrementMale.cbo, dic["PreDecrement"], 0); _gLib._SetSyncUDWin("PreCommencement", this.wRetirementStudio.wPreCommencement.cbo, dic["PreCommencement"], 0); _gLib._SetSyncUDWin("PostCommencement", this.wRetirementStudio.wPostCommencement.cbo, dic["PostCommencement"], 0); _gLib._SetSyncUDWin_ByClipboard("PreDecrement_SetBack_M", this.wRetirementStudio.wPreDecrement_S_M.txt, dic["PreDecrement_SetBack_M"], 0); _gLib._SetSyncUDWin_ByClipboard("PreDecrement_SetBack_F", this.wRetirementStudio.wPreDecrement_S_F.txt, dic["PreDecrement_SetBack_F"], 0); _gLib._SetSyncUDWin_ByClipboard("PreDecrement_Weighting_M", this.wRetirementStudio.wPreDecrement_Weigh_M.txt, dic["PreDecrement_Weighting_M"], 0); _gLib._SetSyncUDWin_ByClipboard("PreDecrement_Weighting_F", this.wRetirementStudio.wPreDecrement_Weigh_M.txt, dic["PreDecrement_Weighting_F"], 0); _gLib._SetSyncUDWin_ByClipboard("PreCommencement_SetBack_M", this.wRetirementStudio.wPreCommencement_S_M.txt, dic["PreCommencement_SetBack_M"], 0); _gLib._SetSyncUDWin_ByClipboard("PreCommencement_SetBack_F", this.wRetirementStudio.wPreCommencement_S_F.txt, dic["PreCommencement_SetBack_F"], 0); _gLib._SetSyncUDWin_ByClipboard("PreCommencement_Weighting_M", this.wRetirementStudio.wPreCommencement_Weight_M.txt, dic["PreCommencement_Weighting_M"], 0); _gLib._SetSyncUDWin_ByClipboard("PreCommencement_Weighting_F", this.wRetirementStudio.wPreCommencement_Weight_F.txt, dic["PreCommencement_Weighting_F"], 0); _gLib._SetSyncUDWin_ByClipboard("PostCommencement_SetBack_M", this.wRetirementStudio.wPostCommencement_S_M.txt, dic["PostCommencement_SetBack_M"], 0); _gLib._SetSyncUDWin_ByClipboard("PostCommencement_SetBack_F", this.wRetirementStudio.wPostCommencement_S_F.txt, dic["PostCommencement_SetBack_F"], 0); _gLib._SetSyncUDWin_ByClipboard("PostCommencement_Weighting_M", this.wRetirementStudio.wPostCommencement_W_M.txt, dic["PostCommencement_Weighting_M"], 0); _gLib._SetSyncUDWin_ByClipboard("PostCommencement_Weighting_F", this.wRetirementStudio.wPostCommencement_W_F.txt, dic["PostCommencement_Weighting_F"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._MsgBox("", "function is not complete"); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
/// <summary> /// 2017-May-16 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("IgnoreAgeAdjustment", "True"); /// dic.Add("LawYear_ValuationYearPlus", ""); /// dic.Add("LawYear_ValuationYearsPlus_txt", ""); /// dic.Add("LawYear_SpecifiedYear", ""); /// dic.Add("LawYear_SpecifiedYear_txt", ""); /// dic.Add("FOP_FormOfPayment", ""); /// dic.Add("FOP_GuaranteePeriod_txt", ""); /// dic.Add("FOP_SurvivorPercent_txt", ""); /// dic.Add("User_DefinedFormOfPaymentAdjustment_txt", ""); /// pPBGCDollarMax._PopVerify_Standard(dic); /// </summary> /// <param name="dic"></param> public void _PopVerify_Standard(MyDictionary dic) { string sFunctionName = "_PopVerify_Standard"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin("IgnoreAgeAdjustment", this.wRetirementStudio.wIgnoreAgeAdjustment.chk, dic["IgnoreAgeAdjustment"], 0); _gLib._SetSyncUDWin("LawYear_ValuationYearPlus", this.wRetirementStudio.wLawYear_ValuationYearPlus.rd, dic["LawYear_ValuationYearPlus"], 0); _gLib._SetSyncUDWin_ByClipboard("LawYear_ValuationYearsPlus_txt", this.wRetirementStudio.wLawYear_ValuationYearsPlus_txt.txt, dic["LawYear_ValuationYearsPlus_txt"], 0); _gLib._SetSyncUDWin("LawYear_SpecifiedYear", this.wRetirementStudio.wLawYear_SpecifiedYear.rd, dic["LawYear_SpecifiedYear"], 0); _gLib._SetSyncUDWin_ByClipboard("LawYear_SpecifiedYear_txt", this.wRetirementStudio.wLawYear_SpecifiedYear_txt.txt, dic["LawYear_SpecifiedYear_txt"], 0); _gLib._SetSyncUDWin("FOP_FormOfPayment", this.wRetirementStudio.wFOP_FormOfPayment.cbo, dic["FOP_FormOfPayment"], 0); _gLib._SetSyncUDWin_ByClipboard("FOP_GuaranteePeriod_txt", this.wRetirementStudio.wFOP_GuaranteePeriod_txt.txt, dic["FOP_GuaranteePeriod_txt"], 0); _gLib._SetSyncUDWin_ByClipboard("FOP_SurvivorPercent_txt", this.wRetirementStudio.wFOP_SurvivorPercent_txt.txt, dic["FOP_SurvivorPercent_txt"], 0); _gLib._SetSyncUDWin_ByClipboard("User_DefinedFormOfPaymentAdjustment_txt", this.wRetirementStudio.wFOP_GuaranteePeriod_txt.txt, dic["User_DefinedFormOfPaymentAdjustment_txt"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._VerifySyncUDWin("IgnoreAgeAdjustment", this.wRetirementStudio.wIgnoreAgeAdjustment.chk, dic["IgnoreAgeAdjustment"], 0); _gLib._VerifySyncUDWin("LawYear_ValuationYearPlus", this.wRetirementStudio.wLawYear_ValuationYearPlus.rd, dic["LawYear_ValuationYearPlus"], 0); _gLib._VerifySyncUDWin("LawYear_ValuationYearsPlus_txt", this.wRetirementStudio.wLawYear_ValuationYearsPlus_txt.txt, dic["LawYear_ValuationYearsPlus_txt"], 0); _gLib._VerifySyncUDWin("LawYear_SpecifiedYear", this.wRetirementStudio.wLawYear_SpecifiedYear.rd, dic["LawYear_SpecifiedYear"], 0); _gLib._VerifySyncUDWin("LawYear_SpecifiedYear_txt", this.wRetirementStudio.wLawYear_SpecifiedYear_txt.txt, dic["LawYear_SpecifiedYear_txt"], 0); _gLib._VerifySyncUDWin("FOP_FormOfPayment", this.wRetirementStudio.wFOP_FormOfPayment.cbo, dic["FOP_FormOfPayment"], 0); _gLib._VerifySyncUDWin("FOP_GuaranteePeriod_txt", this.wRetirementStudio.wFOP_GuaranteePeriod_txt.txt, dic["FOP_GuaranteePeriod_txt"], 0); _gLib._VerifySyncUDWin("FOP_SurvivorPercent_txt", this.wRetirementStudio.wFOP_SurvivorPercent_txt.txt, dic["FOP_SurvivorPercent_txt"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
/// <summary> /// 2013-May-20 /// [email protected] /// /// sample: /// dic.Clear(); /// dic.Add("PopVerify", "Pop"); /// dic.Add("MVOfAssets", ""); /// dic.Add("90ofMarketValue", ""); /// dic.Add("110ofMarketValue", ""); /// dic.Add("PreliminaryActuarial", ""); /// dic.Add("ActuarialValue", ""); /// dic.Add("AVAPFB", ""); /// dic.Add("AVACOBPFB", ""); /// dic.Add("Prior2YearsNHC", ""); /// dic.Add("AVANHCPurchase", ""); /// dic.Add("AVACOBPFBNHCPurchase", ""); /// dic.Add("NARFundLiabNHCPurchase", ""); /// pFundingInformation_FTAPs._PopVerify_AssetNumbers(dic); /// /// </summary> /// <param name="dic"></param> public void _PopVerify_AssetNumbers(MyDictionary dic) { string sFunctionName = "_PopVerify_AssetNumbers"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); if (dic["PopVerify"] == "Pop") { _gLib._SetSyncUDWin_ByClipboard("MVOfAssets", this.wRetirementStudio.wAssetNumbers_MVOfAssets.txtMVOfAssets, dic["MVOfAssets"], 0); _gLib._SetSyncUDWin_ByClipboard("90ofMarketValue", this.wRetirementStudio.wAssetNumbers_90ofMarketValue.txt90ofMarketValue, dic["90ofMarketValue"], 0); _gLib._SetSyncUDWin_ByClipboard("110ofMarketValue", this.wRetirementStudio.wAssetNumbers_110ofMarketValue.txt110ofMarketValue, dic["110ofMarketValue"], 0); _gLib._SetSyncUDWin_ByClipboard("PreliminaryActuarial", this.wRetirementStudio.wAssetNumbers_PreliminaryActuarial.txtPreliminaryActuarial, dic["PreliminaryActuarial"], 0); _gLib._SetSyncUDWin_ByClipboard("ActuarialValue", this.wRetirementStudio.wAssetNumbers_ActuarialValue.txtActuarialValue, dic["ActuarialValue"], 0); _gLib._SetSyncUDWin_ByClipboard("AVAPFB", this.wRetirementStudio.wAssetNumbers_AVAPFB.txtAVAPFB, dic["AVAPFB"], 0); _gLib._SetSyncUDWin_ByClipboard("AVACOBPFB", this.wRetirementStudio.wAssetNumbers_AVACOBPFB.txtAVACOBPFB, dic["AVACOBPFB"], 0); _gLib._SetSyncUDWin_ByClipboard("Prior2YearsNHC", this.wRetirementStudio.wAssetNumbers_Prior2YearsNHC.txtPrior2YearsNHC, dic["Prior2YearsNHC"], 0); _gLib._SetSyncUDWin_ByClipboard("AVANHCPurchase", this.wRetirementStudio.wAssetNumbers_AVANHCPurchase.txtAVANHCPurchase, dic["AVANHCPurchase"], 0); _gLib._SetSyncUDWin_ByClipboard("AVACOBPFBNHCPurchase", this.wRetirementStudio.wAssetNumbers_AVACOBPFBNHCPurchase.txtAVACOBPFBNHCPurchase, dic["AVACOBPFBNHCPurchase"], 0); _gLib._SetSyncUDWin_ByClipboard("NARFundLiabNHCPurchase", this.wRetirementStudio.wAssetNumbers_NARFundLiabNHCPurchase.txtNARFundLiabNHCPurchase, dic["NARFundLiabNHCPurchase"], 0); } if (dic["PopVerify"] == "Verify") { _gLib._VerifySyncUDWin("MVOfAssets", this.wRetirementStudio.wAssetNumbers_MVOfAssets.txtMVOfAssets, dic["MVOfAssets"], 0); _gLib._VerifySyncUDWin("90ofMarketValue", this.wRetirementStudio.wAssetNumbers_90ofMarketValue.txt90ofMarketValue, dic["90ofMarketValue"], 0); _gLib._VerifySyncUDWin("110ofMarketValue", this.wRetirementStudio.wAssetNumbers_110ofMarketValue.txt110ofMarketValue, dic["110ofMarketValue"], 0); _gLib._VerifySyncUDWin("PreliminaryActuarial", this.wRetirementStudio.wAssetNumbers_PreliminaryActuarial.txtPreliminaryActuarial, dic["PreliminaryActuarial"], 0); _gLib._VerifySyncUDWin("ActuarialValue", this.wRetirementStudio.wAssetNumbers_ActuarialValue.txtActuarialValue, dic["ActuarialValue"], 0); _gLib._VerifySyncUDWin("AVAPFB", this.wRetirementStudio.wAssetNumbers_AVAPFB.txtAVAPFB, dic["AVAPFB"], 0); _gLib._VerifySyncUDWin("AVACOBPFB", this.wRetirementStudio.wAssetNumbers_AVACOBPFB.txtAVACOBPFB, dic["AVACOBPFB"], 0); _gLib._VerifySyncUDWin("Prior2YearsNHC", this.wRetirementStudio.wAssetNumbers_Prior2YearsNHC.txtPrior2YearsNHC, dic["Prior2YearsNHC"], 0); _gLib._VerifySyncUDWin("AVANHCPurchase", this.wRetirementStudio.wAssetNumbers_AVANHCPurchase.txtAVANHCPurchase, dic["AVANHCPurchase"], 0); _gLib._VerifySyncUDWin("AVACOBPFBNHCPurchase", this.wRetirementStudio.wAssetNumbers_AVACOBPFBNHCPurchase.txtAVACOBPFBNHCPurchase, dic["AVACOBPFBNHCPurchase"], 0); _gLib._VerifySyncUDWin("NARFundLiabNHCPurchase", this.wRetirementStudio.wAssetNumbers_NARFundLiabNHCPurchase.txtNARFundLiabNHCPurchase, dic["NARFundLiabNHCPurchase"], 0); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
public void TryGetValueWorks() { var d = new MyDictionary(new Dictionary <int, string> { { 3, "b" }, { 6, "z" }, { 9, "x" } }); var di2 = (IDictionary <int, string>)d; string outVal; Assert.True(d.TryGetValue(9, out outVal)); Assert.AreEqual("x", outVal); Assert.True(di2.TryGetValue(3, out outVal)); Assert.AreEqual("b", outVal); outVal = "!!!"; Assert.False(d.TryGetValue(923, out outVal)); Assert.AreEqual(null, outVal); outVal = "!!!"; Assert.False(di2.TryGetValue(353, out outVal)); Assert.AreEqual(null, outVal); }
public List <MyDictionary> GetList(MyDictionary.DictionaryType type) { //string sql = "select * from JCHVRF_Dictionary where trim(Type)='" + type.ToString() + "'"; DataTable dt = JCBase.Utility.Util.InsertDsCachForLoad("JCHVRF_Dictionary"); if (dt != null && dt.Rows.Count > 0) { DataView dv = dt.DefaultView; dv.RowFilter = "trim(Type)='" + type.ToString() + "'"; dt = dv.ToTable(); List <MyDictionary> list = new List <MyDictionary>(); foreach (DataRow dr in dt.Rows) { MyDictionary dic = new MyDictionary(); dic.DicType = type; dic.Code = (dr["Code"] is DBNull) ? "" : dr["Code"].ToString().Trim(); dic.Name = (dr["Name"] is DBNull) ? "" : dr["Name"].ToString().Trim(); list.Add(dic); } return(list); } return(null); }
public static object ExecuteScalar(string sql, CommandType type, MyDictionary dic) { object obj = null; using (SqlConnection conn = GetConn()) { SqlCommand cmd = new SqlCommand(sql, conn); cmd.CommandType = type; //构造参数 SqlParameter[] ps = new SqlParameter[dic.Count]; int index = 0; foreach (var item in dic) { ps[index++] = new SqlParameter(item.Key, item.Value); } cmd.Parameters.AddRange(ps); //执行命令 conn.Open(); obj = cmd.ExecuteScalar(); } return(obj); }
public static List <MyDictionary> Compare(int[,] arr, List <Fingerprint> array) { List <MyDictionary> result = new List <MyDictionary>(); int[,] fpStand = arr; int dot1 = GetNumberOfPoints(fpStand); int dot2 = 0; foreach (var item in array) { int[,] fp = ToIntArr(item.Minutions); dot2 = GetNumberOfPoints(fp); int score = FingerPrintCompare(fpStand, fp); double procentOfCompare = Math.Pow(score, 2) / (dot1 * dot2) * 100; MyDictionary dictionary = new MyDictionary { score = procentOfCompare, fingerprint = item }; result.Add(dictionary); } return(result); }
public static void GetEnumerator_IEnumerator_Invalid() { MyDictionary dictBase = CreateDictionary(100); IEnumerator enumerator = ((IEnumerable)dictBase).GetEnumerator(); // Index < 0 Assert.Throws <InvalidOperationException>(() => enumerator.Current); // Index >= dictionary.Count while (enumerator.MoveNext()) { ; } Assert.Throws <InvalidOperationException>(() => enumerator.Current); Assert.False(enumerator.MoveNext()); // Current throws after resetting enumerator.Reset(); Assert.True(enumerator.MoveNext()); enumerator.Reset(); Assert.Throws <InvalidOperationException>(() => enumerator.Current); }
public static void Indexer_Set_NullKey_ThrowsArgumentNullException() { var dictBase = new MyDictionary(); Assert.Throws<ArgumentNullException>("key", () => dictBase[null] = new FooValue()); }
public static void Item_Get_NullKey_ThrowsArgumentNullException() { var dictBase = new MyDictionary(); Assert.Throws<ArgumentNullException>("key", () => dictBase[null]); }
static void Main(string[] args) { var myDict = new MyDictionary<string, string>(); int cnt = 22; for (int i = 0; i < cnt; i++) { myDict.Add(i.ToString(), Math.Pow(i, 2).ToString()); } string[] keys = myDict.Keys; string[] values = myDict.Values; Console.WriteLine("Keys (numbers as strings): "); for (int i = 0; i < myDict.Count; i++) Console.Write("{0,-5}", keys[i]); Console.WriteLine("\nValues (numbers in second degree as strings): "); for (int i = 0; i < myDict.Count; i++) Console.Write("{0,-5}", values[i]); Console.Write("| Count = {0}", myDict.Count); Console.WriteLine(); for (int i = 15; i < cnt; i++) { myDict.Remove(i.ToString()); } Console.WriteLine("\n\nSome elements were removed\n"); keys = myDict.Keys; values = myDict.Values; Console.WriteLine("Keys (numbers as strings): "); for (int i = 0; i < myDict.Count; i++) Console.Write("{0,-5}", keys[i]); Console.WriteLine("\nValues (numbers in second degree as strings): "); for (int i = 0; i < myDict.Count; i++) Console.Write("{0,-5}", values[i]); Console.ForegroundColor = ConsoleColor.Red; Console.Write("| Count = {0}", myDict.Count); Console.ResetColor(); Console.WriteLine("\n\nChanging the element with index = 4"); myDict["4"] = "999"; keys = myDict.Keys; values = myDict.Values; Console.WriteLine("\nKeys (numbers as strings): "); for (int i = 0; i < myDict.Count; i++) { if (keys[i] == "4") { Console.ForegroundColor = ConsoleColor.Red; Console.Write("{0,-5}", keys[i]); Console.ResetColor(); } else Console.Write("{0,-5}", keys[i]); } Console.WriteLine("\nValues (numbers as strings): "); for (int i = 0; i < myDict.Count; i++) { if (values[i] == myDict["4"]) { Console.ForegroundColor = ConsoleColor.Red; Console.Write("{0,-5}", values[i]); Console.ResetColor(); } else Console.Write("{0,-5}", values[i]); } Console.ReadKey(); }
public void WorkCollectionInheritedClasses() { Student firstStudent = new Student("Alina", "Kylish", 123456789, new DateTime(1988, 4, 3)); Student secondStudent = new Student("Elena", "Kylish", 987654321, new DateTime(1987, 8, 15)); Student thirdStudent = new Student("Oleg", "Ivanov", 975312468, new DateTime(1992, 11, 20)); MyDictionary students = new MyDictionary(); Tuple<string, string, int> key = new Tuple<string,string,int>("Alina", "Kylish", 123456789); students.Add(firstStudent); if (!students.Contains(key)) { Console.WriteLine("This key is not found"); } else { Console.WriteLine("This key is found"); } MyCollection students1 = new MyCollection(); students1.Add(firstStudent); students1.Add(secondStudent); students1.Insert(0, thirdStudent); students1.Add(firstStudent); students1.Remove(firstStudent); students1.Clear(); Console.ReadKey(); }
public static void Reset() { mockFilesystem = new MyDictionary(); userProfile = null; drives = new List<Drive>(0); folderPaths = new Dictionary<Environment.SpecialFolder, string>(0); LineEnding = DEFAULT_LINE_ENDING; }
private void IndexHelpFiles() { string[] files = Directory.GetFiles(Application.StartupPath + "\\help files\\"); fileIndex = new MyDictionary(); foreach (string f in files) { string f2 = f.Substring(f.LastIndexOf("\\") + 1); MatchCollection mc1 = indexMatcher1.Matches(f2); Match m2 = indexMatcher2.Match(f2); Match m3 = indexMatcher3.Match(f2); if (m3.Success) { fileIndex["hname"] = m3.Groups[1].Value; fileIndex["fname"] = f; } List<int> inds = new List<int>(0); foreach (Match m in mc1) { try { int mi = int.Parse(m.Groups[1].Value); string mn = m.Groups[2].Value; inds.Add(mi); MyDictionary tmpd = inds.Aggregate(fileIndex, (current, ti) => current[ti]); tmpd["name"] = mn; } catch { } } try { if (m2.Success) { int mi = int.Parse(m2.Groups[1].Value); string mn = m2.Groups[2].Value; inds.Add(mi); MyDictionary tmpd = inds.Aggregate(fileIndex, (current, ti) => current[ti]); tmpd["sname"] = mn; } } catch { } try { MyDictionary tmpd = inds.Aggregate(fileIndex, (current, ti) => current[ti]); tmpd["fname"] = f; } catch { } } }
private static string AddProc(ulong x, MyDictionary ProcList, Dictionary<ulong, TFunc> NewSubs) { if (ProcList.ContainsKey(x)) return ProcList[x].FName + "();"; TFunc tmpfunc = new TFunc(x, 1); if (!NewSubs.ContainsKey(x)) NewSubs.Add(x, tmpfunc); return "proc_" + x.ToString("X8") + "();"; }
public override string ToString(MyDictionary ProcList, VarDictionary VarDict, Dictionary<ulong, TFunc> NewSubs) { if (!(bytes==null)) if (bytes.Count() > 0) switch (bytes[0]) { case 0x74: return "$jz Loc_" + OpToString(0).Remove(0, 2); case 0x75: return "$jnz Loc_" + OpToString(0).Remove(0, 2); case 0xE8://call; return AddProc(ops[0].value.imm.imm64, ProcList, NewSubs); case 0xE9://jmp; case 0xEB://jmp; return "$jmp Loc_" + OpToString(0).Remove(0, 2); case 0xA3://mov somevar, EAX { TVar Var1 = new TVar((ulong)disp.value.d64, "", 4); if (!VarDict.ContainsKey((ulong)disp.value.d64)) { VarDict.AddVar(Var1); }; return VarDict[(ulong)disp.value.d64].FName + " = " + OpToString(1) + ";"; } case 0xFF: { if (this.bytes[1] == 0x15) return AddProc(disp.value.d64, ProcList, NewSubs); } break; case 0x0F: { if (this.bytes[1] == 0x86) return "$jbe Loc_" + OpToString(0).Remove(0, 2); }break; } string ret = "$"+mnemonic; if (ops[0].size > 0) ret += " " + OpToString(0); if (ops[1].size > 0) ret += ", " + OpToString(1); if (ops[2].size > 0) ret += ", " + OpToString(2); return ret; }
internal Dispatcher() { client_msg_handlers_ = new MyDictionary<int, ClientMsgHandler>(); }
private static void GetAutocompleteOptions(MyDictionary d, string path, string rempath, string numpath, List<ResultItem> lst, bool fv) { if (!string.IsNullOrEmpty(path) || !fv) { if (d.Keys.Length <= 0 || d["name"].Value == null || d["name"].Value.ToString().Length <= 0) return; string newpath = path + d["name"] + ">"; if (rempath.Length <= 0) { lst.Add(new ResultItem(d["name"], newpath, numpath)); return; } int ind = rempath.IndexOf(">"); if (ind >= 0) { if ((d["name"] + "").Equals(rempath.Remove(ind))) { string newrempath = ""; if (ind < rempath.Length - 1) newrempath = rempath.Substring(ind + 1); else lst.Add(new ResultItem("<Current Item>", newpath, numpath)); int[] ik = d.IKeys; if (ik.Length <= 0) { return; } foreach (int i in ik) { GetAutocompleteOptions(d[i], newpath, newrempath, ((numpath == null || numpath.Length <= 0) ? "" : numpath + ".") + i, lst, false); } } } } else { if (rempath == null || rempath.Length <= 0) lst.Add(new ResultItem("<Current Item>", "", "")); int[] ik = d.IKeys; if (ik.Length <= 0) return; foreach (int i in ik) { GetAutocompleteOptions(d[i], path, rempath, ((numpath == null || numpath.Length <= 0) ? "" : numpath + ".") + i, lst, false); } } }
protected virtual void InitPageValue(MyDictionary table) { }
public ulong DisasmFunc(List<Stroka> lst, ulong addr, MyDictionary ProcList) { //List<Stroka> lst = new List<Stroka>(); List<ulong> Tasks = new List<ulong>(); List<ulong> DTasks = new List<ulong>(); List<int> LabelList = new List<int>(); ulong StartAdr = addr; ulong EndAddr = addr; DISASM_INOUT_PARAMS param = new DISASM_INOUT_PARAMS(); uint Len = 0; byte[] sf_prefixes = new byte[Dasmer.MAX_INSTRUCTION_LEN]; param.arch = Dasmer.ARCH_ALL; param.sf_prefixes = sf_prefixes; param.mode = DISMODE.DISASSEMBLE_MODE_32; param.options = (byte)(Dasmer.DISASM_OPTION_APPLY_REL | Dasmer.DISASM_OPTION_OPTIMIZE_DISP); param.bas = assembly.ImageBase()+2000; IInstruction instr1 = new mediana.INSTRUCTION(); Tasks.Add(addr); for (uint i = 0; Tasks.Count > 0; i++) { //instr1 = new mediana.INSTRUCTION(); Len = MeDisasm.disassemble(Tasks[0], out instr1, ref param); if (EndAddr < (Tasks[0] + Len)) EndAddr = Tasks[0] + Len; Console.WriteLine(instr1.mnemonic); DTasks.Add(Tasks[0]); Tasks.Remove(Tasks[0]); lst.Add(new Stroka(this, instr1)); if(Len>0) switch (instr1.bytes[0]) { case 0x0F: switch(instr1.bytes[1]) { case 0x84://jz case 0x85://jz case 0x86://jbe int val = (int)((int)instr1.bytes[2] + (int)instr1.Addr + Len); if (!LabelList.Contains(val)) { if ((!DTasks.Contains((uint)val)) && (!Tasks.Contains((uint)val))) Tasks.Add((uint)val); //Tasks.Add((uint)val);//Add jmp adress to disasm tasks val = (int)FO2RVA((ulong)val); instr1.ops[0].value.imm.imm64 = (ulong)val; LabelList.Add(val); }break; } break; case 0x74://Jz case 0x75://Jnz { int val = (int)((int)instr1.bytes[1] + (int)instr1.Addr + Len); if (!LabelList.Contains(val)) { if ((!DTasks.Contains((uint)val)) && (!Tasks.Contains((uint)val))) Tasks.Add((uint)val); //Tasks.Add((uint)val);//Add jmp adress to disasm tasks val = (int)FO2RVA((ulong)val); instr1.ops[0].value.imm.imm64 = (ulong)val; LabelList.Add(val); } } break; case 0xC2://retn XX; case 0xC3://retn goto _end;//Костыль //continue;// Don't disasm after it case 0xE8://Call; int val3 = (int)instr1.bytes[1] + (int)Len + (int)instr1.Addr; val3 = (int)FO2RVA((ulong)val3); instr1.ops[0].value.imm.imm64 = (ulong)val3; break; case 0xEB://jmp; int val1 = (int)instr1.bytes[1] + (int)Len + (int)instr1.Addr; if (!LabelList.Contains(val1)) { LabelList.Add(val1); if((!DTasks.Contains((uint)val1)) && (!Tasks.Contains((uint)val1))) Tasks.Add((uint)val1); //Tasks.Add((uint)val1);//Add jmp adress to disasm tasks } continue;// Don't disasm after it case 0xE9://jmp; int val2 = (int)instr1.bytes[1] + (int)Len + (int)instr1.Addr; if (!LabelList.Contains(val2)) { if ((!DTasks.Contains((uint)val2)) && (!Tasks.Contains((uint)val2))) Tasks.Add((uint)val2); //Tasks.Add((uint)val2);//Add jmp adress to disasm tasks val2 = (int)FO2RVA((ulong)val2); instr1.ops[0].value.imm.imm64 = (ulong)val2; LabelList.Add(val2); } continue;// Don't disasm after it case 0xFF: if (instr1.bytes[1] == 0x15)//Call { ulong a = instr1.disp.value.d64; Console.WriteLine(a.ToString("X")); if(ProcList.ContainsKey(a)) if(ProcList[a].FName.Contains("ExitProcess"))continue; } break; } //Tasks.Add( instruction.Offset.FileOffset + (uint)instruction.Size); if ((!DTasks.Contains(instr1.Addr + Len)) && (!Tasks.Contains(instr1.Addr + Len))) Tasks.Add(instr1.Addr + Len); instr1.Addr = FO2RVA(instr1.Addr); // += assembly.NTHeader.OptionalHeader.ImageBase; } _end: instr1.Addr = FO2RVA((ulong)instr1.Addr); lst.Sort(delegate(Stroka x, Stroka y) { if (x.addr > y.addr) return 1; if (x.addr == y.addr) return 0; return -1; }); foreach (uint Addr in LabelList) { Stroka result = lst.Find( delegate(Stroka sstr){return sstr.addr == Addr;} ); if (result != null) { result.Label = "Loc_" + result.Inst.Addr.ToString("X8").Remove(0, 2); } } return EndAddr-StartAdr; }
public static void SyncRoot() { // SyncRoot should be the reference to the underlying dictionary, not to MyDictionary var dictBase = new MyDictionary(); object syncRoot = dictBase.SyncRoot; Assert.NotEqual(syncRoot, dictBase); Assert.Equal(dictBase.SyncRoot, dictBase.SyncRoot); }
public static void IDictionaryProperties() { var dictBase = new MyDictionary(); Assert.False(dictBase.IsFixedSize); Assert.False(dictBase.IsReadOnly); Assert.False(dictBase.IsSynchronized); }
static void Main(string[] args) { MyDictionary<string, Auto> auto = new MyDictionary<string, Auto>(); Auto car = new Auto(); auto.Add("Audi", car); auto.Add("BMW", car); foreach (var s in auto) { Console.WriteLine(s.Key); } Console.WriteLine(); Console.ReadLine(); }