This commit is contained in:
John Jenko 2020-01-22 17:33:34 +00:00
parent 89d6dc275c
commit 6ea9865669
72 changed files with 20072 additions and 0 deletions

View File

@ -0,0 +1,105 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLConvert", "XMLConvert\XMLConvert.csproj", "{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CPPConvert", "CPPConvert\CPPConvert.csproj", "{1153363A-3395-4BBA-A507-4FA69132CDFC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConvertAlarms", "ConvertAlarms\ConvertAlarms.csproj", "{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConvertLocalAlarms", "ConvertLocalAlarms\ConvertLocalAlarms.csproj", "{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadFile", "ReadFile\ReadFile.csproj", "{D83BC593-811C-4D32-81B2-9C6031AFDAF5}"
EndProject
Global
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 6
SccLocalPath0 = .
SccProjectUniqueName1 = ConvertAlarms\\ConvertAlarms.csproj
SccLocalPath1 = .
SccProjectFilePathRelativizedFromConnection1 = ConvertAlarms\\
SccProjectUniqueName2 = ConvertLocalAlarms\\ConvertLocalAlarms.csproj
SccLocalPath2 = .
SccProjectFilePathRelativizedFromConnection2 = ConvertLocalAlarms\\
SccProjectUniqueName3 = CPPConvert\\CPPConvert.csproj
SccLocalPath3 = .
SccProjectFilePathRelativizedFromConnection3 = CPPConvert\\
SccProjectUniqueName4 = ReadFile\\ReadFile.csproj
SccLocalPath4 = .
SccProjectFilePathRelativizedFromConnection4 = ReadFile\\
SccProjectUniqueName5 = XMLConvert\\XMLConvert.csproj
SccLocalPath5 = .
SccProjectFilePathRelativizedFromConnection5 = XMLConvert\\
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Debug|Mixed Platforms.Build.0 = Debug|x86
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Debug|x86.ActiveCfg = Debug|x86
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Debug|x86.Build.0 = Debug|x86
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Release|Any CPU.Build.0 = Release|Any CPU
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Release|Mixed Platforms.ActiveCfg = Release|x86
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Release|Mixed Platforms.Build.0 = Release|x86
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Release|x86.ActiveCfg = Release|x86
{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}.Release|x86.Build.0 = Release|x86
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Debug|Mixed Platforms.Build.0 = Debug|x86
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Debug|x86.ActiveCfg = Debug|x86
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Debug|x86.Build.0 = Debug|x86
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Release|Any CPU.Build.0 = Release|Any CPU
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Release|Mixed Platforms.ActiveCfg = Release|x86
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Release|Mixed Platforms.Build.0 = Release|x86
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Release|x86.ActiveCfg = Release|x86
{1153363A-3395-4BBA-A507-4FA69132CDFC}.Release|x86.Build.0 = Release|x86
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Debug|Mixed Platforms.Build.0 = Debug|x86
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Debug|x86.ActiveCfg = Debug|x86
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Debug|x86.Build.0 = Debug|x86
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Release|Any CPU.Build.0 = Release|Any CPU
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Release|Mixed Platforms.ActiveCfg = Release|x86
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Release|Mixed Platforms.Build.0 = Release|x86
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Release|x86.ActiveCfg = Release|x86
{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}.Release|x86.Build.0 = Release|x86
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Debug|Mixed Platforms.Build.0 = Debug|x86
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Debug|x86.ActiveCfg = Debug|Any CPU
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Release|Any CPU.Build.0 = Release|Any CPU
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}.Release|x86.ActiveCfg = Release|Any CPU
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Debug|Mixed Platforms.Build.0 = Debug|x86
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Debug|x86.ActiveCfg = Debug|Any CPU
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Release|Any CPU.Build.0 = Release|Any CPU
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D83BC593-811C-4D32-81B2-9C6031AFDAF5}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1153363A-3395-4BBA-A507-4FA69132CDFC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CPPConvert</RootNamespace>
<AssemblyName>CPPConvert</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Csla">
<HintPath>..\..\..\..\..\..\..\Development\csla20cs\Csla\bin\Debug\Csla.dll</HintPath>
</Reference>
<Reference Include="DevComponents.DotNetBar2, Version=14.0.0.11, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04, processorArchitecture=MSIL" />
<Reference Include="log4net">
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\log4net.dll</HintPath>
</Reference>
<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.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="VEPROMS.CSLA.Library">
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\VEPROMS.CSLA.Library.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="frmCPPConvert.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmCPPConvert.Designer.cs">
<DependentUpon>frmCPPConvert.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmCPPConvert.resx">
<DependentUpon>frmCPPConvert.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</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>

View File

@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = "relative:CPPConvert"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CPPConvert
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmCPPConvert());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CPPConvert")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CPPConvert")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1e1f432a-54d7-4c79-a5ed-c8c863ca75b0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CPPConvert.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CPPConvert.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CPPConvert.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,236 @@
namespace CPPConvert
{
partial class frmCPPConvert
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmCPPConvert));
this.label1 = new System.Windows.Forms.Label();
this.tbFile = new System.Windows.Forms.TextBox();
this.tbResults = new System.Windows.Forms.TextBox();
this.btnBrowse = new System.Windows.Forms.Button();
this.tbDest = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.btnBrowseDest = new System.Windows.Forms.Button();
this.fbd = new System.Windows.Forms.FolderBrowserDialog();
this.ofd = new System.Windows.Forms.OpenFileDialog();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.processToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pb = new DevComponents.DotNetBar.Controls.ProgressBarX();
this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 0;
this.label1.Text = "CPP File";
//
// tbFile
//
this.tbFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbFile.Location = new System.Drawing.Point(83, 27);
this.tbFile.Name = "tbFile";
this.tbFile.Size = new System.Drawing.Size(482, 20);
this.tbFile.TabIndex = 1;
this.tbFile.Text = "C:\\Development\\Proms\\Barakah\\SGTR\\1N2-OP-EOP-RC-0002 Rev00 - Steam Generator Tube" +
" Rupture (CPS-CPP).cpp";
//
// tbResults
//
this.tbResults.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbResults.Location = new System.Drawing.Point(12, 124);
this.tbResults.Multiline = true;
this.tbResults.Name = "tbResults";
this.tbResults.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.tbResults.Size = new System.Drawing.Size(637, 169);
this.tbResults.TabIndex = 3;
//
// btnBrowse
//
this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrowse.Location = new System.Drawing.Point(571, 25);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(72, 23);
this.btnBrowse.TabIndex = 4;
this.btnBrowse.Text = "Browse...";
this.btnBrowse.UseVisualStyleBackColor = true;
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
//
// tbDest
//
this.tbDest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbDest.Location = new System.Drawing.Point(83, 53);
this.tbDest.Name = "tbDest";
this.tbDest.Size = new System.Drawing.Size(482, 20);
this.tbDest.TabIndex = 5;
this.tbDest.Text = "C:\\Development\\Proms\\Barakah\\EOP CPPs\\Output";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(14, 53);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(60, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Destination";
//
// btnBrowseDest
//
this.btnBrowseDest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrowseDest.Location = new System.Drawing.Point(571, 50);
this.btnBrowseDest.Name = "btnBrowseDest";
this.btnBrowseDest.Size = new System.Drawing.Size(72, 23);
this.btnBrowseDest.TabIndex = 7;
this.btnBrowseDest.Text = "Browse...";
this.btnBrowseDest.UseVisualStyleBackColor = true;
this.btnBrowseDest.Click += new System.EventHandler(this.btnBrowseDest_Click);
//
// ofd
//
this.ofd.FileName = "openFileDialog1";
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(661, 24);
this.menuStrip1.TabIndex = 8;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.processToolStripMenuItem,
this.allToolStripMenuItem,
this.testToolStripMenuItem,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File";
//
// processToolStripMenuItem
//
this.processToolStripMenuItem.Name = "processToolStripMenuItem";
this.processToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.processToolStripMenuItem.Text = "&Process";
this.processToolStripMenuItem.Click += new System.EventHandler(this.processToolStripMenuItem_Click);
//
// allToolStripMenuItem
//
this.allToolStripMenuItem.Name = "allToolStripMenuItem";
this.allToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.allToolStripMenuItem.Text = "&All";
this.allToolStripMenuItem.Click += new System.EventHandler(this.allToolStripMenuItem_Click);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// pb
//
this.pb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//
//
//
this.pb.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.pb.Location = new System.Drawing.Point(12, 91);
this.pb.Name = "pb";
this.pb.Size = new System.Drawing.Size(637, 23);
this.pb.TabIndex = 9;
this.pb.Text = "progressBarX1";
//
// testToolStripMenuItem
//
this.testToolStripMenuItem.Name = "testToolStripMenuItem";
this.testToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.testToolStripMenuItem.Text = "&Test";
this.testToolStripMenuItem.Click += new System.EventHandler(this.testToolStripMenuItem_Click);
//
// frmCPPConvert
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(661, 305);
this.Controls.Add(this.pb);
this.Controls.Add(this.btnBrowseDest);
this.Controls.Add(this.label2);
this.Controls.Add(this.tbDest);
this.Controls.Add(this.btnBrowse);
this.Controls.Add(this.tbResults);
this.Controls.Add(this.tbFile);
this.Controls.Add(this.label1);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "frmCPPConvert";
this.Text = "Extract XML and Image Files";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbFile;
private System.Windows.Forms.TextBox tbResults;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.TextBox tbDest;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnBrowseDest;
private System.Windows.Forms.FolderBrowserDialog fbd;
private System.Windows.Forms.OpenFileDialog ofd;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem processToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private DevComponents.DotNetBar.Controls.ProgressBarX pb;
private System.Windows.Forms.ToolStripMenuItem allToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem testToolStripMenuItem;
}
}

View File

@ -0,0 +1,310 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace CPPConvert
{
public partial class frmCPPConvert : Form
{
public frmCPPConvert()
{
InitializeComponent();
}
private long _Offset;
private static long _lastPos = 0l;
private void ReadRecord(BinaryReader br)
{
long curPos = FS.Position;
int nxtPos = PathStartList[0];
if (nxtPos - 4 != curPos)
{
Console.WriteLine("curpos, nxtpos, lastpos\t{0:X08}\t{1:X08}", curPos - _lastPos, nxtPos- _lastPos);
FS.Seek(nxtPos - 4, SeekOrigin.Begin);
}
PathStartList.RemoveAt(0);
_lastPos = FS.Position;
string filePath = ReadString(br);
Console.WriteLine(filePath.Substring(120,filePath.Length-120));
string type = ReadString(br);
int pos = (int) FS.Position;
byte [] buf = ReadBuffer(br);
int size = buf.Length;
if (buf.Length > 4 && StartsWith(buf, "<?xml"))
{
int HowMany0Ds = 0;
int HowMany0As = 0;
int j = 0;
while (j < buf.Length - HowMany0As - HowMany0Ds)
{
if (buf[j] == 0x0D) HowMany0Ds++;
if (buf[j] == 0x0A) HowMany0As++;
j++;
}
int misMatch = HowMany0As - HowMany0Ds;
if (misMatch > 0)
{
FS.Position = pos + buf.Length + 4 - misMatch;
size -= misMatch;
}
}
//Console.WriteLine("filePath={0}\r\ntype={1}", filePath, type);
if(type.ToLower().Contains("procedure"))
{
tbResults.AppendText(string.Format("Extracted {0}\r\n",PartialName(filePath,type)));
SaveFile(filePath,type,buf,size);
}
}
private string PartialName(string filePath, string type)
{
int skipSlashes = 2 +type.Length - type.Replace("/", "").Length;
int start = filePath.Length;
while(skipSlashes-- > 0)
start = filePath.LastIndexOf('/', start-1);
return filePath.Substring(start+1);
}
private void SaveFile(string filePath, string type, byte[] buf,int size)
{
string fn = (tbDest.Text.EndsWith("/") ? tbDest.Text : tbDest.Text + "/") + PartialName(filePath, type);
BuildPath(fn);
FileStream fs = File.Create(fn);
BinaryWriter bw = new BinaryWriter(fs);
if (filePath.ToUpper().EndsWith(".PNG") && buf[4]==0xA)
{
bw.Write(buf, 0, 4);
bw.Write(Encoding.ASCII.GetBytes("\xD"));
bw.Write(buf, 4, size-4);
}
else
{
}
bw.Write(buf,0,size);
bw.Close();
}
private void BuildPath(string fn)
{
FileInfo fi = new FileInfo(fn);
fi.Directory.Create();
}
private string ReadString(BinaryReader br)
{
byte[] buffer = ReadBuffer(br);
return Encoding.BigEndianUnicode.GetString(buffer, 0, buffer.Length);
}
private byte[] ReadBuffer(BinaryReader br)
{
int size = ReadBytesToInt32(br);
if (size == -1) size = 0;
if(size > FS.Length || size < 0)
throw(new Exception(string.Format("Location {0:X08} has a buffer that is too big {1:X08}",FS.Position,size)));
byte[] buffer = new byte[size];
br.Read(buffer, 0, size);
_Offset += size;
return buffer;
}
private int ReadBytesToInt32(BinaryReader br)
{
byte[] buffer = new byte[4];
long off = Offset;
br.Read(buffer, 0, 4);
int i = BitConverter.ToInt32(buffer.Reverse().ToArray(), 0);
//if(i>255) Console.WriteLine("{0:X8} - {1:X8}", off,i);
_Offset += 4;
return i;
}
private void btnBrowse_Click(object sender, EventArgs e)
{
ofd.FileName = tbFile.Text;
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
tbFile.Text = ofd.FileName;
}
private void btnBrowseDest_Click(object sender, EventArgs e)
{
fbd.SelectedPath = tbDest.Text;
if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
tbDest.Text = fbd.SelectedPath;
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
public long Offset
{
get
{
return FS.Seek(0, SeekOrigin.Current);
}
}
FileStream _FS;
public FileStream FS
{
get { return _FS; }
set { _FS = value; }
}
private List<int> _PathStartList;
public List<int> PathStartList
{
get { return _PathStartList; }
set { _PathStartList = value; }
}
private List<int> GetPathStartList(string findIt,FileStream fs)
{
List<int> lst= new List<int>();
BinaryReader br = new BinaryReader(FS);
int buflen = (int) FS.Length;
byte [] buf =br.ReadBytes(buflen);
byte[] bFindIt = Encoding.BigEndianUnicode.GetBytes(findIt);
int findlen = bFindIt.Length;
pb.Text = "Looking for C:/";
pb.Maximum = (int) fs.Length;
for (int i = 0; i < buflen - 4; i++)
{
if (buf[i] == bFindIt[0])
{
int k=0;
for (; k < findlen; k++)
if (buf[k + i] != bFindIt[k])
break;
if (k == findlen) lst.Add(i);
}
pb.Value = i;
}
pb.Text = "Done";
br.Close();
return lst;
}
private bool Foundit(byte[] buf, int offset, byte [] bFindIt)
{
for (int i = 0; i < bFindIt.Length; i++)
if (buf[i + offset] != (int)bFindIt[i])
return false;
return true;
}
private void processToolStripMenuItem_Click(object sender, EventArgs e)
{
tbResults.Clear();
ConvertCPP(tbFile.Text);
pb.Text = "All Done";
}
private void ConvertCPP(string fileName)
{
FS = File.OpenRead(fileName);
PathStartList = GetPathStartList("C:/", FS);
//Console.WriteLine("===> {0} Paths", PathStartList.Count);
FS = File.OpenRead(fileName);
BinaryReader br = new BinaryReader(FS);
try
{
_Offset = 0;
int nRecords = ReadBytesToInt32(br);
//Console.WriteLine("===> {0} Records", nRecords);
int i = 0;
pb.Text = "Splitting File";
pb.Maximum = nRecords;
while (_Offset < FS.Length && nRecords-- > 0)
{
ReadRecord(br);
pb.Value = ++i;
}
}
catch (Exception ex)
{
tbResults.AppendText(string.Format("{0} - {1}-{2}\r\n{3}\r\n\r\n", fileName, ex.GetType().Name, ex.Message, ex.StackTrace));
}
finally
{
br.Close();
}
}
private void allToolStripMenuItem_Click(object sender, EventArgs e)
{
tbResults.Clear();
FileInfo[] myFiles = new FileInfo(tbFile.Text).Directory.GetFiles("*.cpp");
foreach (FileInfo fi in myFiles)
ConvertCPP(fi.FullName);
pb.Text = "All Done";
}
private void testToolStripMenuItem_Click(object sender, EventArgs e)
{
FS = File.OpenRead(tbFile.Text);
PathStartList = GetPathStartList("C:/", FS);
FS = File.OpenRead(tbFile.Text);
BinaryReader br = new BinaryReader(FS);
int nRecords = ReadBytesToInt32(br);
int bytesRead = 4;
int countByThree = 0;
while (bytesRead < FS.Length)
{
if(countByThree % 3 == 0)
{
long curPos = FS.Position;
int nxtPos = PathStartList[0];
if (nxtPos - 4 != curPos)
{
Console.WriteLine("curpos, nxtpos, lastpos\t{0:X08}\t{1:X08}", curPos - _lastPos, nxtPos - _lastPos);
FS.Seek(nxtPos - 4, SeekOrigin.Begin);
}
PathStartList.RemoveAt(0);
}
_lastPos = FS.Position;
long pos = FS.Position;
int size = ReadBytesToInt32(br);
bytesRead += 4;
byte[] buf = br.ReadBytes(size);
bytesRead += size;
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("{0:D4} {1:X08} {2:X08} ",countByThree ,pos,size));
for (int i = 0; i < 120 && i < size; i++)
{
if(buf[i] < 0x20)
sb.Append('.');
else
sb.Append((char) buf[i]);
}
Console.WriteLine(sb.ToString());
if (StartsWith(buf, "<?xml"))
{
int HowMany0Ds = 0;
int HowMany0As = 0;
int j = 0;
while (j < buf.Length - HowMany0As - HowMany0Ds)
{
if (buf[j] == 0x0D) HowMany0Ds++;
if (buf[j] == 0x0A) HowMany0As++;
j++;
}
int misMatch = HowMany0As - HowMany0Ds;
if (misMatch > 0)
{
FS.Position = pos + size + 4 - misMatch;
bytesRead -= misMatch;
}
}
countByThree++;
}
}
private bool StartsWith(byte[] buf, string findIt)
{
byte[] bFindIt = Encoding.ASCII.GetBytes(findIt);
int findlen = bFindIt.Length;
int k=0;
for (; k < findlen; k++)
if (buf[k] != bFindIt[k])
return false;
return true;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="ConvertAlarms.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<userSettings>
<ConvertAlarms.Properties.Settings>
<setting name="Size" serializeAs="String">
<value>1000, 600</value>
</setting>
<setting name="Location" serializeAs="String">
<value>0, 0</value>
</setting>
<setting name="FileName" serializeAs="String">
<value />
</setting>
<setting name="Split1" serializeAs="String">
<value>250</value>
</setting>
<setting name="SqlServer" serializeAs="String">
<value>.\Sql2008Express</value>
</setting>
<setting name="Database" serializeAs="String">
<value>VEPROMS_Barakah</value>
</setting>
<setting name="ProcedureSet" serializeAs="String">
<value>0</value>
</setting>
</ConvertAlarms.Properties.Settings>
</userSettings>
</configuration>

View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8185CA5B-2403-450A-9989-C7E4A2A5D7A1}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConvertAlarms</RootNamespace>
<AssemblyName>ConvertAlarms</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="C1.Win.C1FlexGrid.2, Version=2.6.20142.835, Culture=neutral, PublicKeyToken=79882d576c6336da, processorArchitecture=MSIL" />
<Reference Include="Csla">
<HintPath>..\..\..\..\..\..\..\Development\csla20cs\Csla\bin\Debug\Csla.dll</HintPath>
</Reference>
<Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files\DotNetBar for Windows Forms\DevComponents.DotNetBar2.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS User Interface\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="VEPROMS.CSLA.Library, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\VEPROMS.CSLA.Library.dll</HintPath>
</Reference>
<Reference Include="Volian.Base.Library">
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\Volian.Base.Library.dll</HintPath>
</Reference>
<Reference Include="Volian.Controls.Library">
<HintPath>..\..\..\..\..\..\..\Development\Proms\Volian.Controls.Library\bin\Debug\Volian.Controls.Library.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ConvertTable.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmConvertAlarms.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmConvertAlarms.Designer.cs">
<DependentUpon>frmConvertAlarms.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SaveProcedure.cs">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="frmConvertAlarms.resx">
<DependentUpon>frmConvertAlarms.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</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>

View File

@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = "relative:ConvertAlarms"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,197 @@
using C1.Win.C1FlexGrid;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
namespace ConvertAlarms
{
public partial class frmConvertAlarms
{
private static string GetTableText()
{
return _MyFlexGrid.GetSearchableText();
}
private static void LoadTable2(XmlNode xn, StepLookup mySteps, int level)
{
XmlNode xn2 = xn.SelectSingleNode("tr/td/table");
if (xn2 != null) xn = xn2;
VlnFlexGrid fg = _MyFlexGrid;
fg.Font = new Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Point);
fg.Clear();
fg.Rows.Count = 1;
fg.Cols.Count = 1;
int rows = 0;
fg.MergedRanges.Clear();
foreach (XmlNode xr in xn.ChildNodes)
{
if (xr.Name == "tr")
{
++rows;
AddTableRow(xr, fg, rows);
}
}
fg.MyBorders = new VlnBorders(GridLinePattern.Single, fg.Rows.Count, fg.Cols.Count);
fg.BringToFront();
fg.Invalidate();
Application.DoEvents();
//ShowColumnWidths(fg);
fg.MakeRTFcells(false);
//ShowMergedCells(fg);
//ShowColumnWidths(fg);
//Well, Can I save the table
//using (Step step = MakeCSLAStep(mySteps, mySteps.Count, null, {TableContent}, 20008, E_FromType.Table))
//{
// Grid.MakeGrid(step.MyContent, fg.GetXMLData(), "");
//}
}
public static VlnFlexGrid _MyFlexGrid = null;
private static void AddTableRow(XmlNode xr, VlnFlexGrid fg, int rows)
{
if (rows > fg.Rows.Count)
fg.Rows.Count = rows;
int cols = 0;
foreach (XmlNode xc in xr.ChildNodes)
{
++cols;
//if (xc.InnerText.Contains("RC-V200"))
// Console.WriteLine(xc.InnerText);
//if (xc.InnerText.Contains("RC-V121"))
// Console.WriteLine(xc.InnerText);
//if (xc.InnerXml.Contains("AB 137") || xc.InnerXml.Contains("3013N01"))
// Console.WriteLine("here");
CellRange cr2 = GetMyMergedRange(fg, rows - 1, cols - 1);
//Console.WriteLine("Check {0}", cr2);
while (cr2.c1 != cols - 1 || cr2.r1 != rows - 1)
{
cols++;
cr2 = GetMyMergedRange(fg, rows - 1, cols - 1);
}
AddMergedCells(fg, rows, cols, xc);
//ShowMergedCells(fg);
if (xc.Name == "td")
{
AddTableColumn(xc, fg, rows, cols);
}
}
}
//private static void ShowColumnWidths(VlnFlexGrid fg)
//{
// foreach (Column c in fg.Cols)
// Console.WriteLine("Width[{0}]={1}", c.Index, c.Width);
//}
private static void ShowMergedCells(VlnFlexGrid fg)
{
for (int r = 0; r < fg.Rows.Count; r++)
{
for (int c = 0; c < fg.Cols.Count; c++)
{
CellRange cr3 = GetMyMergedRange(fg, r, c);
if (fg.MergedRanges.Contains(cr3))
Console.WriteLine("cr3 r={0},c={1},rng={2}", r, c, cr3);
}
}
}
private static int GetSpan(string span)
{
int retval = int.Parse("0" + (span ?? ""));
if (retval == 0) return 0;
return retval - 1;
}
private static string GetAttribute(XmlNode xc, string attName)
{
string retval = null;
XmlAttribute xa = xc.Attributes[attName];
if (xa != null)
retval = xa.Value;
return retval;
}
private static void AddMergedCells(VlnFlexGrid fg, int rows, int cols, XmlNode xc)
{
string colspan = GetAttribute(xc, "colspan");
string rowspan = GetAttribute(xc, "rowspan");
if (colspan != null || rowspan != null)
{
//AddMergedRanges
int r1 = rows;
int c1 = cols;
int r2 = r1 + GetSpan(rowspan);
if (r2 > fg.Rows.Count) fg.Rows.Count = r2;
int c2 = c1 + GetSpan(colspan);
if (c2 > fg.Cols.Count) fg.Cols.Count = c2;
CellRange cr = new CellRange();
cr.r1 = r1 - 1;
cr.r2 = r2 - 1;
cr.c1 = c1 - 1;
cr.c2 = c2 - 1;
fg.MergedRanges.Add(cr);
//Console.WriteLine("Merged {0}", cr);
}
}
private static CellRange GetMyMergedRange(VlnFlexGrid fg, int r, int c)
{
foreach (CellRange cr in fg.MergedRanges)
{
if (cr.r1 <= r && cr.r2 >= r && cr.c1 <= c && cr.c2 >= c)
return cr;
}
return fg.GetMergedRange(r, c);
}
private static Regex regNumber = new Regex("^[0-9]+$", RegexOptions.Compiled);
private static void AddTableColumn(XmlNode xc, VlnFlexGrid fg, int rows, int cols)
{
//Console.WriteLine("Rows {0}, Cols {1}", rows, cols);
if (cols > fg.Cols.Count)
fg.Cols.Count = cols;
string width = GetAttribute(xc, "width");
if (width != null && width != "" && regNumber.IsMatch(width))
{
if (width.EndsWith("%"))
fg.Cols[cols - 1].Width = (int)(int.Parse(width.Replace("%", "")) * 96 * 6.5F / 100);
else
{
int w = int.Parse(width)*96/72;
//Console.WriteLine("w[{0}]={1}", cols - 1, w);
fg.Cols[cols - 1].Width = w;
}
}
StringBuilder sb = new StringBuilder();
string prefix = "";
foreach (XmlNode xn in xc.ChildNodes)
{
if (xn.Name == "p")
{
sb.Append(prefix + xn.InnerText);
}
if (xn.Name == "ul")
{
foreach (XmlNode xn2 in xn.ChildNodes)
{
if (xn2.Name == "li")
{
sb.Append(prefix + "*" + xn.InnerText);
}
if (xn2.Name == "p")
{
sb.Append(prefix + xn.InnerText);
}
}
}
}
if (width != null && width != "" && !regNumber.IsMatch(width))
{
Console.WriteLine("width is not a number {0}, rows {1}, cols {2}, Text='{3}'", width, rows, cols, xc.OuterXml);
}
fg[rows - 1, cols - 1] = sb.ToString();
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ConvertAlarms
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmConvertAlarms());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ConvertAlarms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConvertAlarms")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("80225e3c-f32e-41b5-8b31-b8301eea4831")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ConvertAlarms.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ConvertAlarms.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,110 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ConvertAlarms.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1000, 600")]
public global::System.Drawing.Size Size {
get {
return ((global::System.Drawing.Size)(this["Size"]));
}
set {
this["Size"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0, 0")]
public global::System.Drawing.Point Location {
get {
return ((global::System.Drawing.Point)(this["Location"]));
}
set {
this["Location"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string FileName {
get {
return ((string)(this["FileName"]));
}
set {
this["FileName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("250")]
public int Split1 {
get {
return ((int)(this["Split1"]));
}
set {
this["Split1"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute(".\\Sql2008Express")]
public string SqlServer {
get {
return ((string)(this["SqlServer"]));
}
set {
this["SqlServer"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("VEPROMS_Barakah")]
public string Database {
get {
return ((string)(this["Database"]));
}
set {
this["Database"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int ProcedureSet {
get {
return ((int)(this["ProcedureSet"]));
}
set {
this["ProcedureSet"] = value;
}
}
}
}

View File

@ -0,0 +1,27 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ConvertAlarms.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="Size" Type="System.Drawing.Size" Scope="User">
<Value Profile="(Default)">1000, 600</Value>
</Setting>
<Setting Name="Location" Type="System.Drawing.Point" Scope="User">
<Value Profile="(Default)">0, 0</Value>
</Setting>
<Setting Name="FileName" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Split1" Type="System.Int32" Scope="User">
<Value Profile="(Default)">250</Value>
</Setting>
<Setting Name="SqlServer" Type="System.String" Scope="User">
<Value Profile="(Default)">.\Sql2008Express</Value>
</Setting>
<Setting Name="Database" Type="System.String" Scope="User">
<Value Profile="(Default)">VEPROMS_Barakah</Value>
</Setting>
<Setting Name="ProcedureSet" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1 @@
C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.2, Version=2.6.20142.835, Culture=neutral, PublicKeyToken=79882d576c6336da

View File

@ -0,0 +1,517 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
using VEPROMS.CSLA.Library;
using log4net;
using Volian.Controls.Library;
using C1.Win.C1FlexGrid;
using System.Data.SqlClient;
namespace ConvertAlarms
{
public partial class frmConvertAlarms : Form
{
//private void SaveProcedure(string text, string procNumber, string procTitle, int serialNo)
private static DocVersionInfo DVI;
private void SaveProcedure(string text, string procNumber, string procTitle, string fileName)
{
MatchCollection mc = Regex.Matches(text, "pNote");
if (mc.Count > 1) Console.WriteLine("-------> {0} Notes", mc.Count);
// Add Procedure Number and Title
ItemInfo prev = null;
//if (serialNo == 999999)
prev = DVI.MyItem == null ? null : DVI.MyItem.LastSibling; //FindLocation(DVI.MyItem,procNumber);
//else
//{
// prev = FindPrevious(dicSerialNo, serialNo);
//}
using (Procedure prc = Procedure.MakeProcedure(DVI, prev, procNumber, procTitle, 0))
{
MyLookUp = DVI.DocVersionAssociations[0].MyROFst.GetROFSTLookup(DVI);
if (MyLookUp.GetROIDByAccPagID("ALR-" + procNumber, "SP", "IG") == null)
{
prc.MyContent.Config = MakeConfig("<config><PSI ALMSERIALNUMBER=\"{0}\" ALM=\"{1}\" ALMID=\"{2}\" ALMSOURCE=\"{3}\" ALMSETPOINT=\"{4}\" KEPCOPROCNUM=\"{5}\" KEPCOPROCTITLE1=\"{6}\" /></config>",
prcSerialNoValue, prcTitleValue, prcNumberValue, prcSourceValue, prcSetpointValue, FullName.Substring(0, 13), FullName.Substring(14));
Annotation.MakeAnnotation(prc, AnnotationType.GetByNameOrCreate("Conversion Error"), null, "Missing Referenced Object " + procNumber , null);
}
else
prc.MyContent.Config = MakeConfig("<config><PSI KEPCOPROCNUM=\"{0}\" KEPCOPROCTITLE1=\"{1}\" /></config>",
FullName.Substring(0, 13), FullName.Substring(14));
prc.MyContent.Config = prc.MyContent.Config.Replace("<config><",string.Format("<config><Procedure Rev=\"{0}\"/><",RevisionNumber));
Annotation.MakeAnnotation(prc, AnnotationType.GetByNameOrCreate("Conversion Info"), null, GetAnnotationText(fileName), null);
ProcedureInfo prci = ProcedureInfo.Get(prc.ItemID);
// dicSerialNo.Add(serialNo, prci);
// Console.WriteLine("{0},{1}", serialNo, prci.ShortPath);
// Add Section
using (Section sec = Section.MakeSection(prci, null, null, "Procedure Content", 10006))
{
sec.SectionConfig.Section_ColumnMode = SectionConfig.SectionColumnMode.One;
sec.SectionConfig.Section_Pagination = SectionConfig.SectionPagination.Separate;
sec.Save();
SectionInfo seci = SectionInfo.Get(sec.ItemID);
// TODO: Add High Level Steps
// TODO: Add Substeps
MemoryStream ms = GetMemoryStream(text);
Queue<string> qread = new Queue<string>();
using (StreamReader sr = new StreamReader(ms))
fillQueue(qread, sr);
Dictionary<int, ItemInfo> lookup = new Dictionary<int, ItemInfo>();
lookup.Add(0, prci);
lookup.Add(1, seci);
int level = 2;
int type = 20001;
int lastLevel = 2;
int lastType = 0;
int lastIndent = 0;
int extra = 0;
string lastTab = "";
int? DeQueueType = null;
E_FromType myFromType = E_FromType.Step;
Queue<string> enQueue = null;
Queue<string> deQueue = null;
int deQueueLevel = 0;
int deQueueLevelLast = 0;
bool wasFromQueue;
bool firstQueue = false;
ItemInfo deQueueItem = null;
bool saveDeQueueInfo = false;
bool isTable = false;
bool lastWasTable = false;
string tableText = null;
string tab = "";
bool strangeBullet = false;
while (qread.Count > 0 || deQueue != null)
{
string lineText;
tableText = null;
if (deQueue != null)
{
wasFromQueue = true;
extra = 1;
lineText = deQueue.Dequeue().Trim();
if (deQueue.Count == 0)
deQueue = null;
if (Regex.IsMatch(lineText, "(NOTE|CAUTION|WARNING)"))
{
Console.WriteLine("Level {0} Type = {1}", deQueueLevel, DeQueueType);
switch (lineText)
{
case "<NOTE>":
DeQueueType = 20007;
break;
case "<CAUTION>":
DeQueueType = 20006;
break;
case "<WARNING>":
DeQueueType = 20020;
break;
}
firstQueue = true;
lineText = "\t" + deQueue.Dequeue();
while (deQueue.Count > 0 && deQueue.Peek().ToString().Trim().StartsWith("\u2022") == false && !Regex.IsMatch(deQueue.Peek(), "<(NOTE|CAUTION|WARNING)>"))
lineText += " " + deQueue.Dequeue();
myFromType = E_FromType.Note;
}
if (deQueue.Count == 0)
{
deQueue = null;
}
}
else
{
wasFromQueue = false;
DeQueueType = null;
extra = 0;
//if (NextLine != null)
//{
// lineText = NextLine;
// NextLine = null;
//}
//else
//{
lineText = qread.Dequeue().TrimEnd(" ".ToCharArray());
while (lineText.Trim() == "<pNOTE>" || lineText.Trim() == "<pCAUTION>" || lineText.Trim() == "<pWARNING>")
{
if (enQueue == null) enQueue = new Queue<string>();
lineText = qread.Dequeue().Trim();
//Console.WriteLine("======> {0},Count Before = {1} ", lineText.Trim(), enQueue.Count());
while (lineText != "</pNOTE>" && lineText != "</pCAUTION>" && lineText != "</pWARNING>")
{
enQueue.Enqueue(lineText.Trim());
lineText = qread.Dequeue().Trim();
}
lineText = qread.Dequeue().Trim();
//Console.WriteLine("======> {0},Count After = {1} ", lineText.Trim(), enQueue.Count());
}
if (lineText == "&gt;") lineText = lineText.Replace("&gt;", "");
else lineText = lineText.Replace("&lt;", "<").Replace("&gt;", ">");
//}
HasSpecialCharacters(lineText);
if (lineText.StartsWith("<table>"))
{
while (!lineText.Contains("</table>"))
{
lineText += " " + qread.Dequeue();
lineText = Regex.Replace(lineText, "</table>.*", "</table>");
}
XmlDocument xd = new XmlDocument();
xd.LoadXml(lineText);
LoadTable2(xd.DocumentElement, null, 0);
isTable = true;
if (!lastWasTable) level = lastLevel + 1;
else level = lastLevel;
type = 20008;
tableText = GetTableText();
//StringBuilder sbxml= new StringBuilder();
//using(StringWriter sw = new StringWriter(sbxml))
// _MyFlexGrid.WriteXml(sw);
//using(StringReader sr= new StringReader(sbxml.ToString()))
// _MyFlexGrid.ReadXml(sr);
//Application.DoEvents();
}
else lineText = Regex.Replace(lineText, "<[^<>]+>", "");
}
if (lineText.Replace("\t", "").Replace(" ", "") != "")
{
lastLine = lineText;
Match m = Regex.Match(lineText, @"^(\t*)([1-9][0-9]*\.0|[1-9][0-9]*\.[1-9][0-9]*|[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*|[A-Z]\.|\u2022|)([\t ]+)([^\u2022]*)$", RegexOptions.Multiline);
if (m.Groups[4].Value != "")
{
tab = m.Groups[2].Value;
int indent = m.Groups[1].Value.Length;
if (isTable)
{
// do nothing
if (lastWasTable)
level = lastLevel;
else
level = 1 + lastLevel;
type = 20008;
myFromType = E_FromType.Table;
}
else if (indent == 0 && tab.EndsWith(".0")) // High Level Step
{
level = 2;
type = 20002;
}
else if (Regex.IsMatch(tab, "[1-9][0-9]*\\.[1-9][0-9]*\\.[1-9][0-9]*")) // Sub-Substep
{
level = 4;
type = 20001;
}
else if (Regex.IsMatch(tab, "[1-9][0-9]*\\.[1-9][0-9]*")) // Substep
{
level = 3;
type = 20001;
}
else if (Regex.IsMatch(tab, "[A-Z]\\.")) // Sub-Substep
{
level = 5;
type = 20001;
}
else if (tab == "") // Paragraph
{
level = lastLevel + 1;
type = 20024;
}
else if (tab == "\u2022")//bullet
{
if (firstQueue)
level = lastLevel + 1;
else if (lastTab == "\u2022")
level = lastLevel;
else
if (lastType == 20007 && lastTab == "")
level = lastLevel + 1;
else
{
level = indent + 3;
strangeBullet = true;
}
type = 20004;
if (Regex.IsMatch(m.Groups[4].Value, "^[0-9]"))
type = 20011;
}
else if (tab == "\u25CB")//bullet
{
level = indent + 4;
type = 20004;
if (Regex.IsMatch(m.Groups[4].Value, "^[0-9]"))
type = 20011;
}
//while (level < lastLevel)
// lookup.Remove(lastLevel--);
if (firstQueue && deQueueLevelLast > 0) level = deQueueLevelLast+1;
while (level < lookup.Count - 1)
lookup.Remove(lookup.Count - 1);
lastTab = tab;
lastLevel = level;
//lastIndent = indent;
lastWasTable = isTable;
deQueueLevelLast = deQueueLevel;
}
if (deQueue == null && enQueue != null)
{
deQueue = enQueue;
saveDeQueueInfo = true;
enQueue = null;
}
int newType = DeQueueType ?? (isTable ? 20008 : type);
lastType = newType;
if (enQueue == null)
{
if (lookup.Count < level)
{
using (Step stp = (lookup[lookup.Count - 1] as StepInfo).Get())
{
Annotation.MakeAnnotation(stp, AnnotationType.GetByNameOrCreate("Conversion Error"), null, GetAnnotationText2(lineText), null);
}
}
else if (lookup.Count == level)
{
using (Step stp = Step.MakeStep(lookup[level - 1], null, null, tableText ?? m.Groups[4].Value, newType, myFromType))
{
if (strangeBullet)
Annotation.MakeAnnotation(stp, AnnotationType.GetByNameOrCreate("Conversion Error"), null, "Strange Bullet", null);
ItemInfo myItem = StepInfo.Get(stp.ItemID);
if (isTable)
{
Grid.MakeGrid(stp.MyContent, _MyFlexGrid.GetXMLData(), "");
String footnote = GetFootNote(ms, qread);
if (footnote.Length > 0)
Step.MakeStep(myItem, null, null, footnote, 20024, E_FromType.Step);
}
isTable = false;
//Console.WriteLine("+++B tab = {0}, Lookup.Count = {1}, Level = {2}",tab, lookup.Count, level);
lookup.Add(level, myItem);
//Console.WriteLine("+++A tab = {0}, Lookup.Count = {1}, Level = {2}",tab, lookup.Count, level);
if (saveDeQueueInfo)
{
deQueueLevel = level;
deQueueItem = lookup[level];
saveDeQueueInfo = false;
}
if (firstQueue) firstQueue = false;
}
}
else
{
int previousType = ((int)lookup[level].MyContent.Type);
if (firstQueue && DeQueueType != null)
{
previousType = (int) DeQueueType;
level = deQueueLevel + 1;
}
using (Step stp = Step.MakeStep(lookup[level - 1], lookup[level], null, tableText ?? m.Groups[4].Value, previousType, myFromType))
{
Annotation.MakeAnnotation(stp, AnnotationType.GetByNameOrCreate("Conversion Error"), null, string.Format("Type Change {0} to {1}", newType, ((int)lookup[level].MyContent.Type)), null);
if (strangeBullet)
Annotation.MakeAnnotation(stp, AnnotationType.GetByNameOrCreate("Conversion Error"), null, "Strange Bullet", null);
strangeBullet = false;
ItemInfo myItem = StepInfo.Get(stp.ItemID);
if (isTable)
{
Grid.MakeGrid(stp.MyContent, _MyFlexGrid.GetXMLData(), "");
String footnote = GetFootNote(ms, qread);
if (footnote.Length > 0)
Step.MakeStep(myItem, null, null, footnote, 20024, E_FromType.Step);
}
isTable = false;
//Console.WriteLine(">>> tab = {0}, Lookup.Count = {1}, Level = {2}", tab, lookup.Count, level);
lookup[level] = myItem;
if (saveDeQueueInfo)
{
deQueueLevel = level;
deQueueItem = lookup[level];
saveDeQueueInfo = false;
}
if (firstQueue) firstQueue = false;
}
}
myFromType = E_FromType.Step;
if (deQueue == null && deQueueItem != null)
{
level = deQueueLevel;
while (level < lookup.Count)
lookup.Remove(lookup.Count - 1);
lookup[level] = deQueueItem;
deQueueItem = null;
DeQueueType = null;
}
}
//else
//{
// enQueue.Enqueue(lineText);
//}
DeQueueType = null;
}
}
}
}
if (runOne) MessageBox.Show("Done", "Converted");
}
private ItemInfo FindLocation(ItemInfo myItem, string procNumber)
{
while (myItem != null)
{
if (myItem.DisplayNumber.CompareTo(procNumber) >= 0)
return myItem.MyPrevious;
myItem = myItem.NextItem;
}
return myItem;
}
private string MakeConfig(string fmt, params string [] args)
{
string [] atts = new string[args.Length];
args.CopyTo(atts,0);
for(int i=0; i<atts.Length; i++)
atts[i] = atts[i].Replace("&","&amp;").Replace("<","&lt;").Replace(">","&gt;");
return string.Format(fmt, atts);
}
private void fillQueue(Queue<string> qread, StreamReader sr)
{
while(sr.Peek() > 0)
qread.Enqueue(sr.ReadLine());
}
//private string _NextLine;
//public string NextLine
//{
// get { return _NextLine; }
// set { _NextLine = value; }
//}
private string GetFootNote(MemoryStream ms, Queue<string> qRead)
{
string sep = "";
StringBuilder sb = new StringBuilder();
int lineCount = 0;
string lookingFor = null;
while(qRead.Count > 0)
{
// Read a line at a time
string str = qRead.Peek();
if(lineCount == 0 && str.StartsWith("<p>"))
{
lookingFor = "</p>";
str = str.Replace("<p>", "");
}
lineCount++;
str = Regex.Replace(str, "<[^<>]+>", "").Trim(" \t".ToCharArray()).Replace("&gt;", "");
str = str.Replace('\x25CB', 'o').Replace("\u2022", "\\u9679?");
//str = str.Replace('\x25CB', 'o').Replace("\u2022", "\\u7?");
// If Text begins with number then
if (lookingFor != null)
{
if (str.Contains(lookingFor))
{
sb.Append(sep + str.Replace(lookingFor, ""));
return sb.ToString();
}
}
else if (Regex.IsMatch(str, "[0-9].*") || str.StartsWith("<table>"))
return sb.ToString();
//append string
if (sb.ToString() != "" && str != "")
sep = "\r\n";
sb.Append(sep + str);
qRead.Dequeue();// Remove current line from queue
}
return sb.ToString();
}
private void ProcessChars(string str)
{
foreach (char c in str)
{
if (c < 0x20 || c > 0x7F)
Console.WriteLine("{0:X4}", (int)c);
}
}
public void ResetSpecial()
{
FoundSpecial = new List<char>();
}
List<char> FoundSpecial = new List<char>();
private void HasSpecialCharacters(string lineText)
{
StringBuilder sb = new StringBuilder();
foreach (char c in lineText)
{
if ((c < 0x20 || c > 0x7F) && !FoundSpecial.Contains(c))
{
Console.WriteLine("*** Special Character {0:X4}", (int)c);
FoundSpecial.Add(c);
}
}
}
private static string GetAnnotationText(string fileName)
{
return string.Format("FileName:{0}\r\nShortName:{1}\r\nFullName:{2}\r\nSystem:{3}\r\nPNSNo:{4}\r\nRelatedFunction:{5}" ,
fileName,ShortName,FullName,ApSystem,PNSNo ,RelatedFunction);
}
private static string GetAnnotationText2(string lineText)
{
//return string.Format("LineText:{0}\r\nShortName:{1}\r\nFullName:{2}\r\nSystem:{3}\r\nPNSNo:{4}\r\nRelatedFunction:{5}",
// lineText, ShortName, FullName, apSystem, PNSNo, RelatedFunction);
return string.Format("LineText:{0}",
lineText);
}
}
public class StepLookup : SortedDictionary<string, StepInfo>
{
public StepInfo this[int i]
{
get
{
if (this.ContainsKey(i.ToString())) return base[i.ToString()];
return null;
}
set
{
if (i > this.Count)
throw new Exception("Gap in Stack");
if (value == null)
throw new Exception("Null StepInfo");
//if (value.MyHLS.Ordinal==5 && (value.IsNote || value.IsCaution ))
// Volian.Base.Library.vlnStackTrace.ShowStackLocal(2,5,"=====> Adding Caution or Note on Step 5 {0}",value);
if (this.ContainsKey(i.ToString()))
{
base[i.ToString()] = value;
while (this.ContainsKey((i + 1).ToString()))
base.Remove((base.Count - 1).ToString());
}
else base.Add(i.ToString(), value);
//ListMySteps("Set ", this);
}
}
public void AddOne(StepInfo previousStep)
{
this[this.Count] = previousStep;
}
private static void ListMySteps(string str, StepLookup mySteps)
{
int i = 0;
foreach (string key in mySteps.Keys)
{
if (key != i.ToString())
Console.WriteLine("{0} {1} {2} {3}", str, i, key, mySteps[key].DisplayText);
i++;
}
}
}
}

View File

@ -0,0 +1,499 @@
namespace ConvertAlarms
{
partial class frmConvertAlarms
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.tbFileName = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.btnRun = new System.Windows.Forms.Button();
this.btnBrowse = new System.Windows.Forms.Button();
this.btnAll = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.btnConvert = new System.Windows.Forms.Button();
this.label7 = new System.Windows.Forms.Label();
this.tbServer = new System.Windows.Forms.TextBox();
this.cmbDatabase = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.cmbDocVersion = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.ofd = new System.Windows.Forms.OpenFileDialog();
this.sc1 = new System.Windows.Forms.SplitContainer();
this.tcXML = new System.Windows.Forms.TabControl();
this.tpXML = new System.Windows.Forms.TabPage();
this.tbXML = new System.Windows.Forms.TextBox();
this.tpColorCoded = new System.Windows.Forms.TabPage();
this.rtbXML = new System.Windows.Forms.RichTextBox();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tpHTML = new System.Windows.Forms.TabPage();
this.wb = new System.Windows.Forms.WebBrowser();
this.tpRaw = new System.Windows.Forms.TabPage();
this.tbPROMS = new System.Windows.Forms.TextBox();
this.tpStructure = new System.Windows.Forms.TabPage();
this.tv = new System.Windows.Forms.TreeView();
this.tpGrid = new System.Windows.Forms.TabPage();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.tspb = new System.Windows.Forms.ToolStripProgressBar();
this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.tmr = new System.Windows.Forms.Timer(this.components);
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.sc1)).BeginInit();
this.sc1.Panel1.SuspendLayout();
this.sc1.Panel2.SuspendLayout();
this.sc1.SuspendLayout();
this.tcXML.SuspendLayout();
this.tpXML.SuspendLayout();
this.tpColorCoded.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tpHTML.SuspendLayout();
this.tpRaw.SuspendLayout();
this.tpStructure.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.tbFileName);
this.panel1.Controls.Add(this.panel2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(954, 88);
this.panel1.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(23, 13);
this.label1.TabIndex = 1;
this.label1.Text = "File";
//
// tbFileName
//
this.tbFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbFileName.Location = new System.Drawing.Point(56, 6);
this.tbFileName.Name = "tbFileName";
this.tbFileName.Size = new System.Drawing.Size(692, 20);
this.tbFileName.TabIndex = 0;
this.tbFileName.Text = "H:\\Barakah Alarms\\1N2-OP-ARP-CS-0001_Rev_02_FINAL_Zipped_XML_20190804\\ARP-3442-10" +
"01 CS CNMT Spray HDR Block VLV V0001 TRBL.xml";
//
// panel2
//
this.panel2.Controls.Add(this.btnRun);
this.panel2.Controls.Add(this.btnBrowse);
this.panel2.Controls.Add(this.btnAll);
this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.btnConvert);
this.panel2.Controls.Add(this.label7);
this.panel2.Controls.Add(this.tbServer);
this.panel2.Controls.Add(this.cmbDatabase);
this.panel2.Controls.Add(this.label4);
this.panel2.Controls.Add(this.cmbDocVersion);
this.panel2.Controls.Add(this.label6);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(954, 88);
this.panel2.TabIndex = 9;
//
// btnRun
//
this.btnRun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRun.Location = new System.Drawing.Point(862, 3);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(37, 24);
this.btnRun.TabIndex = 13;
this.btnRun.Text = "Run";
this.btnRun.UseVisualStyleBackColor = true;
this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
//
// btnBrowse
//
this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrowse.Location = new System.Drawing.Point(758, 3);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(72, 24);
this.btnBrowse.TabIndex = 2;
this.btnBrowse.Text = "Browse...";
this.btnBrowse.UseVisualStyleBackColor = true;
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
//
// btnAll
//
this.btnAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnAll.Location = new System.Drawing.Point(799, 44);
this.btnAll.Name = "btnAll";
this.btnAll.Size = new System.Drawing.Size(37, 25);
this.btnAll.TabIndex = 12;
this.btnAll.Text = "All";
this.btnAll.UseVisualStyleBackColor = true;
this.btnAll.Click += new System.EventHandler(this.btnAll_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(396, 35);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Database";
//
// btnConvert
//
this.btnConvert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnConvert.Location = new System.Drawing.Point(717, 44);
this.btnConvert.Name = "btnConvert";
this.btnConvert.Size = new System.Drawing.Size(76, 28);
this.btnConvert.TabIndex = 11;
this.btnConvert.Text = "Convert";
this.btnConvert.UseVisualStyleBackColor = true;
this.btnConvert.Click += new System.EventHandler(this.btnConvert_Click);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(12, 35);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(38, 13);
this.label7.TabIndex = 10;
this.label7.Text = "Server";
//
// tbServer
//
this.tbServer.Location = new System.Drawing.Point(56, 32);
this.tbServer.Name = "tbServer";
this.tbServer.Size = new System.Drawing.Size(329, 20);
this.tbServer.TabIndex = 9;
//
// cmbDatabase
//
this.cmbDatabase.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cmbDatabase.FormattingEnabled = true;
this.cmbDatabase.Location = new System.Drawing.Point(455, 32);
this.cmbDatabase.Name = "cmbDatabase";
this.cmbDatabase.Size = new System.Drawing.Size(256, 21);
this.cmbDatabase.TabIndex = 8;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(11, 61);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(75, 13);
this.label4.TabIndex = 7;
this.label4.Text = "Procedure Set";
//
// cmbDocVersion
//
this.cmbDocVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cmbDocVersion.FormattingEnabled = true;
this.cmbDocVersion.Location = new System.Drawing.Point(92, 58);
this.cmbDocVersion.Name = "cmbDocVersion";
this.cmbDocVersion.Size = new System.Drawing.Size(619, 21);
this.cmbDocVersion.TabIndex = 6;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(12, 9);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(23, 13);
this.label6.TabIndex = 1;
this.label6.Text = "File";
//
// sc1
//
this.sc1.Dock = System.Windows.Forms.DockStyle.Fill;
this.sc1.Location = new System.Drawing.Point(0, 88);
this.sc1.Name = "sc1";
//
// sc1.Panel1
//
this.sc1.Panel1.Controls.Add(this.tcXML);
//
// sc1.Panel2
//
this.sc1.Panel2.Controls.Add(this.tabControl1);
this.sc1.Size = new System.Drawing.Size(954, 392);
this.sc1.SplitterDistance = 372;
this.sc1.TabIndex = 1;
//
// tcXML
//
this.tcXML.Controls.Add(this.tpXML);
this.tcXML.Controls.Add(this.tpColorCoded);
this.tcXML.Dock = System.Windows.Forms.DockStyle.Fill;
this.tcXML.Location = new System.Drawing.Point(0, 0);
this.tcXML.Name = "tcXML";
this.tcXML.SelectedIndex = 0;
this.tcXML.Size = new System.Drawing.Size(372, 392);
this.tcXML.TabIndex = 2;
//
// tpXML
//
this.tpXML.Controls.Add(this.tbXML);
this.tpXML.Location = new System.Drawing.Point(4, 22);
this.tpXML.Name = "tpXML";
this.tpXML.Padding = new System.Windows.Forms.Padding(3);
this.tpXML.Size = new System.Drawing.Size(364, 366);
this.tpXML.TabIndex = 1;
this.tpXML.Text = "XML";
this.tpXML.UseVisualStyleBackColor = true;
//
// tbXML
//
this.tbXML.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbXML.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbXML.HideSelection = false;
this.tbXML.Location = new System.Drawing.Point(3, 3);
this.tbXML.Multiline = true;
this.tbXML.Name = "tbXML";
this.tbXML.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tbXML.Size = new System.Drawing.Size(358, 360);
this.tbXML.TabIndex = 0;
this.tbXML.TextChanged += new System.EventHandler(this.tbXML_TextChanged);
//
// tpColorCoded
//
this.tpColorCoded.Controls.Add(this.rtbXML);
this.tpColorCoded.Location = new System.Drawing.Point(4, 22);
this.tpColorCoded.Name = "tpColorCoded";
this.tpColorCoded.Padding = new System.Windows.Forms.Padding(3);
this.tpColorCoded.Size = new System.Drawing.Size(364, 366);
this.tpColorCoded.TabIndex = 0;
this.tpColorCoded.Text = "Color Coded";
this.tpColorCoded.UseVisualStyleBackColor = true;
//
// rtbXML
//
this.rtbXML.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtbXML.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rtbXML.Location = new System.Drawing.Point(3, 3);
this.rtbXML.Name = "rtbXML";
this.rtbXML.Size = new System.Drawing.Size(358, 360);
this.rtbXML.TabIndex = 1;
this.rtbXML.Text = "";
this.rtbXML.SelectionChanged += new System.EventHandler(this.rtbXML_SelectionChanged);
this.rtbXML.TextChanged += new System.EventHandler(this.rtbXML_TextChanged);
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tpHTML);
this.tabControl1.Controls.Add(this.tpRaw);
this.tabControl1.Controls.Add(this.tpStructure);
this.tabControl1.Controls.Add(this.tpGrid);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(578, 392);
this.tabControl1.TabIndex = 0;
//
// tpHTML
//
this.tpHTML.Controls.Add(this.wb);
this.tpHTML.Location = new System.Drawing.Point(4, 22);
this.tpHTML.Name = "tpHTML";
this.tpHTML.Padding = new System.Windows.Forms.Padding(3);
this.tpHTML.Size = new System.Drawing.Size(570, 366);
this.tpHTML.TabIndex = 0;
this.tpHTML.Text = "HTML";
this.tpHTML.UseVisualStyleBackColor = true;
//
// wb
//
this.wb.Dock = System.Windows.Forms.DockStyle.Fill;
this.wb.Location = new System.Drawing.Point(3, 3);
this.wb.MinimumSize = new System.Drawing.Size(20, 20);
this.wb.Name = "wb";
this.wb.Size = new System.Drawing.Size(564, 360);
this.wb.TabIndex = 0;
//
// tpRaw
//
this.tpRaw.Controls.Add(this.tbPROMS);
this.tpRaw.Location = new System.Drawing.Point(4, 22);
this.tpRaw.Name = "tpRaw";
this.tpRaw.Padding = new System.Windows.Forms.Padding(3);
this.tpRaw.Size = new System.Drawing.Size(570, 366);
this.tpRaw.TabIndex = 1;
this.tpRaw.Text = "Raw Text";
this.tpRaw.UseVisualStyleBackColor = true;
//
// tbPROMS
//
this.tbPROMS.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbPROMS.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbPROMS.Location = new System.Drawing.Point(3, 3);
this.tbPROMS.Multiline = true;
this.tbPROMS.Name = "tbPROMS";
this.tbPROMS.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tbPROMS.Size = new System.Drawing.Size(564, 360);
this.tbPROMS.TabIndex = 0;
//
// tpStructure
//
this.tpStructure.Controls.Add(this.tv);
this.tpStructure.Location = new System.Drawing.Point(4, 22);
this.tpStructure.Name = "tpStructure";
this.tpStructure.Size = new System.Drawing.Size(570, 366);
this.tpStructure.TabIndex = 2;
this.tpStructure.Text = "Structure";
this.tpStructure.UseVisualStyleBackColor = true;
//
// tv
//
this.tv.Dock = System.Windows.Forms.DockStyle.Fill;
this.tv.Location = new System.Drawing.Point(0, 0);
this.tv.Name = "tv";
this.tv.Size = new System.Drawing.Size(570, 366);
this.tv.TabIndex = 0;
//
// tpGrid
//
this.tpGrid.Location = new System.Drawing.Point(4, 22);
this.tpGrid.Name = "tpGrid";
this.tpGrid.Size = new System.Drawing.Size(570, 366);
this.tpGrid.TabIndex = 3;
this.tpGrid.Text = "Grid";
this.tpGrid.UseVisualStyleBackColor = true;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tspb,
this.tsslStatus});
this.statusStrip1.Location = new System.Drawing.Point(0, 480);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(954, 22);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
this.statusStrip1.Click += new System.EventHandler(this.statusStrip1_Click);
//
// tspb
//
this.tspb.Name = "tspb";
this.tspb.Size = new System.Drawing.Size(300, 16);
this.tspb.Visible = false;
//
// tsslStatus
//
this.tsslStatus.Name = "tsslStatus";
this.tsslStatus.Size = new System.Drawing.Size(39, 17);
this.tsslStatus.Text = "Ready";
this.tsslStatus.Click += new System.EventHandler(this.tsslStatus_Click);
//
// tmr
//
this.tmr.Interval = 2000;
this.tmr.Tick += new System.EventHandler(this.tmr_Tick);
//
// frmConvertAlarms
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(954, 502);
this.Controls.Add(this.sc1);
this.Controls.Add(this.panel1);
this.Controls.Add(this.statusStrip1);
this.Name = "frmConvertAlarms";
this.Text = "Convert Alarms";
this.Load += new System.EventHandler(this.frmConvertAlarms_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.sc1.Panel1.ResumeLayout(false);
this.sc1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.sc1)).EndInit();
this.sc1.ResumeLayout(false);
this.tcXML.ResumeLayout(false);
this.tpXML.ResumeLayout(false);
this.tpXML.PerformLayout();
this.tpColorCoded.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tpHTML.ResumeLayout(false);
this.tpRaw.ResumeLayout(false);
this.tpRaw.PerformLayout();
this.tpStructure.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbFileName;
private System.Windows.Forms.OpenFileDialog ofd;
private System.Windows.Forms.SplitContainer sc1;
private System.Windows.Forms.TextBox tbXML;
private System.Windows.Forms.WebBrowser wb;
private System.Windows.Forms.TextBox tbPROMS;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel tsslStatus;
private System.Windows.Forms.RichTextBox rtbXML;
private System.Windows.Forms.TabControl tcXML;
private System.Windows.Forms.TabPage tpXML;
private System.Windows.Forms.TabPage tpColorCoded;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tpHTML;
private System.Windows.Forms.TabPage tpRaw;
private System.Windows.Forms.TabPage tpStructure;
private System.Windows.Forms.TreeView tv;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox tbServer;
private System.Windows.Forms.ComboBox cmbDatabase;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox cmbDocVersion;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button btnConvert;
private System.Windows.Forms.Button btnAll;
private System.Windows.Forms.TabPage tpGrid;
private System.Windows.Forms.Button btnRun;
private System.Windows.Forms.ToolStripProgressBar tspb;
private System.Windows.Forms.Timer tmr;
}
}

View File

@ -0,0 +1,886 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
using VEPROMS.CSLA.Library;
using log4net;
using Volian.Controls.Library;
using C1.Win.C1FlexGrid;
using System.Data.SqlClient;
namespace ConvertAlarms
{
public partial class frmConvertAlarms : Form
{
public frmConvertAlarms()
{
InitializeComponent();
}
private void SetDatabaseConnection()
{
Database.VEPROMS_Connection = string.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", tbServer.Text, cmbDatabase.SelectedText);
}
private void btnBrowse_Click(object sender, EventArgs e)
{
FileInfo fi = new FileInfo(tbFileName.Text);
ofd.InitialDirectory = fi.DirectoryName;
ofd.FileName = fi.Name;
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
tbFileName.Text = ofd.FileName;
ProcessXML();
}
}
private void ProcessXML()
{
string fileName = tbFileName.Text;
ProcessXmlFile(fileName);
}
private void ProcessXmlFile(string fileName)
{
UpdateHTML = false;
tbXML.Clear();
UpdateHTML = true;
XmlDocument xDoc = new XmlDocument();
xDoc.Load(fileName);
XmlElement xe1 = xDoc.DocumentElement;
XmlElement xe2 = xe1.ChildNodes[0] as XmlElement;
XmlElement xe3 = xe2.ChildNodes[0] as XmlElement;
XmlElement xe4 = (xe1.ChildNodes[1] as XmlElement).ChildNodes[0] as XmlElement;
RelatedFunction = xe3.Attributes["relatedFunction"].Value;
PNSNo = xe3.Attributes["PNSNo"].Value;
ShortName = xe3.Attributes["shortName"].Value;
FullName = xe3.Attributes["fullName"].Value;
RevisionNumber = xe3.Attributes["revisionNumber"].Value;
Priority = xe3.Attributes["priority"].Value;
Number = xe3.Attributes["number"].Value;
Responsibility = xe4.Attributes["implementor"].Value;
ApSystem = GetSystem(xe3);
XmlNode xn = xDoc.DocumentElement.LastChild.LastChild.LastChild;
string html = GetHtml(xn);
tbXML.Text = html;
}
private static string _RelatedFunction;
public static string RelatedFunction
{
get { return _RelatedFunction; }
set { _RelatedFunction = value; }
}
private static string _PNSNo;
public static string PNSNo
{
get { return _PNSNo; }
set { _PNSNo = value; }
}
private static string _fullName;
public static string FullName
{
get { return _fullName; }
set { _fullName = value; }
}
private static string _Number;
public static string Number
{
get { return frmConvertAlarms._Number; }
set { frmConvertAlarms._Number = value; }
}
private static string _RevisionNumber;
public static string RevisionNumber
{
get { return frmConvertAlarms._RevisionNumber; }
set { frmConvertAlarms._RevisionNumber = value; }
}
private static string _Priority;
public static string Priority
{
get { return frmConvertAlarms._Priority; }
set { frmConvertAlarms._Priority = value; }
}
private static string Responsibility;
public static string Responsibility1
{
get { return frmConvertAlarms.Responsibility; }
set { frmConvertAlarms.Responsibility = value; }
}
private static string _shortName;
public static string ShortName
{
get { return _shortName; }
set { _shortName = value; }
}
private static string _system;
public static string ApSystem
{
get { return _system; }
set { _system = value; }
}
private static string _MyFileName;
public static string MyFileName
{
get { return frmConvertAlarms._MyFileName; }
set { frmConvertAlarms._MyFileName = value; }
}
private static string GetHtml(XmlNode xn)
{
XmlNode pr = xn.PreviousSibling;
int i = 0;
string html = xn.Attributes["content"].Value;
//Console.WriteLine(@"{0} ""{1}""", i++, html);
if (xn != pr)
{
while (pr != null && pr.Name == "NoteInstruction")
{
string html2 = pr.Attributes["content"].Value;
//Console.WriteLine(@"{0} ""{1}""", i++, html2);
html = MergeHTML(html2, html);
//Console.WriteLine(@"{0} ""{1}""", -1, html);
pr = pr.PreviousSibling;
}
}
return html;
}
private static string MergeHTML(string part1, string part2)
{
part1 = part1.Replace("</body></html", "");
part2 = Regex.Replace(part2, "^.*<body[^<>]*>", "", RegexOptions.Singleline);
//part2 = part2.Substring(part2.IndexOf("<p"));
return part1 + part2;
}
private void htmlChanged(string html)
{
byte[] bytes = Encoding.UTF8.GetBytes(html.Replace("\u2022", "&bull;"));
MemoryStream ms = new MemoryStream();
ms.Write(bytes, 0, bytes.Length);
ms.Position = 0;
wb.DocumentStream = ms;
}
private string _HtmlPrefix = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">";
public string HtmlPrefix
{
get { return _HtmlPrefix; }
set { _HtmlPrefix = value; }
}
private string prcSerialNoFldName;
private string prcSerialNoValue;
private string prcTitleFldName;
private string prcTitleValue;
private string prcNumberFldName;
private string prcNumberValue;
private string prcSourceFldName;
private string prcSourceValue;
private string prcSetpointFldName;
private string prcSetpointValue;
//private Regex myReg01 = new Regex("<br /></span>", RegexOptions.Compiled);
//private Regex myReg02 = new Regex("</span><br />", RegexOptions.Compiled);
//private Regex myReg03 = new Regex("<span [^<>]+>", RegexOptions.Compiled);
//private Regex myReg04 = new Regex("</span *>", RegexOptions.Compiled);
//private Regex myReg05 = new Regex("</p>[ \r\n]+<p [^<>]+>", RegexOptions.Compiled);
//private Regex myReg06 = new Regex("<p [^<>]+>", RegexOptions.Compiled);
////private Regex myReg07 = new Regex(@"<br /> +(?=\w)", RegexOptions.Compiled);
//private Regex myReg08 = new Regex(@"<br />[ \r\n]*\t +", RegexOptions.Compiled);
//private Regex myReg09 = new Regex(@"<br />[ \t\r\n]+\[", RegexOptions.Compiled);
//private Regex myReg10 = new Regex("</p *>", RegexOptions.Compiled);
//private Regex myReg11 = new Regex(@"] *\t{4,10}", RegexOptions.Compiled);
//private Regex myReg12 = new Regex("<br ?/>\t+(?=None)", RegexOptions.Compiled);
//private Regex myReg13 = new Regex("<br ?/>\t+(?![[\\u2022]|[1-9])", RegexOptions.Compiled);
//private Regex myReg14 = new Regex("<br />", RegexOptions.Compiled);
//private Regex myReg15 = new Regex("\t\t+", RegexOptions.Compiled);
//private Regex myReg16 = new Regex("\r\n +", RegexOptions.Compiled);
//private Regex myReg17 = new Regex("(\r\n){2,}", RegexOptions.Compiled);
//private Regex myReg18 = new Regex("<table [^<>]+>", RegexOptions.Compiled);
////private Regex myReg19 = new Regex("(?<!\\\\line )\r\n\t(?!([[\\u2022]|None|[1-9]))", RegexOptions.Compiled);
//private Regex myReg20 = new Regex("(?<!\\\\line )\r\n\t(?!([[\\u2022]|None|[1-9]))", RegexOptions.Compiled);
//private Regex myReg21 = new Regex("<table>[^<>]*<tr[^<>]*>[^<>]*<td[^<>]*>[^<>]*<p>(NOTE|CAUTION|WARNING)([^<>]+?)</p>[^<>]*</td>[^<>]*</tr>[^<>]*</table>", RegexOptions.Compiled & RegexOptions.Singleline );
//private Regex myReg22 = new Regex("\\.\\.\\.+", RegexOptions.Compiled);
private void XMLChanged(string xml)
{
Application.DoEvents();
xml = "<?xml version='1.0' encoding='UTF-8'?>\n" + xml;
xml = xml.Replace(HtmlPrefix, "");
//xml = myReg01.Replace(xml, "<br /> </span>");
//xml = myReg02.Replace(xml, "</span><br /> ");
//xml = myReg03.Replace(xml, "");// Remove Style Span start
//xml = myReg04.Replace(xml, "");//
//xml = myReg05.Replace(xml, "<br />\r\n");
//xml = myReg06.Replace(xml, "<br />\r\n<p>");
////xml = myReg07.Replace(xml, " ");//New
//xml = myReg08.Replace(xml, " ");//New
//xml = myReg09.Replace(xml, @"\line [");
//xml = myReg10.Replace(xml, "</p>");
//xml = myReg11.Replace(xml, "]\r\n");
//xml = myReg12.Replace(xml, "\r\n\t");
//xml = myReg13.Replace(xml, " ");
//xml = myReg14.Replace(xml, "\r\n");
//xml = myReg15.Replace(xml, " ");
//xml = myReg16.Replace(xml, "\r\n");
//xml = myReg17.Replace(xml, "\r\n");
//xml = myReg18.Replace(xml, "<table>");
////xml = myReg19.Replace(xml, "{SPACE}");
//xml = myReg20.Replace(xml, " ");
//xml = myReg21.Replace(xml, "<p>\r\n$1$2\r\n</p>");
//xml = myReg22.Replace(xml, ""); //Remove multiple periods
xml = Regex.Replace(xml, "<br /></span>", "<br /> </span>");
xml = Regex.Replace(xml, "</span><br />", "</span><br /> ");
xml = Regex.Replace(xml, "<span [^<>]+>", "");// Remove Style Span start
xml = Regex.Replace(xml, "</span *>", "");//
xml = Regex.Replace(xml, "</p>[ \r\n]+<p [^<>]+>", "<br />\r\n");
xml = Regex.Replace(xml, "<p [^<>]+>", "<br />\r\n<p>");
// xml = Regex.Replace(xml, @"<br /> +(?=\w)", " ");//New
xml = Regex.Replace(xml, @"<br />[ \r\n]*\t (?! +[[\\u2022]| +[1-9]| +[A-Z][.])", " ");//New
//xml = Regex.Replace(xml, @"<br />[ \r\n]*\t +", " ");//New
xml = Regex.Replace(xml, @"<br />[ \t\r\n]+\[", @"\line [");
xml = Regex.Replace(xml, "</p *>", "</p>");
xml = Regex.Replace(xml, @"] *\t{4,10}", "]\r\n");
xml = Regex.Replace(xml, "<br ?/>\t+(?=None)", "\r\n\t");
xml = Regex.Replace(xml, "<br ?/>\t+(?![[\\u2022]|[1-9]|[A-Z]\\.)", " ");
xml = Regex.Replace(xml, "<br />", "\r\n");
xml = Regex.Replace(xml, "\t\t+", " ");
xml = Regex.Replace(xml, "\r\n +", "\r\n");
xml = Regex.Replace(xml, "(\r\n){2,}", "\r\n");
xml = Regex.Replace(xml, "<table [^<>]+>", "<table>");
//xml = Regex.Replace(xml, "(?<!\\\\line )\r\n\t(?!([[\\u2022]|None|[1-9]))", "{SPACE}");
xml = Regex.Replace(xml, "(?<!\\\\line )\r\n\t(?!([[\\u2022]|None|[1-9]))", " ");
xml = Regex.Replace(xml, "<table>[^<>]*<tr[^<>]*>[^<>]*<td[^<>]*>[^<>]*<p>(NOTE|CAUTION|WARNING)([^<>]+?)</p>[^<>]*</td>[^<>]*</tr>[^<>]*</table>", "<p$1>\r\n$1$2\r\n</p$1>", RegexOptions.Singleline);
xml = Regex.Replace(xml, "\\.\\.\\.+", ""); //Remove multiple periods
//xml = Regex.Replace(xml,"
//xml = xml.Replace("&gt;", "");
Application.DoEvents();
byte[] bytes = Encoding.UTF8.GetBytes(xml);
MemoryStream ms = new MemoryStream();
ms.Write(bytes, 0, bytes.Length);
ms.Position = 0;
XmlDocument xDoc2 = new XmlDocument();
xDoc2.Load(ms);
int iStart = 1;
XmlNode xn3 = xDoc2.ChildNodes[1].ChildNodes[1].ChildNodes[0];
if (!xn3.OuterXml.Contains("table"))
{
iStart = 2;
xn3 = xDoc2.ChildNodes[1].ChildNodes[1].ChildNodes[1];
}
prcSerialNoFldName = GetProcInfo(xn3, 0, 0, 0);
prcSerialNoValue = GetProcInfo(xn3, 0, 1, 0);
SerialNo = int.Parse(prcSerialNoValue);
prcTitleFldName = GetProcInfo(xn3, 1, 0, 0);
prcTitleValue = GetProcInfo(xn3, 1, 1, 0);
prcNumberFldName = GetProcInfo(xn3, 2, 0, 0);
prcNumberValue = GetProcInfo(xn3, 2, 1, 0);
prcSourceFldName = GetProcInfo(xn3, 3, 0, 0);
prcSourceValue = GetProcInfo(xn3, 3, 1, 0);
prcSetpointFldName = GetProcInfo(xn3, 4, 0, 0);
prcSetpointValue = GetProcInfo(xn3, 4, 1, 0);
Console.WriteLine("\"FromProcedures\"\t\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t\"{4}\"\t\"{5}\"\t\"{6}\"\t\"{7}\"\t\"{8}\"\t\"{9}\"\t\"{10}\"\t\"{11}\"\t\"{12}\"\t\"{13}\"\t\"{14}\""
, PNSNo.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, ApSystem.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, FullName.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, ShortName.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, RelatedFunction.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, "Rev" + RevisionNumber.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, Priority.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, Number.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, prcNumberValue.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, prcSerialNoValue.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, prcSetpointValue.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, prcSourceValue.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, prcTitleValue.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, Responsibility.Replace("\r\n", ";CR;").Replace("\n", ";CR;").Replace("\r", ";CR;")
, MyFileName);
ProcNumber = prcNumberValue;
ProcTitle = prcTitleValue;
// Skip First Node
UpdateHTML = false;
tbPROMS.Clear();
tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n", prcSerialNoFldName, prcSerialNoValue));
tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n", prcTitleFldName, prcTitleValue));
tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n", prcNumberFldName, prcNumberValue));
tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n", prcSourceFldName, prcSourceValue));
tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n", prcSetpointFldName, prcSetpointValue));
StringBuilder sbAllText = new StringBuilder();
for (int i = iStart; i < xDoc2.ChildNodes[1].ChildNodes[1].ChildNodes.Count; i++)
{
XmlNode xn2 = xDoc2.ChildNodes[1].ChildNodes[1].ChildNodes[i];
if (xn2.OuterXml != "&gt;\r\n" && xn2.OuterXml != "<p></p>")
{
sbAllText.Append("\r\n" + xn2.OuterXml);
//Console.WriteLine("--{0}--|{1}|", i, IndentifySpecialCharacters(xn2.OuterXml));
}
}
tbPROMS.AppendText(sbAllText.ToString().Replace(" ", "\xB7"));
//SaveTree(sbAllText.ToString(), prcNumberValue, prcTitleValue);
ProcTextAll = sbAllText.ToString();
UpdateHTML = true;
}
String ProcTextAll;
int SerialNo;
String ProcNumber;
String ProcTitle;
TreeNode lastNode = null;
private void SaveTree(string text, string procNumber, string procTitle)
{
tv.Nodes.Clear();
MemoryStream ms = GetMemoryStream(text);
using (TextReader tr = new StreamReader(ms))
{
Dictionary<int, TreeNode> lookup = new Dictionary<int, TreeNode>();
lookup.Add(0, tv.Nodes.Add(string.Format("{0} - {1}", procNumber, procTitle)));
int level = 0;
int lastLevel = 0;
int lastIndent = 0;
int extra = 0;
bool textContinued = false;
string lastTab = "";
Queue<string> enQueue = null;
Queue<string> deQueue = null;
bool isTable = false;
while (tr.Peek() >= 0 || deQueue != null)
{
string lineText;
if (deQueue != null)
{
extra = 1;
lineText = deQueue.Dequeue();
if (deQueue.Count == 0)
deQueue = null;
}
else
{
extra = 0;
lineText = tr.ReadLine();
if (lineText.StartsWith("<table>"))
{
while (!lineText.Contains("</table>"))
{
lineText += " " + tr.ReadLine();
lineText = Regex.Replace(lineText, "</table>.*", "</table>");
}
XmlDocument xd = new XmlDocument();
xd.LoadXml(lineText);
LoadTable2(xd.DocumentElement, null, 0);
isTable = true;
//StringBuilder sbxml= new StringBuilder();
//using(StringWriter sw = new StringWriter(sbxml))
// _MyFlexGrid.WriteXml(sw);
//using(StringReader sr= new StringReader(sbxml.ToString()))
// _MyFlexGrid.ReadXml(sr);
//Application.DoEvents();
}
else if (lineText == "NOTE" || lineText == "CAUTION" || lineText == "Warning")
enQueue = new Queue<string>();
}
lineText = Regex.Replace(lineText, "<[^<>]+>", "");
textContinued = false;
if (lineText.Replace("\t", "") != "")
{
Match m = Regex.Match(lineText, @"^(\t*)([1-9][0-9]*\.0|[1-9][0-9]*\.[1-9][0-9]*|\u2022|\u25CB)([\t ]+)([^\u2022]*)$", RegexOptions.Multiline);
string tab = m.Groups[2].Value;
int indent = m.Groups[1].Value.Length;
//if (lineText.Contains("THEN·GO·TO·1N2-OP-EOP-XX-0002"))
// Console.WriteLine("here");
if (isTable)
{
// do nothing
}
if (indent == 0 && tab.EndsWith(".0")) // High Level Step
{
level = 1;
if (deQueue == null && enQueue != null)
{
deQueue = enQueue;
enQueue = null;
}
}
else if (Regex.IsMatch(tab, "[1-9][0-9]*[.0-9]*")) // Substep
{
level = 2;
if (deQueue == null && enQueue != null)
{
deQueue = enQueue;
enQueue = null;
}
}
else if (tab == "") // Paragraph
{
if (Regex.IsMatch(lineText, "(NOTE|NOTES|CAUTION|CAUTIONS|WARNING|WARNINGS)"))
extra = 0;
else
{
lastNode.Text += " " + lineText.TrimStart("\r\n \t".ToCharArray());
//Console.WriteLine("maybe continue '{0}'", lineText);
textContinued = true;
}
level = lastLevel + 1;
}
else if (tab == "\u2022")//bullet
level = indent + 2;
else if (tab == "\u25CB")//bullet
level = indent + 3;
if (level < lastLevel)
while (level < lastLevel) lookup.Remove(lastLevel--);
string txt = string.Format("{0}|{1}||{2}", m.Groups[1].Value, m.Groups[2].Value, m.Groups[4].Value);
if (txt == "|||") txt = lineText;
if (enQueue == null)
{
if (!textContinued && !isTable)
{
if (level > lookup.Count - extra) extra = 0;
//if (level + extra - 1 == lookup.Count)
// Console.WriteLine("Problems {0}, {1}", procNumber, txt);
else if (lookup.Count <= level)
lookup.Add(level + extra, lookup[level + extra - 1].Nodes.Add(txt));
else
lookup[level + extra] = lookup[level + extra - 1].Nodes.Add(txt);
lastNode = lookup[level + extra];
}
}
else
{
enQueue.Enqueue(lineText);
}
lastTab = tab;
lastLevel = level;
lastIndent = indent;
}
}
}
}
private ItemInfo FindPrevious(SortedDictionary<int, ItemInfo> dicSerialNo, int serialNo)
{
ItemInfo lastItem = null;
foreach (int serno in dicSerialNo.Keys)
{
if (serno > serialNo)
return lastItem;
lastItem = dicSerialNo[serno];
}
return lastItem;
}
private bool runOne = true;
private static MemoryStream GetMemoryStream(string text)
{
byte[] bytes = Encoding.UTF8.GetBytes(text);
MemoryStream ms = new MemoryStream(bytes);
ms.Position = 0;
return ms;
}
private string GetProcInfo(XmlNode xn3, int p1, int p2, int p3)
{
if (xn3.OuterXml == "<p></p>") xn3 = xn3.NextSibling;
return xn3.ChildNodes[p1].ChildNodes[p2].ChildNodes[p3].ChildNodes[0].Value.Trim("\r\n ".ToCharArray());
}
private bool _UpdateHTML = true;
public bool UpdateHTML
{
get { return _UpdateHTML; }
set { _UpdateHTML = value; }
}
private string IndentifySpecialCharacters(string xml)
{
StringBuilder sb = new StringBuilder();
string txt = Regex.Replace(xml, "<span[^<>]+>", "");
foreach (char c in txt)
{
if (((int)c) < 32 || ((int)c) > 256)
sb.Append(string.Format("[x{0:X4}]", (int)c));
else
sb.Append(c == ' ' ? '\xb7' : c);
}
return sb.ToString();
}
private void btnRun_Click(object sender, EventArgs e)
{
ProcessXML();
}
Regex regColorCode = new Regex(@"(\<[^<>]+\>)([^<>]*)", RegexOptions.Singleline);
Regex regColorCodeText = new Regex("(\t*)([^\t]*)", RegexOptions.Singleline);
private void ColorCoded(string str)
{
rtbXML.Clear();
Color fColor = Color.PaleTurquoise;
Color fNext = Color.PaleTurquoise;
foreach (Match m in regColorCode.Matches(str))
{
string fmt = m.Groups[1].Value;
string txt = m.Groups[2].Value;
if (fmt.StartsWith("<table"))
fNext = fColor = Color.PaleGreen;
else if (fmt == "</table>")
fNext = Color.PaleTurquoise;
else if (fmt == "<br />")
fColor = Color.PeachPuff;
else if (fmt == "</p>")
fColor = Color.LightPink;
AddToXML(fmt, fColor);
fColor = fNext;
foreach (Match mm in regColorCodeText.Matches(txt))
{
string tabs = mm.Groups[1].Value;
string nontabs = mm.Groups[2].Value;
AddToXML(tabs, Color.Khaki);
AddToXML(nontabs, Color.Yellow);
}
}
}
private void AddToXML(string txt, Color fColor)
{
if (txt == "") return;
rtbXML.SelectionStart = rtbXML.TextLength;
rtbXML.SelectionBackColor = fColor;
rtbXML.SelectedText = txt;
}
private void frmConvertAlarms_Load(object sender, EventArgs e)
{
LoadSettings();
SetEventHandlers();
_MyFlexGrid = new VlnFlexGrid();
tpGrid.Controls.Add(_MyFlexGrid);
string str = AutoFolder;
if (str != null && str.Length > 5)
{
tmr.Enabled = true;
}
}
private void SetEventHandlers()
{
tbFileName.TextChanged += tbFileName_TextChanged;
Move += frmConvertAlarms_Move;
Resize += frmConvertAlarms_Resize;
sc1.SplitterMoved += sc1_SplitterMoved;
//sc2.SplitterMoved += sc2_SplitterMoved;
tbServer.TextChanged += tbServer_TextChanged;
cmbDatabase.TextChanged += cmbDatabase_TextChanged;
cmbDatabase.Click += cmbDatabase_Click;
cmbDocVersion.TextChanged += cmbDocVersion_TextChanged;
//BuildTableCombo();
//BuildProcedureSetCombo();
}
void cmbDatabase_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Database = cmbDatabase.Text;
Properties.Settings.Default.Save();
BuildProcedureSetCombo();
}
private void BuildProcedureSetCombo()
{
DocVersionInfoList dvil = DocVersionInfoList.Get();
cmbDocVersion.DataSource = dvil;
cmbDocVersion.DisplayMember = "SearchDVPath";
cmbDocVersion.ValueMember = "VersionId";
}
private void cmbDocVersion_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.ProcedureSet = (int)cmbDocVersion.SelectedValue;
Properties.Settings.Default.Save();
}
private void cmbDatabase_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.Database = cmbDatabase.Text;
Properties.Settings.Default.Save();
BuildProcedureSetCombo();
}
private void tbServer_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.SqlServer = tbServer.Text;
Properties.Settings.Default.Save();
string db = cmbDatabase.Text;
try
{
BuildDatabaseCombo();
}
catch (Exception ex)
{
tsslStatus.Text = ex.Message;
}
}
private void BuildDatabaseCombo()
{
string tmp = string.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", tbServer.Text, "MASTER");
SqlConnection cn = new SqlConnection(tmp);
cn.Open();
// SqlDataAdapter da = new SqlDataAdapter("select name from sysdatabases where name like 'VEP%' order by name", cn);
//SqlDataAdapter da = new SqlDataAdapter("select name, case when object_id('[' + name + ']..Items') is null then 'Not PROMS' when object_id('[' + name + ']..Revisions') is not null then 'Approval' when object_id('[' + name + ']..ContentAudits') is not null then 'Change Manager' else 'Original' end functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn);
SqlDataAdapter da = new SqlDataAdapter("select name, 'Approval' functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn);
da.SelectCommand.CommandTimeout = 300; // 300 sec timeout
DataSet ds = new DataSet();
try
{
da.Fill(ds);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.GetType().Name, ex.Message);
throw (new Exception("Cannot Load Data List", ex));
}
cn.Close();
//System.Windows.Forms.ContextMenuStrip cms = new System.Windows.Forms.ContextMenuStrip();
//cms.Items.Add("Choose Database");
//System.Windows.Forms.ToolStripMenuItem tsmi = cms.Items[0] as System.Windows.Forms.ToolStripMenuItem;
//tsmi.BackColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.ActiveCaption);// System.Drawing.Color.Pink;
//tsmi.ForeColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.ActiveCaptionText);
//tsmi.Font = new System.Drawing.Font(tsmi.Font, System.Drawing.FontStyle.Bold);
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["functionality"].ToString() == "Approval")
cmbDatabase.Items.Add(dr["name"].ToString());
}
}
void frmConvertAlarms_Resize(object sender, EventArgs e)
{
Properties.Settings.Default.Size = Size;
Properties.Settings.Default.Save();
}
void frmConvertAlarms_Move(object sender, EventArgs e)
{
Properties.Settings.Default.Location = Location;
Properties.Settings.Default.Save();
}
void tbFileName_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.FileName = tbFileName.Text;
Properties.Settings.Default.Save();
}
private void sc1_SplitterMoved(object sender, SplitterEventArgs e)
{
Properties.Settings.Default.Split1 = sc1.SplitterDistance;
Properties.Settings.Default.Save();
}
private void LoadSettings()
{
Size = Properties.Settings.Default.Size;
Location = Properties.Settings.Default.Location;
if (Properties.Settings.Default.FileName != null && Properties.Settings.Default.FileName != "")
{
FileInfo fi = new FileInfo(Properties.Settings.Default.FileName);
tbFileName.Text = fi.FullName;
}
sc1.SplitterDistance = Properties.Settings.Default.Split1;
tbServer.Text = Properties.Settings.Default.SqlServer;
cmbDatabase.Text = Properties.Settings.Default.Database;
try
{
BuildDatabaseCombo();
Database.VEPROMS_Connection = string.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", tbServer.Text, cmbDatabase.Text);
BuildProcedureSetCombo();
cmbDocVersion.SelectedValue = Properties.Settings.Default.ProcedureSet;
}
catch (Exception ex)
{
tsslStatus.Text = ex.Message;
}
}
private void tsslStatus_Click(object sender, EventArgs e)
{
tsslStatus.Text = string.Format("Selection = '{0}'", IndentifySpecialCharacters(tbXML.SelectedText));
Clipboard.Clear();
if (tbXML.SelectedText != "")
Clipboard.SetText(IndentifySpecialCharacters(tbXML.SelectedText));
}
private void rtbXML_SelectionChanged(object sender, EventArgs e)
{
}
private void tbXML_TextChanged(object sender, EventArgs e)
{
if (UpdateHTML)
{
if (AutoFolder == null) htmlChanged(tbXML.Text);
XMLChanged(tbXML.Text);
if (AutoFolder == null) ColorCoded(tbXML.Text);
}
}
private bool _UpdateTbXML = true;
public bool UpdateTbXML
{
get { return _UpdateTbXML; }
set { _UpdateTbXML = value; }
}
private void rtbXML_TextChanged(object sender, EventArgs e)
{
//if (UpdateHTML)
//{
// UpdateHTML = false;
// htmlChanged(rtbXML.Text);
// XMLChanged(rtbXML.Text);
// tbXML.Text = rtbXML.Text;
// UpdateHTML = true;
//}
}
private void btnConvert_Click(object sender, EventArgs e)
{
//SaveProcedure(ProcTextAll, ProcNumber, ProcTitle,999999);
DVI = DocVersionInfo.Get((int)cmbDocVersion.SelectedValue);
SaveProcedure(ProcTextAll, ProcNumber, ProcTitle, tbFileName.Text);
}
string lastLine = "";
SortedDictionary<int, ItemInfo> dicSerialNo;
int errorCount;
private void btnAll_Click(object sender, EventArgs e)
{
DVI = DocVersionInfo.Get((int)cmbDocVersion.SelectedValue);
string fileName = tbFileName.Text;
ConvertFiles(fileName);
}
private void ConvertFiles(string fileName)
{
Application.DoEvents();
DateTime dtStart = DateTime.Now;
errorCount = 0;
dicSerialNo = new SortedDictionary<int, ItemInfo>();
runOne = false;
// Get List of files
FileInfo fi = new FileInfo(fileName);
DirectoryInfo di = fi.Directory;
// Loop through list
FileInfo[] fs = di.GetFiles("*.xml");
tspb.Visible = true;
tspb.Value = 0;
tspb.Maximum = fs.Length;
foreach (FileInfo f in fs)
{
//ResetSpecial();
MyFileName = f.FullName;
tspb.Value++;
tsslStatus.Text = f.Name;
Application.DoEvents();
// Process each file
try
{
ProcessXmlFile(f.FullName);
// Convert each file
//SaveProcedure(ProcTextAll, ProcNumber, ProcTitle, SerialNo);
SaveProcedure(ProcTextAll, ProcNumber, ProcTitle, f.Name);
}
catch (Exception ex)
{
++errorCount;
Console.WriteLine("*** {0} - {1}\r\n*** Procedure {2}\r\n*** Text: {3}\r\n*** File Name:{4} ",
ex.GetType().Name, ex.Message, ProcNumber, lastLine, f.Name);
//break;
}
//break; one Procedure per set
}
runOne = true;
tspb.Visible = false;
tsslStatus.Text = "Done";
//MessageBox.Show(string.Format(
// "{0} Errors\r\n{1} Procedures\r\n{2:F} Seconds", errorCount,
// fs.Length,
// TimeSpan.FromTicks(DateTime.Now.Ticks - dtStart.Ticks).TotalSeconds),
// "Done with this set", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void statusStrip1_Click(object sender, EventArgs e)
{
if (rtbXML.SelectedText != "")
{
tsslStatus.Text = string.Format("Selection = '{0}'", IndentifySpecialCharacters(rtbXML.SelectedText));
Clipboard.Clear();
Clipboard.SetText(IndentifySpecialCharacters(rtbXML.SelectedText));
}
}
ROFSTLookup MyLookUp;
private void tmr_Tick(object sender, EventArgs e)
{
tmr.Enabled = false;
// If timer on the its ready to proccess
string str = AutoFolder;
if (str != null && str.Length > 5)
{
DirectoryInfo di = new DirectoryInfo(str);
FileInfo fi = di.GetFiles("*.xml")[0];
DVI = GetDVI(fi.FullName);
ConvertFiles(fi.FullName);
}
this.Close();
}
private static string _AutoFolder = null;
private static string AutoFolder
{
get
{
if (_AutoFolder == null)
{
_AutoFolder = System.Environment.CommandLine;
_AutoFolder = _AutoFolder.Substring(_AutoFolder.IndexOf(@".exe"" ") + 6).Trim(" \t\r\n".ToCharArray());
}
if (_AutoFolder.Length < 1)
return null;
return _AutoFolder;
}
}
private DocVersionInfo GetDVI(string fileName)
{
XmlDocument xd = new XmlDocument();
xd.Load(fileName);
XmlElement xe = xd.DocumentElement;
while (xe.Name != "ident")
xe = xe.ChildNodes[0] as XmlElement;
string DVIFolderName = xe.Attributes["PNSNo"].Value;
if (cmbDocVersion.SelectedValue != null)
{
DocVersionInfo dvi = DocVersionInfo.Get((int)(cmbDocVersion.SelectedValue));
int idnew;
ROFstInfo fst = dvi.DocVersionAssociations[0].MyROFst;
FolderInfo grandParent = dvi.ActiveParent.ActiveParent as FolderInfo;
// Create a folder
double myOrder = GetMyOrder(grandParent.SortedChildFolders, DVIFolderName);
using (Folder flder = Folder.MakeFolder(grandParent.Get(), null, DVIFolderName, fileName, GetSystem(xe), null, myOrder, null))
{
flder.ManualOrder = 0;
flder.ManualOrder = myOrder;
//Console.WriteLine("myOrder = {0}, flder = {1}", myOrder, flder.ManualOrder);
flder.Save();
// create a a DocVersion
using (DocVersion dv = DocVersion.MakeDocVersion(flder, "Working Draft", null, null, null, null))
{
dv.DocVersionAssociations.Add(fst.Get());
dv.Save();
idnew = dv.VersionID;
}
}
return DocVersionInfo.Get(idnew);
}
return null;
}
private double GetMyOrder(Csla.SortedBindingList<FolderInfo> myList, string DVIFolderName)
{
double lastNum = 0;
// Console.WriteLine("--->>> FolderName {0} Insert Count {1}",DVIFolderName, myList.Count);
foreach (FolderInfo myFolder in myList)
{
// Console.WriteLine("--->>> FolderName {0} Insert Name {1} Insert Order {2}",DVIFolderName, myFolder.Name, myFolder.ManualOrder);
if (myFolder.Name.CompareTo(DVIFolderName) >= 0)
return (lastNum + (double) myFolder.ManualOrder) / 2.0;
lastNum = myFolder.ManualOrder ?? 1.0;
}
return lastNum + 1;
}
private string GetSystem(XmlElement xe)
{
XmlAttribute xa = xe.Attributes["system"];
if (xa is XmlAttribute) return xa.Value;
return "N/A";
}
}
}

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ofd.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>87, 17</value>
</metadata>
<metadata name="tmr.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>203, 3</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="ConvertLocalAlarms.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<userSettings>
<ConvertLocalAlarms.Properties.Settings>
<setting name="Size" serializeAs="String">
<value>1000, 600</value>
</setting>
<setting name="Location" serializeAs="String">
<value>0, 0</value>
</setting>
<setting name="FileName" serializeAs="String">
<value />
</setting>
<setting name="Split1" serializeAs="String">
<value>250</value>
</setting>
<setting name="SqlServer" serializeAs="String">
<value>.\Sql2008Express</value>
</setting>
<setting name="Database" serializeAs="String">
<value>VEPROMs_BARAKAH</value>
</setting>
<setting name="ProcedureSet" serializeAs="String">
<value>0</value>
</setting>
</ConvertLocalAlarms.Properties.Settings>
</userSettings>
</configuration>

View File

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BF0EEE6A-5350-4CE7-8E28-73F1A3811870}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConvertLocalAlarms</RootNamespace>
<AssemblyName>ConvertLocalAlarms</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="C1.Win.C1FlexGrid.2, Version=2.6.20142.835, Culture=neutral, PublicKeyToken=79882d576c6336da, processorArchitecture=MSIL" />
<Reference Include="Csla">
<HintPath>..\..\..\..\..\..\..\Development\csla20cs\Csla\bin\Debug\Csla.dll</HintPath>
</Reference>
<Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files\DotNetBar for Windows Forms\DevComponents.DotNetBar2.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="VEPROMS.CSLA.Library">
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\VEPROMS.CSLA.Library.dll</HintPath>
</Reference>
<Reference Include="Volian.Base.Library">
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\Volian.Base.Library.dll</HintPath>
</Reference>
<Reference Include="Volian.Controls.Library">
<HintPath>..\..\..\..\..\..\..\Development\Proms\Volian.Controls.Library\bin\Debug\Volian.Controls.Library.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ConvertTable.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmConvertLocalAlarms.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmConvertLocalAlarms.Designer.cs">
<DependentUpon>frmConvertLocalAlarms.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SaveProcedureLocal.cs">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="frmConvertLocalAlarms.resx">
<DependentUpon>frmConvertLocalAlarms.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</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>

View File

@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = "relative:ConvertLocalAlarms"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,197 @@
using C1.Win.C1FlexGrid;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
namespace ConvertLocalAlarms
{
public partial class frmConvertLocalAlarms
{
private static string GetTableText()
{
return _MyFlexGrid.GetSearchableText();
}
private static void LoadTable2(XmlNode xn, StepLookup mySteps, int level)
{
XmlNode xn2 = xn.SelectSingleNode("tr/td/table");
if (xn2 != null) xn = xn2;
VlnFlexGrid fg = _MyFlexGrid;
fg.Font = new Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Point);
fg.Clear();
fg.Rows.Count = 1;
fg.Cols.Count = 1;
int rows = 0;
fg.MergedRanges.Clear();
foreach (XmlNode xr in xn.ChildNodes)
{
if (xr.Name == "tr")
{
++rows;
AddTableRow(xr, fg, rows);
}
}
fg.MyBorders = new VlnBorders(GridLinePattern.Single, fg.Rows.Count, fg.Cols.Count);
fg.BringToFront();
fg.Invalidate();
Application.DoEvents();
//ShowColumnWidths(fg);
fg.MakeRTFcells(false);
//ShowMergedCells(fg);
//ShowColumnWidths(fg);
//Well, Can I save the table
//using (Step step = MakeCSLAStep(mySteps, mySteps.Count, null, {TableContent}, 20008, E_FromType.Table))
//{
// Grid.MakeGrid(step.MyContent, fg.GetXMLData(), "");
//}
}
public static VlnFlexGrid _MyFlexGrid = null;
private static void AddTableRow(XmlNode xr, VlnFlexGrid fg, int rows)
{
if (rows > fg.Rows.Count)
fg.Rows.Count = rows;
int cols = 0;
foreach (XmlNode xc in xr.ChildNodes)
{
++cols;
//if (xc.InnerText.Contains("RC-V200"))
// Console.WriteLine(xc.InnerText);
//if (xc.InnerText.Contains("RC-V121"))
// Console.WriteLine(xc.InnerText);
//if (xc.InnerXml.Contains("AB 137") || xc.InnerXml.Contains("3013N01"))
// Console.WriteLine("here");
CellRange cr2 = GetMyMergedRange(fg, rows - 1, cols - 1);
//Console.WriteLine("Check {0}", cr2);
while (cr2.c1 != cols - 1 || cr2.r1 != rows - 1)
{
cols++;
cr2 = GetMyMergedRange(fg, rows - 1, cols - 1);
}
AddMergedCells(fg, rows, cols, xc);
//ShowMergedCells(fg);
if (xc.Name == "td")
{
AddTableColumn(xc, fg, rows, cols);
}
}
}
//private static void ShowColumnWidths(VlnFlexGrid fg)
//{
// foreach (Column c in fg.Cols)
// Console.WriteLine("Width[{0}]={1}", c.Index, c.Width);
//}
private static void ShowMergedCells(VlnFlexGrid fg)
{
for (int r = 0; r < fg.Rows.Count; r++)
{
for (int c = 0; c < fg.Cols.Count; c++)
{
CellRange cr3 = GetMyMergedRange(fg, r, c);
if (fg.MergedRanges.Contains(cr3))
Console.WriteLine("cr3 r={0},c={1},rng={2}", r, c, cr3);
}
}
}
private static int GetSpan(string span)
{
int retval = int.Parse("0" + (span ?? ""));
if (retval == 0) return 0;
return retval - 1;
}
private static string GetAttribute(XmlNode xc, string attName)
{
string retval = null;
XmlAttribute xa = xc.Attributes[attName];
if (xa != null)
retval = xa.Value;
return retval;
}
private static void AddMergedCells(VlnFlexGrid fg, int rows, int cols, XmlNode xc)
{
string colspan = GetAttribute(xc, "colspan");
string rowspan = GetAttribute(xc, "rowspan");
if (colspan != null || rowspan != null)
{
//AddMergedRanges
int r1 = rows;
int c1 = cols;
int r2 = r1 + GetSpan(rowspan);
if (r2 > fg.Rows.Count) fg.Rows.Count = r2;
int c2 = c1 + GetSpan(colspan);
if (c2 > fg.Cols.Count) fg.Cols.Count = c2;
CellRange cr = new CellRange();
cr.r1 = r1 - 1;
cr.r2 = r2 - 1;
cr.c1 = c1 - 1;
cr.c2 = c2 - 1;
fg.MergedRanges.Add(cr);
//Console.WriteLine("Merged {0}", cr);
}
}
private static CellRange GetMyMergedRange(VlnFlexGrid fg, int r, int c)
{
foreach (CellRange cr in fg.MergedRanges)
{
if (cr.r1 <= r && cr.r2 >= r && cr.c1 <= c && cr.c2 >= c)
return cr;
}
return fg.GetMergedRange(r, c);
}
private static Regex regNumber = new Regex("^[0-9]+$", RegexOptions.Compiled);
private static void AddTableColumn(XmlNode xc, VlnFlexGrid fg, int rows, int cols)
{
//Console.WriteLine("Rows {0}, Cols {1}", rows, cols);
if (cols > fg.Cols.Count)
fg.Cols.Count = cols;
string width = GetAttribute(xc, "width");
if (width != null && width != "" && regNumber.IsMatch(width))
{
if (width.EndsWith("%"))
fg.Cols[cols - 1].Width = (int)(int.Parse(width.Replace("%", "")) * 96 * 6.5F / 100);
else
{
int w = int.Parse(width)*96/72;
//Console.WriteLine("w[{0}]={1}", cols - 1, w);
fg.Cols[cols - 1].Width = w;
}
}
StringBuilder sb = new StringBuilder();
string prefix = "";
foreach (XmlNode xn in xc.ChildNodes)
{
if (xn.Name == "p")
{
sb.Append(prefix + xn.InnerText);
}
if (xn.Name == "ul")
{
foreach (XmlNode xn2 in xn.ChildNodes)
{
if (xn2.Name == "li")
{
sb.Append(prefix + "*" + xn.InnerText);
}
if (xn2.Name == "p")
{
sb.Append(prefix + xn.InnerText);
}
}
}
}
if (width != null && width != "" && !regNumber.IsMatch(width))
{
Console.WriteLine("width is not a number {0}, rows {1}, cols {2}, Text='{3}'", width, rows, cols, xc.OuterXml);
}
fg[rows - 1, cols - 1] = sb.ToString();
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ConvertLocalAlarms
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmConvertLocalAlarms());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ConvertLocalAlarms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConvertLocalAlarms")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4fbb3402-5209-47ff-a6ba-e0da93ef51c4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ConvertLocalAlarms.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ConvertLocalAlarms.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,110 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ConvertLocalAlarms.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1000, 600")]
public global::System.Drawing.Size Size {
get {
return ((global::System.Drawing.Size)(this["Size"]));
}
set {
this["Size"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0, 0")]
public global::System.Drawing.Point Location {
get {
return ((global::System.Drawing.Point)(this["Location"]));
}
set {
this["Location"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string FileName {
get {
return ((string)(this["FileName"]));
}
set {
this["FileName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("250")]
public int Split1 {
get {
return ((int)(this["Split1"]));
}
set {
this["Split1"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute(".\\Sql2008Express")]
public string SqlServer {
get {
return ((string)(this["SqlServer"]));
}
set {
this["SqlServer"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("VEPROMs_BARAKAH")]
public string Database {
get {
return ((string)(this["Database"]));
}
set {
this["Database"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int ProcedureSet {
get {
return ((int)(this["ProcedureSet"]));
}
set {
this["ProcedureSet"] = value;
}
}
}
}

View File

@ -0,0 +1,27 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ConvertLocalAlarms.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="Size" Type="System.Drawing.Size" Scope="User">
<Value Profile="(Default)">1000, 600</Value>
</Setting>
<Setting Name="Location" Type="System.Drawing.Point" Scope="User">
<Value Profile="(Default)">0, 0</Value>
</Setting>
<Setting Name="FileName" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Split1" Type="System.Int32" Scope="User">
<Value Profile="(Default)">250</Value>
</Setting>
<Setting Name="SqlServer" Type="System.String" Scope="User">
<Value Profile="(Default)">.\Sql2008Express</Value>
</Setting>
<Setting Name="Database" Type="System.String" Scope="User">
<Value Profile="(Default)">VEPROMs_BARAKAH</Value>
</Setting>
<Setting Name="ProcedureSet" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1 @@
C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.2, Version=2.6.20142.835, Culture=neutral, PublicKeyToken=79882d576c6336da

View File

@ -0,0 +1,549 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
using VEPROMS.CSLA.Library;
using log4net;
using Volian.Controls.Library;
using C1.Win.C1FlexGrid;
using System.Data.SqlClient;
namespace ConvertLocalAlarms
{
public partial class frmConvertLocalAlarms : Form
{
string lastLine = "";
//private void SaveProcedure(string text, string procNumber, string procTitle, int serialNo)
private void SaveProcedure(string text, string procNumber, string procTitle, DocVersionInfo dvi)
{
Console.WriteLine("===> ARP: {0}, AppContext: {1}", dvi.MyFolder.Name, procNumber);
// Add Procedure Number and Title
ItemInfo prev = null;
//if (serialNo == 999999)
prev = dvi.MyItem == null ? null : dvi.MyItem.LastSibling;
//else
//{
// prev = FindPrevious(dicSerialNo, serialNo);
//}
using (Procedure prc = Procedure.MakeProcedure(dvi, prev, procNumber, procTitle, 0))
{
ProcedureInfo prci = ProcedureInfo.Get(prc.ItemID);
// dicSerialNo.Add(serialNo, prci);
// Console.WriteLine("{0},{1}", serialNo, prci.ShortPath);
// Add Section
using (Section sec = Section.MakeSection(prci, null, null, "Procedure Content", 10000))
{
sec.SectionConfig.Section_ColumnMode = SectionConfig.SectionColumnMode.One;
sec.SectionConfig.Section_Pagination = SectionConfig.SectionPagination.Separate;
sec.Save();
SectionInfo seci = SectionInfo.Get(sec.ItemID);
// TODO: Add High Level Steps
// TODO: Add Substeps
MemoryStream ms = GetMemoryStream(text);
Queue<string> qRead = new Queue<string>();
using (StreamReader sr = new StreamReader(ms))
fillQueue(qRead, sr);
Dictionary<int, ItemInfo> lookup = new Dictionary<int, ItemInfo>();
lookup.Add(0, prci);
lookup.Add(1, seci);
int level = 2;
int type = 20001;
int lastLevel = 2;
int lastType = 0;
int lastIndent = 0;
int extra = 0;
string lastTab = "";
int? DeQueueType = null;
E_FromType myFromType = E_FromType.Step;
Queue<string> enQueue = null;
Queue<string> deQueue = null;
int deQueueLevel = 0;
int deQueueLevelLast = 0;
bool wasFromQueue;
bool firstQueue = false;
ItemInfo deQueueItem = null;
bool saveDeQueueInfo = false;
bool isTable = false;
bool lastWasTable = false;
string tableText = null;
string tab = "";
bool strangeBullet = false;
bool lastNoteHadBullet = false;
while (qRead.Count > 0 || deQueue != null)
{
string lineText;
tableText = null;
if (deQueue != null)
{
wasFromQueue = true;
extra = 1;
lineText = deQueue.Dequeue();
if (deQueue.Count == 0)
deQueue = null;
if (lineText=="<NOTE>")
{
DeQueueType = 20007;
}
if (lineText=="<CAUTION>")
{
DeQueueType = 20006;
}
if (lineText=="<WARNING>")
{
DeQueueType = 20020;
}
if (deQueue != null)
{
if (deQueue.Count > 0)
lineText = deQueue.Dequeue();
if (deQueue.Count == 0)
deQueue = null;
}
if (lastNoteHadBullet && lineText.Contains("\u2022"))
DeQueueType = lastType;
}
else
{
wasFromQueue = false;
DeQueueType = null;
extra = 0;
string findend = "";
while (Regex.IsMatch(qRead.Peek(), "<(NOTE|CAUTION|WARNING)>(.*)"))
{
if (enQueue == null) enQueue = new Queue<string>();
lineText = qRead.Dequeue();
string sType = Regex.Replace(lineText, "^<(NOTE|CAUTION|WARNING)>(.*)$", "$1");
lineText = Regex.Replace(lineText, "^<(NOTE|CAUTION|WARNING)>(.*)$", "$2");
findend = string.Format("</{0}>", sType);
enQueue.Enqueue(string.Format("<{0}>", sType));
while (!lineText.Contains(findend))
{
enQueue.Enqueue(lineText);//.Replace("\u2022","").Trim());
lineText = qRead.Dequeue().Trim();
}
lineText = lineText.Replace(findend, "");
enQueue.Enqueue(lineText); //.Replace("\u2022", "").Trim());
}
lineText = qRead.Dequeue().TrimEnd(" ".ToCharArray());
//string append = qRead.Peek();
//lineText = qRead.Dequeue().Trim();
if (lineText == "&gt;") lineText = lineText.Replace("&gt;", "");
else lineText = lineText.Replace("&lt;", "<").Replace("&gt;", ">");
//}
HasSpecialCharacters(lineText);
if (lineText.StartsWith("<table>"))
{
while (!lineText.Contains("</table>"))
{
lineText += " " + qRead.Dequeue();
lineText = Regex.Replace(lineText, "</table>.*", "</table>");
}
XmlDocument xd = new XmlDocument();
xd.LoadXml(lineText);
LoadTable2(xd.DocumentElement, null, 0);
isTable = true;
if (!lastWasTable) level = lastLevel + 1;
else level = lastLevel;
type = 20008;
tableText = GetTableText();
//StringBuilder sbxml= new StringBuilder();
//using(StringWriter sw = new StringWriter(sbxml))
// _MyFlexGrid.WriteXml(sw);
//using(StringReader sr= new StringReader(sbxml.ToString()))
// _MyFlexGrid.ReadXml(sr);
//Application.DoEvents();
}
else lineText = Regex.Replace(lineText, "<[^<>]+>", "");
}
if (lineText.Replace("\t", "").Replace(" ", "") != "")
lastLine = lineText;
Match m = Regex.Match(lineText.Replace('\xFFFD', '\x2022'), @"^(\t*)([1-9][0-9]*\.0|[1-9][0-9]*\.[1-9][0-9]*|[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*|[A-Z]\.|\u2022|)([\t ]+)([^\u2022]*)$", RegexOptions.Multiline);
if (m.Groups[4].Value != "")
{
tab = m.Groups[2].Value;
int indent = m.Groups[1].Value.Length;
if (isTable)
{
// do nothing
if (lastWasTable)
level = lastLevel;
else
level = 1 + lastLevel;
type = 20008;
myFromType = E_FromType.Table;
}
else if (indent == 0 && tab.EndsWith(".0")) // High Level Step
{
level = 2;
type = 20002;
}
else if (Regex.IsMatch(tab, "[1-9][0-9]*\\.[1-9][0-9]*\\.[1-9][0-9]*")) // Sub-Substep
{
level = 4;
type = 20001;
}
else if (Regex.IsMatch(tab, "[1-9][0-9]*\\.[1-9][0-9]*")) // Substep
{
level = 3;
type = 20001;
}
else if (Regex.IsMatch(tab, "[A-Z]\\.")) // Sub-Substep
{
level = 5;
type = 20001;
}
else if (tab == "") // Paragraph
{
//Console.WriteLine("Type = 20024, deQueueuType= {0} Level = {1}", DeQueueType, level);
level = lastLevel + 1;
type = 20024;
}
else if (tab == "\u2022")//bullet
{
if (firstQueue)
level = lastLevel + 1;
else if (lastTab == "\u2022")
level = lastLevel;
else
if (lastType == 20007 && lastTab == "")
level = lastLevel + 1;
else
{
level = indent + 3;
strangeBullet = true;
}
type = 20004;
if (Regex.IsMatch(m.Groups[4].Value, "^[0-9]"))
type = 20011;
}
else if (tab == "\u25CB")//bullet
{
level = indent + 4;
type = 20004;
if (Regex.IsMatch(m.Groups[4].Value, "^[0-9]"))
type = 20011;
}
//while (level < lastLevel)
// lookup.Remove(lastLevel--);
if (firstQueue && deQueueLevelLast > 0) level = deQueueLevelLast + 1;
while (level < lookup.Count - 1)
lookup.Remove(lookup.Count - 1);
lastTab = tab;
lastLevel = level;
//lastIndent = indent;
lastWasTable = isTable;
deQueueLevelLast = deQueueLevel;
}
if (deQueue == null && enQueue != null)
{
deQueue = enQueue;
saveDeQueueInfo = true;
enQueue = null;
}
int newType = DeQueueType ?? (isTable ? 20008 : type);
if (DeQueueType != null)
{
myFromType = E_FromType.Note;
level = 3;
if(deQueue!=null)
Console.WriteLine("Multiple NoteLines");
if (tab == "\u2022")
lastNoteHadBullet = true;
}
lastType = newType;
if (enQueue == null)
{
if (lookup.Count < level)
{
using (Step stp = (lookup[lookup.Count - 1] as StepInfo).Get())
{
Annotation.MakeAnnotation(stp, AnnotationType.GetByNameOrCreate("Conversion Error"), null, GetAnnotationText2(lineText), null);
}
}
else if (lookup.Count == level)
{ // Make new Step Type Child
using (Step stp = Step.MakeStep(lookup[level - 1], null, null, tableText ?? m.Groups[4].Value, newType, myFromType))
{
if (strangeBullet)
Annotation.MakeAnnotation(stp, AnnotationType.GetByNameOrCreate("Conversion Error"), null, "Strange Bullet", null);
ItemInfo myItem = StepInfo.Get(stp.ItemID);
if (isTable)
{
Grid.MakeGrid(stp.MyContent, _MyFlexGrid.GetXMLData(), "");
String footnote = GetFootNote(ms, qRead);
if (footnote.Length > 0) // Make Table FootNote
Step.MakeStep(myItem, null, null, footnote, 20024, E_FromType.Step);
}
isTable = false;
lookup.Add(level, myItem);
//Console.WriteLine("+++B tab = {0}, Lookup.Count = {1}, Level = {2}",tab, lookup.Count, level);
//Console.WriteLine("+++A tab = {0}, Lookup.Count = {1}, Level = {2}",tab, lookup.Count, level);
if (saveDeQueueInfo)
{
deQueueLevel = level;
deQueueItem = lookup[level];
saveDeQueueInfo = false;
}
if (firstQueue) firstQueue = false;
}
}
else
{ // MakeConfig Next Child
int previousType = ((int)lookup[level].MyContent.Type);
if (firstQueue && DeQueueType != null)
{
previousType = (int)DeQueueType;
level = deQueueLevel + 1;
}
using (Step stp = Step.MakeStep(lookup[level - 1], lookup[level], null, tableText ?? m.Groups[4].Value, previousType, myFromType))
{
Annotation.MakeAnnotation(stp, AnnotationType.GetByNameOrCreate("Conversion Error"), null, string.Format("Type Change {0} to {1}", newType, ((int)lookup[level].MyContent.Type)), null);
if (strangeBullet)
Annotation.MakeAnnotation(stp, AnnotationType.GetByNameOrCreate("Conversion Error"), null, "Strange Bullet", null);
strangeBullet = false;
ItemInfo myItem = StepInfo.Get(stp.ItemID);
if (isTable)
{
Grid.MakeGrid(stp.MyContent, _MyFlexGrid.GetXMLData(), "");
String footnote = GetFootNote(ms, qRead);
if (footnote.Length > 0)// Make Table Footnote
Step.MakeStep(myItem, null, null, footnote, 20024, E_FromType.Step);
}
isTable = false;
//Console.WriteLine(">>> tab = {0}, Lookup.Count = {1}, Level = {2}", tab, lookup.Count, level);
lookup[level] = myItem;
if (saveDeQueueInfo)
{
deQueueLevel = level;
deQueueItem = lookup[level];
saveDeQueueInfo = false;
}
if (firstQueue) firstQueue = false;
}
}
myFromType = E_FromType.Step;
if (deQueue == null && deQueueItem != null)
{
level = deQueueLevel;
while (level < lookup.Count)
lookup.Remove(lookup.Count - 1);
lookup[level] = deQueueItem;
deQueueItem = null;
DeQueueType = null;
}
}
//else
//{
// enQueue.Enqueue(lineText);
//}
DeQueueType = null;
}
}
}
if (runOne) MessageBox.Show("Done", "Converted");
}
private ItemInfo FindLocation(ItemInfo myItem, string procNumber)
{
while (myItem != null)
{
if (myItem.DisplayNumber.CompareTo(procNumber) >= 0)
return myItem.MyPrevious;
myItem = myItem.NextItem;
}
return myItem;
}
private string MakeConfig(string fmt, params string [] args)
{
string [] atts = new string[args.Length];
args.CopyTo(atts,0);
for(int i=0; i<atts.Length; i++)
atts[i] = atts[i].Replace("&","&amp;").Replace("<","&lt;").Replace(">","&gt;");
return string.Format(fmt, atts);
}
private void fillQueue(Queue<string> qread, StreamReader sr)
{
while(sr.Peek() > 0)
qread.Enqueue(sr.ReadLine());
}
//public string NextLine
//{
// get { return _NextLine; }
// set { _NextLine = value; }
//}
private string GetFootNote(MemoryStream ms, Queue<string> qRead)
{
string sep = "";
StringBuilder sb = new StringBuilder();
while(qRead.Count > 0)
{
// Read a line at a time
string str = qRead.Peek();
str = Regex.Replace(str, "<[^<>]+>", "").Trim(" \t".ToCharArray()).Replace("&gt;", "");
str = str.Replace('\x25CB', 'o').Replace("\u2022", "\\u9679?");
//str = str.Replace('\x25CB', 'o').Replace("\u2022", "\\u7?");
// If Text begins with number then
if(Regex.IsMatch(str,"[0-9].*") || str.StartsWith("<table>"))
return sb.ToString();
//append string
if (sb.ToString() != "" || str != "")
{
sep = "\r\n";
}
sb.Append(sep + qRead.Dequeue());
}
return sb.ToString();
}
private void ProcessChars(string str)
{
foreach (char c in str)
{
if (c < 0x20 || c > 0x7F)
Console.WriteLine("{0:X4}", (int)c);
}
}
public void ResetSpecial()
{
FoundSpecial = new List<char>();
}
List<char> FoundSpecial = new List<char>();
private void HasSpecialCharacters(string lineText)
{
StringBuilder sb = new StringBuilder();
foreach (char c in lineText)
{
if ((c < 0x20 || c > 0x7F) && !FoundSpecial.Contains(c))
{
Console.WriteLine("*** Special Character {0:X4}", (int)c);
FoundSpecial.Add(c);
}
}
}
//private static string GetAnnotationText(string fileName)
//{
// return string.Format("FileName:{0}\r\nShortName:{1}\r\nFullName:{2}\r\nSystem:{3}\r\nPNSNo:{4}\r\nRelatedFunction:{5}" ,
// fileName,ShortName,FullName,ApSystem,PNSNo ,RelatedFunction);
//}
private static string GetAnnotationText2(string lineText)
{
//return string.Format("LineText:{0}\r\nShortName:{1}\r\nFullName:{2}\r\nSystem:{3}\r\nPNSNo:{4}\r\nRelatedFunction:{5}",
// lineText, ShortName, FullName, apSystem, PNSNo, RelatedFunction);
return string.Format("LineText:{0}",
lineText);
}
//private void fillQueue(Queue<string> qread, StreamReader sr)
//{
// while (sr.Peek() > 0)
// qread.Enqueue(sr.ReadLine());
//}
//private string _NextLine;
//public string NextLine
//{
// get { return _NextLine; }
// set { _NextLine = value; }
//}
//private string GetFootNote(MemoryStream ms, Queue<string> qRead)
//{
// string sep = "";
// StringBuilder sb = new StringBuilder();
// while (qRead.Count > 0)
// {
// // Read a line at a time
// string str = qRead.Peek();
// str = Regex.Replace(str, "<[^<>]+>", "").Trim(" \t".ToCharArray()).Replace("&gt;", "");
// str = str.Replace('\x25CB', 'o').Replace("\u2022", "\\u9679?");
// //str = str.Replace('\x25CB', 'o').Replace("\u2022", "\\u7?");
// // If Text begins with number then
// if (Regex.IsMatch(str, "[0-9].*") || str.StartsWith("<table>"))
// return sb.ToString();
// //append string
// if (sb.ToString() != "" || str != "")
// {
// sep = "\r\n";
// }
// sb.Append(sep + qRead.Dequeue());
// }
// return sb.ToString();
//}
//private void ProcessChars(string str)
//{
// foreach (char c in str)
// {
// if (c < 0x20 || c > 0x7F)
// Console.WriteLine("{0:X4}", (int)c);
// }
//}
//public void ResetSpecial()
//{
// FoundSpecial = new List<char>();
//}
//List<char> FoundSpecial = new List<char>();
//private void HasSpecialCharacters(string lineText)
//{
// StringBuilder sb = new StringBuilder();
// foreach (char c in lineText)
// {
// if ((c < 0x20 || c > 0x7F) && !FoundSpecial.Contains(c))
// {
// Console.WriteLine("*** Special Character {0:X4}", (int)c);
// FoundSpecial.Add(c);
// }
// }
//}
}
public class StepLookup : SortedDictionary<string, StepInfo>
{
public StepInfo this[int i]
{
get
{
if (this.ContainsKey(i.ToString())) return base[i.ToString()];
return null;
}
set
{
if (i > this.Count)
throw new Exception("Gap in Stack");
if (value == null)
throw new Exception("Null StepInfo");
//if (value.MyHLS.Ordinal==5 && (value.IsNote || value.IsCaution ))
// Volian.Base.Library.vlnStackTrace.ShowStackLocal(2,5,"=====> Adding Caution or Note on Step 5 {0}",value);
if (this.ContainsKey(i.ToString()))
{
base[i.ToString()] = value;
while (this.ContainsKey((i + 1).ToString()))
base.Remove((base.Count - 1).ToString());
}
else base.Add(i.ToString(), value);
//ListMySteps("Set ", this);
}
}
public void AddOne(StepInfo previousStep)
{
this[this.Count] = previousStep;
}
private static void ListMySteps(string str, StepLookup mySteps)
{
int i = 0;
foreach (string key in mySteps.Keys)
{
if (key != i.ToString())
Console.WriteLine("{0} {1} {2} {3}", str, i, key, mySteps[key].DisplayText);
i++;
}
}
}
}

View File

@ -0,0 +1,406 @@
namespace ConvertLocalAlarms
{
partial class frmConvertLocalAlarms
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.btn_All = new System.Windows.Forms.Button();
this.btnConvert = new System.Windows.Forms.Button();
this.label7 = new System.Windows.Forms.Label();
this.tbServer = new System.Windows.Forms.TextBox();
this.cmbDatabase = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.cmbDocVersion = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.btn_Run = new System.Windows.Forms.Button();
this.btn_Browse = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.tbFileName = new System.Windows.Forms.TextBox();
this.ofd = new System.Windows.Forms.OpenFileDialog();
this.sc1 = new System.Windows.Forms.SplitContainer();
this.tcXML = new System.Windows.Forms.TabControl();
this.tpXML = new System.Windows.Forms.TabPage();
this.tbPROMS = new System.Windows.Forms.TextBox();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tpStructure = new System.Windows.Forms.TabPage();
this.tv = new System.Windows.Forms.TreeView();
this.tpGrid = new System.Windows.Forms.TabPage();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.tmr = new System.Windows.Forms.Timer(this.components);
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.sc1)).BeginInit();
this.sc1.Panel1.SuspendLayout();
this.sc1.Panel2.SuspendLayout();
this.sc1.SuspendLayout();
this.tcXML.SuspendLayout();
this.tpXML.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tpStructure.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.panel2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(954, 88);
this.panel1.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(23, 13);
this.label1.TabIndex = 1;
this.label1.Text = "File";
//
// panel2
//
this.panel2.Controls.Add(this.btn_All);
this.panel2.Controls.Add(this.btnConvert);
this.panel2.Controls.Add(this.label7);
this.panel2.Controls.Add(this.tbServer);
this.panel2.Controls.Add(this.cmbDatabase);
this.panel2.Controls.Add(this.label4);
this.panel2.Controls.Add(this.cmbDocVersion);
this.panel2.Controls.Add(this.label5);
this.panel2.Controls.Add(this.btn_Run);
this.panel2.Controls.Add(this.btn_Browse);
this.panel2.Controls.Add(this.label6);
this.panel2.Controls.Add(this.tbFileName);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(954, 88);
this.panel2.TabIndex = 9;
//
// btn_All
//
this.btn_All.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_All.Location = new System.Drawing.Point(862, 46);
this.btn_All.Name = "btn_All";
this.btn_All.Size = new System.Drawing.Size(37, 25);
this.btn_All.TabIndex = 12;
this.btn_All.Text = "All";
this.btn_All.UseVisualStyleBackColor = true;
this.btn_All.Click += new System.EventHandler(this.btnAll_Click);
//
// btnConvert
//
this.btnConvert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnConvert.Location = new System.Drawing.Point(754, 46);
this.btnConvert.Name = "btnConvert";
this.btnConvert.Size = new System.Drawing.Size(76, 28);
this.btnConvert.TabIndex = 11;
this.btnConvert.Text = "Convert";
this.btnConvert.UseVisualStyleBackColor = true;
this.btnConvert.Click += new System.EventHandler(this.btnConvert_Click);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(12, 35);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(38, 13);
this.label7.TabIndex = 10;
this.label7.Text = "Server";
//
// tbServer
//
this.tbServer.Location = new System.Drawing.Point(56, 32);
this.tbServer.Name = "tbServer";
this.tbServer.Size = new System.Drawing.Size(190, 20);
this.tbServer.TabIndex = 9;
//
// cmbDatabase
//
this.cmbDatabase.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cmbDatabase.FormattingEnabled = true;
this.cmbDatabase.Location = new System.Drawing.Point(331, 32);
this.cmbDatabase.Name = "cmbDatabase";
this.cmbDatabase.Size = new System.Drawing.Size(417, 21);
this.cmbDatabase.TabIndex = 8;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(11, 61);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(75, 13);
this.label4.TabIndex = 7;
this.label4.Text = "Procedure Set";
//
// cmbDocVersion
//
this.cmbDocVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cmbDocVersion.FormattingEnabled = true;
this.cmbDocVersion.Location = new System.Drawing.Point(92, 58);
this.cmbDocVersion.Name = "cmbDocVersion";
this.cmbDocVersion.Size = new System.Drawing.Size(656, 21);
this.cmbDocVersion.TabIndex = 6;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(259, 35);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(53, 13);
this.label5.TabIndex = 4;
this.label5.Text = "Database";
//
// btn_Run
//
this.btn_Run.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_Run.Location = new System.Drawing.Point(905, 3);
this.btn_Run.Name = "btn_Run";
this.btn_Run.Size = new System.Drawing.Size(37, 25);
this.btn_Run.TabIndex = 3;
this.btn_Run.Text = "Run";
this.btn_Run.UseVisualStyleBackColor = true;
this.btn_Run.Click += new System.EventHandler(this.btnRun_Click);
//
// btn_Browse
//
this.btn_Browse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_Browse.Location = new System.Drawing.Point(827, 3);
this.btn_Browse.Name = "btn_Browse";
this.btn_Browse.Size = new System.Drawing.Size(72, 24);
this.btn_Browse.TabIndex = 2;
this.btn_Browse.Text = "Browse...";
this.btn_Browse.UseVisualStyleBackColor = true;
this.btn_Browse.Click += new System.EventHandler(this.btnBrowse_Click);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(12, 9);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(23, 13);
this.label6.TabIndex = 1;
this.label6.Text = "File";
//
// tbFileName
//
this.tbFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbFileName.Location = new System.Drawing.Point(56, 6);
this.tbFileName.Name = "tbFileName";
this.tbFileName.Size = new System.Drawing.Size(756, 20);
this.tbFileName.TabIndex = 0;
this.tbFileName.Text = "H:\\Barakah Alarms\\1N2-OP-ARP-CS-0001_Rev_02_FINAL_Zipped_XML_20190804\\ARP-3442-10" +
"01 CS CNMT Spray HDR Block VLV V0001 TRBL.xml";
this.tbFileName.TextChanged += new System.EventHandler(this.tbFileName_TextChanged);
//
// ofd
//
this.ofd.Filter = "Text Files|*.txt";
//
// sc1
//
this.sc1.Dock = System.Windows.Forms.DockStyle.Fill;
this.sc1.Location = new System.Drawing.Point(0, 88);
this.sc1.Name = "sc1";
//
// sc1.Panel1
//
this.sc1.Panel1.Controls.Add(this.tcXML);
//
// sc1.Panel2
//
this.sc1.Panel2.Controls.Add(this.tabControl1);
this.sc1.Size = new System.Drawing.Size(954, 392);
this.sc1.SplitterDistance = 372;
this.sc1.TabIndex = 1;
//
// tcXML
//
this.tcXML.Controls.Add(this.tpXML);
this.tcXML.Dock = System.Windows.Forms.DockStyle.Fill;
this.tcXML.Location = new System.Drawing.Point(0, 0);
this.tcXML.Name = "tcXML";
this.tcXML.SelectedIndex = 0;
this.tcXML.Size = new System.Drawing.Size(372, 392);
this.tcXML.TabIndex = 2;
//
// tpXML
//
this.tpXML.Controls.Add(this.tbPROMS);
this.tpXML.Location = new System.Drawing.Point(4, 22);
this.tpXML.Name = "tpXML";
this.tpXML.Padding = new System.Windows.Forms.Padding(3);
this.tpXML.Size = new System.Drawing.Size(364, 366);
this.tpXML.TabIndex = 1;
this.tpXML.Text = "Raw";
this.tpXML.UseVisualStyleBackColor = true;
//
// tbPROMS
//
this.tbPROMS.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbPROMS.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbPROMS.Location = new System.Drawing.Point(3, 3);
this.tbPROMS.Multiline = true;
this.tbPROMS.Name = "tbPROMS";
this.tbPROMS.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tbPROMS.Size = new System.Drawing.Size(358, 360);
this.tbPROMS.TabIndex = 1;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tpStructure);
this.tabControl1.Controls.Add(this.tpGrid);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(578, 392);
this.tabControl1.TabIndex = 0;
//
// tpStructure
//
this.tpStructure.Controls.Add(this.tv);
this.tpStructure.Location = new System.Drawing.Point(4, 22);
this.tpStructure.Name = "tpStructure";
this.tpStructure.Size = new System.Drawing.Size(570, 366);
this.tpStructure.TabIndex = 2;
this.tpStructure.Text = "Structure";
this.tpStructure.UseVisualStyleBackColor = true;
//
// tv
//
this.tv.Dock = System.Windows.Forms.DockStyle.Fill;
this.tv.Location = new System.Drawing.Point(0, 0);
this.tv.Name = "tv";
this.tv.Size = new System.Drawing.Size(570, 366);
this.tv.TabIndex = 0;
//
// tpGrid
//
this.tpGrid.Location = new System.Drawing.Point(4, 22);
this.tpGrid.Name = "tpGrid";
this.tpGrid.Size = new System.Drawing.Size(570, 366);
this.tpGrid.TabIndex = 3;
this.tpGrid.Text = "Grid";
this.tpGrid.UseVisualStyleBackColor = true;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsslStatus});
this.statusStrip1.Location = new System.Drawing.Point(0, 480);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(954, 22);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
this.statusStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.statusStrip1_ItemClicked);
this.statusStrip1.Click += new System.EventHandler(this.tsslStatus_Click);
//
// tsslStatus
//
this.tsslStatus.Name = "tsslStatus";
this.tsslStatus.Size = new System.Drawing.Size(39, 17);
this.tsslStatus.Text = "Ready";
this.tsslStatus.Click += new System.EventHandler(this.tsslStatus_Click);
//
// tmr
//
this.tmr.Tick += new System.EventHandler(this.tmr_Tick);
//
// frmConvertLocalAlarms
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(954, 502);
this.Controls.Add(this.sc1);
this.Controls.Add(this.panel1);
this.Controls.Add(this.statusStrip1);
this.Name = "frmConvertLocalAlarms";
this.Text = "Convert Alarms";
this.Load += new System.EventHandler(this.frmConvertAlarms_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.sc1.Panel1.ResumeLayout(false);
this.sc1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.sc1)).EndInit();
this.sc1.ResumeLayout(false);
this.tcXML.ResumeLayout(false);
this.tpXML.ResumeLayout(false);
this.tpXML.PerformLayout();
this.tabControl1.ResumeLayout(false);
this.tpStructure.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.OpenFileDialog ofd;
private System.Windows.Forms.SplitContainer sc1;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel tsslStatus;
private System.Windows.Forms.TabControl tcXML;
private System.Windows.Forms.TabPage tpXML;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tpStructure;
private System.Windows.Forms.TreeView tv;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox tbServer;
private System.Windows.Forms.ComboBox cmbDatabase;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox cmbDocVersion;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button btn_Run;
private System.Windows.Forms.Button btn_Browse;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox tbFileName;
private System.Windows.Forms.Button btnConvert;
private System.Windows.Forms.Button btn_All;
private System.Windows.Forms.TabPage tpGrid;
private System.Windows.Forms.TextBox tbPROMS;
private System.Windows.Forms.Timer tmr;
}
}

View File

@ -0,0 +1,727 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
using log4net;
using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
using C1.Win.C1FlexGrid;
using System.Data.SqlClient;
namespace ConvertLocalAlarms
{
public partial class frmConvertLocalAlarms : Form
{
public frmConvertLocalAlarms()
{
InitializeComponent();
}
private void SetDatabaseConnection()
{
Database.VEPROMS_Connection = string.Format("Data Source={0};Initial Catalog={1};Integrated Security=True",tbServer.Text,cmbDatabase.SelectedText );
}
private void btnBrowse_Click(object sender, EventArgs e)
{
FileInfo fi = new FileInfo(tbFileName.Text);
ofd.InitialDirectory = fi.DirectoryName;
ofd.FileName = fi.Name;
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
tbFileName.Text = ofd.FileName;
ProcessTxt();
}
}
private void ProcessTxtFile(string fileName)
{
//FileInfo fi = new FileInfo(fileName);
//StreamReader sr = fi.OpenText();
//ProcessHeader(sr);
//ProcTextAll = tbPROMS.Text = sr.ReadToEnd();
//HasSpecialCharacters(ProcTextAll);
//sr.Close();
//SaveTree(ProcTextAll, ProcNumber, ProcTitle);
FileInfo fi = new FileInfo(fileName);
FileStream sr = fi.OpenRead();
byte[] buffer = new byte[fi.Length];
sr.Read(buffer, 0, (int) fi.Length);
string str = Encoding.UTF7.GetString(buffer).Replace("\x95", "\u2022");
ProcessHeader(str);
int headercount = str.IndexOf("Setpoint");
headercount = str.IndexOf("\r\n", headercount);
ProcTextAll = tbPROMS.Text = str.Substring(headercount + 2);
sr.Close();
SaveTree(ProcTextAll, ProcNumber, ProcTitle);
}
Regex regHeader = new Regex("([ A-Z.a-z]+) = '([^']+)'.*", RegexOptions.Compiled);
private void ProcessHeader(string str)
{
ProcNumber="";
ProcTitle="";
int offset = 0;
int linelength = 0;
for (int i = 0; i < 5; i++)
{
linelength = str.IndexOf("\r\n",offset)-offset;
string txt = str.Substring(offset,linelength);
offset += linelength + 2;
Match m = regHeader.Match(txt);
switch (i)
{
case 0:
break;
case 1:
if(m.Groups[1].Value == "Alarm") ProcTitle = m.Groups[2].Value;
break;
case 2:
if(m.Groups[1].Value == "AlarmID") ProcNumber = m.Groups[2].Value;
break;
case 3:
break;
case 4:
break;
}
}
}
private void ProcessTxt()
{
ProcessTxtFile(tbFileName.Text);
}
//private void ProcessXML()
//{
// //string fileName = tbFileName.Text;
// //ProcessXmlFile(fileName);
//}
//private void ProcessXmlFile(string fileName)
//{
// //UpdateHTML = false;
// //tbXML.Clear();
// //UpdateHTML = true;
// //XmlDocument xDoc = new XmlDocument();
// //xDoc.Load(fileName);
// //XmlNode xn = xDoc.DocumentElement.LastChild.LastChild.LastChild;
// //string html = GetHtml(xn);
// //tbXML.Text = html;
//}
//private static string GetHtml(XmlNode xn)
//{
// XmlNode pr = xn.PreviousSibling;
// XmlAttribute xa;
// string html = xn.Attributes["content"].Value;
// while (pr != null && pr.Name == "NoteInstruction")
// {
// html = MergeHTML(pr.Attributes["content"].Value, html);
// pr = pr.PreviousSibling;
// }
// return html;
//}
//private static string MergeHTML(string part1, string part2)
//{
// part1 = part1.Replace("</body></html","");
// part2 = part2.Substring(part2.IndexOf("<p"));
// return part1 + part2;
//}
//private string _HtmlPrefix = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">";
//public string HtmlPrefix
//{
// get { return _HtmlPrefix; }
// set { _HtmlPrefix = value; }
//}
//private void XMLChanged(string xml)
//{
// Application.DoEvents();
// xml = "<?xml version='1.0' encoding='UTF-8'?>\n" + xml;
// xml = xml.Replace(HtmlPrefix, "");
// //xml = xml.Replace("\x09", "[Tab]");
// //xml = xml.Replace("text-indent:0px;\">", "text-indent:0px;\">\r\n");
// //xml = xml.Replace(" \x09", "\r\n&#x09;");
// //xml = xml.Replace("\x09", "&#x09;");
// xml = Regex.Replace(xml, "<br /></span>", "<br /> </span>");
// xml = Regex.Replace(xml, "</span><br />", "</span><br /> ");
// xml = Regex.Replace(xml, "\\<span [^<>]+\\>", "");
// xml = Regex.Replace(xml, "\\</span *\\>", "");
// xml = Regex.Replace(xml, "\\</p\\>[ \r\n]+\\<p [^<>]+\\>", "<br />\r\n");
// xml = Regex.Replace(xml, "\\<p [^<>]+\\>", "<br />\r\n");
// xml = Regex.Replace(xml, @"<br />[ \t\r\n]+\[", @"\line [");
// xml = Regex.Replace(xml, "\\</p *\\>", "");
// xml = Regex.Replace(xml, @"\]\t{4,5}", "]\r\n");
// xml = Regex.Replace(xml, "<br ?/>\t+(?![[\\u2022])", " ");
// xml = Regex.Replace(xml, "<br ?/>\t+(?![[\\u2022])", " ");
// xml = Regex.Replace(xml, "\t\t+", " ");
// xml = Regex.Replace(xml, "<br />", "\r\n");
// xml = Regex.Replace(xml, "\r\n +", "\r\n");
// xml = Regex.Replace(xml, "(\r\n){2,}", "\r\n");
// //aml = Regex.Replace(xml,"
// Application.DoEvents();
// byte[] bytes = Encoding.UTF8.GetBytes(xml);
// MemoryStream ms = new MemoryStream();
// ms.Write(bytes, 0, bytes.Length);
// ms.Position = 0;
// XmlDocument xDoc2 = new XmlDocument();
// xDoc2.Load(ms);
// //FileInfo fi = new FileInfo("C:\\Temp\\Alarm.xml");
// //StreamWriter sw = fi.CreateText();
// //sw.Write(xml);
// //sw.Close();
// //XmlDocument xDoc2 = new XmlDocument();
// //// Lookfor special characters
// ////FindSpecialCharacters(xml);
// //xDoc2.Load(fi.FullName);
// XmlNode xn3 = xDoc2.ChildNodes[1].ChildNodes[1].ChildNodes[0];
// string prcSerialNoFldName = GetProcInfo(xn3, 0, 0, 0);
// string prcSerialNoValue = GetProcInfo(xn3, 0, 1, 0);
// SerialNo = int.Parse(prcSerialNoValue);
// string prcTitleFldName = GetProcInfo(xn3, 1, 0, 0);
// string prcTitleValue = GetProcInfo(xn3, 1, 1, 0);
// string prcNumberFldName = GetProcInfo(xn3, 2, 0, 0);
// string prcNumberValue = GetProcInfo(xn3, 2, 1, 0);
// string prcSourceFldName = GetProcInfo(xn3, 3, 0, 0);
// string prcSourceValue = GetProcInfo(xn3, 3, 1, 0);
// string prcSetpointFldName = GetProcInfo(xn3, 4, 0, 0);
// string prcSetpointValue = GetProcInfo(xn3, 4, 1, 0);
// ProcNumber = prcNumberValue;
// ProcTitle = prcTitleValue;
// // Skip First Node
// UpdateHTML = false;
// tbPROMS.Clear();
// tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n",prcSerialNoFldName,prcSerialNoValue));
// tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n",prcTitleFldName,prcTitleValue));
// tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n",prcNumberFldName,prcNumberValue));
// tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n",prcSourceFldName,prcSourceValue));
// tbPROMS.AppendText(string.Format("{0} = '{1}'\r\n",prcSetpointFldName,prcSetpointValue));
// StringBuilder sbAllText = new StringBuilder();
// for (int i = 1; i < xDoc2.ChildNodes[1].ChildNodes[1].ChildNodes.Count; i++)
// {
// XmlNode xn2 = xDoc2.ChildNodes[1].ChildNodes[1].ChildNodes[i];
// sbAllText.Append(xn2.OuterXml);
// }
// tbPROMS.AppendText(sbAllText.ToString().Replace(" ", "\xB7"));
// SaveTree(sbAllText.ToString(), prcNumberValue, prcTitleValue);
// ProcTextAll = sbAllText.ToString();
// UpdateHTML = true;
//}
String ProcTextAll;
//int SerialNo;
String ProcNumber;
String ProcTitle;
private void SaveTree(string text, string procNumber, string procTitle)
{
tv.Nodes.Clear();
MemoryStream ms = GetMemoryStream(text);
using (TextReader tr = new StreamReader(ms))
{
Dictionary<int, TreeNode> lookup = new Dictionary<int, TreeNode>();
lookup.Add(0, tv.Nodes.Add(string.Format("{0} - {1}", procNumber, procTitle)));
int level = 0;
int lastLevel = 0;
int lastIndent = 0;
int extra = 0;
string lastTab = "";
Queue<string> enQueue = null;
Queue<string> deQueue = null;
while (tr.Peek() >= 0 || deQueue != null)
{
string lineText;
if (deQueue != null)
{
extra = 1;
lineText = deQueue.Dequeue();
if (deQueue.Count == 0)
deQueue = null;
}
else
{
extra = 0;
lineText = tr.ReadLine();
if (lineText == "NOTE")
enQueue = new Queue<string>();
if (lineText.StartsWith("<NOTE>"))
{
enQueue = new Queue<string>();
enQueue.Enqueue("NOTE");
}
lineText = lineText.Replace("<NOTE>", "");
}
// Strip XML Tags
lineText = Regex.Replace(lineText, "<[^<>]+>", "");
if (lineText.Replace("\t", "") != "")
{
Match m = Regex.Match(lineText, @"^(\t*)([1-9][0-9]*\.0|[1-9][0-9]*\.[1-9][0-9]*|[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*|\u2022)([\t ]+)([^\u2022]*)$", RegexOptions.Multiline);
string tab = m.Groups[2].Value;
int indent = m.Groups[1].Value.Length;
if (indent == 0 && tab.EndsWith(".0")) // High Level Step
{
level = 1;
if (deQueue == null && enQueue != null)
{
deQueue = enQueue;
enQueue = null;
}
}
else if (Regex.IsMatch(tab, "[1-9][0-9]*[.0-9]*")) // Substep
{
level = 1 + tab.Length - tab.Replace(".","").Length;
if (deQueue == null && enQueue != null)
{
deQueue = enQueue;
enQueue = null;
}
}
else if (tab == "") // Paragraph
{
if (Regex.IsMatch(lineText, "(NOTE|NOTES|CAUTION|CAUTIONS)")) extra = 0;
level = lastLevel + 1;
}
else if (tab == "\u2022")//bullet
level = indent + 2;
if (level < lastLevel)
while (level < lastLevel) lookup.Remove(lastLevel--);
string txt = string.Format("{0}|{1}||{2}", m.Groups[1].Value, m.Groups[2].Value, m.Groups[4].Value);
if (txt == "|||") txt = lineText;
if (enQueue == null)
{
if (level > lookup.Count - extra) extra = 0;
if(level + extra -1 == lookup.Count)
Console.WriteLine("Problems {0}, {1}",procNumber,txt);
else if (lookup.Count <= level)
lookup.Add(level + extra, lookup[level + extra - 1].Nodes.Add(txt));
else
lookup[level + extra] = lookup[level + extra - 1].Nodes.Add(txt);
}
else
{
enQueue.Enqueue(lineText);
}
lastTab = tab;
lastLevel = level;
lastIndent = indent;
}
}
}
}
//private ItemInfo FindPrevious(SortedDictionary<int, ItemInfo> dicSerialNo, int serialNo)
//{
// ItemInfo lastItem = null;
// foreach (int serno in dicSerialNo.Keys)
// {
// if (serno > serialNo)
// return lastItem;
// lastItem = dicSerialNo[serno];
// }
// return lastItem;
//}
private bool runOne = true;
private static MemoryStream GetMemoryStream(string text)
{
byte[] bytes = Encoding.UTF8.GetBytes(text);
MemoryStream ms = new MemoryStream(bytes);
ms.Position = 0;
return ms;
}
//private string GetProcInfo(XmlNode xn3, int p1, int p2, int p3)
//{
// return xn3.ChildNodes[p1].ChildNodes[p2].ChildNodes[p3].Value.Trim("\r\n ".ToCharArray());
//}
//private bool _UpdateHTML = true;
//public bool UpdateHTML
//{
// get { return _UpdateHTML; }
// set { _UpdateHTML = value; }
//}
private string IndentifySpecialCharacters(string txt)
{
StringBuilder sb = new StringBuilder();
foreach (char c in txt)
{
if (((int)c) < 32 || ((int)c) > 256)
sb.Append(string.Format("[x{0:X4}]", (int)c));
else
sb.Append(c == ' ' ? '\xb7' : c);
}
return sb.ToString();
}
private void btnRun_Click(object sender, EventArgs e)
{
ProcessTxt();
}
//Regex regColorCode = new Regex(@"(\<[^<>]+\>)([^<>]*)", RegexOptions.Singleline);
//Regex regColorCodeText = new Regex("(\t*)([^\t]*)", RegexOptions.Singleline);
//private void ColorCoded(string str)
//{
// rtbXML.Clear();
// Color fColor = Color.PaleTurquoise;
// Color fNext = Color.PaleTurquoise;
// foreach(Match m in regColorCode.Matches(str))
// {
// string fmt = m.Groups[1].Value;
// string txt = m.Groups[2].Value;
// if (fmt.StartsWith("<table"))
// fNext = fColor = Color.PaleGreen;
// else if (fmt == "</table>")
// fNext = Color.PaleTurquoise;
// else if (fmt == "<br />")
// fColor = Color.PeachPuff;
// else if (fmt == "</p>")
// fColor = Color.LightPink;
// AddToXML(fmt, fColor);
// fColor = fNext;
// foreach (Match mm in regColorCodeText.Matches(txt))
// {
// string tabs = mm.Groups[1].Value;
// string nontabs = mm.Groups[2].Value;
// AddToXML(tabs, Color.Khaki);
// AddToXML(nontabs, Color.Yellow);
// }
// }
//}
//private void AddToXML(string txt, Color fColor)
//{
// if(txt=="") return;
// rtbXML.SelectionStart = rtbXML.TextLength;
// rtbXML.SelectionBackColor = fColor;
// rtbXML.SelectedText = txt;
//}
private double GetMyOrder(Csla.SortedBindingList<FolderInfo> myList, string DVIFolderName)
{
double lastNum = 0;
// Console.WriteLine("--->>> FolderName {0} Insert Count {1}",DVIFolderName, myList.Count);
foreach (FolderInfo myFolder in myList)
{
// Console.WriteLine("--->>> FolderName {0} Insert Name {1} Insert Order {2}",DVIFolderName, myFolder.Name, myFolder.ManualOrder);
if (myFolder.Name.CompareTo(DVIFolderName) >= 0)
return (lastNum + (double)myFolder.ManualOrder) / 2.0;
lastNum = myFolder.ManualOrder ?? 1.0;
}
return lastNum + 1;
}
private void tmr_Tick(object sender, EventArgs e)
{
tmr.Enabled = false;
// If timer on the its ready to proccess
int idnew = 0;
string str = AutoFolder;
if (str != null && str.Length > 5)
{
DirectoryInfo di = new DirectoryInfo(str);
DocVersionInfo dvi = DocVersionInfo.Get((int)cmbDocVersion.SelectedValue);
VEPROMS.CSLA.Library.FolderInfo grandParent = dvi.ActiveParent.ActiveParent as FolderInfo;
using (VEPROMS.CSLA.Library.Folder flder = MakeFolder(str, grandParent))
{
ROFstInfo fst = dvi.DocVersionAssociations[0].MyROFst;
flder.ManualOrder = 0;
double myOrder = GetMyOrder(grandParent.SortedChildFolders, str); flder.ManualOrder = myOrder;
//Console.WriteLine("myOrder = {0}, flder = {1}", myOrder, flder.ManualOrder);
flder.Save();
// create a a DocVersion
using (DocVersion dv = DocVersion.MakeDocVersion(flder, "Working Draft", null, null, null, null))
{
dv.DocVersionAssociations.Add(fst.Get());
dv.Save();
idnew = dv.VersionID;
}
}
ProcessFolder(di, DocVersionInfo.Get(idnew));
}
this.Close();
}
private static Folder MakeFolder(string str, VEPROMS.CSLA.Library.FolderInfo grandParent)
{
int num = 0;
foreach(FolderInfo chld in grandParent.ChildFolders)
{
if(chld.Name.StartsWith(str))
{
if(chld.Name.StartsWith(str + "."))
{
string str2=chld.Name.Substring(str.Length+1);
num = Math.Max(int.Parse(str2)+1,num);
}
else num=1;
}
}
return Folder.MakeFolder(grandParent.Get(), null, str+(num==0?"":"." + num.ToString()), str, str.Substring(12, 2), null, 1, null);
}
private static string _AutoFolder = null;
private static string AutoFolder
{
get
{
if (_AutoFolder == null)
{
_AutoFolder = System.Environment.CommandLine;
_AutoFolder = _AutoFolder.Substring(_AutoFolder.IndexOf(@".exe"" ") + 6).Trim(" \t\r\n".ToCharArray());
}
if (_AutoFolder.Length < 1)
return null;
return _AutoFolder;
}
}
private void frmConvertAlarms_Load(object sender, EventArgs e)
{
_MyFlexGrid = new VlnFlexGrid();
LoadSettings();
SetEventHandlers();
string str = AutoFolder;
if (str != null && str.Length > 5)
{
tmr.Enabled = true;
}
}
private void SetEventHandlers()
{
tbFileName.TextChanged += tbFileName_TextChanged;
Move += frmConvertAlarms_Move;
Resize += frmConvertAlarms_Resize;
sc1.SplitterMoved += sc1_SplitterMoved;
//sc2.SplitterMoved += sc2_SplitterMoved;
tbServer.TextChanged+=tbServer_TextChanged;
cmbDatabase.TextChanged+=cmbDatabase_TextChanged;
cmbDatabase.Click += cmbDatabase_Click;
cmbDocVersion.TextChanged+=cmbDocVersion_TextChanged;
//BuildTableCombo();
//BuildProcedureSetCombo();
}
void cmbDatabase_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Database = cmbDatabase.Text;
Properties.Settings.Default.Save();
BuildProcedureSetCombo();
}
private void BuildProcedureSetCombo()
{
DocVersionInfoList dvil = DocVersionInfoList.Get();
cmbDocVersion.DataSource = dvil;
cmbDocVersion.DisplayMember = "SearchDVPath";
cmbDocVersion.ValueMember = "VersionId";
}
private void cmbDocVersion_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.ProcedureSet = (int) cmbDocVersion.SelectedValue;
Properties.Settings.Default.Save();
}
private void cmbDatabase_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.Database = cmbDatabase.Text;
Properties.Settings.Default.Save();
BuildProcedureSetCombo();
}
private void tbServer_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.SqlServer = tbServer.Text;
Properties.Settings.Default.Save();
string db = cmbDatabase.Text;
try
{
BuildDatabaseCombo();
}
catch (Exception ex)
{
tsslStatus.Text = ex.Message;
}
}
private void BuildDatabaseCombo()
{
string tmp = string.Format("Data Source={0};Initial Catalog={1};Integrated Security=True",tbServer.Text,"MASTER");
SqlConnection cn = new SqlConnection(tmp);
cn.Open();
// SqlDataAdapter da = new SqlDataAdapter("select name from sysdatabases where name like 'VEP%' order by name", cn);
//SqlDataAdapter da = new SqlDataAdapter("select name, case when object_id('[' + name + ']..Items') is null then 'Not PROMS' when object_id('[' + name + ']..Revisions') is not null then 'Approval' when object_id('[' + name + ']..ContentAudits') is not null then 'Change Manager' else 'Original' end functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn);
SqlDataAdapter da = new SqlDataAdapter("select name, 'Approval' functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn);
da.SelectCommand.CommandTimeout = 300; // 300 sec timeout
DataSet ds = new DataSet();
try
{
da.Fill(ds);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.GetType().Name, ex.Message);
throw (new Exception("Cannot Load Data List", ex));
}
cn.Close();
//System.Windows.Forms.ContextMenuStrip cms = new System.Windows.Forms.ContextMenuStrip();
//cms.Items.Add("Choose Database");
//System.Windows.Forms.ToolStripMenuItem tsmi = cms.Items[0] as System.Windows.Forms.ToolStripMenuItem;
//tsmi.BackColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.ActiveCaption);// System.Drawing.Color.Pink;
//tsmi.ForeColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.ActiveCaptionText);
//tsmi.Font = new System.Drawing.Font(tsmi.Font, System.Drawing.FontStyle.Bold);
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (dr["functionality"].ToString() == "Approval")
cmbDatabase.Items.Add( dr["name"].ToString());
}
}
void frmConvertAlarms_Resize(object sender, EventArgs e)
{
Properties.Settings.Default.Size = Size;
Properties.Settings.Default.Save();
}
void frmConvertAlarms_Move(object sender, EventArgs e)
{
Properties.Settings.Default.Location = Location;
Properties.Settings.Default.Save();
}
void tbFileName_TextChanged(object sender, EventArgs e)
{
Properties.Settings.Default.FileName = tbFileName.Text;
Properties.Settings.Default.Save();
}
private void sc1_SplitterMoved(object sender, SplitterEventArgs e)
{
Properties.Settings.Default.Split1 = sc1.SplitterDistance;
Properties.Settings.Default.Save();
}
private void LoadSettings()
{
Size = Properties.Settings.Default.Size;
Location = Properties.Settings.Default.Location;
if (Properties.Settings.Default.FileName != null && Properties.Settings.Default.FileName != "")
{
FileInfo fi = new FileInfo(Properties.Settings.Default.FileName);
tbFileName.Text = fi.FullName;
}
sc1.SplitterDistance = Properties.Settings.Default.Split1;
tbServer.Text = Properties.Settings.Default.SqlServer;
cmbDatabase.Text = Properties.Settings.Default.Database;
try
{
BuildDatabaseCombo();
Database.VEPROMS_Connection = string.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", tbServer.Text, cmbDatabase.Text);
BuildProcedureSetCombo();
cmbDocVersion.SelectedValue = Properties.Settings.Default.ProcedureSet;
}
catch (Exception ex)
{
tsslStatus.Text = ex.Message;
}
}
private void tsslStatus_Click(object sender, EventArgs e)
{
}
//private void rtbXML_SelectionChanged(object sender, EventArgs e)
//{
//}
//private void tbXML_TextChanged(object sender, EventArgs e)
//{
// if (UpdateHTML)
// {
// htmlChanged(tbXML.Text);
// XMLChanged(tbXML.Text);
// ColorCoded(tbXML.Text);
// }
//}
//private bool _UpdateTbXML = true;
//public bool UpdateTbXML
//{
// get { return _UpdateTbXML; }
// set { _UpdateTbXML = value; }
//}
//private void rtbXML_TextChanged(object sender, EventArgs e)
//{
// //if (UpdateHTML)
// //{
// // UpdateHTML = false;
// // htmlChanged(rtbXML.Text);
// // XMLChanged(rtbXML.Text);
// // tbXML.Text = rtbXML.Text;
// // UpdateHTML = true;
// //}
//}
private void btnConvert_Click(object sender, EventArgs e)
{
DocVersionInfo dvi = DocVersionInfo.Get((int)cmbDocVersion.SelectedValue);
try
{
SaveProcedure(ProcTextAll, ProcNumber, ProcTitle, dvi);
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}.{1} {2} {3}",dvi.MyFolder.Name,ProcNumber, ex.GetType().Name, ex.Message);
}
}
//SortedDictionary<int, ItemInfo> dicSerialNo;
private void btnAll_Click(object sender, EventArgs e)
{
//dicSerialNo = new SortedDictionary<int, ItemInfo>();
FileInfo fi = new FileInfo(tbFileName.Text);
DirectoryInfo di = fi.Directory;
// Loop through list
DocVersionInfo dvi = DocVersionInfo.Get((int)cmbDocVersion.SelectedValue);
ProcessFolder(di,dvi);
}
private void ProcessFolder(DirectoryInfo di, DocVersionInfo dvi)
{
runOne = false;
// Get List of files
//DocVersionInfo dvi = DocVersionInfo.Get((int)cmbDocVersion.SelectedValue);
foreach (FileInfo f in di.GetFiles("*.txt"))
{
if (f.Name.StartsWith("AlarmData") == false && f.Name.Length > 14)
{
tsslStatus.Text = f.Name;
Application.DoEvents();
// Process each file
try
{
ProcessTxtFile(f.FullName);
// Convert each file
//SaveProcedure(ProcTextAll, ProcNumber, ProcTitle, SerialNo);
SaveProcedure(ProcTextAll, ProcNumber, ProcTitle, dvi);
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}.{1} {2} {3}", di.Name, f.Name, ex.GetType().Name, ex.Message);
}
//SaveProcedure(ProcTextAll, ProcNumber, ProcTitle, dvi);
}
}
runOne = true;
}
private void statusStrip1_Click(object sender, EventArgs e)
{
if (tbPROMS.SelectedText != "")
{
tsslStatus.Text = string.Format("Selection = '{0}'", IndentifySpecialCharacters(tbPROMS.SelectedText));
Clipboard.Clear();
Clipboard.SetText(IndentifySpecialCharacters(tbPROMS.SelectedText));
}
}
private void statusStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (tbPROMS.SelectedText != "")
{
tsslStatus.Text = string.Format("Selection = '{0}'", IndentifySpecialCharacters(tbPROMS.SelectedText));
Clipboard.Clear();
Clipboard.SetText(IndentifySpecialCharacters(tbPROMS.SelectedText));
}
}
}
}

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ofd.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>87, 17</value>
</metadata>
<metadata name="tmr.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>203, 3</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -0,0 +1,48 @@
namespace ReadFile
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(540, 262);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace ReadFile
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Test();
}
public void Test()
{
// Use default replacement fallback for invalid encoding.
//UnicodeEncoding enc = new UnicodeEncoding(true, false, false);
UTF8Encoding enc = new UTF8Encoding();
// Define a string with various Unicode characters.
string str1 = "AB YZ 19 DEGREE \xb0 BULLET \x95 \uD800\udc05 \u00e4";
str1 += "Unicode characters. \u00a9 \u010C s \u0062\u0308";
Console.WriteLine("Created original string...\n");
// Convert string to byte array.
byte[] bytes = enc.GetBytes(str1);
FileStream fs = File.Create(@".\characters.bin");
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(bytes);
bw.Close();
// Read bytes from file.
FileStream fsIn = File.OpenRead(@".\characters.bin");
BinaryReader br = new BinaryReader(fsIn);
const int count = 10; // Number of bytes to read at a time.
byte[] bytesRead = new byte[10]; // Buffer (byte array).
int read; // Number of bytes actually read.
string str2 = String.Empty; // Decoded string.
// Try using Encoding object for all operations.
do
{
read = br.Read(bytesRead, 0, count);
str2 += enc.GetString(bytesRead, 0, read);
} while (read == count);
br.Close();
Console.WriteLine("Decoded string using UnicodeEncoding.GetString()...");
CompareForEquality(str1, str2);
Console.WriteLine();
// Use Decoder for all operations.
fsIn = File.OpenRead(@".\characters.bin");
br = new BinaryReader(fsIn);
Decoder decoder = enc.GetDecoder();
char[] chars = new char[50];
int index = 0; // Next character to write in array.
int written = 0; // Number of chars written to array.
do
{
read = br.Read(bytesRead, 0, count);
if (index + decoder.GetCharCount(bytesRead, 0, read) - 1 >= chars.Length)
Array.Resize(ref chars, chars.Length + 50);
written = decoder.GetChars(bytesRead, 0, read, chars, index);
index += written;
} while (read == count);
br.Close();
// Instantiate a string with the decoded characters.
string str3 = new String(chars, 0, index);
Console.WriteLine("Decoded string using UnicodeEncoding.Decoder.GetString()...");
CompareForEquality(str1, str3);
}
private static void CompareForEquality(string original, string decoded)
{
bool result = original.Equals(decoded);
Console.WriteLine("original = decoded: {0}",
original.Equals(decoded, StringComparison.Ordinal));
if (!result)
{
Console.WriteLine("Code points in original string:{0}",original);
foreach (var ch in original)
Console.Write("{0} ", Convert.ToUInt16(ch).ToString("X4"));
Console.WriteLine();
Console.WriteLine("Code points in decoded string:{0}",decoded);
foreach (var ch in decoded)
Console.Write("{0} ", Convert.ToUInt16(ch).ToString("X4"));
Console.WriteLine();
}
}
// The example displays the following output:
// Created original string...
//
// Decoded string using UnicodeEncoding.GetString()...
// original = decoded: False
// Code points in original string:
// 0041 0042 0020 0059 005A 0020 0031 0039 0020 D800 DC05 0020 00E4 0055 006E 0069 0063 006F
// 0064 0065 0020 0063 0068 0061 0072 0061 0063 0074 0065 0072 0073 002E 0020 00A9 0020 010C
// 0020 0073 0020 0062 0308
// Code points in decoded string:
// 0041 0042 0020 0059 005A 0020 0031 0039 0020 FFFD FFFD 0020 00E4 0055 006E 0069 0063 006F
// 0064 0065 0020 0063 0068 0061 0072 0061 0063 0074 0065 0072 0073 002E 0020 00A9 0020 010C
// 0020 0073 0020 0062 0308
//
// Decoded string using UnicodeEncoding.Decoder.GetString()...
// original = decoded: True
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ReadFile
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ReadFile")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReadFile")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d6efcdc1-06b8-4c4d-b126-515701db696b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ReadFile.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ReadFile.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ReadFile.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D83BC593-811C-4D32-81B2-9C6031AFDAF5}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ReadFile</RootNamespace>
<AssemblyName>ReadFile</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</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.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</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>

View File

@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = "relative:ReadFile"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>

View File

@ -0,0 +1,172 @@
using C1.Win.C1FlexGrid;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
namespace XMLConvert
{
public partial class frmConvertXML
{
private static void LoadTable2(XmlNode xn, StepLookup mySteps, int level)
{
XmlNode xn2 = xn.SelectSingleNode("tr/td/table");
if (xn2 != null) xn = xn2;
VlnFlexGrid fg = _MyFlexGrid;
fg.Font = new Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Point);
fg.Clear();
fg.Rows.Count = 1;
fg.Cols.Count = 1;
int rows = 0;
fg.MergedRanges.Clear();
foreach (XmlNode xr in xn.ChildNodes)
{
if (xr.Name == "tr")
{
++rows;
AddTableRow(xr, fg, rows);
}
}
fg.MyBorders = new VlnBorders(GridLinePattern.Single, fg.Rows.Count, fg.Cols.Count);
fg.BringToFront();
fg.Invalidate();
Application.DoEvents();
fg.MakeRTFcells();
//Well, Can I save the table
using (Step step = MakeCSLAStep(mySteps, mySteps.Count, null, "table", 20008, E_FromType.Table))
{
Grid.MakeGrid(step.MyContent, fg.GetXMLData(), "");
}
}
public static VlnFlexGrid _MyFlexGrid = null;
private static void AddTableRow(XmlNode xr, VlnFlexGrid fg, int rows)
{
if (rows > fg.Rows.Count)
fg.Rows.Count = rows;
int cols = 0;
foreach (XmlNode xc in xr.ChildNodes)
{
++cols;
//if (xc.InnerText.Contains("RC-V200"))
// Console.WriteLine(xc.InnerText);
//if (xc.InnerText.Contains("RC-V121"))
// Console.WriteLine(xc.InnerText);
//if (xc.InnerXml.Contains("AB 137") || xc.InnerXml.Contains("3013N01"))
// Console.WriteLine("here");
CellRange cr2 = GetMyMergedRange(fg, rows - 1, cols - 1);
//Console.WriteLine("Check {0}", cr2);
while (cr2.c1 != cols - 1 || cr2.r1 != rows - 1)
{
cols++;
cr2 = GetMyMergedRange(fg, rows - 1, cols - 1);
}
AddMergedCells(fg, rows, cols, xc);
//ShowMergedCells(fg);
if (xc.Name == "td")
{
AddTableColumn(xc, fg, rows, cols);
}
}
}
private static void ShowMergedCells(VlnFlexGrid fg)
{
for (int r = 0; r < fg.Rows.Count; r++)
{
for (int c = 0; c < fg.Cols.Count; c++)
{
CellRange cr3 = GetMyMergedRange(fg, r, c);
if (fg.MergedRanges.Contains(cr3))
Console.WriteLine("*** cr3 r={0},c={1},rng={2}", r, c, cr3);
}
}
}
private static int GetSpan(string span)
{
int retval = int.Parse("0" + (span ?? ""));
if (retval == 0) return 0;
return retval - 1;
}
private static void AddMergedCells(VlnFlexGrid fg, int rows, int cols, XmlNode xc)
{
string colspan = GetAttribute(xc, "colspan");
string rowspan = GetAttribute(xc, "rowspan");
if (colspan != null || rowspan != null)
{
//AddMergedRanges
int r1 = rows;
int c1 = cols;
int r2 = r1 + GetSpan(rowspan);
if (r2 > fg.Rows.Count) fg.Rows.Count = r2;
int c2 = c1 + GetSpan(colspan);
if (c2 > fg.Cols.Count) fg.Cols.Count = c2;
CellRange cr = new CellRange();
cr.r1 = r1 - 1;
cr.r2 = r2 - 1;
cr.c1 = c1 - 1;
cr.c2 = c2 - 1;
fg.MergedRanges.Add(cr);
//Console.WriteLine("Merged {0}", cr);
}
}
private static CellRange GetMyMergedRange(VlnFlexGrid fg, int r, int c)
{
foreach (CellRange cr in fg.MergedRanges)
{
if (cr.r1 <= r && cr.r2 >= r && cr.c1 <= c && cr.c2 >= c)
return cr;
}
return fg.GetMergedRange(r, c);
}
private static Regex regNumber = new Regex("^[0-9]+$", RegexOptions.Compiled);
private static void AddTableColumn(XmlNode xc, VlnFlexGrid fg, int rows, int cols)
{
//Console.WriteLine("Rows {0}, Cols {1}", rows, cols);
if (cols > fg.Cols.Count)
fg.Cols.Count = cols;
string width = GetAttribute(xc, "width");
if (width != null && width != "" && regNumber.IsMatch(width))
{
if (width.EndsWith("%"))
fg.Cols[cols - 1].Width = (int)(int.Parse(width.Replace("%", "")) * 96 * 6.5F / 100);
else
fg.Cols[cols - 1].Width = int.Parse(width) * 96 / 72;
}
StringBuilder sb = new StringBuilder();
string prefix = "";
foreach (XmlNode xn in xc.ChildNodes)
{
if (xn.Name == "p")
{
sb.Append(prefix + xn.InnerText);
}
if (xn.Name == "ul")
{
foreach (XmlNode xn2 in xn.ChildNodes)
{
if (xn2.Name == "li")
{
sb.Append(prefix + "*" + xn.InnerText);
}
if (xn2.Name == "p")
{
sb.Append(prefix + xn.InnerText);
}
}
}
}
if (width != null && width != "" && !regNumber.IsMatch(width))
{
Console.WriteLine("*** width is not a number {0}, rows {1}, cols {2}, Text='{3}'", width, rows, cols, xc.OuterXml);
}
fg[rows - 1, cols - 1] = sb.ToString();
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace XMLConvert
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmConvertXML());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XMLConvert")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("XMLConvert")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("76909147-264a-4d49-84e9-6c6da792991a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace XMLConvert.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("XMLConvert.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace XMLConvert.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1 @@
C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.2, Version=2.6.20142.835, Culture=neutral, PublicKeyToken=79882d576c6336da

View File

@ -0,0 +1,319 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace XMLConvert
{
public partial class frmConvertXML
{
private string xmlSample1 = @"<C1FlexGrid version='1.0.5612.18617'>
<Control>
<MyBorderDetailString>&lt;?xml version='1.0' encoding='utf-16'?&gt;
&lt;VlnBorders Rows='5' Columns='3'&gt;
&lt;VerticalLines Rows='5' Columns='4'&gt;
&lt;Lines&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;/Lines&gt;
&lt;/VerticalLines&gt;
&lt;HorizontalLines Rows='6' Columns='3'&gt;
&lt;Lines&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;GridLinePattern&gt;Single&lt;/GridLinePattern&gt;
&lt;/Lines&gt;
&lt;/HorizontalLines&gt;
&lt;/VlnBorders&gt;</MyBorderDetailString>
<MyBorders>Volian Custom Borders</MyBorders>
<IsRoTable>False</IsRoTable>
<RODbId>0</RODbId>
<DPI>96</DPI>
<FirstEntry>False</FirstEntry>
<BorderColor>Black</BorderColor>
<StyleBackColor>255, 255, 255</StyleBackColor>
<AllowMerging>Custom</AllowMerging>
<AllowResizing>Both</AllowResizing>
<HighLight>WithFocus</HighLight>
<FocusRect>Solid</FocusRect>
<DrawMode>OwnerDraw</DrawMode>
<BackColor>255, 255, 255</BackColor>
<VisualStyle>Custom</VisualStyle>
<ScrollBars>None</ScrollBars>
<Cursor>Default</Cursor>
<Font>Courier New, 12pt</Font>
<Margin>3, 3, 3, 3</Margin>
<MaximumSize>0, 0</MaximumSize>
<MinimumSize>0, 0</MinimumSize>
<RightToLeft>No</RightToLeft>
<Padding>0, 0, 0, 0</Padding>
<ImeMode>NoControl</ImeMode>
</Control>
<ColumnInfo>
<Count>3</Count>
<Fixed>0</Fixed>
<DefaultSize>125</DefaultSize>
</ColumnInfo>
<Columns>
<Column index='0'>
<Width>68</Width>
</Column>
<Column index='1'>
<Width>178</Width>
</Column>
<Column index='2'>
<Width>368</Width>
</Column>
</Columns>
<RowInfo>
<Count>5</Count>
<Fixed>0</Fixed>
<DefaultSize>25</DefaultSize>
</RowInfo>
<Rows>
<Row index='0'>
<Height>25</Height>
</Row>
<Row index='1'>
<Height>25</Height>
</Row>
<Row index='2'>
<Height>25</Height>
</Row>
<Row index='3'>
<Height>25</Height>
</Row>
<Row index='4'>
<Height>51</Height>
</Row>
</Rows>
<Cells>
<Cell index='0,0'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 PROC \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='0,1'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 PROC TITLE \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='0,2'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 FUNCTION \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='1,0'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 R-3 \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='1,1'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 Restore CCW \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='1,2'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 Cross-tie CCW from Unit Two \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='2,0'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 R-11 \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='2,1'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 Restore RHR \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='2,2'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 Repower RHR pump(s) from Unit Two \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='3,0'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 LS-2 \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='3,1'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 Start-up AFW \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='3,2'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 Cross-tie AFW from Unit Two \par
}
</Data>
<UserData type='System.Int32'>16</UserData>
</Cell>
<Cell index='4,0'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 LS-6 \par
\par
\par
}
</Data>
<UserData type='System.Int32'>48</UserData>
</Cell>
<Cell index='4,1'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 RCS Make-up \par
With CVCS \par
Cross-tie \par
}
</Data>
<UserData type='System.Int32'>48</UserData>
</Cell>
<Cell index='4,2'>
<Data>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Courier New;}}
\viewkind4\uc1\pard\sl-240\slmult0\f0\fs24 CVCS Cross-tie For Level Control\par
\par
}
</Data>
<UserData type='System.Int32'>32</UserData>
</Cell>
</Cells>
<Styles>
<Style>
<Name>Normal</Name>
<Definition>Font:Courier New, 12pt;BackColor:255, 255, 255;TextAlign:LeftTop;Border:Flat,1,Black,Both;</Definition>
</Style>
<Style>
<Name>Alternate</Name>
<Definition>BackColor:255, 255, 255;</Definition>
</Style>
<Style>
<Name>Fixed</Name>
<Definition>BackColor:Control;ForeColor:ControlText;Border:Flat,1,ControlDark,Both;BackgroundImageLayout:Hide;</Definition>
</Style>
<Style>
<Name>Highlight</Name>
<Definition>BackColor:LightCyan;ForeColor:Black;</Definition>
</Style>
<Style>
<Name>Focus</Name>
<Definition>BackColor:LightCyan;ForeColor:Black;</Definition>
</Style>
<Style>
<Name>Editor</Name>
</Style>
<Style>
<Name>Search</Name>
<Definition>BackColor:Highlight;ForeColor:HighlightText;</Definition>
</Style>
<Style>
<Name>Frozen</Name>
<Definition>BackColor:Beige;</Definition>
</Style>
<Style>
<Name>NewRow</Name>
<Definition>ForeColor:GrayText;</Definition>
</Style>
<Style>
<Name>EmptyArea</Name>
<Definition>BackColor:Transparent;Border:None,1,Black,Both;</Definition>
</Style>
<Style>
<Name>SelectedColumnHeader</Name>
</Style>
<Style>
<Name>SelectedRowHeader</Name>
</Style>
<Style>
<Name>GrandTotal</Name>
<Definition>BackColor:Black;ForeColor:White;</Definition>
</Style>
<Style>
<Name>Subtotal0</Name>
<Definition>BackColor:ControlDarkDark;ForeColor:White;</Definition>
</Style>
<Style>
<Name>Subtotal1</Name>
<Definition>BackColor:ControlDarkDark;ForeColor:White;</Definition>
</Style>
<Style>
<Name>Subtotal2</Name>
<Definition>BackColor:ControlDarkDark;ForeColor:White;</Definition>
</Style>
<Style>
<Name>Subtotal3</Name>
<Definition>BackColor:ControlDarkDark;ForeColor:White;</Definition>
</Style>
<Style>
<Name>Subtotal4</Name>
<Definition>BackColor:ControlDarkDark;ForeColor:White;</Definition>
</Style>
<Style>
<Name>Subtotal5</Name>
<Definition>BackColor:ControlDarkDark;ForeColor:White;</Definition>
</Style>
<Style>
<Name>FilterEditor</Name>
</Style>
<Style>
<Name>FirstCustomStyle</Name>
</Style>
</Styles>
</C1FlexGrid>";
}
}

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C621AE2E-6AFC-41C6-A3D4-F6CAA7ABF2CF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>XMLConvert</RootNamespace>
<AssemblyName>XMLConvert</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="C1.Win.C1FlexGrid.2, Version=2.6.20142.835, Culture=neutral, PublicKeyToken=79882d576c6336da, processorArchitecture=MSIL" />
<Reference Include="Csla">
<HintPath>..\..\..\..\..\..\..\Development\csla20cs\Csla\bin\Debug\Csla.dll</HintPath>
</Reference>
<Reference Include="DevComponents.DotNetBar2, Version=14.0.0.11, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04, processorArchitecture=MSIL" />
<Reference Include="log4net">
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="VEPROMS.CSLA.Library">
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\VEPROMS.CSLA.Library.dll</HintPath>
</Reference>
<Reference Include="Volian.Base.Library, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Development\Proms\VEPROMS.CSLA.Library\bin\Debug\Volian.Base.Library.dll</HintPath>
</Reference>
<Reference Include="Volian.Controls.Library">
<HintPath>..\..\..\..\..\..\..\Development\Proms\Volian.Controls.Library\bin\Debug\Volian.Controls.Library.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ConvertTable.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SampleXML.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmConvertXML.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmConvertXML.Designer.cs">
<DependentUpon>frmConvertXML.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="vlnhtml.cs" />
<EmbeddedResource Include="frmConvertXML.resx">
<DependentUpon>frmConvertXML.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</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>

View File

@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = "relative:XMLConvert"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,434 @@
namespace XMLConvert
{
partial class frmConvertXML
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.tbFile = new System.Windows.Forms.TextBox();
this.btnLoad = new System.Windows.Forms.Button();
this.tbResults = new System.Windows.Forms.TextBox();
this.btnFindNodeTypes = new System.Windows.Forms.Button();
this.btnStructure = new System.Windows.Forms.Button();
this.btnLoadContent = new System.Windows.Forms.Button();
this.btnLoadProcedure = new System.Windows.Forms.Button();
this.btnBrowse = new System.Windows.Forms.Button();
this.ofd = new System.Windows.Forms.OpenFileDialog();
this.pbSection = new DevComponents.DotNetBar.Controls.ProgressBarX();
this.pbStep = new DevComponents.DotNetBar.Controls.ProgressBarX();
this.btnAll = new System.Windows.Forms.Button();
this.btnAllStructure = new System.Windows.Forms.Button();
this.pbProcs = new DevComponents.DotNetBar.Controls.ProgressBarX();
this.btnAllStructure2 = new System.Windows.Forms.Button();
this.lblProcedure = new System.Windows.Forms.Label();
this.lblSection = new System.Windows.Forms.Label();
this.lblStep = new System.Windows.Forms.Label();
this.btnAllContent = new System.Windows.Forms.Button();
this.btnHTML = new System.Windows.Forms.Button();
this.btnHTML2 = new System.Windows.Forms.Button();
this.btnCandN = new System.Windows.Forms.Button();
this.btnHTLM3 = new System.Windows.Forms.Button();
this.btnAllContent2 = new System.Windows.Forms.Button();
this.btnVerbs = new System.Windows.Forms.Button();
this.btnFigures = new System.Windows.Forms.Button();
this.btnTables = new System.Windows.Forms.Button();
this.bntTable2 = new System.Windows.Forms.Button();
this.btnStepOrNo = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(22, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(48, 13);
this.label1.TabIndex = 0;
this.label1.Text = "XML File";
//
// tbFile
//
this.tbFile.Location = new System.Drawing.Point(85, 17);
this.tbFile.Name = "tbFile";
this.tbFile.Size = new System.Drawing.Size(578, 20);
this.tbFile.TabIndex = 1;
this.tbFile.Text = "C:\\Development\\Proms\\Barakah\\AOPRev1\\AOP CPP Batch 1\\XML\\procedure\\1N2-OP-AOP-MP-" +
"0001 Rev01 FINAL - Main Transformer Abnormal.xml";
//
// btnLoad
//
this.btnLoad.Location = new System.Drawing.Point(12, 43);
this.btnLoad.Name = "btnLoad";
this.btnLoad.Size = new System.Drawing.Size(58, 23);
this.btnLoad.TabIndex = 2;
this.btnLoad.Text = "Load";
this.btnLoad.UseVisualStyleBackColor = true;
this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
//
// tbResults
//
this.tbResults.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbResults.Location = new System.Drawing.Point(12, 183);
this.tbResults.Multiline = true;
this.tbResults.Name = "tbResults";
this.tbResults.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.tbResults.Size = new System.Drawing.Size(726, 351);
this.tbResults.TabIndex = 3;
this.tbResults.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbResults_KeyDown);
//
// btnFindNodeTypes
//
this.btnFindNodeTypes.Location = new System.Drawing.Point(76, 43);
this.btnFindNodeTypes.Name = "btnFindNodeTypes";
this.btnFindNodeTypes.Size = new System.Drawing.Size(92, 23);
this.btnFindNodeTypes.TabIndex = 4;
this.btnFindNodeTypes.Text = "FindNodeTypes";
this.btnFindNodeTypes.UseVisualStyleBackColor = true;
this.btnFindNodeTypes.Click += new System.EventHandler(this.btnFindNodeTypes_Click);
//
// btnStructure
//
this.btnStructure.Location = new System.Drawing.Point(174, 43);
this.btnStructure.Name = "btnStructure";
this.btnStructure.Size = new System.Drawing.Size(59, 23);
this.btnStructure.TabIndex = 5;
this.btnStructure.Text = "Structure";
this.btnStructure.UseVisualStyleBackColor = true;
this.btnStructure.Click += new System.EventHandler(this.btnStructure_Click);
//
// btnLoadContent
//
this.btnLoadContent.Location = new System.Drawing.Point(270, 43);
this.btnLoadContent.Name = "btnLoadContent";
this.btnLoadContent.Size = new System.Drawing.Size(83, 23);
this.btnLoadContent.TabIndex = 6;
this.btnLoadContent.Text = "Load Content";
this.btnLoadContent.UseVisualStyleBackColor = true;
this.btnLoadContent.Click += new System.EventHandler(this.btnLoadContent_Click);
//
// btnLoadProcedure
//
this.btnLoadProcedure.AccessibleDescription = "z";
this.btnLoadProcedure.Location = new System.Drawing.Point(643, 43);
this.btnLoadProcedure.Name = "btnLoadProcedure";
this.btnLoadProcedure.Size = new System.Drawing.Size(95, 23);
this.btnLoadProcedure.TabIndex = 7;
this.btnLoadProcedure.Text = "Load Procedure";
this.btnLoadProcedure.UseVisualStyleBackColor = true;
this.btnLoadProcedure.Click += new System.EventHandler(this.btnLoadProcedure_Click);
//
// btnBrowse
//
this.btnBrowse.Location = new System.Drawing.Point(669, 14);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(75, 23);
this.btnBrowse.TabIndex = 8;
this.btnBrowse.Text = "Browse";
this.btnBrowse.UseVisualStyleBackColor = true;
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
//
// ofd
//
this.ofd.FileName = "openFileDialog1";
//
// pbSection
//
//
//
//
this.pbSection.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.pbSection.Location = new System.Drawing.Point(99, 141);
this.pbSection.Name = "pbSection";
this.pbSection.Size = new System.Drawing.Size(639, 12);
this.pbSection.TabIndex = 9;
this.pbSection.Text = "progressBarX1";
//
// pbStep
//
//
//
//
this.pbStep.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.pbStep.Location = new System.Drawing.Point(99, 159);
this.pbStep.Name = "pbStep";
this.pbStep.Size = new System.Drawing.Size(639, 13);
this.pbStep.TabIndex = 10;
this.pbStep.Text = "progressBarX2";
//
// btnAll
//
this.btnAll.Location = new System.Drawing.Point(705, 72);
this.btnAll.Name = "btnAll";
this.btnAll.Size = new System.Drawing.Size(33, 23);
this.btnAll.TabIndex = 11;
this.btnAll.Text = "All";
this.btnAll.UseVisualStyleBackColor = true;
this.btnAll.Click += new System.EventHandler(this.btnAll_Click);
//
// btnAllStructure
//
this.btnAllStructure.Location = new System.Drawing.Point(186, 72);
this.btnAllStructure.Name = "btnAllStructure";
this.btnAllStructure.Size = new System.Drawing.Size(47, 23);
this.btnAllStructure.TabIndex = 12;
this.btnAllStructure.Text = "All Structure";
this.btnAllStructure.UseVisualStyleBackColor = true;
this.btnAllStructure.Click += new System.EventHandler(this.btnAllStructure_Click);
//
// pbProcs
//
//
//
//
this.pbProcs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.pbProcs.Location = new System.Drawing.Point(99, 123);
this.pbProcs.Name = "pbProcs";
this.pbProcs.Size = new System.Drawing.Size(639, 12);
this.pbProcs.TabIndex = 13;
this.pbProcs.Text = "progressBarX1";
//
// btnAllStructure2
//
this.btnAllStructure2.Location = new System.Drawing.Point(186, 94);
this.btnAllStructure2.Name = "btnAllStructure2";
this.btnAllStructure2.Size = new System.Drawing.Size(47, 23);
this.btnAllStructure2.TabIndex = 14;
this.btnAllStructure2.Text = "All Structure";
this.btnAllStructure2.UseVisualStyleBackColor = true;
this.btnAllStructure2.Click += new System.EventHandler(this.btnAllStructure2_Click);
//
// lblProcedure
//
this.lblProcedure.Location = new System.Drawing.Point(12, 123);
this.lblProcedure.Name = "lblProcedure";
this.lblProcedure.Size = new System.Drawing.Size(86, 18);
this.lblProcedure.TabIndex = 15;
this.lblProcedure.Text = "Procedure";
//
// lblSection
//
this.lblSection.Location = new System.Drawing.Point(12, 141);
this.lblSection.Name = "lblSection";
this.lblSection.Size = new System.Drawing.Size(86, 18);
this.lblSection.TabIndex = 16;
this.lblSection.Text = "Section";
//
// lblStep
//
this.lblStep.Location = new System.Drawing.Point(12, 160);
this.lblStep.Name = "lblStep";
this.lblStep.Size = new System.Drawing.Size(86, 18);
this.lblStep.TabIndex = 17;
this.lblStep.Text = "Step";
//
// btnAllContent
//
this.btnAllContent.Location = new System.Drawing.Point(270, 72);
this.btnAllContent.Name = "btnAllContent";
this.btnAllContent.Size = new System.Drawing.Size(33, 23);
this.btnAllContent.TabIndex = 18;
this.btnAllContent.Text = "All";
this.btnAllContent.UseVisualStyleBackColor = true;
this.btnAllContent.Click += new System.EventHandler(this.btnAllContent_Click);
//
// btnHTML
//
this.btnHTML.Location = new System.Drawing.Point(359, 43);
this.btnHTML.Name = "btnHTML";
this.btnHTML.Size = new System.Drawing.Size(51, 23);
this.btnHTML.TabIndex = 19;
this.btnHTML.Text = "HTML";
this.btnHTML.UseVisualStyleBackColor = true;
this.btnHTML.Click += new System.EventHandler(this.btnHTML_Click);
//
// btnHTML2
//
this.btnHTML2.Location = new System.Drawing.Point(359, 72);
this.btnHTML2.Name = "btnHTML2";
this.btnHTML2.Size = new System.Drawing.Size(51, 23);
this.btnHTML2.TabIndex = 20;
this.btnHTML2.Text = "HTML2";
this.btnHTML2.UseVisualStyleBackColor = true;
this.btnHTML2.Click += new System.EventHandler(this.btnHTML2_Click);
//
// btnCandN
//
this.btnCandN.Location = new System.Drawing.Point(416, 43);
this.btnCandN.Name = "btnCandN";
this.btnCandN.Size = new System.Drawing.Size(58, 23);
this.btnCandN.TabIndex = 21;
this.btnCandN.Text = "C and N";
this.btnCandN.UseVisualStyleBackColor = true;
this.btnCandN.Click += new System.EventHandler(this.btnCandN_Click);
//
// btnHTLM3
//
this.btnHTLM3.Location = new System.Drawing.Point(359, 94);
this.btnHTLM3.Name = "btnHTLM3";
this.btnHTLM3.Size = new System.Drawing.Size(51, 23);
this.btnHTLM3.TabIndex = 22;
this.btnHTLM3.Text = "HTML3";
this.btnHTLM3.UseVisualStyleBackColor = true;
this.btnHTLM3.Click += new System.EventHandler(this.btnHTLM3_Click);
//
// btnAllContent2
//
this.btnAllContent2.Location = new System.Drawing.Point(270, 94);
this.btnAllContent2.Name = "btnAllContent2";
this.btnAllContent2.Size = new System.Drawing.Size(33, 23);
this.btnAllContent2.TabIndex = 18;
this.btnAllContent2.Text = "All2";
this.btnAllContent2.UseVisualStyleBackColor = true;
this.btnAllContent2.Click += new System.EventHandler(this.btnAllContent2_Click);
//
// btnVerbs
//
this.btnVerbs.Location = new System.Drawing.Point(416, 72);
this.btnVerbs.Name = "btnVerbs";
this.btnVerbs.Size = new System.Drawing.Size(58, 23);
this.btnVerbs.TabIndex = 23;
this.btnVerbs.Text = "Verbs";
this.btnVerbs.UseVisualStyleBackColor = true;
this.btnVerbs.Click += new System.EventHandler(this.btnVerbs_Click);
//
// btnFigures
//
this.btnFigures.Location = new System.Drawing.Point(416, 94);
this.btnFigures.Name = "btnFigures";
this.btnFigures.Size = new System.Drawing.Size(58, 24);
this.btnFigures.TabIndex = 24;
this.btnFigures.Text = "Figures";
this.btnFigures.UseVisualStyleBackColor = true;
this.btnFigures.Click += new System.EventHandler(this.btnFigures_Click);
//
// btnTables
//
this.btnTables.Location = new System.Drawing.Point(480, 72);
this.btnTables.Name = "btnTables";
this.btnTables.Size = new System.Drawing.Size(65, 23);
this.btnTables.TabIndex = 25;
this.btnTables.Text = "Tables";
this.btnTables.UseVisualStyleBackColor = true;
this.btnTables.Click += new System.EventHandler(this.btnTables_Click);
//
// bntTable2
//
this.bntTable2.Location = new System.Drawing.Point(558, 72);
this.bntTable2.Name = "bntTable2";
this.bntTable2.Size = new System.Drawing.Size(67, 22);
this.bntTable2.TabIndex = 26;
this.bntTable2.Text = "Table2";
this.bntTable2.UseVisualStyleBackColor = true;
this.bntTable2.Click += new System.EventHandler(this.bntTable2_Click);
//
// btnStepOrNo
//
this.btnStepOrNo.Location = new System.Drawing.Point(480, 43);
this.btnStepOrNo.Name = "btnStepOrNo";
this.btnStepOrNo.Size = new System.Drawing.Size(73, 23);
this.btnStepOrNo.TabIndex = 27;
this.btnStepOrNo.Text = "StepOrNot";
this.btnStepOrNo.UseVisualStyleBackColor = true;
this.btnStepOrNo.Click += new System.EventHandler(this.btnStepOrNo_Click);
//
// frmConvertXML
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(750, 557);
this.Controls.Add(this.btnStepOrNo);
this.Controls.Add(this.bntTable2);
this.Controls.Add(this.btnTables);
this.Controls.Add(this.btnFigures);
this.Controls.Add(this.btnVerbs);
this.Controls.Add(this.btnHTLM3);
this.Controls.Add(this.btnCandN);
this.Controls.Add(this.btnHTML2);
this.Controls.Add(this.btnHTML);
this.Controls.Add(this.btnAllContent2);
this.Controls.Add(this.btnAllContent);
this.Controls.Add(this.lblStep);
this.Controls.Add(this.lblSection);
this.Controls.Add(this.lblProcedure);
this.Controls.Add(this.btnAllStructure2);
this.Controls.Add(this.pbProcs);
this.Controls.Add(this.btnAllStructure);
this.Controls.Add(this.btnAll);
this.Controls.Add(this.pbStep);
this.Controls.Add(this.pbSection);
this.Controls.Add(this.btnBrowse);
this.Controls.Add(this.btnLoadProcedure);
this.Controls.Add(this.btnLoadContent);
this.Controls.Add(this.btnStructure);
this.Controls.Add(this.btnFindNodeTypes);
this.Controls.Add(this.tbResults);
this.Controls.Add(this.btnLoad);
this.Controls.Add(this.tbFile);
this.Controls.Add(this.label1);
this.Name = "frmConvertXML";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbFile;
private System.Windows.Forms.Button btnLoad;
private System.Windows.Forms.TextBox tbResults;
private System.Windows.Forms.Button btnFindNodeTypes;
private System.Windows.Forms.Button btnStructure;
private System.Windows.Forms.Button btnLoadContent;
private System.Windows.Forms.Button btnLoadProcedure;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.OpenFileDialog ofd;
private DevComponents.DotNetBar.Controls.ProgressBarX pbSection;
private DevComponents.DotNetBar.Controls.ProgressBarX pbStep;
private System.Windows.Forms.Button btnAll;
private System.Windows.Forms.Button btnAllStructure;
private DevComponents.DotNetBar.Controls.ProgressBarX pbProcs;
private System.Windows.Forms.Button btnAllStructure2;
private System.Windows.Forms.Label lblProcedure;
private System.Windows.Forms.Label lblSection;
private System.Windows.Forms.Label lblStep;
private System.Windows.Forms.Button btnAllContent;
private System.Windows.Forms.Button btnHTML;
private System.Windows.Forms.Button btnHTML2;
private System.Windows.Forms.Button btnCandN;
private System.Windows.Forms.Button btnHTLM3;
private System.Windows.Forms.Button btnAllContent2;
private System.Windows.Forms.Button btnVerbs;
private System.Windows.Forms.Button btnFigures;
private System.Windows.Forms.Button btnTables;
private System.Windows.Forms.Button bntTable2;
private System.Windows.Forms.Button btnStepOrNo;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ofd.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>

View File

@ -0,0 +1,742 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Xml;
using System.Xml.Schema;
using System.IO;
namespace XMLConvert
{
/// <summary>
/// Root Node
/// </summary>
[XmlRoot("html")]
public class vlnhtml : VlnHtmlContainer
{
}
[TypeConverter(typeof(ExpandableObjectConverter))]
/// <summary>
/// Part
/// </summary>
public class VlnHtmlPart
{
#region ID
protected string _ID = string.Empty;
[System.ComponentModel.DefaultValueAttribute("")]
[XmlIgnore]
public string ID
{
get { return _ID; }
set { _ID = value; }
}
#endregion
//#region Parent and Containing Svg
//// ToDo: MyParent
//private SvgPartGrouping _MyParent;
//[XmlIgnore()]
//public SvgPartGrouping MyParent
//{
// get { return _MyParent; }
// set { _MyParent = value; }
//}
//// ToDo: MySvg
//private Svg _MySvg;
//public Svg MySvg
//{
// get { return _MySvg; }
// set { _MySvg = value; }
//}
//internal void SetParent(SvgPartGrouping myParent)
//{
// _MyParent = myParent;
// _MySvg = myParent.MySvg == null? MyParent : myParent.MySvg;
//}
//#endregion
#region Dictionary of Parts
internal virtual void AddLookup(Dictionary<string, VlnHtmlPart> lookUp)
{
if (_ID != string.Empty && !lookUp.ContainsKey(_ID))
lookUp.Add(_ID, this);
}
#endregion
}
[Serializable()]
[TypeConverter(typeof(VlnHtmlPartsConverter))]
/// <summary>
/// Parts
/// </summary>
public class VlnHtmlParts : CollectionBase, ICustomTypeDescriptor
{
/// <summary>Notifies when the collection has been modified.</summary>
public event EventHandler OnItemsChanged;
/// <summary>Notifies that an item has been added.</summary>
public event VlnHtmlPartHandler OnItemAdd;
/// <summary>Notifies that items have been added.</summary>
public event VlnHtmlPartHandler OnItemsAdd;
/// <summary>Notifies that an item has been removed.</summary>
public event VlnHtmlPartHandler OnItemRemove;
/// <summary>
/// <para>
/// Initializes a new instance of <see cref='VlnHtmlPart'/>.
/// </para>
/// </summary>
public VlnHtmlParts()
{
}
/// <summary>
/// <para>
/// Initializes a new instance of <see cref='VlnHtmlPart'/> based on another <see cref='VlnHtmlPart'/>.
/// </para>
/// </summary>
/// <param name='value'>
/// A <see cref='VlnHtmlPart'/> from which the contents are copied
/// </param>
public VlnHtmlParts(VlnHtmlParts value)
{
this.AddRange(value);
}
/// <summary>
/// <para>
/// Initializes a new instance of <see cref='VlnHtmlPart'/> containing any array of <see cref='VlnHtmlPart'/> objects.
/// </para>
/// </summary>
/// <param name='value'>
/// A array of <see cref='VlnHtmlPart'/> objects with which to intialize the collection
/// </param>
public VlnHtmlParts(VlnHtmlPart[] value)
{
this.AddRange(value);
}
/// <summary>
/// <para>Represents the entry at the specified index of the <see cref='VlnHtmlPart'/>.</para>
/// </summary>
/// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
/// <value>
/// <para> The entry at the specified index of the collection.</para>
/// </value>
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
public VlnHtmlPart this[int index]
{
get { return ((VlnHtmlPart)(List[index])); }
set { List[index] = value; }
}
//#region SetupInheritance
//internal void SetupInheritance(SvgInheritedSettings myParentsSettings)
//{
// foreach (vlnhtmlpart vlnhtmlpart in List)
// vlnhtmlpart.SetupInheritance(myParentsSettings);
//}
//#endregion
#region Dictionary of Parts
internal void AddLookup(Dictionary<string, VlnHtmlPart> lookUp)
{
foreach (VlnHtmlPart vlnhtmlpart in List)
vlnhtmlpart.AddLookup(lookUp);
}
#endregion
internal static void ShowException(Exception ex)
{
StringBuilder sb = new StringBuilder();
string sep = "";
for (Exception ex1 = ex; ex1 != null; ex1 = ex1.InnerException)
{
sb.Append(sep + string.Format("ShowException {0} - {1}", ex1.GetType().Name, ex1.Message));
sep = "\r\n";
}
Console.WriteLine(sb);
}
/// <summary>
/// <para>Adds a <see cref='VlnHtmlPart'/> with the specified value to the
/// <see cref='VlnHtmlPart'/> .</para>
/// </summary>
/// <param name='value'>The <see cref='VlnHtmlPart'/> to add.</param>
/// <returns>
/// <para>The index at which the new element was inserted.</para>
/// </returns>
/// <seealso cref='VlnHtmlParts.AddRange'/>
public int Add(VlnHtmlPart value)
{
int ndx = List.Add(value);
if (OnItemAdd != null) { OnItemAdd(this, new vlnhtmlpartArgs(value)); }
if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); }
return ndx;
}
/// <summary>
/// <para>Copies the elements of an array to the end of the <see cref='VlnHtmlPart'/>.</para>
/// </summary>
/// <param name='value'>
/// An array of type <see cref='VlnHtmlPart'/> containing the objects to add to the collection.
/// </param>
/// <returns>
/// <para>None.</para>
/// </returns>
/// <seealso cref='VlnHtmlParts.Add'/>
public void AddRange(VlnHtmlPart[] value)
{
for (int i = 0; i < value.Length; i++)
{
this.Add(value[i]);
}
if (OnItemsAdd != null) { OnItemsAdd(this, new vlnhtmlpartArgs(value)); }
if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); }
}
/// <summary>
/// <para>
/// Adds the contents of another <see cref='VlnHtmlPart'/> to the end of the collection.
/// </para>
/// </summary>
/// <param name='value'>
/// A <see cref='VlnHtmlPart'/> containing the objects to add to the collection.
/// </param>
/// <returns>
/// <para>None.</para>
/// </returns>
/// <seealso cref='VlnHtmlParts.Add'/>
public void AddRange(VlnHtmlParts value)
{
for (int i = 0; i < value.Count; i++)
{
this.Add(value[i]);
}
if (OnItemsAdd != null) { OnItemsAdd(this, new vlnhtmlpartArgs(value)); }
if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); }
}
/// <summary>
/// <para>Gets a value indicating whether the
/// <see cref='VlnHtmlPart'/> contains the specified <see cref='VlnHtmlPart'/>.</para>
/// </summary>
/// <param name='value'>The <see cref='VlnHtmlPart'/> to locate.</param>
/// <returns>
/// <para><see langword='true'/> if the <see cref='VlnHtmlPart'/> is contained in the collection;
/// otherwise, <see langword='false'/>.</para>
/// </returns>
/// <seealso cref='VlnHtmlParts.IndexOf'/>
public bool Contains(VlnHtmlPart value)
{
return List.Contains(value);
}
/// <summary>
/// <para>Copies the <see cref='VlnHtmlPart'/> values to a one-dimensional <see cref='System.Array'/> instance at the
/// specified index.</para>
/// </summary>
/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='VlnHtmlPart'/> .</para></param>
/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
/// <returns>
/// <para>None.</para>
/// </returns>
/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='VlnHtmlPart'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception>
/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
/// <seealso cref='System.Array'/>
public void CopyTo(VlnHtmlPart[] array, int index)
{
List.CopyTo(array, index);
}
/// <summary>
/// <para>Returns the index of a <see cref='VlnHtmlPart'/> in
/// the <see cref='VlnHtmlPart'/> .</para>
/// </summary>
/// <param name='value'>The <see cref='VlnHtmlPart'/> to locate.</param>
/// <returns>
/// <para>The index of the <see cref='VlnHtmlPart'/> of <paramref name='value'/> in the
/// <see cref='VlnHtmlPart'/>, if found; otherwise, -1.</para>
/// </returns>
/// <seealso cref='VlnHtmlParts.Contains'/>
public int IndexOf(VlnHtmlPart value)
{
return List.IndexOf(value);
}
/// <summary>
/// <para>Inserts a <see cref='VlnHtmlPart'/> into the <see cref='VlnHtmlParts'/> at the specified index.</para>
/// </summary>
/// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param>
/// <param name=' value'>The <see cref='VlnHtmlPart'/> to insert.</param>
/// <returns><para>None.</para></returns>
/// <seealso cref='VlnHtmlParts.Add'/>
public void Insert(int index, VlnHtmlPart value)
{
List.Insert(index, value);
if (OnItemAdd != null) { OnItemAdd(this, new vlnhtmlpartArgs(value)); }
if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); }
}
/// <summary>
/// <para> Removes a specific <see cref='VlnHtmlPart'/> from the
/// <see cref='VlnHtmlParts'/> .</para>
/// </summary>
/// <param name='value'>The <see cref='VlnHtmlPart'/> to remove from the <see cref='VlnHtmlParts'/> .</param>
/// <returns><para>None.</para></returns>
/// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
public void Remove(VlnHtmlPart value)
{
List.Remove(value);
if (OnItemRemove != null) { OnItemRemove(this, new vlnhtmlpartArgs(value)); }
if (OnItemsChanged != null) { OnItemsChanged(value, EventArgs.Empty); }
}
#region ICustomTypeDescriptor impl
public String GetClassName()
{ return TypeDescriptor.GetClassName(this, true); }
public AttributeCollection GetAttributes()
{ return TypeDescriptor.GetAttributes(this, true); }
public String GetComponentName()
{ return TypeDescriptor.GetComponentName(this, true); }
public TypeConverter GetConverter()
{ return TypeDescriptor.GetConverter(this, true); }
public EventDescriptor GetDefaultEvent()
{ return TypeDescriptor.GetDefaultEvent(this, true); }
public PropertyDescriptor GetDefaultProperty()
{ return TypeDescriptor.GetDefaultProperty(this, true); }
public object GetEditor(Type editorBaseType)
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
public EventDescriptorCollection GetEvents(System.Attribute[] attributes)
{ return TypeDescriptor.GetEvents(this, attributes, true); }
public EventDescriptorCollection GetEvents()
{ return TypeDescriptor.GetEvents(this, true); }
public object GetPropertyOwner(PropertyDescriptor pd)
{ return this; }
/// <summary>
/// Called to get the properties of this type. Returns properties with certain
/// attributes. this restriction is not implemented here.
/// </summary>
/// <param name="attributes"></param>
/// <returns></returns>
public PropertyDescriptorCollection GetProperties(System.Attribute[] attributes)
{ return GetProperties(); }
/// <summary>
/// Called to get the properties of this type.
/// </summary>
/// <returns></returns>
public PropertyDescriptorCollection GetProperties()
{
// Create a collection object to hold property descriptors
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
// Iterate the list
for (int i = 0; i < this.Count; i++)
{
// Create a property descriptor for the item and add to the property descriptor collection
vlnhtmlpartsPropertyDescriptor pd = new vlnhtmlpartsPropertyDescriptor(this, i);
pds.Add(pd);
}
// return the property descriptor collection
return pds;
}
#endregion
/// Event arguments for the vlnhtmlparts collection class.
public class vlnhtmlpartArgs : EventArgs
{
private VlnHtmlParts t;
/// Default constructor.
public vlnhtmlpartArgs()
{
t = new VlnHtmlParts();
}
/// Initializes with a vlnhtmlpart.
/// Data object.
public vlnhtmlpartArgs(VlnHtmlPart t)
: this()
{
this.t.Add(t);
}
/// Initializes with a collection of vlnhtmlpart objects.
/// Collection of data.
public vlnhtmlpartArgs(VlnHtmlParts ts)
: this()
{
this.t.AddRange(ts);
}
/// Initializes with an array of vlnhtmlpart objects.
/// Array of data.
public vlnhtmlpartArgs(VlnHtmlPart[] ts)
: this()
{
this.t.AddRange(ts);
}
/// Gets or sets the data of this argument.
public VlnHtmlParts vlnhtmlparts
{
get { return t; }
set { t = value; }
}
}
/// vlnhtmlparts event handler.
public delegate void VlnHtmlPartHandler(object sender, vlnhtmlpartArgs e);
#region Property Descriptor
/// <summary>
/// Summary description for CollectionPropertyDescriptor.
/// </summary>
public partial class vlnhtmlpartsPropertyDescriptor : vlnListPropertyDescriptor
{
private VlnHtmlPart Item { get { return (VlnHtmlPart)_Item; } }
public vlnhtmlpartsPropertyDescriptor(VlnHtmlParts collection, int index) : base(collection, index) { ;}
public override string DisplayName
{ get { return Item.GetType().Name; } }
}
#endregion
[Serializable()]
public partial class vlnListPropertyDescriptor : PropertyDescriptor
{
protected object _Item = null;
public vlnListPropertyDescriptor(System.Collections.IList collection, int index)
: base("#" + index.ToString(), null)
{ _Item = collection[index]; }
public override bool CanResetValue(object component)
{ return true; }
public override Type ComponentType
{ get { return _Item.GetType(); } }
public override object GetValue(object component)
{ return _Item; }
public override bool IsReadOnly
{ get { return false; } }
public override Type PropertyType
{ get { return _Item.GetType(); } }
public override void ResetValue(object component)
{ ;}
public override bool ShouldSerializeValue(object component)
{ return true; }
public override void SetValue(object component, object value)
{ /*_Item = value*/;}
//public override AttributeCollection Attributes
//{ get { return new AttributeCollection(null); } }
public override string DisplayName
{ get { return _Item.ToString(); } }
public override string Description
{ get { return _Item.ToString(); } }
public override string Name
{ get { return _Item.ToString(); } }
} // Class
#region Converter
internal class VlnHtmlPartsConverter : ExpandableObjectConverter
{
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
{
if (destType == typeof(string) && value is VlnHtmlParts)
{
// Return department and department role separated by comma.
return ((VlnHtmlParts)value).List.Count.ToString() + " SVG Drawing Parts";
}
return base.ConvertTo(context, culture, value, destType);
}
}
#endregion
/// SVGParts event handler.
//public delegate void VlnHtmlPartHandler(object sender, VlnHtmlPartArgs e);
//#region Property Descriptor
///// <summary>
///// Summary description for CollectionPropertyDescriptor.
///// </summary>
//public partial class VlnHtmlPartsPropertyDescriptor : vlnListPropertyDescriptor
//{
// private VlnHtmlPart Item { get { return (VlnHtmlPart)_Item; } }
// public VlnHtmlPartsPropertyDescriptor(VlnHtmlParts collection, int index) : base(collection, index) { ;}
// public override string DisplayName
// { get { return Item.GetType().Name; } }
//}
//#endregion
//[Serializable()]
//public partial class vlnListPropertyDescriptor : PropertyDescriptor
//{
// protected object _Item = null;
// public vlnListPropertyDescriptor(System.Collections.IList collection, int index)
// : base("#" + index.ToString(), null)
// { _Item = collection[index]; }
// public override bool CanResetValue(object component)
// { return true; }
// public override Type ComponentType
// { get { return _Item.GetType(); } }
// public override object GetValue(object component)
// { return _Item; }
// public override bool IsReadOnly
// { get { return false; } }
// public override Type PropertyType
// { get { return _Item.GetType(); } }
// public override void ResetValue(object component)
// { ;}
// public override bool ShouldSerializeValue(object component)
// { return true; }
// public override void SetValue(object component, object value)
// { /*_Item = value*/;}
// //public override AttributeCollection Attributes
// //{ get { return new AttributeCollection(null); } }
// public override string DisplayName
// { get { return _Item.ToString(); } }
// public override string Description
// { get { return _Item.ToString(); } }
// public override string Name
// { get { return _Item.ToString(); } }
//} // Class
//#region Converter
//internal class VlnHtmlPartsConverter : ExpandableObjectConverter
//{
// public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
// {
// if (destType == typeof(string) && value is VlnHtmlParts)
// {
// // Return department and department role separated by comma.
// return ((VlnHtmlParts)value).List.Count.ToString() + " Vln Html Parts";
// }
// return base.ConvertTo(context, culture, value, destType);
// }
//}
// }
//#endregion
}
/// <summary>
/// Hyperrlink
/// </summary>
public class vlnhtml_a
{
//url
}
public class vlnhtmlContent : VlnHtmlPart
{
string _text;
[XmlText]
public string Text
{
get { return _text; }
set { _text = value; }
}
string _style;// -qt-block-indent:1or2
[XmlAttribute("style")]
public string Style
{
get { return _style; }
set { _style = value; }
}
string _align;// Center Right Justify
[XmlAttribute("align")]
public string Align
{
get { return _align; }
set { _align = value; }
}
}
/// <summary>
/// Paragraph
/// </summary>
public class vlnhtml_p : vlnhtmlContent
{
}
/// <summary>
/// Break
/// </summary>
public class vlnhtml_br : VlnHtmlPart
{
}
/// <summary>
/// Image
/// </summary>
public class vlnhtml_img : VlnHtmlPart
{
string _src;//filename and Path
[XmlAttribute("src")]
public string Src
{
get { return _src; }
set { _src = value; }
}
int _width;
[XmlAttribute("width")]
public int Width
{
get { return _width; }
set { _width = value; }
}
}
/// <summary>
/// Container
/// </summary>
public class VlnHtmlContainer : VlnHtmlPart
{
VlnHtmlParts _Children = new VlnHtmlParts();
[XmlElement("ul", typeof(vlnhtml_ul))]
[XmlElement("ol", typeof(vlnhtml_ol))]
[XmlElement("li", typeof(vlnhtml_li))]
[XmlElement("p", typeof(vlnhtml_p))]
[XmlElement("a", typeof(vlnhtml_a))]
[XmlElement("br", typeof(vlnhtml_br))]
[XmlElement("img", typeof(vlnhtml_img))]
[XmlElement("table", typeof(vlnhtml_table))]
internal VlnHtmlParts Children
{
get
{
//if (_Children == null)
// _Children = new VlnHtmlParts();
return _Children;
}
set { _Children = value; }
}
}
/// <summary>
/// Ordered List
/// </summary>
public class vlnhtml_ol : VlnHtmlContainer
{
string _style;// -qt-block-indent:1or2
[XmlAttribute("style")]
public string Style
{
get { return _style; }
set { _style = value; }
}
}
/// <summary>
/// Unordered List
/// </summary>
public class vlnhtml_ul : VlnHtmlContainer
{
string _style;// -qt-block-indent:1or2
[XmlAttribute("style")]
public string Style
{
get { return _style; }
set { _style = value; }
}
}
/// <summary>
/// List Item
/// </summary>
public class vlnhtml_li : vlnhtmlContent
{
}
/// <summary>
/// Table
/// </summary>
public class vlnhtml_table : VlnHtmlContainer
{
string _style;// -qt-block-indent:1or2
[XmlAttribute("style")]
public string Style
{
get { return _style; }
set { _style = value; }
}
int _border;//
int _cellspacing;
int _cellpadding;
}
public class vlnhtml_tr : VlnHtmlContainer
{
}
public class vlnhtml_td : VlnHtmlContainer
{
}
public static class HtmlSerializer<T> where T : class
{
public static string StringSerialize(T t)
{
string strOutput = string.Empty;
XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.w3.org/2000/html");
using (MemoryStream ms = new MemoryStream())
{
xs.Serialize(new NonXsiTextWriter(ms, Encoding.UTF8), t);
//xs.Serialize(ms, t);
ms.Position = 0;
StreamReader sr = new StreamReader(ms);
strOutput = sr.ReadToEnd();
ms.Close();
}
return strOutput;
}
public static T StringDeserialize(string s)
{
T t;
XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.w3.org/2000/html");
UTF8Encoding enc = new UTF8Encoding();
Byte[] arrBytData = enc.GetBytes(s);
using (MemoryStream ms = new MemoryStream(arrBytData))
{
t = (T)xs.Deserialize(ms);
}
return t;
}
public static void WriteFile(T t, string fileName)
{
string strOutput = string.Empty;
XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.w3.org/2000/html");
using (FileStream fs = new FileStream(fileName, FileMode.Create))
{
xs.Serialize(new NonXsiTextWriter(fs, Encoding.UTF8), t);
fs.Close();
}
}
public static T ReadFile(string fileName)
{
T t;
XmlSerializer xs = new XmlSerializer(typeof(T), "http://www.w3.org/2000/html");
using (FileStream fs = new FileStream(fileName, FileMode.Open))
{
t = (T)xs.Deserialize(fs);
}
return t;
}
}
public class NonXsiTextWriter : XmlTextWriter
{
public NonXsiTextWriter(TextWriter w) : base(w) { }
public NonXsiTextWriter(Stream w, Encoding encoding)
: base(w, encoding)
{
this.Formatting = Formatting.Indented;
}
public NonXsiTextWriter(string filename, Encoding encoding) : base(filename, encoding) { }
bool _skip = false;
public override void WriteStartAttribute(string prefix, string localName, string ns)
{
if ((prefix == "xmlns" && (localName == "xsd" || localName == "xsi")) || // Omits XSD and XSI declarations.
ns == XmlSchema.InstanceNamespace) // Omits all XSI attributes.
{
_skip = true;
return;
}
if (localName == "xlink_href")
base.WriteStartAttribute(prefix, "xlink:href", ns);
else
base.WriteStartAttribute(prefix, localName, ns);
}
public override void WriteString(string text)
{
if (_skip) return;
base.WriteString(text);
}
public override void WriteEndAttribute()
{
if (_skip)
{ // Reset the flag, so we keep writing.
_skip = false;
return;
}
base.WriteEndAttribute();
}
}
}