This commit is contained in:
Wiesław Šoltés 2018-06-14 22:24:58 +02:00
Родитель cfb5b123a8
Коммит 4c3f334a36
14 изменённых файлов: 238 добавлений и 78 удалений

Просмотреть файл

@ -5,6 +5,10 @@ VisualStudioVersion = 15.0.27703.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroStationTagExplorer", "src\MicroStationTagExplorer\MicroStationTagExplorer.csproj", "{59F5B5F5-2569-4263-9E94-D53DA097FCAD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroStationTagExplorerInterop", "src\MicroStationTagExplorerInterop\MicroStationTagExplorerInterop.csproj", "{CDDC9304-E54C-4E6C-A647-4C6FC78DB2A6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroStationTagExplorerModel", "src\MicroStationTagExplorerModel\MicroStationTagExplorerModel.csproj", "{E75B1451-B4EA-4806-87BA-11C596EB6B3E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +19,14 @@ Global
{59F5B5F5-2569-4263-9E94-D53DA097FCAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59F5B5F5-2569-4263-9E94-D53DA097FCAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59F5B5F5-2569-4263-9E94-D53DA097FCAD}.Release|Any CPU.Build.0 = Release|Any CPU
{CDDC9304-E54C-4E6C-A647-4C6FC78DB2A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CDDC9304-E54C-4E6C-A647-4C6FC78DB2A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CDDC9304-E54C-4E6C-A647-4C6FC78DB2A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CDDC9304-E54C-4E6C-A647-4C6FC78DB2A6}.Release|Any CPU.Build.0 = Release|Any CPU
{E75B1451-B4EA-4806-87BA-11C596EB6B3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E75B1451-B4EA-4806-87BA-11C596EB6B3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E75B1451-B4EA-4806-87BA-11C596EB6B3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E75B1451-B4EA-4806-87BA-11C596EB6B3E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -8,8 +8,6 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using Microsoft.Win32;
using MicroStationTagExplorer.Model;
using Excel = Microsoft.Office.Interop.Excel;
namespace MicroStationTagExplorer
{
@ -93,7 +91,7 @@ namespace MicroStationTagExplorer
TextBoxStatus.Text = System.IO.Path.GetFileName(file.Path);
});
Microstation.GetTagData(file);
MicrostationInterop.GetTagData(file);
}
}
catch (Exception ex)
@ -159,32 +157,7 @@ namespace MicroStationTagExplorer
values[i + 1, 5] = tags[i].Path;
}
Excel.Application app = Utilities.CreateObject<Excel.Application>("Excel.Application");
app.Visible = true;
Excel.Workbook wb = app.Workbooks.Add();
Excel.Worksheet ws = wb.Worksheets.Add();
Excel.Range start = ws.Cells[1, 1];
Excel.Range end = ws.Cells[tags.Length + 1, 6];
Excel.Range range = ws.Range[start, end];
range.Value = values;
ws.Rows["2:2"].Select();
app.ActiveWindow.SplitColumn = 0;
app.ActiveWindow.SplitRow = 1;
app.ActiveWindow.FreezePanes = true;
ws.Range[ws.Cells[1, 1], ws.Cells[1, 1]].CurrentRegion.Select();
app.Selection.AutoFilter();
ws.Columns[1].Resize(Type.Missing, 6).Select();
ws.Columns[1].Resize(Type.Missing, 6).EntireColumn.AutoFit();
ws.ListObjects.AddEx(Excel.XlListObjectSourceType.xlSrcRange, range, null, Excel.XlYesNoGuess.xlYes).Name = "Tags";
ws.Range["A1"].Select();
Excelnterop.ExportTags(values, tags.Length + 1, 6);
}
catch (Exception ex)
{

Просмотреть файл

@ -53,12 +53,6 @@
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Compile Include="Microstation.cs" />
<Compile Include="Model\File.cs" />
<Compile Include="Model\Tag.cs" />
<Compile Include="Model\TagDefinition.cs" />
<Compile Include="Model\TagSet.cs" />
<Compile Include="Utilities.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -81,43 +75,14 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Core">
<Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>8</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="Microsoft.Office.Interop.Excel">
<Guid>{00020813-0000-0000-C000-000000000046}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>9</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="MicroStationDGN">
<Guid>{CF9F97BF-39F2-4B8E-835C-8BE9E99DAF5B}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="VBIDE">
<Guid>{0002E157-0000-0000-C000-000000000046}</Guid>
<VersionMajor>5</VersionMajor>
<VersionMinor>3</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<ProjectReference Include="..\MicroStationTagExplorerInterop\MicroStationTagExplorerInterop.csproj">
<Project>{cddc9304-e54c-4e6c-a647-4c6fc78db2a6}</Project>
<Name>MicroStationTagExplorerInterop</Name>
</ProjectReference>
<ProjectReference Include="..\MicroStationTagExplorerModel\MicroStationTagExplorerModel.csproj">
<Project>{e75b1451-b4ea-4806-87ba-11c596eb6b3e}</Project>
<Name>MicroStationTagExplorerModel</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,38 @@
using System;
using Excel = Microsoft.Office.Interop.Excel;
namespace MicroStationTagExplorer
{
public static class Excelnterop
{
public static void ExportTags(object[,] values, int rows, int columns)
{
Excel.Application app = Utilities.CreateObject<Excel.Application>("Excel.Application");
app.Visible = true;
Excel.Workbook wb = app.Workbooks.Add();
Excel.Worksheet ws = wb.Worksheets.Add();
Excel.Range start = ws.Cells[1, 1];
Excel.Range end = ws.Cells[rows, columns];
Excel.Range range = ws.Range[start, end];
range.Value = values;
ws.Rows["2:2"].Select();
app.ActiveWindow.SplitColumn = 0;
app.ActiveWindow.SplitRow = 1;
app.ActiveWindow.FreezePanes = true;
ws.Range[ws.Cells[1, 1], ws.Cells[1, 1]].CurrentRegion.Select();
app.Selection.AutoFilter();
ws.Columns[1].Resize(Type.Missing, 6).Select();
ws.Columns[1].Resize(Type.Missing, 6).EntireColumn.AutoFit();
ws.ListObjects.AddEx(Excel.XlListObjectSourceType.xlSrcRange, range, null, Excel.XlYesNoGuess.xlYes).Name = "Tags";
ws.Range["A1"].Select();
}
}
}

Просмотреть файл

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CDDC9304-E54C-4E6C-A647-4C6FC78DB2A6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MicroStationTagExplorerInterop</RootNamespace>
<AssemblyName>MicroStationTagExplorerInterop</AssemblyName>
<TargetFrameworkVersion>v4.5.2</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>
</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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<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" />
</ItemGroup>
<ItemGroup>
<Compile Include="Excelnterop.cs" />
<Compile Include="MicrostationInterop.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities.cs" />
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Core">
<Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>8</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="Microsoft.Office.Interop.Excel">
<Guid>{00020813-0000-0000-C000-000000000046}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>9</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="MicroStationDGN">
<Guid>{CF9F97BF-39F2-4B8E-835C-8BE9E99DAF5B}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="VBIDE">
<Guid>{0002E157-0000-0000-C000-000000000046}</Guid>
<VersionMajor>5</VersionMajor>
<VersionMinor>3</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MicroStationTagExplorerModel\MicroStationTagExplorerModel.csproj">
<Project>{e75b1451-b4ea-4806-87ba-11c596eb6b3e}</Project>
<Name>MicroStationTagExplorerModel</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using MicroStationTagExplorer.Model;
using BCOM = MicroStationDGN;
namespace MicroStationTagExplorer
{
public static class Microstation
public static class MicrostationInterop
{
public static Int64 ToInt64(BCOM.DLong value)
{

Просмотреть файл

@ -0,0 +1,15 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("MicroStationTagExplorerInterop")]
[assembly: AssemblyDescription("MicroStation Tag Explorer Interop")]
[assembly: AssemblyConfiguration("Wiesław Šoltés")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MicroStationTagExplorerInterop")]
[assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("cddc9304-e54c-4e6c-a647-4c6fc78db2a6")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace MicroStationTagExplorer.Model
namespace MicroStationTagExplorer
{
public class File
{

Просмотреть файл

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E75B1451-B4EA-4806-87BA-11C596EB6B3E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MicroStationTagExplorerModel</RootNamespace>
<AssemblyName>MicroStationTagExplorerModel</AssemblyName>
<TargetFrameworkVersion>v4.5.2</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>
</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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<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" />
</ItemGroup>
<ItemGroup>
<Compile Include="File.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Tag.cs" />
<Compile Include="TagDefinition.cs" />
<Compile Include="TagSet.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,15 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("MicroStationTagExplorerModel")]
[assembly: AssemblyDescription("MicroStation Tag Explorer Model")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Wiesław Šoltés")]
[assembly: AssemblyProduct("MicroStationTagExplorerModel")]
[assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("e75b1451-b4ea-4806-87ba-11c596eb6b3e")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -1,6 +1,6 @@
using System;
namespace MicroStationTagExplorer.Model
namespace MicroStationTagExplorer
{
public class Tag
{

Просмотреть файл

@ -1,5 +1,5 @@

namespace MicroStationTagExplorer.Model
namespace MicroStationTagExplorer
{
public class TagDefinition
{

Просмотреть файл

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace MicroStationTagExplorer.Model
namespace MicroStationTagExplorer
{
public class TagSet
{