Exemple #1
0
        /// <summary>
        /// 根据SQLXML文件路径获取SQL实体
        /// </summary>
        /// <param name="_Path">SQLXML路径</param>
        /// <returns>SQLXML实体</returns>
        public static SQLCodeEntity GetSQLCodeEntityByPath(String _Path)
        {
            SQLCodeEntity _SQLCodeEntity = null;

            try
            {
                if (!File.Exists(_Path))
                {
                    return(null);
                }
                //实例化XML文件操作类
                XmlOperate _XmlOperate = new XmlOperate();
                //判断配置文件是否只读
                FileInfo fi = new FileInfo(_Path);
                //如果只读则修改为普通
                fi.Attributes = FileAttributes.Normal;
                //实例化文件操作类
                DirectoryFileOperate _DirectoryFileOperate = new DirectoryFileOperate();
                //根据指定路径读取文件
                string _XmlContent = _DirectoryFileOperate.ShareReadFile(_Path);
                //把xml转换成对象
                _SQLCodeEntity = _XmlOperate.SimpleXmlToObject <SQLCodeEntity>(_XmlContent);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(_SQLCodeEntity);
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            // Link homelink = new Link { DisplayName = "Home", Source = new Uri("/Pages/Introduction.xaml", UriKind.Relative) };
            mylist.Links.Clear();
            //   mylist.Links.Add(homelink);
            string filepath = @"App\data\";

            System.IO.DirectoryInfo dir = new DirectoryInfo(filepath);
            if (dir.Exists)
            {
                FileInfo[] fiList = dir.GetFiles();
                foreach (FileInfo f in fiList)
                {
                    if (f.Extension == ".est")
                    {
                        using (DataSet ds = XmlOperate.GetDataSet(f.FullName))
                        {
                            Link link = new Link();

                            link.DisplayName = f.Name.Split('.')[0] + "\n" + ds.Tables[0].DefaultView[0]["ProjectCode"].ToString();
                            link.Source      = new Uri(f.Name, UriKind.Relative);
                            this.mylist.Links.Add(link);
                        }
                    }
                }
            }
            this.mylist.SelectedSource = new Uri("home", UriKind.Relative);
        }
Exemple #3
0
        public static ProjectEstimateSetViewModel GetMouldModel()
        {
            string    datafile = "App\\data\\mould";
            DataSet   ds       = XmlOperate.GetDataSet(datafile);
            DataTable dt       = ds.Tables[0];

            return(new ProjectEstimateSetViewModel(dt));
        }
Exemple #4
0
        public ReportStatistic(FrameWork.WinForm.Plugin.IEmrHost m_Host)
        {
            // TODO: Complete member initialization
            InitializeComponent();
            m_App = m_Host;
            //xmlOperate = XmlOperate.GetInstance();

            xmlOperate = new XmlOperate(AppDomain.CurrentDomain.BaseDirectory + "Report.xml");
        }
Exemple #5
0
    /// <summary>
    /// 在切换到战斗场景时调用
    /// </summary>
    /// <param name="names">战斗的角色名列表,Player1在前,Player2在后,人机对战只需要玩家的角色名</param>
    /// 作者:胡皓然
    public void StartFightScene(List <string> playerLeftHeroes, List <string> playerRightHeroes)
    {
        _playerLeft = new Player(1);
        _playerLeft.SetHeroAttr(XmlOperate.GetHeroInformation(playerLeftHeroes[0]), XmlOperate.GetHeroInformation(playerLeftHeroes[1]), XmlOperate.GetHeroInformation(playerLeftHeroes[2]));

        _playerRight = new Player(2);
        _playerRight.SetHeroAttr(XmlOperate.GetHeroInformation(playerRightHeroes[0]), XmlOperate.GetHeroInformation(playerRightHeroes[1]), XmlOperate.GetHeroInformation(playerRightHeroes[2]));

        ChangeScene("BattleScene-boat");
    }
Exemple #6
0
        public string SendCommand(string CommandType, string userid, string deviceid, string Phone, string mode = null, string sens = null)
        {
            //http://api.mgoogps.com/service/sendcommand/?param=id,4210033800&model,X&com,BD&phone,13800000000
            string url = string.Format("/service/sendcommand/?param=id,{0}&model,{1}", deviceid, "X");

            XmlOperate xml = new XmlOperate(deviceid, userid);

            switch (CommandType)
            {
            case "1":
                url += string.Format("&com,BD&phone,{0}", Phone);     //绑定手机
                mode = "";  sens = "";
                break;

            case "2":
                url  += string.Format("&com,BDR");   //解绑手机
                Phone = "";  mode = "";  sens = "";
                break;

            case "3":
                url  += string.Format("&com,ZD&mode,{0}&sens,{1}", mode, sens);    // 设置震动报警方式
                Phone = "";
                break;

            case "4":
                url += string.Format("&com,SF");     //     设防
                break;

            case "5":
                url += string.Format("&com,CF");     //     撤防
                break;

            case "6":
                url += string.Format("&com,DY");     //  断油电
                break;

            case "7":
                url += string.Format("&com,TY");     //  通油电
                break;

            default:
                break;
            }
            MG_DAL.MgoogpsWebClient mwc = new MG_DAL.MgoogpsWebClient();
            mwc.RequestMethodName = url;
            string json = mwc.RequestSend();

            if (json.Equals("\"ok\""))
            {
                xml.CreateXml(CommandType, deviceid, Phone, mode, sens);
                // string ph = xml.GetXml("Phone");
                return("success");
            }
            return("error");
        }
Exemple #7
0
        private static void Init()
        {
            SqlData sd   = new SqlData();
            string  data = "";

            XmlOperate <SqlData> .DSerialize(ref sd, "Config.xml", ref data);

            PassWD  = Encryption.SuperDesDecrypt(sd.honeybee, "zjsxzsta", "zjsxzstb");
            connStr = String.Format(Encryption.SuperDesDecrypt(sd.connStr, "zjsxzsta", "zjsxzstb"), Flie_Path, PassWD);
            con     = new OleDbConnection(connStr);
            //SqlProcessing<SqlData>.Init(sd.connStr, sd.honeybee);
        }
Exemple #8
0
 /// <summary>
 /// 根据角色数量随机设置角色
 /// </summary>
 public void SetRandHero()
 {
     if (_heroNum == 1)
     {
         _heroes[0] = XmlOperate.GetHeroInformation("JiXiaoke");
     }
     else if (_heroNum == 3)
     {
         _heroes[0] = XmlOperate.GetHeroInformation("JiXiaoke");
         _heroes[1] = XmlOperate.GetHeroInformation("JiXiaoke");
         _heroes[2] = XmlOperate.GetHeroInformation("JiXiaoke");
     }
 }
Exemple #9
0
        /// <summary>
        /// 添加SQLXML文件
        /// </summary>
        /// <param name="parameters">页面传递的参数</param>
        /// <returns>true:成功,false:失败</returns>
        public object AddSql(Dictionary <String, String> parameters)
        {
            try
            {
                ////XML存储路径
                //string _XmlOutPath = Path.Combine(WorkDir, SQLPath);
                //if (!Directory.Exists(_XmlOutPath))//如果路径不存在
                //{
                //    //创建路径
                //    Directory.CreateDirectory(_XmlOutPath);
                //}

                //检查SQLXML路径是否存在
                CheckPath();
                JsonOperate _JsonOperate = new JsonOperate();
                //获取SQL序号
                string _SqlNum = parameters.ContainsKey("SqlNum") ? _JsonOperate.FromJsonString <string>(parameters["SqlNum"]) : "";
                //获取SQL说明
                string _SqlDescription = parameters.ContainsKey("SqlDescription") ? _JsonOperate.FromJsonString <string>(parameters["SqlDescription"]) : "";
                //获取SQL语句
                string _SQLString = parameters.ContainsKey("SQLString") ? _JsonOperate.FromJsonString <string>(parameters["SQLString"]) : "";

                //SQL语句所在xml文件路径
                string xmlPath = Path.Combine(SQLPath, _SqlNum + ".xml");
                if (File.Exists(xmlPath))//如果存在文件,返回false
                {
                    return(new { Methods = false });
                }
                if (string.IsNullOrEmpty(_SqlNum) || string.IsNullOrEmpty(_SqlDescription) || string.IsNullOrEmpty(_SQLString))
                {
                    return(new { Methods = false });
                }
                //实例化XML文件操作类
                XmlOperate _XmlOperate = new XmlOperate();
                //实例化SQL实体类
                SQLCodeEntity _SQLCodeEntity = new SQLCodeEntity();
                _SQLCodeEntity.SqlNum         = _SqlNum;
                _SQLCodeEntity.SqlDescription = _SqlDescription;
                _SQLCodeEntity.SQLString      = _SQLString;

                //转换成xml字符串
                string _XmlString = _XmlOperate.ObjectToSimpleXml(_SQLCodeEntity);
                //生成SQLXML文件
                File.WriteAllText(xmlPath, _XmlString);
                return(new { Methods = true });
            }
            catch
            {
                return(new { Methods = false });
            }
        }
        //从文件获取数据
        private void GetData(ref ProjectEstimateSetViewModel projectEstimateSetViewModel, ref TailDifferenceViewModel tdvm)
        {
            string    datafile = _datapath + DataFileName;
            DataSet   ds       = XmlOperate.GetDataSet(datafile);
            DataTable dt       = ds.Tables[0];
            DataTable dt2      = ds.Tables[1];

            projectEstimateSetViewModel = new ProjectEstimateSetViewModel(dt);
            tdvm = new TailDifferenceViewModel();
            tdvm.TailDifference         = dt2.DefaultView[0]["TailDifference"].ToString();
            tdvm.ItemWithTailDifference = dt2.DefaultView[0]["ItemWithTailDifference"].ToString();
            tdvm.CompositeTaxRate       = dt2.DefaultView[0]["CompositeTaxRate"].ToString();
            tdvm.AnnualPriceDifference  = dt2.DefaultView[0]["AnnualPriceDifference"].ToString();
        }
        public void GetData()
        {
            if (!CheckImportFile())
            {
                return;
            }
            if (CheckFIleExist())
            {
                this.Condition = "待更新";
                string    datafile = "App\\data\\" + ProjectName + ".est";
                DataSet   ds       = XmlOperate.GetDataSet(datafile);
                DataTable dt       = ds.Tables[0];
                DataTable dt2      = ds.Tables[1];
                estimateSetViewModel = new ProjectEstimateSetViewModel(dt);
                tdvm = new TailDifferenceViewModel();
                tdvm.TailDifference         = dt2.DefaultView[0]["TailDifference"].ToString();
                tdvm.ItemWithTailDifference = dt2.DefaultView[0]["ItemWithTailDifference"].ToString();
                tdvm.CompositeTaxRate       = dt2.DefaultView[0]["CompositeTaxRate"].ToString();
                tdvm.AnnualPriceDifference  = dt2.DefaultView[0]["AnnualPriceDifference"].ToString();
                ManageTailDifference(ref tdvm);
                estimateSetViewModel.GetDataToFinanceData(proc, catagorySet);
                estimateSetViewModel.SetToDestCompositeTaxRate(tdvm.Double_CompositeTaxRate);
            }

            else
            {
                this.Condition = "待生成";
                string    mouldpath = "App\\data\\mould";
                DataSet   ds        = XmlOperate.GetDataSet(mouldpath);
                DataTable dt        = ds.Tables[0];
                DataTable dt2       = ds.Tables[1];
                estimateSetViewModel = new ProjectEstimateSetViewModel(dt);
                tdvm = new TailDifferenceViewModel();
                tdvm.TailDifference         = dt2.DefaultView[0]["TailDifference"].ToString();
                tdvm.ItemWithTailDifference = dt2.DefaultView[0]["ItemWithTailDifference"].ToString();
                tdvm.CompositeTaxRate       = dt2.DefaultView[0]["CompositeTaxRate"].ToString();
                tdvm.AnnualPriceDifference  = dt2.DefaultView[0]["AnnualPriceDifference"].ToString();

                ManageTailDifference(ref tdvm);
                estimateSetViewModel.GetDataToFinanceData(proc, catagorySet);
                estimateSetViewModel.SetToDestCompositeTaxRate(tdvm.Double_CompositeTaxRate);
            }
        }
Exemple #12
0
    public void OnClick()
    {
        // change the scene

        //return the chosed heroes' name
        List <string> list = sel.ReturnList();

        if (GameManager.GetInstance()._nowMode == GameManager.mode.computer)
        {
            Player player = new Player(1);
            player.SetHeroNum(GameManager.GetInstance()._heroesNum);
            if (GameManager.GetInstance()._heroesNum == 1)
            {
                player.SetHeroAttr(XmlOperate.GetHeroInformation(list[0]));
            }
            else if (GameManager.GetInstance()._heroesNum == 3)
            {
                player.SetHeroAttr(XmlOperate.GetHeroInformation(list[0]), XmlOperate.GetHeroInformation(list[1]), XmlOperate.GetHeroInformation(list[2]));
            }
            Player computer = new Player(2);
            computer.SetHeroNum(GameManager.GetInstance()._heroesNum);
            computer.SetRandHero();
            GameManager.GetInstance().SetPlayers(player, computer);
            GameManager.GetInstance()._controlPlayer = 1;
            GameManager.GetInstance().ChangeScene("UserSetScene");
        }
        else if (GameManager.GetInstance()._nowMode == GameManager.mode.player)
        {
            Player player = new Player(GameManager.GetInstance()._controlPlayer);
            player.SetHeroNum(GameManager.GetInstance()._heroesNum);
            if (GameManager.GetInstance()._heroesNum == 1)
            {
                player.SetHeroAttr(XmlOperate.GetHeroInformation(list[0]));
                //通知联网部分英雄选择
            }
            else if (GameManager.GetInstance()._heroesNum == 3)
            {
                player.SetHeroAttr(XmlOperate.GetHeroInformation(list[0]), XmlOperate.GetHeroInformation(list[1]), XmlOperate.GetHeroInformation(list[2]));
                //通知联网部分英雄选择
            }
            GameManager.GetInstance().ChangeScene("WaitScene");
        }
    }
Exemple #13
0
        /// <summary>
        /// 读取指定目录下的所有xml文件,将其转换为SQL语句实体对象列表
        /// </summary>
        /// <param name="path">xml文件的路径</param>
        /// <returns>SQL语句实体对象列表</returns>
        private List <SQLCodeEntity> ConvertXmlToEntity(String _Path)
        {
            try
            {
                List <SQLCodeEntity> _SQLCodeEntityLsit = new List <SQLCodeEntity>();
                DirectoryInfo        directory          = new DirectoryInfo(_Path);
                //DirectoryFileOperate df = new DirectoryFileOperate();
                XmlOperate _XmlOperate = new XmlOperate();

                if (directory.Exists)//判断目录是否存在
                {
                    List <string> _XmlPathlist = GetAllXmlFilelist(_Path);
                    //将xml文件转为iLogObject对象
                    foreach (string _path in _XmlPathlist)
                    {
                        //判断配置文件是否只读
                        FileInfo fi = new FileInfo(_path);
                        //如果只读则修改为普通
                        //if (fi.Attributes.ToString().IndexOf("ReadOnly") != -1)
                        //{
                        fi.Attributes = FileAttributes.Normal;
                        //}
                        //string _XmlContent = df.ShareReadFile(_path);
                        ////把xml转换成对象
                        //SQLCodeEntity _SQLCodeEntity = _XmlOperate.SimpleXmlToObject<SQLCodeEntity>(_XmlContent);
                        SQLCodeEntity _SQLCodeEntity = SQLCodeHelp.GetSQLCodeEntityByPath(_path);
                        if (_SQLCodeEntity == null || _SQLCodeEntity.SqlNum != Path.GetFileNameWithoutExtension(_path))
                        {
                            //重命名为源文件名+.bak扩展名
                            fi.MoveTo(_path + ".bak");
                            continue;
                        }
                        _SQLCodeEntityLsit.Add(_SQLCodeEntity);
                    }
                }
                return(_SQLCodeEntityLsit);
            }
            catch
            {
                return(null);
            }
        }
Exemple #14
0
        /// <summary>
        /// 根据SQL序号修改SQL文件
        /// </summary>
        /// <param name="parameters">页面传递的参数</param>
        /// <returns>true:成功,false:失败</returns>
        public object EditSql(Dictionary <String, String> parameters)
        {
            try
            {
                JsonOperate _JsonOperate = new JsonOperate();
                //获取SQL序号
                string _SqlNum = parameters.ContainsKey("SqlNum") ? _JsonOperate.FromJsonString <string>(parameters["SqlNum"]) : "";
                //获取SQL说明
                string _SqlDescription = parameters.ContainsKey("SqlDescription") ? _JsonOperate.FromJsonString <string>(parameters["SqlDescription"]) : "";
                //获取SQL语句
                string _SQLString = parameters.ContainsKey("SQLString") ? _JsonOperate.FromJsonString <string>(parameters["SQLString"]) : "";

                //SQL语句所在xml文件路径
                string xmlPath = Path.Combine(SQLPath, _SqlNum + ".xml");
                if (!File.Exists(xmlPath))
                {
                    return(new { Methods = false });
                }
                //实例化XML文件操作类
                XmlOperate _XmlOperate = new XmlOperate();
                //实例化SQL实体类
                SQLCodeEntity _SQLCodeEntity = new SQLCodeEntity();
                _SQLCodeEntity.SqlNum         = _SqlNum;
                _SQLCodeEntity.SqlDescription = _SqlDescription;
                _SQLCodeEntity.SQLString      = _SQLString;

                //转换成xml字符串
                string _Xmlstring = _XmlOperate.ObjectToSimpleXml(_SQLCodeEntity);
                bool   _IsSuccess = SaveXml(_Xmlstring, xmlPath);
                return(new { Methods = _IsSuccess });
            }
            catch
            {
                return(new { Methods = false });
            }
        }
Exemple #15
0
 public ZCompensation()
 {
     _DSixZAttri = new Dictionary <string, SixZAttri>();
     _LSixZAttri = new List <SixZAttri>();
     xmlOperate  = new XmlOperate(ConfigurationClass.ReadSetting("xmlzComp"));
 }
Exemple #16
0
 void Awake()
 {
     GetComponent <Hero>()._attr = XmlOperate.GetHeroInformation("JiXiaoke");
 }
Exemple #17
0
 public XPosition()
 {
     _DTwoXAttri = new Dictionary <string, TwoXAttri>();
     xmlOperate  = new XmlOperate(ConfigurationClass.ReadSetting("xmlxPosition"));
 }
Exemple #18
0
 public YPosition()
 {
     _DYAttri   = new Dictionary <string, YAttri>();
     xmlOperate = new XmlOperate(ConfigurationClass.ReadSetting("xmlyPosition"));
 }
Exemple #19
0
 public ZPostionModel()
 {
     _DSixZAttri = new Dictionary <string, SixZAttri>();
     _LSixZAttri = new List <SixZAttri>();
     xmlOperate  = new XmlOperate(ConfigurationClass.ReadSetting("xmlzPotion"));
 }
Exemple #20
0
        public string GetCommandConfig(string deviceid, string userid)
        {
            XmlOperate xml = new XmlOperate(deviceid, userid);

            return(xml.GetCommandXmlNode());
        }