管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2023-08-21 2d2cfdcbf7714d1f78f5c084e74b0e84b4e74f76
合并通用的方法
已重命名1个文件
已添加1个文件
已修改6个文件
110 ■■■■■ 文件已修改
DataLoader/CS/Importor.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/CS/MetaHelper.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/CS/NtstWeb.cs 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/CS/StaticData.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/CS/Tools.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/DataLoader.csproj 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/LoginWin.xaml.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/Model/Tool.cs 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DataLoader/CS/Importor.cs
@@ -58,7 +58,7 @@
        public static int InsertMeta(SysMeta meta)
        {
            List<DbParameter> list = Tool.GetParams<SysMeta>(insertMeta, meta);
            List<DbParameter> list = Tools.GetParams<SysMeta>(insertMeta, meta);
            object obj = Helper.GetScalar(insertMeta, list.ToArray());
@@ -91,7 +91,7 @@
            vd.Meta.depid = 1;
            vd.Meta.verid = 0;
            vd.Meta.type = fi.Extension.ToLower().Replace(".", "");
            vd.Meta.sizes = Tool.SizeToMb(fi.Length);
            vd.Meta.sizes = Tools.SizeToMb(fi.Length);
            vd.Meta.create_user = Tool.UserId;
        }
DataLoader/CS/MetaHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataLoader.CS
{
    public class MetaHelper
    {
    }
}
DataLoader/CS/NtstWeb.cs
DataLoader/CS/StaticData.cs
@@ -39,6 +39,11 @@
        public readonly static String OSGB = ".osgb";
        /// <summary>
        /// æ …格数据扩展名
        /// </summary>
        public static readonly List<String> RASTER_EXT = new List<String> { ".img", ".tif", ".tiff", "jpg", "jp2" };
        /// <summary>
        /// 16进制
        /// </summary>
        public static readonly char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
DataLoader/CS/Tools.cs
@@ -59,10 +59,27 @@
        }
        /// <summary>
        /// æ¢ç®—为MB
        /// </summary>
        public static double SizeToMb(long size)
        {
            if (size < 1050)
            {
                return 0.001;
            }
            String str = string.Format("{0:F3}", size / 1024.0 / 1024.0);
            return Double.Parse(str);
        }
        /// <summary>
        /// èŽ·å–è®¾ç½®
        /// </summary>
        public static string GetSetting(string key)
        {
            if (!ConfigurationManager.AppSettings.AllKeys.Contains(key)) return null;
            return ConfigurationManager.AppSettings[key];
        }
DataLoader/DataLoader.csproj
@@ -135,11 +135,12 @@
    <Compile Include="CS\Importor.cs" />
    <Compile Include="CS\LogOut.cs" />
    <Compile Include="CS\MD5Helper.cs" />
    <Compile Include="CS\MetaHelper.cs" />
    <Compile Include="CS\StaticData.cs" />
    <Compile Include="CS\Tools.cs" />
    <Compile Include="Model\Tool.cs" />
    <Compile Include="CS\ModelHandler.cs" />
    <Compile Include="Model\NtstWeb.cs" />
    <Compile Include="CS\NtstWeb.cs" />
    <Compile Include="CS\PostgreHelper.cs" />
    <Compile Include="Model\ViewData.cs" />
    <Compile Include="LoginWin.xaml.cs">
DataLoader/LoginWin.xaml.cs
@@ -1,4 +1,5 @@
using CefSharp;
using DataLoader.CS;
using DataLoader.Model;
using System;
using System.Collections.Generic;
@@ -32,7 +33,7 @@
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            web.Address = Tool.BaseDir + "htmls\\login.html";
            web.Address = Tools.BaseDir + "htmls\\login.html";
        }
    }
}
DataLoader/Model/Tool.cs
@@ -27,70 +27,5 @@
        public static string Token = "";
        public static char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
        public static string FormatBytes(long bytes)
        {
            string[] Suffix = { "Byte", "KB", "MB", "GB", "TB" };
            int i = 0;
            double dblSByte = bytes;
            if (bytes > 1024)
                for (i = 0; (bytes / 1024) > 0; i++, bytes /= 1024)
                    dblSByte = bytes / 1024.0;
            return String.Format("{0:0.##}{1}", dblSByte, Suffix[i]);
        }
        public static string GetSetting(string key)
        {
            if (!ConfigurationManager.AppSettings.AllKeys.Contains(key))
            {
                return null;
            }
            return ConfigurationManager.AppSettings[key];
        }
        public static List<DbParameter> GetParams<T>(string sql, T t)
        {
            List<DbParameter> list = new List<DbParameter>();
            Type tType = typeof(T);
            BindingFlags flags = BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance;
            int start = sql.IndexOf("@");
            while (start != -1)
            {
                int end = sql.IndexOf(",", start);
                if (end == -1) end = sql.IndexOf(")", start);
                if (end == -1) end = sql.IndexOf(" ", start);
                if (end == -1) end = sql.Length;
                string name = sql.Substring(start + 1, end - start - 1);
                PropertyInfo pi = tType.GetProperty(name, flags);
                if (pi != null)
                {
                    object value = pi.GetValue(t, null);
                    DbParameter dp = new NpgsqlParameter("@" + name, value);
                    list.Add(dp);
                }
                start = sql.IndexOf("@", end);
            }
            return list;
        }
        public static double SizeToMb(long size)
        {
            if (size < 1050)
            {
                return 0.001;
            }
            String str = string.Format("{0:F3}", size / 1024.0 / 1024.0);
            return Double.Parse(str);
        }
    }
}