コード例 #1
0
ファイル: HJData.cs プロジェクト: penzz/FTPMonitor
        public override DataInfo GetDataInfo(string fullpath)
        {
            try
            {
                FileInfo fileInfo = new FileInfo(fullpath);
                string[] infos = fullpath.Split('\\');
                int length = infos.Length;
                DataInfo dataInfo = new DataInfo();
                dataInfo.Name = infos[length - 1];
                dataInfo.CreateTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", fileInfo.CreationTime);
                string[] strs = dataInfo.Name.Split('-');
                dataInfo.Satellite = strs[0];
                dataInfo.Sensor = strs[1];
                dataInfo.Rownum = Convert.ToInt32(strs[2]);
                dataInfo.Colnum = Convert.ToInt32(strs[3]);

                dataInfo.PhotoTime = strs[4];
                dataInfo.FullPath = fullpath;
                string id = strs[5].Substring(0, strs[5].Length - 7);
                dataInfo.Id = id + CC.getRandom();

                return dataInfo;
            }
            catch (Exception)
            {
                return null;
            }
        }
コード例 #2
0
ファイル: DataOperate.cs プロジェクト: penzz/FTPMonitor
 /// <summary>
 /// 增加新数据,已废弃
 /// </summary>
 /// <param name="dataInfo"></param>
 public void LoadOneData(DataInfo dataInfo)
 {
     //数据入库
     int count = InsertData(dataInfo);
     if (count < 0)
     {
         string str = new StringBuilder().AppendFormat("数据{0}入库失败", dataInfo.Name).ToString();
         LogManager.AddMessage(MessageType.ERR, str);
     }
     else
     {
         LogManager.AddMessage(MessageType.NEW, dataInfo.Name);
     }
 }
コード例 #3
0
ファイル: BaseData.cs プロジェクト: penzz/FTPMonitor
        /// <summary>
        /// 根据全路径获取数据信息
        /// </summary>
        /// <param name="fullpath"></param>
        /// <returns></returns>
        public virtual DataInfo GetDataInfo(string fullpath)
        {
            try
            {
                FileInfo fileInfo = new FileInfo(fullpath);
                string[] infos = fullpath.Split('\\');
                int length = infos.Length;
                DataInfo dataInfo = new DataInfo();
                dataInfo.Name = infos[length - 1];
                dataInfo.CreateTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", fileInfo.CreationTime);
                string[] strs = dataInfo.Name.Split('_');
                dataInfo.Satellite = strs[0];
                dataInfo.Sensor = strs[1];
                dataInfo.CenterLon = Convert.ToDouble(strs[2].Substring(1));
                if (strs[2].Substring(0, 1) == "W")
                {
                    dataInfo.CenterLon *= -1;
                }

                dataInfo.CenterLat = Convert.ToDouble(strs[3].Substring(1));
                if (strs[3].Substring(0, 1) == "S")
                {
                    dataInfo.CenterLat *= -1;
                }

                dataInfo.PhotoTime = strs[4];
                dataInfo.FullPath = fullpath;
                string id = strs[5].Substring(0, strs[5].Length - 7);
                dataInfo.Id = id + CC.getRandom();

                return dataInfo;
            }
            catch (Exception)
            {
                return null;
            }
        }
コード例 #4
0
ファイル: DataOperate.cs プロジェクト: penzz/FTPMonitor
 /// <summary>
 /// 插入一条新数据信息
 /// </summary>
 /// <param name="datainfo"></param>
 /// <returns></returns>
 private int InsertData(DataInfo datainfo)
 {
     string sql = String.Format("insert into DataInfo(id,name,satellite,sensor,phototime,createtime,centerlat,centerlon,rownum,colnum,fullpath) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", datainfo.Id, datainfo.Name, datainfo.Satellite, datainfo.Sensor, datainfo.PhotoTime, datainfo.CreateTime, datainfo.CenterLat, datainfo.CenterLon, datainfo.Rownum, datainfo.Colnum, datainfo.FullPath);
     return DataBaseControl.RunSqlForCount(sql);
 }