示例#1
0
 public void C7Generate(NuGenEQML control, string number)
 {
     this.xmldocument.Load("CalculationXML/c7.xml");
     foreach (XmlNode node in this.xmldocument.FirstChild.ChildNodes)
     {
         int num21;
         int num   = 0;
         int num2  = 0;
         int num3  = 0;
         int num4  = 0;
         int num5  = 0;
         int num6  = 0;
         int num7  = 0;
         int num8  = 0;
         int num9  = 0;
         int num10 = 0;
         int num11 = 0;
         int num12 = 0;
         int num13 = 0;
         int num14 = 0;
         int num15 = 0;
         int num16 = 0;
         int num17 = 0;
         int num18 = 0;
         int num19 = 0;
         int num20 = 0;
         if (StudentModel.isReGeneration)
         {
             num  = this.numberTools.myRandom(4);
             num2 = this.numberTools.myRandom(4);
             num3 = this.numberTools.myRandom(4);
             num4 = this.numberTools.myRandom(6);
             num5 = this.numberTools.myRandom(6);
             num6 = this.numberTools.myRandom(6);
             num7 = this.numberTools.myRandom(6);
             if (((num4 * num7) - (num5 * num6)) == 0)
             {
                 num4 = -1 * num4;
             }
             num8  = (num4 * num7) - (num5 * num6);
             num9  = this.numberTools.myRandom(9);
             num10 = this.numberTools.myRandom(9);
             num11 = this.numberTools.myRandom(9);
             num12 = this.numberTools.myRandom(9);
             num13 = this.numberTools.myRandom(9);
             num14 = this.numberTools.myRandom(9);
             num15 = ((num9 + (num * num11)) * num4) + ((num10 + (num * num12)) * num6);
             num16 = ((num9 + (num * num11)) * num5) + ((num10 + (num * num12)) * num7);
             num17 = ((num11 + (num2 * num13)) * num4) + ((num12 + (num2 * num14)) * num6);
             num18 = ((num11 + (num2 * num13)) * num5) + ((num12 + (num2 * num14)) * num7);
             num19 = ((((num3 * num9) + ((num * num3) * num11)) + num13) * num4) + ((((num3 * num10) + ((num * num3) * num12)) + num14) * num6);
             num20 = ((((num3 * num9) + ((num * num3) * num11)) + num13) * num5) + ((((num3 * num10) + ((num * num3) * num12)) + num14) * num7);
             string        str    = SupportTools.getGuid();
             string        path   = "temp/generate/c7.xml";
             FileStream    w      = new FileStream(path, FileMode.Create);
             XmlTextWriter writer = new XmlTextWriter(w, Encoding.UTF8)
             {
                 Formatting = Formatting.Indented
             };
             writer.WriteStartDocument();
             writer.WriteStartElement("Info");
             writer.WriteAttributeString("save", "false");
             writer.WriteAttributeString("guid", str);
             writer.WriteStartElement("Params");
             writer.WriteElementString("a1 ", num.ToString());
             writer.WriteElementString("a2 ", num2.ToString());
             writer.WriteElementString("a3 ", num3.ToString());
             writer.WriteElementString("b11 ", num4.ToString());
             writer.WriteElementString("b12 ", num5.ToString());
             writer.WriteElementString("b21 ", num6.ToString());
             writer.WriteElementString("b22 ", num7.ToString());
             writer.WriteElementString("x11", num9.ToString());
             writer.WriteElementString("x12", num10.ToString());
             writer.WriteElementString("x21", num11.ToString());
             writer.WriteElementString("x22", num12.ToString());
             writer.WriteElementString("x31", num13.ToString());
             writer.WriteElementString("x32", num14.ToString());
             writer.WriteElementString("c11", num15.ToString());
             writer.WriteElementString("c12", num16.ToString());
             writer.WriteElementString("c21", num17.ToString());
             writer.WriteElementString("c22", num18.ToString());
             writer.WriteElementString("c31", num19.ToString());
             writer.WriteElementString("c32", num20.ToString());
             writer.WriteEndElement();
             writer.WriteStartElement("Answer");
             num21 = 1 - ((num * num2) * num3);
             writer.WriteElementString("d11", num21.ToString());
             num21 = -1 * num;
             writer.WriteElementString("d12", num21.ToString());
             num21 = num * num2;
             writer.WriteElementString("d13", num21.ToString());
             num21 = num2 * num3;
             writer.WriteElementString("d14", num21.ToString());
             num21 = 1;
             writer.WriteElementString("d15", num21.ToString());
             num21 = -1 * num2;
             writer.WriteElementString("d16", num21.ToString());
             num21 = -1 * num3;
             writer.WriteElementString("d17", num21.ToString());
             num21 = 0;
             writer.WriteElementString("d18", num21.ToString());
             num21 = 1;
             writer.WriteElementString("d19", num21.ToString());
             writer.WriteElementString("d20", SupportTools.DoubleFormat((1.0 * num7) / ((double)num8)).ToString());
             writer.WriteElementString("d21", SupportTools.DoubleFormat((-num5 * 1.0) / ((double)num8)).ToString());
             writer.WriteElementString("d22", SupportTools.DoubleFormat((-num6 * 1.0) / ((double)num8)).ToString());
             writer.WriteElementString("d23", SupportTools.DoubleFormat((num4 * 1.0) / ((double)num8)).ToString());
             writer.WriteElementString("d24", num9.ToString());
             writer.WriteElementString("d25", num10.ToString());
             writer.WriteElementString("d26", num11.ToString());
             writer.WriteElementString("d27", num12.ToString());
             writer.WriteElementString("d28", num13.ToString());
             writer.WriteElementString("d29", num14.ToString());
             writer.WriteEndElement();
             writer.WriteEndElement();
             writer.WriteEndDocument();
             writer.Flush();
             writer.Close();
         }
         else
         {
             XmlDocument xmldoc = new XmlDocument();
             xmldoc.Load("temp/generate/c7.xml");
             XmlNode node2 = SupportTools.ParamsXmlNode(xmldoc);
             foreach (XmlNode node3 in node2.ChildNodes)
             {
                 if (node3.Name.Equals("a1"))
                 {
                     num = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a2"))
                 {
                     num2 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a3"))
                 {
                     num3 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b11"))
                 {
                     num4 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b12"))
                 {
                     num5 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b21"))
                 {
                     num6 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b22"))
                 {
                     num7 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c11"))
                 {
                     num15 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c12"))
                 {
                     num16 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c21"))
                 {
                     num17 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c22"))
                 {
                     num18 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c31"))
                 {
                     num19 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c32"))
                 {
                     num20 = int.Parse(node3.InnerText);
                 }
             }
         }
         num21 = num * num3;
         string sXML = node.InnerText.Replace("#x#", number).Replace("#k#", num.ToString()).Replace("#l#", num2.ToString()).Replace("#m#", num3.ToString()).Replace("#n#", num21.ToString()).Replace("#o#", num4.ToString()).Replace("#p#", num5.ToString()).Replace("#q#", num6.ToString()).Replace("#r#", num7.ToString()).Replace("#s#", num15.ToString()).Replace("#t#", num16.ToString()).Replace("#u#", num17.ToString()).Replace("#v#", num18.ToString()).Replace("#w#", num19.ToString()).Replace("#y#", num20.ToString());
         control.Size    = new Size(440, 100);
         control.Enabled = false;
         control.pub_LoadXML(sXML);
     }
 }
示例#2
0
 public void g_two_1Generate(NuGenEQML control0, TableLayoutPanel tableLayoutPanel, List <TextBox> listT, string number)
 {
     this.xmlDocument.Load("GapfillingXML/g_two_1.xml");
     foreach (XmlNode node in this.xmlDocument.FirstChild.ChildNodes)
     {
         double num   = 0.0;
         double num2  = 0.0;
         double num3  = 0.0;
         double num4  = 0.0;
         double num5  = 0.0;
         double num6  = 0.0;
         double num7  = 0.0;
         double num8  = 0.0;
         double num9  = 0.0;
         double num10 = 0.0;
         double num11 = 0.0;
         double num12 = 0.0;
         double num13 = 0.0;
         double num14 = 0.0;
         double num15 = 0.0;
         double num16 = 0.0;
         double num17 = 0.0;
         double num18 = 0.0;
         double num19 = 0.0;
         if (StudentModel.isReGeneration)
         {
             num   = 1.0;
             num2  = this.numberTools.myRandom(5);
             num3  = this.numberTools.myRandom(5);
             num4  = this.numberTools.myRandom(5);
             num5  = this.numberTools.myRandom(5);
             num6  = this.numberTools.myRandom(5);
             num7  = this.numberTools.myRandom(5);
             num8  = this.numberTools.myRandom(3);
             num9  = this.numberTools.myRandom(3);
             num10 = this.numberTools.myRandom(3);
             num11 = (num5 * num2) + 1.0;
             num12 = (num6 * num2) + 1.0;
             num13 = (num7 * num2) + 1.0;
             num14 = (num5 * num3) + num8;
             num15 = (num5 * num4) + num9;
             num16 = ((num6 * num3) + num8) + 1.0;
             num17 = ((num7 * num3) + num8) + 1.0;
             num18 = ((num6 * num4) + num9) + num10;
             num19 = (((num7 * num4) + num9) + num10) + 1.0;
             string        str    = SupportTools.getGuid();
             string        path   = "temp/generate/g_two_1.xml";
             FileStream    w      = new FileStream(path, FileMode.Create);
             XmlTextWriter writer = new XmlTextWriter(w, Encoding.UTF8)
             {
                 Formatting = Formatting.Indented
             };
             writer.WriteStartDocument();
             writer.WriteStartElement("Info");
             writer.WriteAttributeString("save", "false");
             writer.WriteAttributeString("guid", str);
             writer.WriteStartElement("Params");
             writer.WriteElementString("a11", num.ToString());
             writer.WriteElementString("a12", num2.ToString());
             writer.WriteElementString("a13", num3.ToString());
             writer.WriteElementString("a14", num4.ToString());
             writer.WriteElementString("a21", num5.ToString());
             writer.WriteElementString("a22", num11.ToString());
             writer.WriteElementString("a23", num14.ToString());
             writer.WriteElementString("a24", num15.ToString());
             writer.WriteElementString("a31", num6.ToString());
             writer.WriteElementString("a32", num12.ToString());
             writer.WriteElementString("a33", num16.ToString());
             writer.WriteElementString("a34", num18.ToString());
             writer.WriteElementString("a41", num7.ToString());
             writer.WriteElementString("a42", num13.ToString());
             writer.WriteElementString("a43", num17.ToString());
             writer.WriteElementString("a44", num19.ToString());
             writer.WriteEndElement();
             double k     = ((((((num6 * num8) - (num5 * num8)) - num5) - (num6 * num9)) + (num7 * num9)) + ((num6 * num8) * num10)) - ((num7 * num8) * num10);
             double num21 = num8 + 1.0;
             double num22 = (num9 - num8) - (num8 * num10);
             double num23 = (num8 * num10) - num9;
             double num24 = ((num5 - num6) - (num6 * num10)) + (num7 * num10);
             double num25 = -1.0;
             double num26 = 1.0 + num10;
             double num27 = -num10;
             double num28 = num6 - num7;
             double num29 = 0.0;
             double num30 = -1.0;
             double num31 = 1.0;
             double num32 = (((((((((((((num2 * num5) - (num3 * num5)) + (num3 * num6)) - (num4 * num6)) + (num4 * num7)) + ((num2 * num5) * num8)) - ((num2 * num6) * num8)) + ((num2 * num6) * num9)) - ((num2 * num7) * num9)) + ((num3 * num6) * num10)) - ((num3 * num7) * num10)) - (((num2 * num6) * num8) * num10)) + (((num2 * num7) * num8) * num10)) + 1.0;
             double num33 = (num3 - num2) - (num2 * num8);
             double num34 = ((((num4 - num3) + (num2 * num8)) - (num2 * num9)) - (num3 * num10)) + ((num2 * num8) * num10);
             double num35 = (((num2 * num9) - num4) + (num3 * num10)) - ((num2 * num8) * num10);
             writer.WriteStartElement("Answer");
             writer.WriteElementString("b11", SupportTools.DoubleFormat(num32).ToString());
             writer.WriteElementString("b12", SupportTools.DoubleFormat(num33).ToString());
             writer.WriteElementString("b13", SupportTools.DoubleFormat(num34).ToString());
             writer.WriteElementString("b14", SupportTools.DoubleFormat(num35).ToString());
             writer.WriteElementString("b21", SupportTools.DoubleFormat(k).ToString());
             writer.WriteElementString("b22", SupportTools.DoubleFormat(num21).ToString());
             writer.WriteElementString("b23", SupportTools.DoubleFormat(num22).ToString());
             writer.WriteElementString("b24", SupportTools.DoubleFormat(num23).ToString());
             writer.WriteElementString("b31", SupportTools.DoubleFormat(num24).ToString());
             writer.WriteElementString("b32", SupportTools.DoubleFormat(num25).ToString());
             writer.WriteElementString("b33", SupportTools.DoubleFormat(num26).ToString());
             writer.WriteElementString("b34", SupportTools.DoubleFormat(num27).ToString());
             writer.WriteElementString("b41", SupportTools.DoubleFormat(num28).ToString());
             writer.WriteElementString("b42", SupportTools.DoubleFormat(num29).ToString());
             writer.WriteElementString("b43", SupportTools.DoubleFormat(num30).ToString());
             writer.WriteElementString("b44", SupportTools.DoubleFormat(num31).ToString());
             writer.WriteEndElement();
             writer.WriteEndElement();
             writer.WriteEndDocument();
             writer.Flush();
             writer.Close();
         }
         else
         {
             XmlDocument xmldoc = new XmlDocument();
             xmldoc.Load("temp/generate/g_two_1.xml");
             XmlNode node2 = SupportTools.ParamsXmlNode(xmldoc);
             foreach (XmlNode node3 in node2.ChildNodes)
             {
                 if (node3.Name.Equals("a11"))
                 {
                     num = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a12"))
                 {
                     num2 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a13"))
                 {
                     num3 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a14"))
                 {
                     num4 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a21"))
                 {
                     num5 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a22"))
                 {
                     num11 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a23"))
                 {
                     num14 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a24"))
                 {
                     num15 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a31"))
                 {
                     num6 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a32"))
                 {
                     num12 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a33"))
                 {
                     num16 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a34"))
                 {
                     num18 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a41"))
                 {
                     num7 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a42"))
                 {
                     num13 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a43"))
                 {
                     num17 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a44"))
                 {
                     num19 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b3"))
                 {
                     num8 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b4"))
                 {
                     num9 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c"))
                 {
                     num10 = int.Parse(node3.InnerText);
                 }
             }
         }
         control0.pub_LoadXML(node.InnerText.Replace("#x#", number).Replace("#a#", num.ToString()).Replace("#b#", num2.ToString()).Replace("#c#", num3.ToString()).Replace("#d#", num4.ToString()).Replace("#e#", num5.ToString()).Replace("#f#", num11.ToString()).Replace("#g#", num14.ToString()).Replace("#h#", num15.ToString()).Replace("#i#", num6.ToString()).Replace("#j#", num12.ToString()).Replace("#k#", num16.ToString()).Replace("#l#", num18.ToString()).Replace("#m#", num7.ToString()).Replace("#n#", num13.ToString()).Replace("#o#", num17.ToString()).Replace("#p#", num19.ToString()));
         control0.Size    = new Size(410, 120);
         control0.Anchor  = AnchorStyles.None;
         control0.Enabled = false;
         new InitControls().matrixFourToFour(tableLayoutPanel, listT);
     }
 }
示例#3
0
 public void g_four_1Generate(NuGenEQML control0, string number)
 {
     this.xmlDocument.Load("GapfillingXML/g_four_1.xml");
     foreach (XmlNode node in this.xmlDocument.FirstChild.ChildNodes)
     {
         Dictionary <int, string> dictionary = null;
         if (StudentModel.isReGeneration)
         {
             dictionary = this.initial();
             string        str    = SupportTools.getGuid();
             string        path   = "temp/generate/g_four_1.xml";
             FileStream    w      = new FileStream(path, FileMode.Create);
             XmlTextWriter writer = new XmlTextWriter(w, Encoding.UTF8)
             {
                 Formatting = Formatting.Indented
             };
             writer.WriteStartDocument();
             writer.WriteStartElement("Info");
             writer.WriteAttributeString("save", "false");
             writer.WriteAttributeString("guid", str);
             writer.WriteStartElement("Params");
             writer.WriteElementString("a11", dictionary[1].ToString());
             writer.WriteElementString("a12", dictionary[2].ToString());
             writer.WriteElementString("a13", dictionary[3].ToString());
             writer.WriteElementString("a21", dictionary[4].ToString());
             writer.WriteElementString("a22", dictionary[5].ToString());
             writer.WriteElementString("a23", dictionary[6].ToString());
             writer.WriteElementString("a31", dictionary[7].ToString());
             writer.WriteElementString("a32", dictionary[8].ToString());
             writer.WriteElementString("a33", dictionary[9].ToString());
             writer.WriteEndElement();
             writer.WriteStartElement("Answer");
             double num  = int.Parse(dictionary[((this.i - 1) * 3) + this.r]) * ((int.Parse(dictionary[((this.j - 1) * 3) + this.s]) * int.Parse(dictionary[((this.l - 1) * 3) + this.t])) - (int.Parse(dictionary[((this.j - 1) * 3) + this.t]) * int.Parse(dictionary[((this.l - 1) * 3) + this.s])));
             int    num2 = (-1 * this.a) * ((int.Parse(dictionary[((this.j - 1) * 3) + this.t]) * int.Parse(dictionary[((this.l - 1) * 3) + this.r])) - (int.Parse(dictionary[((this.j - 1) * 3) + this.r]) * int.Parse(dictionary[((this.l - 1) * 3) + this.t])));
             int    num3 = this.b * ((int.Parse(dictionary[((this.j - 1) * 3) + this.s]) * int.Parse(dictionary[((this.l - 1) * 3) + this.r])) - (int.Parse(dictionary[((this.j - 1) * 3) + this.r]) * int.Parse(dictionary[((this.l - 1) * 3) + this.s])));
             writer.WriteElementString("k", SupportTools.DoubleFormat(num / ((double)(num2 + num3))).ToString());
             writer.WriteEndElement();
             writer.WriteEndElement();
             writer.WriteEndDocument();
             writer.Flush();
             writer.Close();
         }
         else
         {
             XmlDocument xmldoc = new XmlDocument();
             xmldoc.Load("temp/generate/g_four_1.xml");
             XmlNode node2 = SupportTools.ParamsXmlNode(xmldoc);
             dictionary = new Dictionary <int, string>();
             foreach (XmlNode node3 in node2.ChildNodes)
             {
                 if (node3.Name.Equals("a11"))
                 {
                     dictionary.Add(1, node3.InnerText);
                 }
                 else if (node3.Name.Equals("a12"))
                 {
                     dictionary.Add(2, node3.InnerText);
                 }
                 else if (node3.Name.Equals("a13"))
                 {
                     dictionary.Add(3, node3.InnerText);
                 }
                 else if (node3.Name.Equals("a21"))
                 {
                     dictionary.Add(4, node3.InnerText);
                 }
                 else if (node3.Name.Equals("a22"))
                 {
                     dictionary.Add(5, node3.InnerText);
                 }
                 else if (node3.Name.Equals("a23"))
                 {
                     dictionary.Add(6, node3.InnerText);
                 }
                 else if (node3.Name.Equals("a31"))
                 {
                     dictionary.Add(7, node3.InnerText);
                 }
                 else if (node3.Name.Equals("a32"))
                 {
                     dictionary.Add(8, node3.InnerText);
                 }
                 else if (node3.Name.Equals("a33"))
                 {
                     dictionary.Add(9, node3.InnerText);
                 }
             }
         }
         string sXML = node.InnerText.Replace("#x#", number).Replace("#a#", dictionary[1].ToString()).Replace("#b#", dictionary[2].ToString()).Replace("#c#", dictionary[3].ToString()).Replace("#d#", dictionary[4].ToString()).Replace("#e#", dictionary[5].ToString()).Replace("#f#", dictionary[6].ToString()).Replace("#g#", dictionary[7].ToString()).Replace("#h#", dictionary[8].ToString()).Replace("#i#", dictionary[9].ToString());
         control0.pub_LoadXML(sXML);
         control0.Size    = new Size(0x235, 90);
         control0.Enabled = false;
         control0.Anchor  = AnchorStyles.None;
     }
 }
示例#4
0
 public void g_seven_1_3Generate(NuGenEQML control0, TableLayoutPanel tableLayoutPanel, List <TextBox> list, string number)
 {
     this.xmlDocument.Load("GapfillingXML/g_seven_1_3.xml");
     foreach (XmlNode node in this.xmlDocument.FirstChild.ChildNodes)
     {
         int    i        = 0;
         int    num2     = 0;
         int    num3     = 0;
         int    num4     = 0;
         string newValue = null;
         string str2     = null;
         string str3     = null;
         if (StudentModel.isReGeneration)
         {
             i        = this.numberTools.myRandom(6);
             num2     = this.numberTools.myRandom(6);
             num3     = this.numberTools.myRandom(6);
             num4     = this.numberTools.myRandom(6);
             newValue = this.numberTools.compare(i);
             str2     = this.numberTools.compare(num2);
             str3     = this.numberTools.compare(num3);
             string        str4   = SupportTools.getGuid();
             string        path   = "temp/generate/g_seven_1_3.xml";
             FileStream    w      = new FileStream(path, FileMode.Create);
             XmlTextWriter writer = new XmlTextWriter(w, Encoding.UTF8)
             {
                 Formatting = Formatting.Indented
             };
             writer.WriteStartDocument();
             writer.WriteStartElement("Info");
             writer.WriteAttributeString("save", "false");
             writer.WriteAttributeString("guid", str4);
             writer.WriteStartElement("Params");
             writer.WriteElementString("a", i.ToString());
             writer.WriteElementString("b", num2.ToString());
             writer.WriteElementString("c", num3.ToString());
             writer.WriteElementString("d", num4.ToString());
             writer.WriteEndElement();
             int    num5  = 0;
             double num6  = SupportTools.DoubleFormat(1.0 / ((double)num4));
             double num7  = SupportTools.DoubleFormat((num2 - (2.0 * i)) / ((double)num4));
             int    num8  = 0;
             int    num9  = 0;
             int    num10 = 2;
             int    num11 = 0;
             int    num12 = 0;
             int    num13 = 0;
             writer.WriteStartElement("Answer");
             writer.WriteElementString("b11", num5.ToString());
             writer.WriteElementString("b12", num6.ToString());
             writer.WriteElementString("b13", num7.ToString());
             writer.WriteElementString("b21", num8.ToString());
             writer.WriteElementString("b22", num9.ToString());
             writer.WriteElementString("b23", num10.ToString());
             writer.WriteElementString("b31", num11.ToString());
             writer.WriteElementString("b32", num12.ToString());
             writer.WriteElementString("b33", num13.ToString());
             writer.WriteEndElement();
             writer.WriteEndElement();
             writer.WriteEndDocument();
             writer.Flush();
             writer.Close();
         }
         else
         {
             XmlDocument xmldoc = new XmlDocument();
             xmldoc.Load("temp/generate/g_seven_1_3.xml");
             XmlNode node2 = SupportTools.ParamsXmlNode(xmldoc);
             foreach (XmlNode node3 in node2.ChildNodes)
             {
                 if (node3.Name.Equals("a"))
                 {
                     i = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b"))
                 {
                     num2 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c"))
                 {
                     num3 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("d"))
                 {
                     num4 = int.Parse(node3.InnerText);
                 }
             }
             newValue = this.numberTools.compare(i);
             str2     = this.numberTools.compare(num2);
             str3     = this.numberTools.compare(num3);
         }
         if (str2 == "+1")
         {
             str2 = "+";
         }
         else if (str2 == "-1")
         {
             str2 = "-";
         }
         string sXML = node.InnerText.Replace("#x#", number).Replace("#a#", newValue).Replace("#b#", str2).Replace("#c#", str3).Replace("#d#", num4.ToString());
         control0.pub_LoadXML(sXML);
         control0.Size    = new Size(850, 60);
         control0.Enabled = false;
         control0.Anchor  = AnchorStyles.None;
         new InitControls().matrixThreeToThree(tableLayoutPanel, list);
     }
 }
示例#5
0
 public void g_five_1Generate(NuGenEQML control1, string number)
 {
     this.xmlDocument.Load("GapfillingXML/g_five_1.xml");
     foreach (XmlNode node in this.xmlDocument.FirstChild.ChildNodes)
     {
         int    num4;
         int    num       = 0;
         int    i         = 0;
         string innerText = null;
         string str2      = null;
         string str3      = null;
         string str4      = null;
         string str5      = null;
         string str6      = null;
         string str7      = null;
         string str8      = null;
         string str9      = null;
         if (StudentModel.isReGeneration)
         {
             num       = this.numberTools.myRandom(5);
             i         = this.numberTools.myRandom(5);
             innerText = "k" + this.numberTools.compare(i);
             str2      = "k" + this.numberTools.compare(i);
             str3      = "k" + this.numberTools.compare(-1 * i);
             str4      = "k" + this.numberTools.compare(-1 * i);
             num4      = -1 * i;
             str5      = num4.ToString();
             num4      = -1 * i;
             str6      = num4.ToString();
             str7      = i.ToString();
             str8      = i.ToString();
             str9      = i.ToString();
             string        str10  = SupportTools.getGuid();
             string        path   = "temp/generate/g_five_1.xml";
             FileStream    w      = new FileStream(path, FileMode.Create);
             XmlTextWriter writer = new XmlTextWriter(w, Encoding.UTF8)
             {
                 Formatting = Formatting.Indented
             };
             writer.WriteStartDocument();
             writer.WriteStartElement("Info");
             writer.WriteAttributeString("save", "false");
             writer.WriteAttributeString("guid", str10);
             writer.WriteStartElement("Params");
             writer.WriteElementString("a", num.ToString());
             writer.WriteElementString("b", i.ToString());
             writer.WriteElementString("a11", innerText.ToString());
             writer.WriteElementString("a12", str3.ToString());
             writer.WriteElementString("a13", str5.ToString());
             writer.WriteElementString("a21", str4.ToString());
             writer.WriteElementString("a22", str2.ToString());
             writer.WriteElementString("a23", str7.ToString());
             writer.WriteElementString("a31", str6.ToString());
             writer.WriteElementString("a32", str8.ToString());
             writer.WriteElementString("a33", str9.ToString());
             writer.WriteEndElement();
             writer.WriteStartElement("Answer");
             writer.WriteElementString("k", SupportTools.DoubleFormat(((double)num) / 2.0).ToString());
             writer.WriteEndElement();
             writer.WriteEndElement();
             writer.WriteEndDocument();
             writer.Flush();
             writer.Close();
         }
         else
         {
             XmlDocument xmldoc = new XmlDocument();
             xmldoc.Load("temp/generate/g_five_1.xml");
             XmlNode node2 = SupportTools.ParamsXmlNode(xmldoc);
             foreach (XmlNode node3 in node2.ChildNodes)
             {
                 if (node3.Name.Equals("a"))
                 {
                     num = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b"))
                 {
                     i = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("a11"))
                 {
                     innerText = node3.InnerText;
                 }
                 else if (node3.Name.Equals("a22"))
                 {
                     str2 = node3.InnerText;
                 }
                 else if (node3.Name.Equals("a12"))
                 {
                     str3 = node3.InnerText;
                 }
                 else if (node3.Name.Equals("a21"))
                 {
                     str4 = node3.InnerText;
                 }
                 else if (node3.Name.Equals("a13"))
                 {
                     str5 = node3.InnerText;
                 }
                 else if (node3.Name.Equals("a31"))
                 {
                     str6 = node3.InnerText;
                 }
                 else if (node3.Name.Equals("a23"))
                 {
                     str7 = node3.InnerText;
                 }
                 else if (node3.Name.Equals("a32"))
                 {
                     str8 = node3.InnerText;
                 }
                 else if (node3.Name.Equals("a33"))
                 {
                     str9 = node3.InnerText;
                 }
             }
         }
         num4 = 3 * i;
         string sXML = node.InnerText.Replace("#x#", number).Replace("#a#", innerText.ToString()).Replace("#b#", str3.ToString()).Replace("#c#", str5.ToString()).Replace("#d#", str4.ToString()).Replace("#e#", str2.ToString()).Replace("#f#", str7.ToString()).Replace("#g#", str6.ToString()).Replace("#h#", str8.ToString()).Replace("#i#", str9.ToString()).Replace("#j#", num.ToString()).Replace("#k#", num4.ToString()).Replace("#l#", "");
         control1.Size    = new Size(500, 80);
         control1.Enabled = false;
         control1.pub_LoadXML(sXML);
         control1.Anchor = AnchorStyles.None;
     }
 }
示例#6
0
 public void C9Generate(NuGenEQML control, string number)
 {
     this.xmldocument.Load("CalculationXML/c9.xml");
     foreach (XmlNode node in this.xmldocument.FirstChild.ChildNodes)
     {
         int num5;
         int num  = 0;
         int i    = 0;
         int num3 = 0;
         int num4 = 0;
         if (StudentModel.isReGeneration)
         {
             List <int> list = this.GenerateDifferent(9);
             num  = list[0];
             i    = list[1];
             num3 = list[2];
             num4 = list[3];
             string        str    = SupportTools.getGuid();
             string        path   = "temp/generate/c9.xml";
             FileStream    w      = new FileStream(path, FileMode.Create);
             XmlTextWriter writer = new XmlTextWriter(w, Encoding.UTF8)
             {
                 Formatting = Formatting.Indented
             };
             writer.WriteStartDocument();
             writer.WriteStartElement("Info");
             writer.WriteAttributeString("save", "false");
             writer.WriteAttributeString("guid", str);
             writer.WriteStartElement("Params");
             writer.WriteElementString("a", num.ToString());
             writer.WriteElementString("b", i.ToString());
             writer.WriteElementString("c", num3.ToString());
             writer.WriteElementString("d", num4.ToString());
             writer.WriteEndElement();
             writer.WriteStartElement("Answer");
             num5 = ((i - num) * (num3 - num)) * (num3 - i);
             writer.WriteElementString("D2", num5.ToString());
             writer.WriteElementString("x1", SupportTools.DoubleFormat((((i - num4) * (num3 - num4)) * 1.0) / ((double)((i - num) * (num3 - num)))).ToString());
             writer.WriteElementString("x2", SupportTools.DoubleFormat((((num4 - num) * (num3 - num4)) * 1.0) / ((double)((i - num) * (num3 - i)))).ToString());
             writer.WriteElementString("x3", SupportTools.DoubleFormat((((num4 - num) * (num4 - i)) * 1.0) / ((double)((num3 - i) * (num3 - num)))).ToString());
             writer.WriteEndElement();
             writer.WriteEndElement();
             writer.WriteEndDocument();
             writer.Flush();
             writer.Close();
         }
         else
         {
             XmlDocument xmldoc = new XmlDocument();
             xmldoc.Load("temp/generate/c9.xml");
             XmlNode node2 = SupportTools.ParamsXmlNode(xmldoc);
             foreach (XmlNode node3 in node2.ChildNodes)
             {
                 if (node3.Name.Equals("a"))
                 {
                     num = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b"))
                 {
                     i = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c"))
                 {
                     num3 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("d"))
                 {
                     num4 = int.Parse(node3.InnerText);
                 }
             }
         }
         num5 = num4 * num4;
         string sXML = node.InnerText.Replace("#x#", number).Replace("#k#", ((num == 1) || (num == -1)) ? num.ToString().Replace("1", "") : num.ToString()).Replace("#l#", ((i == 1) || (i == -1)) ? this.numberTools.compare(i).Replace("1", "") : this.numberTools.compare(i)).Replace("#m#", ((num3 == 1) || (num3 == -1)) ? this.numberTools.compare(num3).Replace("1", "") : this.numberTools.compare(num3)).Replace("#n#", num4.ToString()).Replace("#o#", ((num == 1) || (num == -1)) ? (num5 = num * num).ToString().Replace("1", "") : (num5 = num * num).ToString()).Replace("#p#", ((i == 1) || (i == -1)) ? this.numberTools.compare(i * i).Replace("1", "") : this.numberTools.compare(i * i)).Replace("#q#", ((num3 == 1) || (num3 == -1)) ? this.numberTools.compare(num3 * num3).Replace("1", "") : this.numberTools.compare(num3 * num3)).Replace("#r#", num5.ToString());
         control.Size    = new Size(440, 100);
         control.Enabled = false;
         control.pub_LoadXML(sXML);
     }
 }
示例#7
0
 public void g_seven_1_2Generate(NuGenEQML control0, TableLayoutPanel tableLayoutPanel, List <TextBox> list, string number)
 {
     this.xmlDocument.Load("GapfillingXML/g_seven_1_2.xml");
     foreach (XmlNode node in this.xmlDocument.FirstChild.ChildNodes)
     {
         int num  = 0;
         int num2 = 0;
         int num3 = 0;
         int num4 = 0;
         int num5 = 0;
         int num6 = 0;
         int num7 = 0;
         int num8 = 0;
         if (StudentModel.isReGeneration)
         {
             num  = this.random.Next(-5, 6);
             num2 = this.random.Next(-5, 6);
             num3 = this.random.Next(-5, 6);
             num4 = this.random.Next(-5, 6);
             num5 = this.numberTools.myRandom(4);
             num6 = this.numberTools.myRandom(4);
             num7 = this.numberTools.myRandom(4);
             num8 = this.numberTools.myRandom(4);
             string        str    = SupportTools.getGuid();
             string        path   = "temp/generate/g_seven_1_2.xml";
             FileStream    w      = new FileStream(path, FileMode.Create);
             XmlTextWriter writer = new XmlTextWriter(w, Encoding.UTF8)
             {
                 Formatting = Formatting.Indented
             };
             writer.WriteStartDocument();
             writer.WriteStartElement("Info");
             writer.WriteAttributeString("save", "false");
             writer.WriteAttributeString("guid", str);
             writer.WriteStartElement("Params");
             writer.WriteElementString("b11", num.ToString());
             writer.WriteElementString("b12", num2.ToString());
             writer.WriteElementString("b21", num3.ToString());
             writer.WriteElementString("b22", num4.ToString());
             writer.WriteElementString("a", num5.ToString());
             writer.WriteElementString("b", num6.ToString());
             writer.WriteElementString("c", num7.ToString());
             writer.WriteElementString("d", num8.ToString());
             writer.WriteEndElement();
             int    num9  = num;
             double num10 = SupportTools.DoubleFormat(((1.0 * num6) * num3) / ((double)num5));
             int    num11 = 0;
             int    num12 = 0;
             double num13 = SupportTools.DoubleFormat(((1.0 * num5) * num2) / ((double)num6));
             int    num14 = num4;
             int    num15 = 0;
             int    num16 = 0;
             int    num17 = 0;
             int    num18 = 0;
             int    num19 = num;
             double num20 = SupportTools.DoubleFormat(((1.0 * num8) * num3) / ((double)num7));
             int    num21 = 0;
             int    num22 = 0;
             double num23 = SupportTools.DoubleFormat(((1.0 * num7) * num2) / ((double)num8));
             int    num24 = num4;
             writer.WriteStartElement("Answer");
             writer.WriteElementString("c11", num9.ToString());
             writer.WriteElementString("c12", num10.ToString());
             writer.WriteElementString("c13", num11.ToString());
             writer.WriteElementString("c14", num12.ToString());
             writer.WriteElementString("c21", num13.ToString());
             writer.WriteElementString("c22", num14.ToString());
             writer.WriteElementString("c23", num15.ToString());
             writer.WriteElementString("c24", num16.ToString());
             writer.WriteElementString("c31", num17.ToString());
             writer.WriteElementString("c32", num18.ToString());
             writer.WriteElementString("c33", num19.ToString());
             writer.WriteElementString("c34", num20.ToString());
             writer.WriteElementString("c41", num21.ToString());
             writer.WriteElementString("c42", num22.ToString());
             writer.WriteElementString("c43", num23.ToString());
             writer.WriteElementString("c44", num24.ToString());
             writer.WriteEndElement();
             writer.WriteEndElement();
             writer.WriteEndDocument();
             writer.Flush();
             writer.Close();
         }
         else
         {
             XmlDocument xmldoc = new XmlDocument();
             xmldoc.Load("temp/generate/g_seven_1_2.xml");
             XmlNode node2 = SupportTools.ParamsXmlNode(xmldoc);
             foreach (XmlNode node3 in node2.ChildNodes)
             {
                 if (node3.Name.Equals("a"))
                 {
                     num5 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b"))
                 {
                     num6 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("c"))
                 {
                     num7 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("d"))
                 {
                     num8 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b11"))
                 {
                     num = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b12"))
                 {
                     num2 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b21"))
                 {
                     num3 = int.Parse(node3.InnerText);
                 }
                 else if (node3.Name.Equals("b22"))
                 {
                     num4 = int.Parse(node3.InnerText);
                 }
             }
         }
         string sXML = node.InnerText.Replace("#x#", number).Replace("#a#", num.ToString()).Replace("#b#", num2.ToString()).Replace("#c#", num3.ToString()).Replace("#d#", num4.ToString()).Replace("#e#", num5.ToString()).Replace("#f#", num6.ToString()).Replace("#g#", num7.ToString()).Replace("#h#", num8.ToString());
         control0.pub_LoadXML(sXML);
         control0.Size    = new Size(0x47e, 0x41);
         control0.Enabled = false;
         control0.Anchor  = AnchorStyles.None;
         new InitControls().matrixFourToFour(tableLayoutPanel, list);
     }
 }