This commit is contained in:
Kathy Ruffing 2007-12-03 15:13:32 +00:00
parent a5f84f8f19
commit ebd73f245c
20 changed files with 2047 additions and 0 deletions

View File

@ -0,0 +1,383 @@
/*
IniReader class for C#
Version: 1.0 Date: 2002/04/24
*/
/*
Copyright © 2002, The KPD-Team
All rights reserved.
http://www.mentalis.org/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Neither the name of the KPD-Team, nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Text;
using System.Collections;
using System.Runtime.InteropServices;
// The Org.Mentalis.Files contains a number of classes that read from or write to special files.
namespace Org.Mentalis.Files {
/// <summary>
/// The INIReader class can read keys from and write keys to an INI file.
/// </summary>
/// <remarks>
/// This class uses several Win32 API functions to read from and write to INI files. It will not work on Linux or FreeBSD.
/// </remarks>
public class IniReader {
// API declarations
/// <summary>
/// The GetPrivateProfileInt function retrieves an integer associated with a key in the specified section of an initialization file.
/// </summary>
/// <param name="lpApplicationName">Pointer to a null-terminated string specifying the name of the section in the initialization file.</param>
/// <param name="lpKeyName">Pointer to the null-terminated string specifying the name of the key whose value is to be retrieved. This value is in the form of a string; the GetPrivateProfileInt function converts the string into an integer and returns the integer.</param>
/// <param name="nDefault">Specifies the default value to return if the key name cannot be found in the initialization file.</param>
/// <param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param>
/// <returns>The return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value. If the value of the key is less than zero, the return value is zero.</returns>
[DllImport("KERNEL32.DLL", EntryPoint="GetPrivateProfileIntA", CharSet=CharSet.Ansi)]
private static extern int GetPrivateProfileInt(string lpApplicationName, string lpKeyName, int nDefault, string lpFileName);
/// <summary>
/// The WritePrivateProfileString function copies a string into the specified section of an initialization file.
/// </summary>
/// <param name="lpApplicationName">Pointer to a null-terminated string containing the name of the section to which the string will be copied. If the section does not exist, it is created. The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters.</param>
/// <param name="lpKeyName">Pointer to the null-terminated string containing the name of the key to be associated with a string. If the key does not exist in the specified section, it is created. If this parameter is NULL, the entire section, including all entries within the section, is deleted.</param>
/// <param name="lpString">Pointer to a null-terminated string to be written to the file. If this parameter is NULL, the key pointed to by the lpKeyName parameter is deleted.</param>
/// <param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file.</param>
/// <returns>If the function successfully copies the string to the initialization file, the return value is nonzero; if the function fails, or if it flushes the cached version of the most recently accessed initialization file, the return value is zero.</returns>
[DllImport("KERNEL32.DLL", EntryPoint="WritePrivateProfileStringA", CharSet=CharSet.Ansi)]
private static extern int WritePrivateProfileString (string lpApplicationName, string lpKeyName, string lpString, string lpFileName);
/// <summary>
/// The GetPrivateProfileString function retrieves a string from the specified section in an initialization file.
/// </summary>
/// <param name="lpApplicationName">Pointer to a null-terminated string that specifies the name of the section containing the key name. If this parameter is NULL, the GetPrivateProfileString function copies all section names in the file to the supplied buffer.</param>
/// <param name="lpKeyName">Pointer to the null-terminated string specifying the name of the key whose associated string is to be retrieved. If this parameter is NULL, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter.</param>
/// <param name="lpDefault">Pointer to a null-terminated default string. If the lpKeyName key cannot be found in the initialization file, GetPrivateProfileString copies the default string to the lpReturnedString buffer. This parameter cannot be NULL. <br>Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.</br></param>
/// <param name="lpReturnedString">Pointer to the buffer that receives the retrieved string.</param>
/// <param name="nSize">Specifies the size, in TCHARs, of the buffer pointed to by the lpReturnedString parameter.</param>
/// <param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param>
/// <returns>The return value is the number of characters copied to the buffer, not including the terminating null character.</returns>
[DllImport("KERNEL32.DLL", EntryPoint="GetPrivateProfileStringA", CharSet=CharSet.Ansi)]
private static extern int GetPrivateProfileString (string lpApplicationName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);
/// <summary>
/// The GetPrivateProfileSectionNames function retrieves the names of all sections in an initialization file.
/// </summary>
/// <param name="lpszReturnBuffer">Pointer to a buffer that receives the section names associated with the named file. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character.</param>
/// <param name="nSize">Specifies the size, in TCHARs, of the buffer pointed to by the lpszReturnBuffer parameter.</param>
/// <param name="lpFileName">Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter is NULL, the function searches the Win.ini file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.</param>
/// <returns>The return value specifies the number of characters copied to the specified buffer, not including the terminating null character. If the buffer is not large enough to contain all the section names associated with the specified initialization file, the return value is equal to the length specified by nSize minus two.</returns>
[DllImport("KERNEL32.DLL", EntryPoint="GetPrivateProfileSectionNamesA", CharSet=CharSet.Ansi)]
private static extern int GetPrivateProfileSectionNames (byte[] lpszReturnBuffer, int nSize, string lpFileName);
/// <summary>
/// The WritePrivateProfileSection function replaces the keys and values for the specified section in an initialization file.
/// </summary>
/// <param name="lpAppName">Pointer to a null-terminated string specifying the name of the section in which data is written. This section name is typically the name of the calling application.</param>
/// <param name="lpString">Pointer to a buffer containing the new key names and associated values that are to be written to the named section.</param>
/// <param name="lpFileName">Pointer to a null-terminated string containing the name of the initialization file. If this parameter does not contain a full path for the file, the function searches the Windows directory for the file. If the file does not exist and lpFileName does not contain a full path, the function creates the file in the Windows directory. The function does not create a file if lpFileName contains the full path and file name of a file that does not exist.</param>
/// <returns>If the function succeeds, the return value is nonzero.<br>If the function fails, the return value is zero.</br></returns>
[DllImport("KERNEL32.DLL", EntryPoint="WritePrivateProfileSectionA", CharSet=CharSet.Ansi)]
private static extern int WritePrivateProfileSection (string lpAppName, string lpString, string lpFileName);
/// <summary>Constructs a new IniReader instance.</summary>
/// <param name="file">Specifies the full path to the INI file (the file doesn't have to exist).</param>
public IniReader(string file) {
Filename = file;
}
/// <summary>Gets or sets the full path to the INI file.</summary>
/// <value>A String representing the full path to the INI file.</value>
public string Filename {
get {
return m_Filename;
}
set {
m_Filename = value;
}
}
/// <summary>Gets or sets the section you're working in. (aka 'the active section')</summary>
/// <value>A String representing the section you're working in.</value>
public string Section {
get {
return m_Section;
}
set {
m_Section = value;
}
}
/// <summary>Reads an Integer from the specified key of the specified section.</summary>
/// <param name="section">The section to search in.</param>
/// <param name="key">The key from which to return the value.</param>
/// <param name="defVal">The value to return if the specified key isn't found.</param>
/// <returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
public int ReadInteger(string section, string key, int defVal) {
return GetPrivateProfileInt(section, key, defVal, Filename);
}
/// <summary>Reads an Integer from the specified key of the specified section.</summary>
/// <param name="section">The section to search in.</param>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file.</returns>
public int ReadInteger(string section, string key) {
return ReadInteger(section, key, 0);
}
/// <summary>Reads an Integer from the specified key of the active section.</summary>
/// <param name="key">The key from which to return the value.</param>
/// <param name="defVal">The section to search in.</param>
/// <returns>Returns the value of the specified Key, or returns the default value if the specified Key isn't found in the active section of the INI file.</returns>
public int ReadInteger(string key, int defVal) {
return ReadInteger(Section, key, defVal);
}
/// <summary>Reads an Integer from the specified key of the active section.</summary>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified key, or returns 0 if the specified key isn't found in the active section of the INI file.</returns>
public int ReadInteger(string key) {
return ReadInteger(key, 0);
}
/// <summary>Reads a String from the specified key of the specified section.</summary>
/// <param name="section">The section to search in.</param>
/// <param name="key">The key from which to return the value.</param>
/// <param name="defVal">The value to return if the specified key isn't found.</param>
/// <returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
public string ReadString(string section, string key, string defVal) {
StringBuilder sb = new StringBuilder(MAX_ENTRY);
int Ret = GetPrivateProfileString(section, key, defVal, sb, MAX_ENTRY, Filename);
return sb.ToString();
}
/// <summary>Reads a String from the specified key of the specified section.</summary>
/// <param name="section">The section to search in.</param>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified section/key pair, or returns an empty String if the specified section/key pair isn't found in the INI file.</returns>
public string ReadString(string section, string key) {
return ReadString(section, key, "");
}
/// <summary>Reads a String from the specified key of the active section.</summary>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified key, or returns an empty String if the specified key isn't found in the active section of the INI file.</returns>
public string ReadString(string key) {
return ReadString(Section, key);
}
/// <summary>Reads a Long from the specified key of the specified section.</summary>
/// <param name="section">The section to search in.</param>
/// <param name="key">The key from which to return the value.</param>
/// <param name="defVal">The value to return if the specified key isn't found.</param>
/// <returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
public long ReadLong(string section, string key, long defVal) {
return long.Parse(ReadString(section, key, defVal.ToString()));
}
/// <summary>Reads a Long from the specified key of the specified section.</summary>
/// <param name="section">The section to search in.</param>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified section/key pair, or returns 0 if the specified section/key pair isn't found in the INI file.</returns>
public long ReadLong(string section, string key) {
return ReadLong(section, key, 0);
}
/// <summary>Reads a Long from the specified key of the active section.</summary>
/// <param name="key">The key from which to return the value.</param>
/// <param name="defVal">The section to search in.</param>
/// <returns>Returns the value of the specified key, or returns the default value if the specified key isn't found in the active section of the INI file.</returns>
public long ReadLong(string key, long defVal) {
return ReadLong(Section, key, defVal);
}
/// <summary>Reads a Long from the specified key of the active section.</summary>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified Key, or returns 0 if the specified Key isn't found in the active section of the INI file.</returns>
public long ReadLong(string key) {
return ReadLong(key, 0);
}
/// <summary>Reads a Byte array from the specified key of the specified section.</summary>
/// <param name="section">The section to search in.</param>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified section/key pair, or returns null (Nothing in VB.NET) if the specified section/key pair isn't found in the INI file.</returns>
public byte[] ReadByteArray(string section, string key) {
try {
return Convert.FromBase64String(ReadString(section, key));
} catch {}
return null;
}
/// <summary>Reads a Byte array from the specified key of the active section.</summary>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified key, or returns null (Nothing in VB.NET) if the specified key pair isn't found in the active section of the INI file.</returns>
public byte[] ReadByteArray(string key) {
return ReadByteArray(Section, key);
}
/// <summary>Reads a Boolean from the specified key of the specified section.</summary>
/// <param name="section">The section to search in.</param>
/// <param name="key">The key from which to return the value.</param>
/// <param name="defVal">The value to return if the specified key isn't found.</param>
/// <returns>Returns the value of the specified section/key pair, or returns the default value if the specified section/key pair isn't found in the INI file.</returns>
public bool ReadBoolean(string section, string key, bool defVal) {
return Boolean.Parse(ReadString(section, key, defVal.ToString()));
}
/// <summary>Reads a Boolean from the specified key of the specified section.</summary>
/// <param name="section">The section to search in.</param>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified section/key pair, or returns false if the specified section/key pair isn't found in the INI file.</returns>
public bool ReadBoolean(string section, string key) {
return ReadBoolean(section, key, false);
}
/// <summary>Reads a Boolean from the specified key of the specified section.</summary>
/// <param name="key">The key from which to return the value.</param>
/// <param name="defVal">The value to return if the specified key isn't found.</param>
/// <returns>Returns the value of the specified key pair, or returns the default value if the specified key isn't found in the active section of the INI file.</returns>
public bool ReadBoolean(string key, bool defVal) {
return ReadBoolean(Section, key, defVal);
}
/// <summary>Reads a Boolean from the specified key of the specified section.</summary>
/// <param name="key">The key from which to return the value.</param>
/// <returns>Returns the value of the specified key, or returns false if the specified key isn't found in the active section of the INI file.</returns>
public bool ReadBoolean(string key) {
return ReadBoolean(Section, key);
}
/// <summary>Writes an Integer to the specified key in the specified section.</summary>
/// <param name="section">The section to write in.</param>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string section, string key, int value) {
return Write(section, key, value.ToString());
}
/// <summary>Writes an Integer to the specified key in the active section.</summary>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string key, int value) {
return Write(Section, key, value);
}
/// <summary>Writes a String to the specified key in the specified section.</summary>
/// <param name="section">Specifies the section to write in.</param>
/// <param name="key">Specifies the key to write to.</param>
/// <param name="value">Specifies the value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string section, string key, string value) {
return (WritePrivateProfileString(section, key, value, Filename) != 0);
}
/// <summary>Writes a String to the specified key in the active section.</summary>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string key, string value) {
return Write(Section, key, value);
}
/// <summary>Writes a Long to the specified key in the specified section.</summary>
/// <param name="section">The section to write in.</param>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string section, string key, long value) {
return Write(section, key, value.ToString());
}
/// <summary>Writes a Long to the specified key in the active section.</summary>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string key, long value) {
return Write(Section, key, value);
}
/// <summary>Writes a Byte array to the specified key in the specified section.</summary>
/// <param name="section">The section to write in.</param>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string section, string key, byte [] value) {
if (value == null)
return Write(section, key, (string)null);
else
return Write(section, key, value, 0, value.Length);
}
/// <summary>Writes a Byte array to the specified key in the active section.</summary>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string key, byte [] value) {
return Write(Section, key, value);
}
/// <summary>Writes a Byte array to the specified key in the specified section.</summary>
/// <param name="section">The section to write in.</param>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <param name="offset">An offset in <i>value</i>.</param>
/// <param name="length">The number of elements of <i>value</i> to convert.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string section, string key, byte [] value, int offset, int length) {
if (value == null)
return Write(section, key, (string)null);
else
return Write(section, key, Convert.ToBase64String(value, offset, length));
}
/// <summary>Writes a Boolean to the specified key in the specified section.</summary>
/// <param name="section">The section to write in.</param>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string section, string key, bool value) {
return Write(section, key, value.ToString());
}
/// <summary>Writes a Boolean to the specified key in the active section.</summary>
/// <param name="key">The key to write to.</param>
/// <param name="value">The value to write.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool Write(string key, bool value) {
return Write(Section, key, value);
}
/// <summary>Deletes a key from the specified section.</summary>
/// <param name="section">The section to delete from.</param>
/// <param name="key">The key to delete.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool DeleteKey(string section, string key) {
return (WritePrivateProfileString(section, key, null, Filename) != 0);
}
/// <summary>Deletes a key from the active section.</summary>
/// <param name="key">The key to delete.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool DeleteKey(string key) {
return (WritePrivateProfileString(Section, key, null, Filename) != 0);
}
/// <summary>Deletes a section from an INI file.</summary>
/// <param name="section">The section to delete.</param>
/// <returns>Returns true if the function succeeds, false otherwise.</returns>
public bool DeleteSection(string section) {
return WritePrivateProfileSection(section, null, Filename) != 0;
}
/// <summary>Retrieves a list of all available sections in the INI file.</summary>
/// <returns>Returns an ArrayList with all available sections.</returns>
public ArrayList GetSectionNames() {
try {
byte[] buffer = new byte[MAX_ENTRY];
GetPrivateProfileSectionNames(buffer, MAX_ENTRY, Filename);
string [] parts = Encoding.ASCII.GetString(buffer).Trim('\0').Split('\0');
return new ArrayList(parts);
} catch {}
return null;
}
//Private variables and constants
/// <summary>
/// Holds the full path to the INI file.
/// </summary>
private string m_Filename;
/// <summary>
/// Holds the active section name
/// </summary>
private string m_Section;
/// <summary>
/// The maximum number of bytes in a section buffer.
/// </summary>
private const int MAX_ENTRY = 32768;
}
}

View File

@ -0,0 +1,51 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{889E30F7-CFBC-470D-9488-7009C354F9C9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IniReader</RootNamespace>
<AssemblyName>IniReader</AssemblyName>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\veproms\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IniReader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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:Volian.Utils.Library\\IniReader"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,35 @@
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("IniReader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Volian Enterprises, Inc.")]
[assembly: AssemblyProduct("IniReader")]
[assembly: AssemblyCopyright("Copyright © Volian Enterprises, Inc. 2006")]
[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("0defcd71-3fa3-4b0c-8df0-64ca71984473")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,77 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{2F79D7F9-885E-4441-99F3-045D7612B2E5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MSWord</RootNamespace>
<AssemblyName>MSWord</AssemblyName>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\veproms\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WordDoc.cs" />
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Core">
<Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>3</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="VBIDE">
<Guid>{0002E157-0000-0000-C000-000000000046}</Guid>
<VersionMajor>5</VersionMajor>
<VersionMinor>3</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="Word">
<Guid>{00020905-0000-0000-C000-000000000046}</Guid>
<VersionMajor>8</VersionMajor>
<VersionMinor>3</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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:Volian.Utils.Library\\MSWord"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,35 @@
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("MSWord")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Volian Enterprises, Inc.")]
[assembly: AssemblyProduct("MSWord")]
[assembly: AssemblyCopyright("Copyright © Volian Enterprises, Inc. 2006")]
[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("d96766ab-573a-470e-8104-d862880d1cd7")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using Microsoft.Office.Interop;
using Microsoft.Office.Interop.Word;
namespace Volian.MSWord
{
public class WordDoc
{
private object optional = Missing.Value;
private object oFalse = false;
private object oTrue = true;
private object oBlank = "";
private object oWdStory = WdUnits.wdStory;
private object oWdWord = WdUnits.wdWord;
private object oWdChar = WdUnits.wdCharacter;
private object oWdLine = WdUnits.wdLine;
private object oWdPara = WdUnits.wdParagraph;
private object oWdExtend = WdMovementType.wdExtend;
private object oWdMove = WdMovementType.wdMove;
private object o1 = 1;
private Application m_App;
// Microsoft.Office.Interop.Word.Application App
// {
// get{return m_App;}
// }
private Document m_Doc;
// Microsoft.Office.Interop.Word.Document Doc
// {
// get{return m_Doc;}
// }
private string mDocName;
public string DocName
{
get { return mDocName; }
set { mDocName = value; }
}
public WordDoc(string sPath)
{
m_App = new ApplicationClass();
//m_App.Visible = true;
mDocName = sPath;
object oFile = sPath;
m_Doc = m_App.Documents.Open(
ref oFile // FileName
,ref optional // ConfirmConversions
,ref optional // ReadOnly
,ref optional // AddToRecentFiles
,ref optional // PasswordDocument
,ref optional // PasswordTemplate
,ref optional // Revert
,ref optional // WritePasswordDocument
,ref optional // WritePasswordTemplate
,ref optional // Format
,ref optional // Encoding
,ref optional // Visible
,ref optional // OpenAndRepair
,ref optional // DocumentDirection
,ref optional // NoEncodingDialog
,ref optional // XMLTransform
);
}
//~WordDoc()
//{
// m_App.Quit(ref oFalse, ref optional, ref optional);
//}
private string SaveDoc()
{
object oFileName = mDocName;
object oFileFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument;
//object oFileFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatFilteredHTML;
object oPassWord = "";
try
{
m_Doc.SaveAs2000(
ref oFileName // FileName
,ref oFileFormat // FileFormat
,ref oFalse // LockComments
,ref oPassWord // Password
,ref oFalse // AddToRecentFiles
,ref oPassWord // WritePassword
,ref oFalse // ReadOnlyRecommended
,ref oFalse // EmbedTrueTypeFonts
,ref oFalse // SaveNativePictureFormat
,ref oFalse // SaveFormsData
,ref oFalse // SaveAsAOCELetter
);
return "Successful Save";
}
catch (Exception ex)
{
return string.Format("Error during Doc save - {0}", ex.Message);
}
}
public string Save()
{
return SaveDoc();
}
public string Save(string sPath)
{
mDocName = sPath;
return SaveDoc();
}
public void Close()
{
m_App.Quit(ref oFalse, ref optional, ref optional);
}
}
}

View File

@ -0,0 +1,35 @@
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("vlnObject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Volian Enterprises, Inc.")]
[assembly: AssemblyProduct("vlnObject")]
[assembly: AssemblyCopyright("Copyright © Volian Enterprises, Inc. 2006")]
[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("456c5324-6f56-478e-8069-b8e8957f5749")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="utf-8" ?>
<dbControl>
<connection string="Provider=Microsoft.Jet.OLEDB.4.0;Data source={path};Extended Properties=dBase III;Persist Security Info=False"/>
<default datapath="\\rhmdesktop\VEDATA"/>
<dbObject type="datapath"
items="Plants"
imageindex="1"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child="plant">
<folders child="plant">
<folder title="xEntergy Nuclear Northeast - Indian Point Unit 2" template="veip2" />
<folder title="Virginia Power - Surry" template="vesurry" />
<folder title="Virginia Power - Surry (1A)" template="vesurrya" />
<folder title="Virginia Power - North Anna" template="venanna" />
<folder title="Virginia Power - North Anna, Unit 1" template="venanna1" />
<folder title="Virginia Power - North Anna, Unit 2" template="venanna2" />
<folder title="Northern States Power - Prairie Island Emergency Operating Procedures" template="vensp" />
<folder title="Northern States Power - Prairie Island Abnormal Operating Procedures" template="venspaop" />
<folder title="Northern States Power - Prairie Island Electrical Maintenance Procedures" template="vensppe" />
<folder title="Northern States Power - Prairie Island Alarm Response Procedures" template="vensparp" />
<folder title="Northern States Power - Prairie Island Remote Alarm Response Procedures" template="vensprar" />
<folder title="Northern States Power - Prairie Island System Operating Procedures" template="venspsop" />
<folder title="Northern States Power - Prairie Island Instrument Failure Guides" template="venspifg" />
<folder title="Northern States Power - Prairie Island Alarm Response Modifications" template="vensparm" />
<folder title="Northern States Power - Prairie Island SAMGS" template="venspsam" />
<folder title="American Electric Power - D. C. Cook" template="veaep" />
<folder title="Wisconsin Electric Power - Point Beach" template="vewpb" />
<folder title="Constellation Energy Group - Ginna" template="verge" />
<folder title="TUEC - Comanche Peak" template="vetuec" />
<folder title="Entergy Nuclear Northeast - Indian Point Unit 3" template="veip3" />
<folder title="Maine Yankee Atomic Power Company - Maine Yankee" template="vemya" />
<folder title="Yankee Atomic Electric - Yankee Rowe" template="veyae" />
<folder title="Wisconsin Public Service Corp.- Kewaunee" template="vewps" />
<folder title="Wisconsin Public Service Corp.- Kewaunee Operating Procedures" template="vewpsop" />
<folder title="Wisconsin Public Service Corp.- Kewaunee Alarm Response Procedures" template="vewpsarp" />
<folder title="Wisconsin Public Service Corp.- Kewaunee OP EOPs and AOPs" template="vewpsaep" />
<folder title="South Carolina Gas and Electric - V.C. Summer" template="vesummer" />
<folder title="Louisiana Power and Light - Waterford" template="velpl" />
<folder title="Pacific Gas and Electric - Diablo Canyon" template="vepac" />
<folder title="Southern California Edison - San Onofre" template="vesce" />
<folder title="Carolina Power and Light - Robinson" template="vecplr" />
<folder title="Arkansas Nuclear One - Unit 1" template="veano1" />
<folder title="Emergency Operating Procedures" template="veano2" />
<folder title="Normal Operating Procedures" template="veano2op" />
<folder title="Abnormal Operating Procedures" template="veano2ap" />
<folder title="Low Mode Emergency Operating Procedures" template="veano2lm" />
<folder title="Annunciator Procedures" template="veano2an" />
<folder title="Southern Nuclear Operating Company - Vogtle" template="vegpc" />
<folder title="Florida Power and Light - Turkey Point EOPs" template="vefpl" />
<folder title="Florida Power and Light - Turkey Point ONOPs" template="vefpl4" />
<folder title="Florida Power and Light - Turkey Point SAMGs" template="vefpls" />
<folder title="STPNOC - South Texas" template="vehlp" />
<folder title="Carolina Power and Light - Shearon Harris" template="vecpls" />
<folder title="Virginia Power - EPIP" template="veepip" />
<folder title="AmerenUE - Callaway Plant" template="vecal" />
<folder title="ADM - Administrative Procedures - Wolf Creek" template="vewcnadm" />
<folder title="ALR - Alarm Response Procedures - Wolf Creek" template="vewcnalr" />
<folder title="CKL - Check List Procedures - Wolf Creek" template="vewcnckl" />
<folder title="EMG - Emergency Procedures - Wolf Creek" template="vewcnemg" />
<folder title="FP - Fire Protection Procedures - Wolf Creek" template="vewcnfp" />
<folder title="FHP - Fuel Handling Procedures - Wolf Creek" template="vewcnfhp" />
<folder title="GEN - General Operating Procedures - Wolf Creek" template="vewcngen" />
<folder title="OFN - Off-Normal Procedures - Wolf Creek" template="vewcnofn" />
<folder title="STN STS - Surveillance Procedures - Wolf Creek" template="vewcnsur" />
<folder title="STN - Non-Tech Spec Surveillance Procedures - Wolf Creek" template="vewcnstn" />
<folder title="STS - Tech Spec Surveillance Procedures - Wolf Creek" template="vewcnsts" />
<folder title="SYS - System Procedures - Wolf Creek" template="vewcnsys" />
<folder title="TMP - Temporary Procedures - Wolf Creek" template="vewcntmp" />
<folder title="IPS - IPS Procedures - Wolf Creek" template="vewcnips" />
<folder title="CHM - Chemistry Procedures - Wolf Creek" template="vewcnchm" />
<folder title="Wolf Creek Procedures - Local Drive" template="vewcn" />
<folder title="Duke Power - Catawba 1B Interim Set" template="vecat" />
<folder title="Duke Power - Catawba Revision 1C" template="vecns" />
<folder title="Duke Power - McGuire" template="vemcg" />
<folder title="Exelon Nuclear - Braidwood/Byron" template="vecebwb" />
<folder title="Exelon Nuclear - Braidwood" template="vebraid" />
<folder title="Exelon Nuclear - Byron" template="vebyron" />
<folder title="Constellation Energy Group - Calvert Cliffs" template="vebge" />
<folder title="North Atlantic Energy Service Corp. - Seabrook Nuclear Plant" template="vesea" />
<folder title="Volian Enterprises. - River Bend Station" template="vervbnd" />
<folder title="River Bend Station - Mechanical Procedures" template="vervmech" />
<folder title="River Bend Station - Operations Procedures" template="vervops" />
<folder title="River Bend Station - Radiation Protection Procedures" template="vervrp" />
<folder title="River Bend Station - Fire Protection Procedures" template="vervfp" />
<folder title="River Bend Station - I and C" template="vervic" />
<folder title="River Bend Station - Chemistry Procedures" template="vervchem" />
<folder title="River Bend Station - Electrical Procedures" template="vervelec" />
<folder title="River Bend Station - Protective Relay Procedures" template="vervrel" />
<folder title="River Bend Station - Operations Procedures" template="vervops" />
<folder title="River Bend Station - IST" template="vervist" />
<folder title="Southern Nuclear Operating Company - Farley Nuclear Plant" template="vefnp" />
<folder title="CEN - Combustion Engineering ERGs" template="vecen" />
<folder title="WOG - Emergency Response Guidelines LP Rev. 1" template="velp1" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1" template="vehp1" />
<folder title="WOG - Emergency Response Guidelines LP Rev. 1a" template="velpr1a" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1a" template="vehp1a" />
<folder title="WOG - Emergency Response Guidelines LP Rev. 1b" template="velpr1b" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1b" template="vehp1b" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1b - Figures" template="vehp1bfg" />
<folder title="WOG - Emergency Response Guidelines Rev. 1c" template="verev1c" />
<folder title="WOG - Emergency Response Guidelines Rev. 2" template="verev2" />
<folder title="VEPROMS - Test and Validation Procedures" template="vetest" />
<folder title="VEPROMS - Test Procedures for Calvert Cliffs" template="vebgedt" />
<folder title="VEPROMS - Demo Database" template="vedemo" />
<folder title="VEPROMS - UKRAINE Verbal Translation EOIs" template="veukrain" />
<folder title="VEPROMS - PI Wolf Creek Performance Improvement Procedures" template="vewcnpi" />
</folders>
</dbObject>
<dbObject type="plant"
items="Sets"
imageindex="2"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child="set">
<folders active="set.dbf">
<folder title="Emergency Procedures" template="procs" exception="procs2"/>
<folder title="Emergency Procedures Unit 1" template="procs" requires="procs2"/>
<folder title="Emergency Procedures Unit 2" template="procs2" />
<folder title="Emergency Procedures - Sample Version" template="samples" />
<folder title="Emergency Procedures (Intro / Attachment / Foldout)" template="pages" />
<folder title="Emergency Procedures (Intro / Attachment / Foldout)" template="intro" />
<folder title="Emergency Procedures (Intro / Attachment / Foldout)" template="intro2" />
<folder title="Writer's Guide" template="wg" />
<folder title="Abnormal Procedures" template="abbyproc" />
<folder template="*.prc" title="~Procedures ({filename})" />
<folder template="*.bck" title="~Background Documents ({filename})" />
<folder template="*.dvt" title="~Deviation Documents ({filename})" />
<folder template="*.sl?" title="~Procedures ({filename})" />
</folders>
</dbObject>
<dbObject type="set"
items="Versions"
imageindex="3"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child="version">
<folders active="set.dbf">
<folder template="." title="Working Draft" />
<folder template="approved" title="Approved Version"/>
<folder template="chgsht" title="Change Sheet Version"/>
<folder template="tmpchg" title="Temporary Change"/>
<folder template="approved\tmpchg" title="Approved Temporary Change"/>
</folders>
</dbObject>
<dbObject type="version"
items="Procedures"
imageindex="4"
key="dbPath"
title="{number} - {title}"
select="select * from [set] where entry is not null"
table="Set"
criteria="entry is not null"
sort="number"
child="proc">
<folders active="set.dbf">
<folder template="*.zip" title="Archive ({filename})" child="archive"/>
<!--folder template="approved" title="Approved Version" child="version"/-->
</folders>
</dbObject>
<dbObject type="proc"
imageindex="5"
items="Sections"
key="{{Entry}}"
title="{step} - {sequence} {text}"
select="select * from(
select
asc(mid(sequence,2,1))-48 as sec,
asc(mid(step,1,1))-64 as sec2,
rtrim(mid(text,76,8)) as fmt,
mid(text,83,3) as subfmt,
rtrim(mid(text,86,20)) as secnum,
iif(mid(step,2,1)='0','S',mid(step,2,1)) + right('0'+rtrim(left(iif(type is null,'',type),1)),1) as OldType,
* from [{{entry}}] where sequence like ' %') order by sec"
table="Proc"
criteria=""
sort="step,sequence"
child="section"/>
<dbObject type="section"
imageindex="6"
items="Steps"
key=""
title="{stp: 3} - {text}"
select="select stp,step,text,type from (select asc(mid(step,2,1))-48 as stp,* from [{{entry}}] where step like '{{Step:1}}%' and sequence='S')order by stp"
table="Section"
criteria=""
sort="stp"
child="step"/>
<dbObject type="step"
imageindex="7"
items="Step Structure"
key="{{Step}}"
title="{Sequence} - {Text}"
select="select * from [{{entry}}] where step = '{{Step}}' and (sequence like '[*S!]_' or sequence='S$') "
select1="select * from [{{entry}}] where step = '{{step}}' and sequence &lt;&gt; 'S'"
table="Step"
criteria=""
sort="sequence"
child="substep"
child1="dbStepStruct"/>
<dbObject type="substep"
imageindex="8"
items="Substeps"
key=""
title="{sequence} - {text}"
select="select * from [{{entry}}] where step = '{{step}}' and (sequence like '{{sequence}}_' or sequence like '{{sequence}}[*!]_') "
table="SubStep"
criteria=""
sort="sequence"
child1="dbSubStep"/>
<dbObject type="stepstruct"
imageindex="8"
items="Structure"
key="{{Step}}{{Sequence}}"
title="{Sequence} - {Text}"
select=""
table=""
criteria=""
sort=""
child=""/>
<dbObject type="archive"
items=""
imageindex="9"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child=""/>
</dbControl>

View File

@ -0,0 +1,282 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Xml;
using System.Xml.Schema;
using System.Collections;
using System.IO;
using System.Text.RegularExpressions;
namespace vlnObjectLibrary
{
[Serializable()]
public class vlnObject : IXmlSerializable , IDisposable
{
#region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
public void Dispose()
{
/* See if I need to do anything */
}
#region XML Serialization
public void WriteXml(XmlWriter w)
{
WriteXml(w, true);
}
public void WriteXml(XmlWriter w,bool bSaveParent)
{
w.WriteAttributeString("title", Title);
w.WriteAttributeString("path", Path);
w.WriteAttributeString("type", Type);
if (m_PropArray.Count > 0)
{
w.WriteStartElement("properties");
foreach (string sKey in m_PropArray.Keys)
{
w.WriteStartElement("property");
w.WriteAttributeString("name", sKey);
w.WriteAttributeString("value", PropArray[sKey]);
w.WriteEndElement();
}
w.WriteEndElement();
}
if (bSaveParent && Parent != null)
{
w.WriteStartElement("parent");
Parent.WriteXml(w);
w.WriteEndElement();
}
}
private bool SkipToElement(XmlReader xr)
{
while (xr.Read())
if (xr.NodeType == XmlNodeType.Element || xr.NodeType == XmlNodeType.EndElement)
return xr.NodeType == XmlNodeType.Element;
return false;
}
public void ReadXml(XmlReader xr)
{
SkipToElement(xr);
if (xr.MoveToAttribute("title")) m_Title = xr.Value;
if (xr.MoveToAttribute("type")) m_Type = xr.Value;
if (xr.MoveToAttribute("path")) m_Path = xr.Value;
while (SkipToElement(xr))
{
if (xr.NodeType == XmlNodeType.Element && xr.Name == "properties")
while (SkipToElement(xr))
if (xr.NodeType == XmlNodeType.Element && xr.Name == "property")
AddProp(xr.ReadSubtree());
if (xr.NodeType == XmlNodeType.Element && xr.Name == "parent")
m_Parent = new vlnObject(xr.ReadSubtree());
}
xr.Close();
}
public XmlSchema GetSchema()
{
return (null);
}
#endregion
#region Constructors
public vlnObject(vlnObject parent, string type, string title, string path)
{
m_Parent = parent;
m_Type = type;
m_Title = title;
m_Path = path;
m_PropArray = new Dictionary<string,string>();
}
public vlnObject()
{
m_Parent = null;
m_Title = null;
m_Path = null;
m_Type = null;
m_PropArray = new Dictionary<string, string>();
}
public vlnObject(XmlReader xr)
{
m_Parent = null;
m_PropArray = new Dictionary<string, string>();
this.ReadXml(xr);
}
public vlnObject(string sXML)
{
m_Parent = null;
m_PropArray = new Dictionary<string, string>();
this.ReadXml(new XmlTextReader(new StringReader(sXML)));
}
#endregion
#region Public Properties
private vlnObject m_Parent;
public vlnObject Parent
{
get { return m_Parent; }
set { m_Parent = value; }
}
private string m_Title;
public string Title
{
get { return m_Title; }
set { m_Title = value; }
}
private string m_Path;
public string Path
{
get { return m_Path; }
set { m_Path = value; }
}
private string m_Type;
public string Type
{
get { return m_Type; }
set { m_Type = value; }
}
private Dictionary<string,string> m_PropArray;
public Dictionary<string, string> PropArray
{
get { return m_PropArray; }
set { m_PropArray = value; }
}
#endregion
#region Public Methods
public vlnObject Add(string type, string title, string path)
{
vlnObject b = new vlnObject(this, type, title, path);
return b;
}
public void AddProp(string name, string value)
{
PropArray[name.ToUpper()] = value;
}
public void AddProp(XmlReader xr)
{
SkipToElement(xr);
string sName = null;
string sValue = null;
if (xr.MoveToAttribute("name")) sName = xr.Value;
if (xr.MoveToAttribute("value")) sValue = xr.Value;
if (sName != null && sValue != null) AddProp(sName, sValue);
xr.Close();
}
public override string ToString()
{
StringWriter swxml = new StringWriter();
XmlSerializer mySer = new XmlSerializer(this.GetType());
mySer.Serialize(swxml, this);
return swxml.ToString();
}
#endregion
private List<vlnObject> m_Children;
public List<vlnObject> Children
{
get
{
return m_Children;
}
set
{
m_Children = value;
}
}
public void LoadChildren(string sXml)
{
LoadChildren(new XmlTextReader(new StringReader(sXml)));
}
public void LoadChildren(XmlReader xr)
{
m_Children = new List<vlnObject>();
SkipToElement(xr);
while(SkipToElement(xr)){
vlnObject o = new vlnObject(xr.ReadSubtree());
o.Parent = this;
m_Children.Add(o);
}
}
public string AllChildren()
{
StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);
xw.WriteStartElement("children");
foreach (vlnObject vb in Children)
{
xw.WriteStartElement("vlnObject");
vb.WriteXml(xw,false);
xw.WriteEndElement();
}
xw.WriteEndElement();
return sw.ToString();
}
public string ProcessString(string s)
{
//string retval=s;
//string retval = Regex.Replace(s, "{[.]*}", new MatchEvaluator(ReplaceKey));
string retval = Regex.Replace(s, "{{.*?}}", new MatchEvaluator(ReplaceRow));
retval = Regex.Replace(retval, "{.*?}", new MatchEvaluator(ReplaceDrv));
return retval;
}
private string ReplaceRow(Match m)
{
string sResult = FindField(m.Value.Substring(2, m.Value.Length - 4));
if (sResult == null && Parent != null)
{
sResult = Parent.ReplaceRow(m);
}
if (sResult == null)
{
log.ErrorFormat("vlnObject - Couldn't find {0}", m.Value);
}
return sResult;
}
private string ReplaceDrv(Match m)
{
string sRetVal = FindField(m.Value.Substring(1, m.Value.Length - 2));
if (sRetVal == null) sRetVal = "";
return sRetVal;
}
private string FindField(string s)
{
string retval = "";
string[] parts = s.ToUpper().Split(":".ToCharArray());
switch (s.ToUpper())
{
case "PATH":
retval = m_Path;
break;
//case "TITLE":
//retval = m_Title;
//break;
case "TYPE":
retval = m_Type;
break;
default:
if (PropArray.ContainsKey(parts[0]))
{
retval = PropArray[parts[0]].ToString();
}
else
{
return null;
}
break;
}
if (parts.Length > 1)
{
int width = Convert.ToInt32(parts[1]);
if (parts[1][0] == ' ' || parts[1][0] == '0')
{
retval = retval.PadLeft(width, parts[1][0]);
}
else
{
retval = retval.PadRight(width).Substring(0, width).Trim();
}
}
return retval;
}
}
}

View File

@ -0,0 +1,60 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{933269F5-C3AD-423E-88EB-133A7333FD6B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>vlnObject</RootNamespace>
<AssemblyName>vlnObject</AssemblyName>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\veproms\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\veproms\bin\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="vlnObject.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="vlnControl.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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:Volian.Utils.Library\\vlnObject"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,35 @@
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("vlnServerLibrary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Volian Enterprises, Inc.")]
[assembly: AssemblyProduct("vlnServerLibrary")]
[assembly: AssemblyCopyright("Copyright © Volian Enterprises, Inc. 2006")]
[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("ca6a9567-282a-427f-9a41-2c205650f3d1")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="utf-8" ?>
<dbControl>
<connection string="Provider=Microsoft.Jet.OLEDB.4.0;Data source={path};Extended Properties=dBase III;Persist Security Info=False"/>
<default datapath="\\rhmdesktop\VEDATA"/>
<dbObject type="datapath"
items="Plants"
imageindex="1"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child="plant">
<folders child="plant">
<folder title="xEntergy Nuclear Northeast - Indian Point Unit 2" template="veip2" />
<folder title="Virginia Power - Surry" template="vesurry" />
<folder title="Virginia Power - Surry (1A)" template="vesurrya" />
<folder title="Virginia Power - North Anna" template="venanna" />
<folder title="Virginia Power - North Anna, Unit 1" template="venanna1" />
<folder title="Virginia Power - North Anna, Unit 2" template="venanna2" />
<folder title="Northern States Power - Prairie Island Emergency Operating Procedures" template="vensp" />
<folder title="Northern States Power - Prairie Island Abnormal Operating Procedures" template="venspaop" />
<folder title="Northern States Power - Prairie Island Electrical Maintenance Procedures" template="vensppe" />
<folder title="Northern States Power - Prairie Island Alarm Response Procedures" template="vensparp" />
<folder title="Northern States Power - Prairie Island Remote Alarm Response Procedures" template="vensprar" />
<folder title="Northern States Power - Prairie Island System Operating Procedures" template="venspsop" />
<folder title="Northern States Power - Prairie Island Instrument Failure Guides" template="venspifg" />
<folder title="Northern States Power - Prairie Island Alarm Response Modifications" template="vensparm" />
<folder title="Northern States Power - Prairie Island SAMGS" template="venspsam" />
<folder title="American Electric Power - D. C. Cook" template="veaep" />
<folder title="Wisconsin Electric Power - Point Beach" template="vewpb" />
<folder title="Constellation Energy Group - Ginna" template="verge" />
<folder title="TUEC - Comanche Peak" template="vetuec" />
<folder title="Entergy Nuclear Northeast - Indian Point Unit 3" template="veip3" />
<folder title="Maine Yankee Atomic Power Company - Maine Yankee" template="vemya" />
<folder title="Yankee Atomic Electric - Yankee Rowe" template="veyae" />
<folder title="Wisconsin Public Service Corp.- Kewaunee" template="vewps" />
<folder title="Wisconsin Public Service Corp.- Kewaunee Operating Procedures" template="vewpsop" />
<folder title="Wisconsin Public Service Corp.- Kewaunee Alarm Response Procedures" template="vewpsarp" />
<folder title="Wisconsin Public Service Corp.- Kewaunee OP EOPs and AOPs" template="vewpsaep" />
<folder title="South Carolina Gas and Electric - V.C. Summer" template="vesummer" />
<folder title="Louisiana Power and Light - Waterford" template="velpl" />
<folder title="Pacific Gas and Electric - Diablo Canyon" template="vepac" />
<folder title="Southern California Edison - San Onofre" template="vesce" />
<folder title="Carolina Power and Light - Robinson" template="vecplr" />
<folder title="Arkansas Nuclear One - Unit 1" template="veano1" />
<folder title="Emergency Operating Procedures" template="veano2" />
<folder title="Normal Operating Procedures" template="veano2op" />
<folder title="Abnormal Operating Procedures" template="veano2ap" />
<folder title="Low Mode Emergency Operating Procedures" template="veano2lm" />
<folder title="Annunciator Procedures" template="veano2an" />
<folder title="Southern Nuclear Operating Company - Vogtle" template="vegpc" />
<folder title="Florida Power and Light - Turkey Point EOPs" template="vefpl" />
<folder title="Florida Power and Light - Turkey Point ONOPs" template="vefpl4" />
<folder title="Florida Power and Light - Turkey Point SAMGs" template="vefpls" />
<folder title="STPNOC - South Texas" template="vehlp" />
<folder title="Carolina Power and Light - Shearon Harris" template="vecpls" />
<folder title="Virginia Power - EPIP" template="veepip" />
<folder title="AmerenUE - Callaway Plant" template="vecal" />
<folder title="ADM - Administrative Procedures - Wolf Creek" template="vewcnadm" />
<folder title="ALR - Alarm Response Procedures - Wolf Creek" template="vewcnalr" />
<folder title="CKL - Check List Procedures - Wolf Creek" template="vewcnckl" />
<folder title="EMG - Emergency Procedures - Wolf Creek" template="vewcnemg" />
<folder title="FP - Fire Protection Procedures - Wolf Creek" template="vewcnfp" />
<folder title="FHP - Fuel Handling Procedures - Wolf Creek" template="vewcnfhp" />
<folder title="GEN - General Operating Procedures - Wolf Creek" template="vewcngen" />
<folder title="OFN - Off-Normal Procedures - Wolf Creek" template="vewcnofn" />
<folder title="STN STS - Surveillance Procedures - Wolf Creek" template="vewcnsur" />
<folder title="STN - Non-Tech Spec Surveillance Procedures - Wolf Creek" template="vewcnstn" />
<folder title="STS - Tech Spec Surveillance Procedures - Wolf Creek" template="vewcnsts" />
<folder title="SYS - System Procedures - Wolf Creek" template="vewcnsys" />
<folder title="TMP - Temporary Procedures - Wolf Creek" template="vewcntmp" />
<folder title="IPS - IPS Procedures - Wolf Creek" template="vewcnips" />
<folder title="CHM - Chemistry Procedures - Wolf Creek" template="vewcnchm" />
<folder title="Wolf Creek Procedures - Local Drive" template="vewcn" />
<folder title="Duke Power - Catawba 1B Interim Set" template="vecat" />
<folder title="Duke Power - Catawba Revision 1C" template="vecns" />
<folder title="Duke Power - McGuire" template="vemcg" />
<folder title="Exelon Nuclear - Braidwood/Byron" template="vecebwb" />
<folder title="Exelon Nuclear - Braidwood" template="vebraid" />
<folder title="Exelon Nuclear - Byron" template="vebyron" />
<folder title="Constellation Energy Group - Calvert Cliffs" template="vebge" />
<folder title="North Atlantic Energy Service Corp. - Seabrook Nuclear Plant" template="vesea" />
<folder title="Volian Enterprises. - River Bend Station" template="vervbnd" />
<folder title="River Bend Station - Mechanical Procedures" template="vervmech" />
<folder title="River Bend Station - Operations Procedures" template="vervops" />
<folder title="River Bend Station - Radiation Protection Procedures" template="vervrp" />
<folder title="River Bend Station - Fire Protection Procedures" template="vervfp" />
<folder title="River Bend Station - I and C" template="vervic" />
<folder title="River Bend Station - Chemistry Procedures" template="vervchem" />
<folder title="River Bend Station - Electrical Procedures" template="vervelec" />
<folder title="River Bend Station - Protective Relay Procedures" template="vervrel" />
<folder title="River Bend Station - Operations Procedures" template="vervops" />
<folder title="River Bend Station - IST" template="vervist" />
<folder title="Southern Nuclear Operating Company - Farley Nuclear Plant" template="vefnp" />
<folder title="CEN - Combustion Engineering ERGs" template="vecen" />
<folder title="WOG - Emergency Response Guidelines LP Rev. 1" template="velp1" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1" template="vehp1" />
<folder title="WOG - Emergency Response Guidelines LP Rev. 1a" template="velpr1a" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1a" template="vehp1a" />
<folder title="WOG - Emergency Response Guidelines LP Rev. 1b" template="velpr1b" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1b" template="vehp1b" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1b - Figures" template="vehp1bfg" />
<folder title="WOG - Emergency Response Guidelines Rev. 1c" template="verev1c" />
<folder title="WOG - Emergency Response Guidelines Rev. 2" template="verev2" />
<folder title="VEPROMS - Test and Validation Procedures" template="vetest" />
<folder title="VEPROMS - Test Procedures for Calvert Cliffs" template="vebgedt" />
<folder title="VEPROMS - Demo Database" template="vedemo" />
<folder title="VEPROMS - UKRAINE Verbal Translation EOIs" template="veukrain" />
<folder title="VEPROMS - PI Wolf Creek Performance Improvement Procedures" template="vewcnpi" />
</folders>
</dbObject>
<dbObject type="plant"
items="Sets"
imageindex="2"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child="set">
<folders active="set.dbf">
<folder title="Emergency Procedures" template="procs" exception="procs2"/>
<folder title="Emergency Procedures Unit 1" template="procs" requires="procs2"/>
<folder title="Emergency Procedures Unit 2" template="procs2" />
<folder title="Emergency Procedures - Sample Version" template="samples" />
<folder title="Emergency Procedures (Intro / Attachment / Foldout)" template="pages" />
<folder title="Emergency Procedures (Intro / Attachment / Foldout)" template="intro" />
<folder title="Emergency Procedures (Intro / Attachment / Foldout)" template="intro2" />
<folder title="Writer's Guide" template="wg" />
<folder title="Abnormal Procedures" template="abbyproc" />
<folder template="*.prc" title="~Procedures ({filename})" />
<folder template="*.bck" title="~Background Documents ({filename})" />
<folder template="*.dvt" title="~Deviation Documents ({filename})" />
<folder template="*.sl?" title="~Procedures ({filename})" />
</folders>
</dbObject>
<dbObject type="set"
items="Versions"
imageindex="3"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child="version">
<folders active="set.dbf">
<folder template="." title="Working Draft" />
<folder template="approved" title="Approved Version"/>
<folder template="chgsht" title="Change Sheet Version"/>
<folder template="tmpchg" title="Temporary Change"/>
<folder template="approved\tmpchg" title="Approved Temporary Change"/>
</folders>
</dbObject>
<dbObject type="version"
items="Procedures"
imageindex="4"
key="dbPath"
title="{number} - {title}"
select="select * from [set] where entry is not null"
table="Set"
criteria="entry is not null"
sort="number"
child="proc">
<folders active="set.dbf">
<folder template="*.zip" title="Archive ({filename})" child="archive"/>
<!--folder template="approved" title="Approved Version" child="version"/-->
</folders>
</dbObject>
<dbObject type="proc"
imageindex="5"
items="Sections"
key="{{Entry}}"
title="{step} - {sequence} {text}"
select="select * from(
select
asc(mid(sequence,2,1))-48 as sec,
asc(mid(step,1,1))-64 as sec2,
rtrim(mid(text,76,8)) as fmt,
mid(text,83,3) as subfmt,
rtrim(mid(text,86,20)) as secnum,
iif(mid(step,2,1)='0','S',mid(step,2,1)) + right('0'+rtrim(left(iif(type is null,'',type),1)),1) as OldType,
* from [{{entry}}] where sequence like ' %') order by sec"
table="Proc"
criteria=""
sort="step,sequence"
child="section"/>
<dbObject type="section"
imageindex="6"
items="Steps"
key=""
title="{stp: 3} - {text}"
select="select stp,step,text,type from (select asc(mid(step,2,1))-48 as stp,* from [{{entry}}] where step like '{{Step:1}}%' and sequence='S')order by stp"
table="Section"
criteria=""
sort="stp"
child="step"/>
<dbObject type="step"
imageindex="7"
items="Step Structure"
key="{{Step}}"
title="{Sequence} - {Text}"
select="select * from [{{entry}}] where step = '{{Step}}' and (sequence like '[*S!]_' or sequence='S$') "
select1="select * from [{{entry}}] where step = '{{step}}' and sequence &lt;&gt; 'S'"
table="Step"
criteria=""
sort="sequence"
child="substep"
child1="dbStepStruct"/>
<dbObject type="substep"
imageindex="8"
items="Substeps"
key=""
title="{sequence} - {text}"
select="select * from [{{entry}}] where step = '{{step}}' and (sequence like '{{sequence}}_' or sequence like '{{sequence}}[*!]_') "
table="SubStep"
criteria=""
sort="sequence"
child1="dbSubStep"/>
<dbObject type="stepstruct"
imageindex="8"
items="Structure"
key="{{Step}}{{Sequence}}"
title="{Sequence} - {Text}"
select=""
table=""
criteria=""
sort=""
child=""/>
<dbObject type="archive"
items=""
imageindex="9"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child=""/>
</dbControl>

View File

@ -0,0 +1,249 @@
using System;
using System.Collections.Generic;
using System.Text;
using vlnObjectLibrary;
using System.Xml;
using System.IO;
using System.Data;
using System.Data.OleDb;
using System.Reflection;
namespace vlnServerLibrary
{
public class vlnServer // This class loads children for a vlnObject
{
#region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
#region Static Properties
private static string m_XmlControlPath;
private static XmlDocument m_XmlControl;
public static string XMLControlPath
{
get { return m_XmlControlPath; }
set
{
m_XmlControlPath = value;
}
}
public static XmlDocument XMLControl
{
get
{
if (m_XmlControl == null)
{
m_XmlControl = new XmlDocument();
lock (m_XmlControl)
{
XMLControlPath = "vlnControl.xml";
m_XmlControl.Load(m_XmlControlPath);
}
}
return m_XmlControl;
}
}
#endregion
private List<vlnObject> LoadChildren(vlnObject o)
{
o.Children = new List<vlnObject>();
LoadChildrenFromFolders(o);// TODO: Load children based upon directory lookup
LoadChildrenFromDB(o,LookUp(o,"select"));// TODO: Load children based upon select statement
return o.Children;
}
public string GetChildren(string sVlnObject)
{
using (vlnObject o = new vlnObject(sVlnObject))
{
LoadChildren(o);
return o.AllChildren();
}
}
public string GetDataPath()
{
vlnObject o = new vlnObject();
o.Type="datapath";
o.Title="Data Path";
o.Path=LookUpX(o,".//default/@datapath");
return o.ToString();
}
protected string LookUp(vlnObject o,string s)
{
string xPath = string.Format(".//dbObject[@type='{0}']/@{1}", o.Type, s);
return LookUpX(o,xPath);
}
protected string LookUpP(vlnObject o,string s)
{
string xPath = string.Format(".//dbObject[@type='{0}']/@{1}", o.Parent.Type, s);
return LookUpX(o,xPath);
}
protected string LookUpX(vlnObject o,string xPath)
{
return LookUpX(o,xPath, XMLControl);
}
private void LoadChildrenFromDB(vlnObject o,string sSelect)
{
if (sSelect != "")
{
try
{
string s = LookUpX(o,".//connection/@string");
OleDbConnectionStringBuilder csb = new OleDbConnectionStringBuilder(s);
OleDbConnection dbConn = new OleDbConnection(csb.ConnectionString);
string sTable = LookUp(o,"table");
//if (dbConn.State != ConnectionState.Open) dbConn.Open();
OleDbDataAdapter da = new OleDbDataAdapter(sSelect, dbConn);
DataSet ds = new DataSet();
da.Fill(ds, sTable);
string srt = LookUp(o,"sort");
DataView dv = new DataView(ds.Tables[sTable], LookUp(o,"criteria"), LookUp(o,"sort"), DataViewRowState.CurrentRows);
foreach (DataRowView mydrv in dv)
{
vlnObject vb = o.Add(LookUp(o,"child"), "", o.Path);
foreach (DataColumn dc in dv.Table.Columns)
{
vb.AddProp(dc.ColumnName, mydrv[dc.ColumnName].ToString());
}
vb.Title = LookUpP(vb,"title");
o.Children.Add(vb);
}
}
catch (Exception ex)
{
log.ErrorFormat("{0}\r\n{1}", ex.Message, ex.InnerException);
}
}
}
public DataSet GetDataSet(vlnObject o, string sSelect)
{
if (sSelect != "")
{
try
{
OleDbConnection dbConn = new OleDbConnection(LookUpX(o, ".//connection/@string"));
OleDbDataAdapter da = new OleDbDataAdapter(sSelect, dbConn);
DataSet ds = new DataSet();
da.Fill(ds, LookUp(o, "table"));
return ds;
}
catch (Exception ex)
{
log.ErrorFormat("{0}\r\n{1}", ex.Message, ex.InnerException);
}
}
return null;
}
public OleDbDataReader GetDataReader(vlnObject o, string sSelect)
{
if (sSelect != "")
{
OleDbConnection dbConn = new OleDbConnection(LookUpX(o, ".//connection/@string"));
OleDbCommand cmd = new OleDbCommand(sSelect, dbConn);
cmd.CommandType = CommandType.Text;
dbConn.Open();
OleDbDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
return dr;
}
return null;
}
private void LoadChildrenFromFolders(vlnObject o)
{
// First look in the XML to see if there are any folders for the specified item
XmlNodeList nl = XMLControl.SelectNodes(string.Format(".//dbObject[@type='{0}']/folders/folder", o.Type));
if (nl.Count != 0)
{
foreach (XmlNode xn in nl)
{
LoadChildrenFromFolder(o,xn);
}
}
}
private void LoadChildrenFromFolder(vlnObject o, XmlNode xn)
{
// First look in the XML to see if there are any folders for the specified item
string sTmp = LookUpX(o,"@template", xn);
if (sTmp != "")
{
string sException = LookUpX(o,"@exception", xn);
string sRequired = LookUpX(o,"@requires", xn);
DirectoryInfo di = new DirectoryInfo(o.Path);
if (sRequired == "" || di.GetFileSystemInfos(sRequired).Length > 0)
{
if (sException == "" || di.GetFileSystemInfos(sException).Length == 0)
{
try
{
if (sTmp == ".")
{
LoadChildrenFromFolder(o, xn, di);
}
else
{
if(sTmp.Contains("\\")){
string[] sTmps = sTmp.Split('\\');
DirectoryInfo [] dis = di.GetDirectories(sTmps[0]);
foreach (DirectoryInfo di2 in dis)
{
foreach (FileSystemInfo di3 in di2.GetFileSystemInfos(sTmps[1]))
{
LoadChildrenFromFolder(o, xn, di3);
}
}
}
else
{
foreach (FileSystemInfo di1 in di.GetFileSystemInfos(sTmp))
{
LoadChildrenFromFolder(o, xn, di1);
}
}
}
}
catch (DirectoryNotFoundException ex)
{
// Ignore this exception
log.InfoFormat("Directory {0} Template {1} Error {2}",di, sTmp,ex.Message);
}
catch (Exception ex)
{
log.ErrorFormat("Error: {0}\r\n{1}", ex.Message, ex.InnerException);
}
}
}
}
}
private void LoadChildrenFromFolder(vlnObject o,XmlNode xn, FileSystemInfo fi)
{
vlnObject vb = o.Add(LookUpX(o,"@child", xn), "", fi.FullName);
vb.AddProp("filename", fi.Name);
vb.Title = GetTitle(fi.FullName, LookUpX(vb,"@title", xn));
o.Children.Add(vb);
}
protected string GetTitle(string sPath, string sDefault)
{
string sRetval = sDefault;
if (sRetval[0] == '~')
{
string sTitlePath = sPath + "\\title";
if (File.Exists(sTitlePath))
{
StreamReader sr = File.OpenText(sTitlePath);
return sr.ReadToEnd();
}
sRetval = sRetval.Substring(1);
}
return sRetval;
}
protected string LookUpX(vlnObject o, string xPath, XmlNode xn)
{
XmlNode nd = xn;
XmlNode ndf = nd.SelectSingleNode(xPath);
while (ndf == null && nd.ParentNode != null)
{
nd = nd.ParentNode;
ndf = nd.SelectSingleNode(xPath);
}
if (ndf == null) return "";
return o.ProcessString(ndf.InnerText);
}
}
}

View File

@ -0,0 +1,64 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F9B53DDC-2A2E-4A17-B777-4EC0EE585DE2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>vlnServerLibrary</RootNamespace>
<AssemblyName>vlnServerLibrary</AssemblyName>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\veproms\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\veproms\bin\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="vlnObject, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\veproms\bin\vlnObject.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="vlnServer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="vlnControl.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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:Volian.Utils.Library\\vlnServerLibrary"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

93
proms_1/proms.sln Normal file
View File

@ -0,0 +1,93 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataLoader", "DataLoader\DataLoader.csproj", "{8E239A2B-B38C-4CD5-BA0D-A41A88BD2AEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volian.Controls.Library", "Volian.Controls.Library\Volian.Controls.Library.csproj", "{8556527C-6615-487F-8AF7-22EBC3EF0268}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Volian.Utils.Library", "Volian.Utils.Library", "{5A0EDD18-70A4-4D5E-93CC-39F4D246352A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IniReader", "Volian.Utils.Library\IniReader\IniReader.csproj", "{889E30F7-CFBC-470D-9488-7009C354F9C9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSWord", "Volian.Utils.Library\MSWord\MSWord.csproj", "{2F79D7F9-885E-4441-99F3-045D7612B2E5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vlnObjectLibrary", "Volian.Utils.Library\vlnObject\vlnObjectLibrary.csproj", "{933269F5-C3AD-423E-88EB-133A7333FD6B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vlnServerLibrary", "Volian.Utils.Library\vlnServerLibrary\vlnServerLibrary.csproj", "{F9B53DDC-2A2E-4A17-B777-4EC0EE585DE2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VEPROMS.CSLA.Library", "VEPROMS.CSLA.Library\VEPROMS.CSLA.Library.csproj", "{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}"
EndProject
Global
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 8
SccProjectUniqueName0 = DataLoader\\DataLoader.csproj
SccProjectName0 = \u0022$/PROMS/DataLoader\u0022,\u0020IIAAAAAA
SccLocalPath0 = DataLoader
SccProjectUniqueName1 = Volian.Controls.Library\\Volian.Controls.Library.csproj
SccProjectName1 = \u0022$/PROMS/Volian.Controls.Library\u0022,\u0020TVBAAAAA
SccLocalPath1 = Volian.Controls.Library
SccProjectUniqueName2 = VEPROMS.CSLA.Library\\VEPROMS.CSLA.Library.csproj
SccProjectName2 = \u0022$/PROMS/VEPROMS.CSLA.Library\u0022,\u0020TPBAAAAA
SccLocalPath2 = VEPROMS.CSLA.Library
SccLocalPath3 = .
SccProjectUniqueName4 = Volian.Utils.Library\\IniReader\\IniReader.csproj
SccProjectTopLevelParentUniqueName4 = proms.sln
SccLocalPath4 = .
SccProjectFilePathRelativizedFromConnection4 = Volian.Utils.Library\\IniReader\\
SccProjectUniqueName5 = Volian.Utils.Library\\MSWord\\MSWord.csproj
SccProjectTopLevelParentUniqueName5 = proms.sln
SccLocalPath5 = .
SccProjectFilePathRelativizedFromConnection5 = Volian.Utils.Library\\MSWord\\
SccProjectUniqueName6 = Volian.Utils.Library\\vlnObject\\vlnObjectLibrary.csproj
SccProjectTopLevelParentUniqueName6 = proms.sln
SccLocalPath6 = .
SccProjectFilePathRelativizedFromConnection6 = Volian.Utils.Library\\vlnObject\\
SccProjectUniqueName7 = Volian.Utils.Library\\vlnServerLibrary\\vlnServerLibrary.csproj
SccProjectTopLevelParentUniqueName7 = proms.sln
SccLocalPath7 = .
SccProjectFilePathRelativizedFromConnection7 = Volian.Utils.Library\\vlnServerLibrary\\
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8E239A2B-B38C-4CD5-BA0D-A41A88BD2AEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E239A2B-B38C-4CD5-BA0D-A41A88BD2AEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E239A2B-B38C-4CD5-BA0D-A41A88BD2AEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E239A2B-B38C-4CD5-BA0D-A41A88BD2AEE}.Release|Any CPU.Build.0 = Release|Any CPU
{8556527C-6615-487F-8AF7-22EBC3EF0268}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8556527C-6615-487F-8AF7-22EBC3EF0268}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8556527C-6615-487F-8AF7-22EBC3EF0268}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8556527C-6615-487F-8AF7-22EBC3EF0268}.Release|Any CPU.Build.0 = Release|Any CPU
{889E30F7-CFBC-470D-9488-7009C354F9C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{889E30F7-CFBC-470D-9488-7009C354F9C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{889E30F7-CFBC-470D-9488-7009C354F9C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{889E30F7-CFBC-470D-9488-7009C354F9C9}.Release|Any CPU.Build.0 = Release|Any CPU
{2F79D7F9-885E-4441-99F3-045D7612B2E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F79D7F9-885E-4441-99F3-045D7612B2E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F79D7F9-885E-4441-99F3-045D7612B2E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F79D7F9-885E-4441-99F3-045D7612B2E5}.Release|Any CPU.Build.0 = Release|Any CPU
{933269F5-C3AD-423E-88EB-133A7333FD6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{933269F5-C3AD-423E-88EB-133A7333FD6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{933269F5-C3AD-423E-88EB-133A7333FD6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{933269F5-C3AD-423E-88EB-133A7333FD6B}.Release|Any CPU.Build.0 = Release|Any CPU
{F9B53DDC-2A2E-4A17-B777-4EC0EE585DE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9B53DDC-2A2E-4A17-B777-4EC0EE585DE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9B53DDC-2A2E-4A17-B777-4EC0EE585DE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9B53DDC-2A2E-4A17-B777-4EC0EE585DE2}.Release|Any CPU.Build.0 = Release|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41B2D786-1C03-4C1A-9247-DA9F0D6B06D5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{889E30F7-CFBC-470D-9488-7009C354F9C9} = {5A0EDD18-70A4-4D5E-93CC-39F4D246352A}
{2F79D7F9-885E-4441-99F3-045D7612B2E5} = {5A0EDD18-70A4-4D5E-93CC-39F4D246352A}
{933269F5-C3AD-423E-88EB-133A7333FD6B} = {5A0EDD18-70A4-4D5E-93CC-39F4D246352A}
{F9B53DDC-2A2E-4A17-B777-4EC0EE585DE2} = {5A0EDD18-70A4-4D5E-93CC-39F4D246352A}
EndGlobalSection
EndGlobal

10
proms_1/proms.vssscc Normal file
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"
}