move to sdk style csproj

This commit is contained in:
Zhuangkh 2022-04-12 14:18:02 +08:00
parent ae3f1e0e5f
commit 9945d3e38e
5 changed files with 12 additions and 445 deletions

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("地质建模")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("地质建模")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("85a8fb17-cf6e-4d07-ad0d-f860c37b08f5")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,121 +0,0 @@
using Autodesk.Revit.DB;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace uBIM_EarthTools
{
class ExcelHelper
{
/// <summary>
/// 读取地质数据
/// 原数据单位为M,转换为MM
/// </summary>
/// <param name="filePath">文件路径</param>
/// <returns></returns>
public static List<Borehole> GetDataFromExcel(string filePath)
{
List<Borehole> boreholeList = new List<Borehole>();
Microsoft.Office.Interop.Excel.Workbook wb = null;
Microsoft.Office.Interop.Excel.Worksheet ws = null;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();//lauch excel application
excel.DisplayAlerts = false;
if (excel != null)
{
excel.Visible = false;
excel.UserControl = true;// 以只读的形式打开EXCEL文件
wb = excel.Workbooks.Open(filePath, missing, true, missing, missing, missing,
missing, missing, missing, true, missing, missing, missing, missing, missing);
ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets.Item[1];
Dictionary<string, string> typeList = new Dictionary<string, string>();
for (int i = 1; i < ws.UsedRange.Rows.Count + 1; i++)
{
typeList.Add(ws.Cells[i, 1].Text, ws.Cells[i, 2].Text);
}
ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets.Item[2];
//取得总记录行数(包括标题列)
int rowsint = ws.UsedRange.Rows.Count; //得到行数
//int rowsint = begin_row + 2*10;
int columnsint = ws.UsedRange.Columns.Count;//得到列数
for (int i = 1; i <= rowsint; i += 2)
{
Borehole borehole = new Borehole();
borehole.Name = ws.Cells[i, 1].Text;
double x = double.Parse(ws.Cells[i, 2].Text) * 1000 / 304.8;
double y = double.Parse(ws.Cells[i, 3].Text) * 1000 / 304.8;
for (int j = 4; j <= columnsint; j++)
{
if (null == ws.Cells[i + 1, j].Text || ws.Cells[i + 1, j].Text == "")
break;
else
{
string type = string.Empty;
try
{
type = "地质" + ws.Cells[i, j].Text + "-" + typeList[ws.Cells[i, j].Text] + "层";
}
catch (Exception e)
{
MessageBox.Show(i.ToString() + "," + j.ToString());
throw;
}
double z = double.Parse(ws.Cells[i+1, j].Text) * 1000 / 304.8;
XYZ xyz = new XYZ(x, y, z);
GeologyLayer geologyLayer = new GeologyLayer(type, xyz);
borehole.ValueList.Add(geologyLayer);
}
}
boreholeList.Add(borehole);
}
}
KillProcess(excel);
return boreholeList;
}
public static List<string> GetGeologyType(string filePath)
{
List<string> types = new List<string>();
Microsoft.Office.Interop.Excel.Workbook wb = null;
Microsoft.Office.Interop.Excel.Worksheet ws = null;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();//lauch excel application
excel.DisplayAlerts = false;
if (excel != null)
{
excel.Visible = false;
excel.UserControl = true;// 以只读的形式打开EXCEL文件
wb = excel.Workbooks.Open(filePath, missing, true, missing, missing, missing,
missing, missing, missing, true, missing, missing, missing, missing, missing);
ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets.get_Item(1);
for (int i = 1; i < ws.UsedRange.Rows.Count + 1; i++)
{
types.Add("地质" + ws.Cells[i, 1].Text + "-" + ws.Cells[i, 2].Text + "层");
}
}
KillProcess(excel);
return types;
}
#region excel进程
[DllImport("User32.dll", CharSet = CharSet.Auto)]
private static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID);
private static void KillProcess(Microsoft.Office.Interop.Excel.Application excel)
{
IntPtr t = new IntPtr(excel.Hwnd);
int k = 0;
GetWindowThreadProcessId(t, out k);
System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById(k);
p.Kill();
}
#endregion
}
}

View File

@ -18,77 +18,6 @@ namespace uBIMEarthTools.Utils
{ {
class ExcelHelper class ExcelHelper
{ {
/// <summary>
/// 读取地质数据
/// 原数据单位为M,转换为MM
/// </summary>
/// <param name="filePath">文件路径</param>
/// <returns></returns>
public static List<Borehole> GetDataFromXls(string filePath)
{
List<Borehole> boreholeList = new List<Borehole>();
Microsoft.Office.Interop.Excel.Workbook wb = null;
Microsoft.Office.Interop.Excel.Worksheet ws = null;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();//lauch excel application
excel.DisplayAlerts = false;
if (excel != null)
{
excel.Visible = false;
excel.UserControl = true;// 以只读的形式打开EXCEL文件
wb = excel.Workbooks.Open(filePath, missing, true, missing, missing, missing,
missing, missing, missing, true, missing, missing, missing, missing, missing);
ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets.Item[1];
Dictionary<string, string> typeList = new Dictionary<string, string>();
for (int i = 1; i < ws.UsedRange.Rows.Count + 1; i++)
{
typeList.Add(ws.Cells[i, 1].Text, ws.Cells[i, 2].Text);
}
ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets.Item[2];
//取得总记录行数(包括标题列)
int rowsint = ws.UsedRange.Rows.Count; //得到行数
//int rowsint = begin_row + 2*10;
int columnsint = ws.UsedRange.Columns.Count;//得到列数
for (int i = 1; i <= rowsint; i += 2)
{
Borehole borehole = new Borehole();
borehole.Name = ws.Cells[i, 1].Text;
double x = double.Parse(ws.Cells[i, 2].Text) * 1000 / 304.8;
double y = double.Parse(ws.Cells[i, 3].Text) * 1000 / 304.8;
for (int j = 4; j <= columnsint; j++)
{
if (null == ws.Cells[i + 1, j].Text || ws.Cells[i + 1, j].Text == "")
break;
else
{
string type = string.Empty;
try
{
type = "地质" + ws.Cells[i, j].Text + "-" + typeList[ws.Cells[i, j].Text] + "层";
}
catch (Exception e)
{
MessageBox.Show(i.ToString() + "," + j.ToString());
throw;
}
double z = double.Parse(ws.Cells[i + 1, j].Text) * 1000 / 304.8;
XYZ xyz = new XYZ(x, y, z);
GeologyLayer geologyLayer = new GeologyLayer(type, xyz);
borehole.ValueList.Add(geologyLayer);
}
}
boreholeList.Add(borehole);
}
}
KillProcess(excel);
return boreholeList;
}
public static List<Borehole> GetDataFromExcel(string filePath) public static List<Borehole> GetDataFromExcel(string filePath)
{ {
ExcelPackage.LicenseContext = LicenseContext.NonCommercial; ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
@ -175,19 +104,6 @@ namespace uBIMEarthTools.Utils
return typeList; return typeList;
} }
#region excel进程
[DllImport("User32.dll", CharSet = CharSet.Auto)]
private static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID);
private static void KillProcess(Microsoft.Office.Interop.Excel.Application excel)
{
IntPtr t = new IntPtr(excel.Hwnd);
int k = 0;
GetWindowThreadProcessId(t, out k);
System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById(k);
p.Kill();
}
#endregion
#region Excel和Sheet返回DataTable #region Excel和Sheet返回DataTable
/// <summary> /// <summary>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EPPlus" version="5.6.4" targetFramework="net48" />
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.4.1" targetFramework="net48" />
<package id="NPOI" version="2.4.1" targetFramework="net452" />
<package id="SharpZipLib" version="1.0.0" targetFramework="net452" />
<package id="System.ComponentModel.Annotations" version="4.7.0" targetFramework="net48" />
</packages>

View File

@ -1,203 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <TargetFramework>net472</TargetFramework>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <UseWPF>true</UseWPF>
<ProjectGuid>{85A8FB17-CF6E-4D07-AD0D-F860C37B08F5}</ProjectGuid> <UseWindowsForms>true</UseWindowsForms>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>uBIMEarthTools</RootNamespace>
<AssemblyName>uBIMEarthTools</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="EPPlus, Version=5.6.4.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL"> <PackageReference Include="EPPlus" Version="5.6.4" />
<HintPath>..\packages\EPPlus.5.6.4\lib\net45\EPPlus.dll</HintPath> <PackageReference Include="Microsoft.Office.Interop.Excel" Version="14.0.0.1" />
</Reference> <PackageReference Include="NPOI" Version="2.5.5" />
<Reference Include="ICSharpCode.SharpZipLib, Version=1.0.0.999, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL"> <PackageReference Include="RevitSDK2020" Version="1.0.0" />
<HintPath>..\packages\SharpZipLib.1.0.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath> <PackageReference Include="Triangle" Version="0.0.6-Beta3" />
</Reference> </ItemGroup>
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.4.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <ItemGroup>
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.4.1\lib\net46\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\Microsoft.Office.Interop.Excel.dll</HintPath>
</Reference>
<Reference Include="NPOI, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.4.1\lib\net45\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.4.1\lib\net45\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXml4Net, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.4.1\lib\net45\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats, Version=2.4.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.4.1\lib\net45\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="RevitAPI">
<HintPath>C:\Program Files\Autodesk\Revit 2019\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>C:\Program Files\Autodesk\Revit 2019\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.ComponentModel.Annotations.4.7.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Security" />
<Reference Include="System.Threading.Tasks" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Triangle, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\triangle\sourceCode\sourceCode\Triangle.NET\Triangle\bin\Debug\Triangle.dll</HintPath>
</Reference>
<Reference Include="uBIM.UI"> <Reference Include="uBIM.UI">
<HintPath>..\lib\uBIM.UI.dll</HintPath> <HintPath>..\lib\uBIM.UI.dll</HintPath>
</Reference> </Reference>
<Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> </Project>
<Compile Include="DataClass\GeologyParams.cs" />
<Compile Include="DesignDataEntry\DesignDataEntry.cs" />
<Compile Include="DesignDataEntry\DesignDataEntryWindow.xaml.cs">
<DependentUpon>DesignDataEntryWindow.xaml</DependentUpon>
</Compile>
<Compile Include="DesignDataEntry\DesignDataEntryCommand.cs" />
<Compile Include="GeologyCompute.cs" />
<Compile Include="MassEarthwork\MassCutEverything.cs" />
<Compile Include="MassEarthwork\Models\CustomFamilyInfo.cs" />
<Compile Include="MassEarthwork\Models\MassCutEverythingDataInfo.cs" />
<Compile Include="MassEarthwork\Views\MassCutEverythingWindow.xaml.cs">
<DependentUpon>MassCutEverythingWindow.xaml</DependentUpon>
</Compile>
<Compile Include="PileCheckCommand.cs" />
<Compile Include="PileCheck\PileCheckCommand.cs" />
<Compile Include="PileCheck\PileCheckWindow.xaml.cs">
<DependentUpon>PileCheckWindow.xaml</DependentUpon>
</Compile>
<Compile Include="PileCheck\PileParametersEntity.cs" />
<Compile Include="Properties\Annotations.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Ribbon.cs" />
<Compile Include="Utils\BackgroudTask.cs" />
<Compile Include="Utils\DelegateCommand.cs" />
<Compile Include="Utils\LoadOpts.cs" />
<Compile Include="Utils\Common.cs" />
<Compile Include="Utils\AppConfig.cs" />
<Compile Include="DataClass\Borehole.cs" />
<Compile Include="DataClass\GeologyBlock.cs" />
<Compile Include="Utils\ExcelHelper.cs" />
<Compile Include="DWGDataExport.cs" />
<Compile Include="Utils\FailureHandler.cs" />
<Compile Include="DataClass\GeologyLayer.cs" />
<Compile Include="GeologyCylinder.cs" />
<Compile Include="GeologyModel.cs" />
<Compile Include="ProgressForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ProgressForm.designer.cs">
<DependentUpon>ProgressForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resource.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="DataClass\TypeEquals.cs" />
<Compile Include="Utils\NotificationExtensions.cs" />
<Compile Include="Utils\PropertyChangedNotify.cs" />
<Compile Include="Utils\TextBoxDoubleEx.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ProgressForm.resx">
<DependentUpon>ProgressForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
<CustomToolNamespace>uBIM_EarthTools</CustomToolNamespace>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="MassEarthwork\公制常规模型.rft" />
<None Include="packages.config" />
<None Include="Resources\地质钻孔圆柱.rfa" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\pyramid.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\contract.png" />
</ItemGroup>
<ItemGroup>
<Page Include="DesignDataEntry\DesignDataEntryWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MassEarthwork\Views\MassCutEverythingWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PileCheck\PileCheckWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>