Пример #1
0
        override public void FromXml(XmlElement xml)
        {
            XmlRead.Attr(xml, "bound_left", ref bound_left);
            XmlRead.Attr(xml, "bound_top", ref bound_top);
            XmlRead.Attr(xml, "bound_right", ref bound_right);
            XmlRead.Attr(xml, "bound_bottom", ref bound_bottom);

            XmlRead.Attr(xml, "gravity", ref gravity);
            XmlRead.Attr(xml, "air_resistance", ref air_resistance);
            XmlRead.Attr(xml, "wind_range", ref wind_range);
            XmlRead.Attr(xml, "wind_step", ref wind_step);

            XmlRead.Attr(xml, "camera_margin_x", ref camera_margin_x);
            XmlRead.Attr(xml, "camera_margin_y", ref camera_margin_y);
            XmlRead.Attr(xml, "camera_smooth_x", ref camera_smooth_x);
            XmlRead.Attr(xml, "camera_smooth_y", ref camera_smooth_y);

            XmlRead.Attr(xml, "camera_min_x", ref camera_min_x);
            XmlRead.Attr(xml, "camera_min_y", ref camera_min_y);
            XmlRead.Attr(xml, "camera_max_x", ref camera_max_x);
            XmlRead.Attr(xml, "camera_max_y", ref camera_max_y);

            ReadBorn(xml);
            ReadMapCell(xml, "background", m_listBG);
            ReadMapCell(xml, "terrain", m_listTerrain);
        }
Пример #2
0
        private void ReadBorn(XmlElement xml)
        {
            XmlNodeList bornList = XmlRead.GetList(xml, "born_pos");

            m_dicBornData.Clear();
            foreach (XmlNode node in bornList)
            {
                XmlElement ele   = node as XmlElement;
                BornData   pBorn = DataBase.CreateInstance <BornData>();
                pBorn.FromXml(ele);
                int team = 0;
                XmlRead.Attr(ele, "team", ref team);
                if (m_dicBornData.ContainsKey(team))
                {
                    m_dicBornData[team].Add(pBorn);
                }
                else
                {
                    m_dicBornData[team] = new List <BornData>()
                    {
                        pBorn
                    };
                }
            }
        }
Пример #3
0
        public override void FromXml(XmlElement xml)
        {
            XmlRead.Attr(xml, "config_id", ref config_id);
            XmlRead.Attr(xml, "resource_id", ref m_iResourceID);
            XmlRead.Attr(xml, "shape_path", ref m_strShapePath);
            XmlRead.Attr(xml, "border_path", ref m_strBorderPath);
            XmlRead.Attr(xml, "mass", ref m_fMass);
            XmlRead.Attr(xml, "g_factor", ref m_fGFactor);
            XmlRead.Attr(xml, "wind_factor", ref m_fWindFactor);
            XmlRead.Attr(xml, "air_resit_factor", ref m_fAirResitFactor);

            float attack_box_min_x = 0;

            XmlRead.Attr(xml, "attack_box_min_x", ref attack_box_min_x);
            m_pAttackRect.xMin = attack_box_min_x;

            float attack_box_min_y = 0;

            XmlRead.Attr(xml, "attack_box_min_y", ref attack_box_min_y);
            m_pAttackRect.yMin = attack_box_min_y;

            float attack_box_max_x = 0;

            XmlRead.Attr(xml, "attack_box_max_x", ref attack_box_max_x);
            m_pAttackRect.xMax = attack_box_max_x;

            float attack_box_max_y = 0;

            XmlRead.Attr(xml, "attack_box_max_y", ref attack_box_max_y);
            m_pAttackRect.yMax = attack_box_max_y;

            XmlRead.Attr(xml, "bomb_range", ref m_fBombRange);
        }
Пример #4
0
        bool LoginFile()
        {
            LoginData dum = new LoginData(); bool lflag = false;

            while (XmlRead.Read())
            {
                if (XmlRead.Depth == 2)
                {
                    dum.FullName = XmlRead.Value;
                    XmlRead.Skip(); XmlRead.Skip();

                    XmlRead.Read();
                    dum.UserName = XmlRead.Value;
                    XmlRead.Skip(); XmlRead.Skip();

                    XmlRead.Read();
                    dum.PassWord = XmlRead.Value;
                    XmlRead.Skip(); XmlRead.Skip();

                    L.AddLast(dum);
                    lflag = true;
                }
            }

            return(lflag);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog();
            dialog.Filter = "MusicXML files|*.xml";
            if (dialog.ShowDialog() == true)
            {
                //LoadDocToClasses.list.Clear();
                //LoadDocToClasses.MeasuresList.Clear();
                //LoadCharsToViewPort.x.Clear();
                XmlRead xmlReader = new XmlRead();
                //viewer.LoadFile(dialog.FileName);
                xmlReader.File_path = dialog.FileName;
                Logger.Log("Loading: " + dialog.FileName);
                Console.WriteLine("Loaded file>> " + dialog.FileName);
                //     textBlock.Text += "\n Loadind file ... Processing  ";
                XDocument Doc = XDocument.Load(dialog.FileName, LoadOptions.SetLineInfo);
                //XDocument Doc = XmlRead.GetXmlInventory(dialog.FileName);
                //LoadDocToClasses.Document = Doc;
                //Misc.LoadFile.LoadDocument(Doc);
                MusicScore mus_score = new MusicScore(Doc);

                /*
                 * LoadDocToClasses.AddMeasuresToXListV(Doc);
                 * //   textBlock.Text += "\n File imported to measures list \n Press Load button to process";
                 * List<MusicalChars> list;
                 * LoadDocToClasses.LoadCharsFromMeasures();
                 * list = LoadDocToClasses.list;
                 * Logger.Log("XML Loaded");
                 */
            }
        }
Пример #6
0
        public override void Handle()
        {
            var code = XmlRead.GetAttribute("code");

            if (code == "1")
            {
                Bot.ConnectToGame(); // next game server
            }
        }
Пример #7
0
 public override void FromXml(XmlElement xml)
 {
     XmlRead.Attr(xml, "resource", ref resource);
     XmlRead.Attr(xml, "pos_x", ref pos_x);
     XmlRead.Attr(xml, "pos_y", ref pos_y);
     XmlRead.Attr(xml, "digable", ref digable);
     XmlRead.Attr(xml, "width", ref Width);
     XmlRead.Attr(xml, "height", ref Height);
 }
Пример #8
0
 private void LoadFile()
 {
     try
     {
         Dictionary <string, string> dictionary = new Dictionary <string, string>();
         XmlRead read = new XmlRead();
         Dictionary <string, string> item = read.GetItem(FileName.File1);
         foreach (KeyValuePair <string, string> pair in item)
         {
             this.combobox.Items.Add("[" + pair.Key + "]" + pair.Value);
             dictionary.Add(pair.Key, pair.Value);
         }
         this.combobox.Items.Add("----------------------");
         Dictionary <string, string> dictionary3 = read.GetItem(FileName.File2);
         foreach (KeyValuePair <string, string> pair in dictionary3)
         {
             this.combobox.Items.Add("[" + pair.Key + "]" + pair.Value);
             dictionary.Add(pair.Key, pair.Value);
         }
         this.file_1.set_FileFilter("Excel文件(*.xls)|*.xls");
         this.file_2.set_FileFilter("Excel文件(*.xls)|*.xls");
         this.file_1.get_TextBoxFile().Text = IniRead.GetPrivateProfileString("File", "File1Path");
         this.file_2.get_TextBoxFile().Text = IniRead.GetPrivateProfileString("File", "File2Path");
         this.com_sheet_1.Text = IniRead.GetPrivateProfileString("File", "TableInFile1");
         this.com_sheet_2.Text = IniRead.GetPrivateProfileString("File", "TableInFile2");
         string privateProfileString = IniRead.GetPrivateProfileString("FieldCon", "FileNumber");
         int    result = 1;
         int.TryParse(privateProfileString, out result);
         this.radioButton1.Checked = result == 1;
         this.radioButton2.Checked = result == 2;
         DataGridView view  = this.dataGridView1;
         DataTable    table = WenBenItem.Items();
         foreach (DataRow row in table.Rows)
         {
             string str2 = IniRead.GetPrivateProfileString("FieldCon", row["key"].ToString());
             if (str2 != "0.0")
             {
                 view.Rows[Convert.ToInt32(row["id"]) - 1].Cells["WenJianLie"].Value = str2;
             }
         }
         view.Rows[6].Cells["MoRen"].Value    = IniRead.GetPrivateProfileString("FieldCon", "DefaultFuHeRen");
         view.Rows[7].Cells["MoRen"].Value    = IniRead.GetPrivateProfileString("FieldCon", "DefaultShouKuanRen");
         view.Rows[0x13].Cells["MoRen"].Value = IniRead.GetPrivateProfileString("FieldCon", "DefaultShuiLv");
         this.combo_1.Text = "[" + IniRead.GetPrivateProfileString("TableCon", "MainTableField") + "]" + read.GetKey1();
         this.combo_2.Text = "[" + IniRead.GetPrivateProfileString("TableCon", "AssistantTableField") + "]" + read.GetKey2();
         this.txt_1.Text   = IniRead.GetPrivateProfileString("TableCon", "MainTableIgnoreRow");
         this.txt_2.Text   = IniRead.GetPrivateProfileString("TableCon", "AssistantTableIgnoreRow");
     }
     catch (Exception exception)
     {
         HandleException.HandleError(exception);
     }
 }
Пример #9
0
 public void XPathThatReturnsNumericValue()
 {
     XmlRead task = new XmlRead();
     task.BuildEngine = new MockBuild();
     string prjRootPath = TaskUtility.getProjectRootDirectory(true);
     task.XmlFileName = Path.Combine(prjRootPath, @"Source\Subversion.proj");
     task.XPath = "count(/n:Project/n:PropertyGroup/*)";
     task.Namespace = "http://schemas.microsoft.com/developer/msbuild/2003";
     task.Prefix = "n";
     Assert.IsTrue(task.Execute(), "Execute failed.");
     Assert.AreEqual("6", task.Value);
 }
Пример #10
0
 public static void DataManager()
 {
     while (true)
     {
         var readClass    = new XmlRead();
         var currencyList = readClass.Read();
         Thread.Sleep(20000);
         //var timer = new System.Timers.Timer();
         //timer.Interval = 20000;
         //timer.Enabled = true;
     }
 }
Пример #11
0
 override public void FromXml(System.Xml.XmlElement xml)
 {
     try
     {
         XmlRead.Attr(xml, "pos_x", ref pos_x);
         XmlRead.Attr(xml, "pos_y", ref pos_y);
         XmlRead.Attr(xml, "face", ref face);
     }
     catch (Exception e)
     {
         LOG.Error(e.Message);
     }
 }
Пример #12
0
        private void ReadMapCell(XmlElement xml, string name, List <MapCellData> list)
        {
            XmlNodeList xmlList = XmlRead.GetList(xml, name);

            list.Clear();
            foreach (XmlNode node in xmlList)
            {
                XmlElement  ele   = node as XmlElement;
                MapCellData pData = DataBase.CreateInstance <MapCellData>();
                pData.FromXml(ele);
                list.Add(pData);
            }
        }
Пример #13
0
 public override void FromXml(XmlElement xml)
 {
     XmlRead.Attr(xml, "id", ref id);
     XmlRead.Attr(xml, "default_name", ref default_name);
     XmlRead.Attr(xml, "description", ref description);
     XmlRead.Attr(xml, "damage", ref damage);
     XmlRead.Attr(xml, "center_damage", ref center_damage);
     XmlRead.Attr(xml, "cd", ref cd);
     XmlRead.Attr(xml, "energy", ref energy);
     XmlRead.Attr(xml, "index", ref index);
     XmlRead.Attr(xml, "image_resource", ref image_resource);
     XmlRead.Attr(xml, "fly_voice_resource", ref fly_voice_resource);
     XmlRead.Attr(xml, "bomb_voice_resource", ref bomb_voice_resource);
 }
Пример #14
0
        public void XPathThatReturnsBooleanValue()
        {
            XmlRead task = new XmlRead();

            task.BuildEngine = new MockBuild();
            string prjRootPath = TaskUtility.GetProjectRootDirectory(true);

            task.XmlFileName = Path.Combine(prjRootPath, @"Source\Subversion.proj");
            task.XPath       = "10 < 10";
            task.Namespace   = "http://schemas.microsoft.com/developer/msbuild/2003";
            task.Prefix      = "n";
            Assert.IsTrue(task.Execute(), "Execute failed.");
            Assert.AreEqual("False", task.Value);
        }
Пример #15
0
        public void XmlReadExecute()
        {
            XmlRead task = new XmlRead();
            task.BuildEngine = new MockBuild();
            string prjRootPath = TaskUtility.getProjectRootDirectory(true);
            task.XmlFileName = Path.Combine(prjRootPath, @"Source\Subversion.proj");
            task.XPath = "string(/n:Project/n:PropertyGroup/n:MSBuildCommunityTasksPath/text())";
            task.Namespace = "http://schemas.microsoft.com/developer/msbuild/2003";
            task.Prefix = "n";
            Assert.IsTrue(task.Execute(), "Execute Failed");

            task.XPath = "/n:Project/n:Target/@Name";
            Assert.IsTrue(task.Execute(), "Execute Failed");
        }
Пример #16
0
        public override void FromXml(XmlElement xml)
        {
            XmlRead.Attr(xml, "id", ref id);
            XmlRead.Attr(xml, "default_name", ref default_name);
            XmlRead.Attr(xml, "description", ref description);
            XmlRead.Attr(xml, "resource_id", ref resource_id);
            XmlRead.Attr(xml, "scale", ref scale);
            XmlRead.Attr(xml, "walk_speed_x", ref walk_speed_x);
            XmlRead.Attr(xml, "walk_speed_y", ref walk_speed_y);
            XmlRead.Attr(xml, "low_fire_angle", ref low_fire_angle);
            XmlRead.Attr(xml, "high_fire_angle", ref high_fire_angle);
            XmlRead.Attr(xml, "fire_range", ref fire_range);
            int weapon_pos_x = 0;

            XmlRead.Attr(xml, "weapon_pos_x", ref weapon_pos_x);
            int weapon_pos_y = 0;

            XmlRead.Attr(xml, "weapon_pos_y", ref weapon_pos_y);
            WeaponPosition = new Vector2(weapon_pos_x, weapon_pos_y);

            XmlRead.Attr(xml, "be_attack_box_min_x", ref be_attack_box_min_x);
            XmlRead.Attr(xml, "be_attack_box_min_y", ref be_attack_box_min_y);
            XmlRead.Attr(xml, "be_attack_box_max_x", ref be_attack_box_max_x);
            XmlRead.Attr(xml, "be_attack_box_max_y", ref be_attack_box_max_y);
            XmlRead.Attr(xml, "self_skill", ref self_skill);
            XmlRead.Attr(xml, "m_iHP", ref m_iHP);
            XmlRead.Attr(xml, "m_iMoveEnergy", ref m_iMoveEnergy);
            XmlRead.Attr(xml, "m_iAddEnergy", ref m_iAddEnergy);

            XmlNodeList xmlList = xml.GetElementsByTagName("state");

            foreach (XmlNode node in xmlList)
            {
                XmlElement         ele   = node as XmlElement;
                CharacterStateData pData = DataBase.CreateInstance <CharacterStateData>();
                pData.FromXml(ele);
                CharacterStateType eType = CharacterStateType.UNDEFINE;
                XmlRead.AttrEnum <CharacterStateType>(ele, "state_type", ref eType);
                if (Actions.ContainsKey(eType))
                {
                    LOG.Error("repeat state[" + eType.ToString() + "] in same instruction[" + id + "]");
                }
                else
                {
                    Actions[eType] = pData;
                }
            }
        }
Пример #17
0
        public void XmlReadExecute()
        {
            XmlRead task = new XmlRead();

            task.BuildEngine = new MockBuild();
            string prjRootPath = TaskUtility.GetProjectRootDirectory(true);

            task.XmlFileName = Path.Combine(prjRootPath, @"Source\Subversion.proj");
            task.XPath       = "string(/n:Project/n:PropertyGroup/n:MSBuildCommunityTasksPath/text())";
            task.Namespace   = "http://schemas.microsoft.com/developer/msbuild/2003";
            task.Prefix      = "n";
            Assert.IsTrue(task.Execute(), "Execute Failed");

            task.XPath = "/n:Project/n:Target/@Name";
            Assert.IsTrue(task.Execute(), "Execute Failed");
        }
Пример #18
0
        private void ComboboxSave()
        {
            XmlRead read   = new XmlRead();
            int     result = 0;

            try
            {
                int num2;
                read.Delete(FileName.File1);
                int.TryParse(this.txt_1.Text, out result);
                result--;
                if (result < 0)
                {
                    result = 0;
                }
                DataTable table = ExcelRead.ExcelToDataTable(this.file_1.get_TextBoxFile().Text, this.com_sheet_1.Text.Trim() + "$", 0);
                for (num2 = 0; num2 < table.Columns.Count; num2++)
                {
                    int num3 = num2 + 1;
                    read.File1AppendChild("1." + num3.ToString(), table.Rows[Convert.ToInt32(result)][num2].ToString());
                }
                read.Delete(FileName.File2);
                int.TryParse(this.txt_2.Text, out result);
                result--;
                if (result < 0)
                {
                    result = 0;
                }
                if (File.Exists(this.file_2.get_TextBoxFile().Text.Trim()))
                {
                    DataTable table2 = ExcelRead.ExcelToDataTable(this.file_2.get_TextBoxFile().Text, this.com_sheet_2.Text.Trim() + "$", 0);
                    for (num2 = 0; num2 < table2.Columns.Count; num2++)
                    {
                        read.File2AppendChild("2." + ((num2 + 1)).ToString(), table.Rows[Convert.ToInt32(result)][num2].ToString());
                    }
                }
                Regex regex = new Regex(@"^\[\d+\]");
                read.SetKey1(regex.Replace(this.combo_1.Text.Trim(), string.Empty));
                read.SetKey2(regex.Replace(this.combo_2.Text.Trim(), string.Empty));
            }
            catch (Exception exception)
            {
                MessageBoxHelper.Show(exception.ToString(), "异常");
            }
        }
Пример #19
0
        public override void FromXml(XmlElement xml)
        {
            XmlRead.Attr(xml, "animation_name", ref animation_name);
            XmlRead.Attr(xml, "total_frame", ref total_frame);

            XmlNodeList xmlList = xml.GetElementsByTagName("attack");
            int         frame   = -1;

            foreach (XmlNode node in xmlList)
            {
                XmlElement          ele   = node as XmlElement;
                CharacterAttackType eType = CharacterAttackType.NONE;

                XmlRead.AttrEnum <CharacterAttackType>(ele, "attack_type", ref eType);
                XmlRead.Attr(ele, "frame_index", ref frame);

                AttackBaseData pData = AttackBaseData.CreateInstance(eType);
                pData.FromXml(ele);
                AttackData[frame]      = pData;
                Network.attackbasedata = pData;
            }
        }
Пример #20
0
        private void LoadBombData()
        {
            string      path = Application.dataPath;
            Object      obj  = Resources.Load("Config/bomb_data");
            string      f    = obj.ToString();
            XmlDocument doc  = new XmlDocument();

            doc.LoadXml(f);
            XmlElement  root    = doc.DocumentElement;
            XmlNodeList xmlList = root.GetElementsByTagName("bomb");

            foreach (XmlNode node in xmlList)
            {
                XmlElement ele = node as XmlElement;

                int id = 0;
                XmlRead.Attr(ele, "", ref id);

                BombData pData = DataBase.CreateInstance <BombData>();
                pData.FromXml(ele);
                m_dicBombData[pData.config_id] = pData;
            }
        }
Пример #21
0
 public override void FromXml(XmlElement xml)
 {
     XmlRead.Attr(xml, "id", ref image_id);
     XmlRead.Attr(xml, "source_", ref image_source);
     XmlRead.Attr(xml, "text", ref image_name);
 }
Пример #22
0
 public override void FromXml(XmlElement xml)
 {
     XmlRead.Attr(xml, "name", ref Character_name);
 }
Пример #23
0
        public override void Handle()
        {
            var t = XmlRead.GetAttribute("t");

            Log.Information("{0}: {1} - {2}", Bot?.Login, "Z", t);
        }
Пример #24
0
        public override void Handle()
        {
            Bot.Ses = XmlRead.GetAttribute("ses");

            Connection.SendData(new ChatPacketOut());
        }
Пример #25
0
 public override void Handle()
 {
     Bot.ChatServer = XmlRead.GetAttribute("server");
     Bot.ConnectToChat();
 }
Пример #26
0
        public override void Handle()
        {
            Bot.Key = XmlRead.GetAttribute("key");

            Bot.TryLogin();
        }
Пример #27
0
 public void Read(Connection connection, XmlRead xmlRead)
 {
     Connection = connection;
     XmlRead    = xmlRead;
 }
Пример #28
0
 public override void FromXml(XmlElement xml)
 {
     XmlRead.Attr(xml, "level", ref level);
     XmlRead.Attr(xml, "exp", ref needExp);
 }
Пример #29
0
        private void DataReceived(object sender, SocketAsyncEventArgs socketAsyncEventArgs)
        {
            try
            {
                if (!_socket.Connected)
                {
                    return;
                }

                var numReceivedBytes = socketAsyncEventArgs.BytesTransferred;

                if (numReceivedBytes > 0)
                {
                    var bytes = ByteUtil.ChompBytes(socketAsyncEventArgs.Buffer, 0, numReceivedBytes);

                    var data = Encoding.UTF8.GetString(bytes);

                    data = _serverType switch
                    {
                        ServerEnum.Chat => CompressionUtil.DecompressChat(data),
                        ServerEnum.Game => CompressionUtil.DecompressGame(data),
                        _ => data
                    };

                    _receivedMessage += data;

                    if (_receivedMessage.Contains((char)0x00))
                    {
                        var messages = _receivedMessage.Split((char)0x00);

                        foreach (var message in messages)
                        {
                            if (message.Length == 0)
                            {
                                continue;
                            }

                            var packet = new XmlRead("<root>" + message + "</root>");

                            foreach (var incoming in packet.Children)
                            {
                                var packetType =
                                    Neptunium.PacketManager.GetPacketHandler(incoming.XmlName, _serverType);

                                if (packetType == null)
                                {
                                    Log.Debug("[{0}] [{1}] [{2}] [{3}] [{4}] {@attributes} {@child}", "IN", _serverType,
                                              Bot?.Login,
                                              Bot?.Login, incoming.XmlName,
                                              incoming.Attributes,
                                              incoming.Children);
                                    continue;
                                }

                                try
                                {
                                    Log.Verbose("[{0}] [{1}] [{2}] [{3}] [{4}] {@attributes} {@child}", "IN",
                                                _serverType,
                                                Bot?.Login,
                                                Bot?.Login, incoming.XmlName,
                                                incoming.Attributes,
                                                incoming.Children);
                                    var packetIn = (PacketIn)Activator.CreateInstance(packetType);
                                    packetIn.Read(this, incoming);
                                    packetIn.Handle();
                                }
                                catch (Exception ex)
                                {
                                    Log.Error(ex, "Packet Error");
                                }
                            }
                        }

                        _receivedMessage = messages[^ 1];
Пример #30
0
 public override void FromXml(XmlElement xml)
 {
     XmlRead.Attr(xml, "bomb_config_id", ref bomb_config_id);
     XmlRead.Attr(xml, "damage", ref damage);
     XmlRead.Attr(xml, "center_damage", ref center_damage);
 }
Пример #31
0
        public override void Handle()
        {
            var s = XmlRead.GetAttribute("s");

            Log.Information("{0}: {1} - {2}", Bot?.Login, "RadioList", s);
        }
Пример #32
0
 public override void FromXml(XmlElement xml)
 {
     XmlRead.Attr(xml, "id", ref chat_id);
     XmlRead.Attr(xml, "text", ref chat_text);
 }