Commit for development environment setup

This commit is contained in:
2023-06-19 16:12:33 -04:00
parent be72063a3c
commit bbce2ad0a6
2209 changed files with 1171775 additions and 625 deletions

View File

@@ -0,0 +1,78 @@
<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>{48CD3831-84A5-45AB-BD36-213359779E21}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FindLinx</RootNamespace>
<AssemblyName>FindLinx</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="frmFindLinx.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmFindLinx.Designer.cs">
<DependentUpon>frmFindLinx.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmFindLinx.resx">
<SubType>Designer</SubType>
<DependentUpon>frmFindLinx.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>
<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,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace FindLinx
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmFindLinx());
}
}
}

View File

@@ -0,0 +1,33 @@
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("FindLinx")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FindLinx")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[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("864d5e18-264c-4257-98d3-a50da715ca19")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[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:2.0.50727.5477
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FindLinx.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", "2.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("FindLinx.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:2.0.50727.5477
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FindLinx.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.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,153 @@
namespace FindLinx
{
partial class frmFindLinx
{
/// <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.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.chooseDBToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.findLinxToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.allDBsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.tbResults = new System.Windows.Forms.TextBox();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.chooseDBToolStripMenuItem,
this.findLinxToolStripMenuItem,
this.allDBsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(642, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File";
//
// 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);
//
// chooseDBToolStripMenuItem
//
this.chooseDBToolStripMenuItem.Name = "chooseDBToolStripMenuItem";
this.chooseDBToolStripMenuItem.Size = new System.Drawing.Size(77, 20);
this.chooseDBToolStripMenuItem.Text = "Choose DB";
this.chooseDBToolStripMenuItem.Click += new System.EventHandler(this.chooseDBToolStripMenuItem_Click);
//
// findLinxToolStripMenuItem
//
this.findLinxToolStripMenuItem.Enabled = false;
this.findLinxToolStripMenuItem.Name = "findLinxToolStripMenuItem";
this.findLinxToolStripMenuItem.Size = new System.Drawing.Size(63, 20);
this.findLinxToolStripMenuItem.Text = "FindLinx";
this.findLinxToolStripMenuItem.Click += new System.EventHandler(this.findLinxToolStripMenuItem_Click);
//
// allDBsToolStripMenuItem
//
this.allDBsToolStripMenuItem.Name = "allDBsToolStripMenuItem";
this.allDBsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
this.allDBsToolStripMenuItem.Text = "All DBs";
this.allDBsToolStripMenuItem.Click += new System.EventHandler(this.allDBsToolStripMenuItem_Click);
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsslStatus});
this.statusStrip1.Location = new System.Drawing.Point(0, 328);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(642, 22);
this.statusStrip1.TabIndex = 1;
this.statusStrip1.Text = "statusStrip1";
//
// tsslStatus
//
this.tsslStatus.Name = "tsslStatus";
this.tsslStatus.Size = new System.Drawing.Size(39, 17);
this.tsslStatus.Text = "Ready";
//
// tbResults
//
this.tbResults.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbResults.Location = new System.Drawing.Point(0, 24);
this.tbResults.Multiline = true;
this.tbResults.Name = "tbResults";
this.tbResults.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tbResults.Size = new System.Drawing.Size(642, 304);
this.tbResults.TabIndex = 2;
//
// frmFindLinx
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(642, 350);
this.Controls.Add(this.tbResults);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "frmFindLinx";
this.Text = "Find Links";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem chooseDBToolStripMenuItem;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel tsslStatus;
private System.Windows.Forms.ToolStripMenuItem findLinxToolStripMenuItem;
private System.Windows.Forms.TextBox tbResults;
private System.Windows.Forms.ToolStripMenuItem allDBsToolStripMenuItem;
}
}

View File

@@ -0,0 +1,378 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
namespace FindLinx
{
public partial class frmFindLinx : Form
{
public frmFindLinx()
{
InitializeComponent();
}
public string MyStatus
{
get { return tsslStatus.Text; }
set { tsslStatus.Text = value; Application.DoEvents(); }
}
private static string _SelectedDatabase = null;
public static string SelectedDatabase
{
get { return frmFindLinx._SelectedDatabase; }
set
{
frmFindLinx._SelectedDatabase = value;
_ConnectionString = _MenuConnectionString.Replace("{MENU}", SelectedDatabase);
}
}
private static string _MenuConnectionString = @"Data Source=VOLIAN-SERVER;User Id=proms2010;password=proms2010;Initial Catalog={MENU}";
private static string _ConnectionString = null;
private Dictionary<int, string> _MyContents = null;
private void chooseDBToolStripMenuItem_Click(object sender, EventArgs e)
{
ChooseDatabase();
findLinxToolStripMenuItem.Enabled = true;
LoadContents();
ResetLinks();
FindLinks();
//ShowLinks(SelectedDatabase);
}
private void ChooseDatabase()
{
System.Windows.Forms.ContextMenuStrip cms = BuildDatabaseMenu();
SelectedDatabase = null;
while (SelectedDatabase == null)
{
cms.Show(new System.Drawing.Point((System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - cms.Width) / 2, (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - cms.Height) / 2));
System.Windows.Forms.Application.DoEvents();
}
}
private static System.Windows.Forms.ContextMenuStrip BuildDatabaseMenu()
{
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 (string name in DBNames)
cms.Items.Add(name, null, new EventHandler(Database_Click));
return cms;
}
private static List<string> _DBNames;
public static List<string> DBNames
{
get
{
if (_DBNames == null)
_DBNames = GetDatabases();
return _DBNames;
}
}
private static List<string> GetDatabases()
{
List<string> dbNames;
dbNames = new List<string>();
SelectedDatabase = "master";
SqlConnection cn = new SqlConnection(_ConnectionString);
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 from sysdatabases where name not in ('master','model','msdb','tempdb') and name like 'VEPROMS%' 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();
foreach (DataRow dr in ds.Tables[0].Rows)
dbNames.Add(dr["name"].ToString());
return dbNames;
}
private static void Database_Click(object sender, EventArgs e)
{
System.Windows.Forms.ToolStripMenuItem tsmi = sender as System.Windows.Forms.ToolStripMenuItem;
if (tsmi != null)
{
SelectedDatabase = tsmi.Text;
}
}
private void findLinxToolStripMenuItem_Click(object sender, EventArgs e)
{
FindLinks();
}
private Dictionary<string, int> DicPrefix;
private Dictionary<string, int> DicSuffix;
private void ResetLinks()
{
DicPrefix = new Dictionary<string, int>();
DicSuffix = new Dictionary<string, int>();
}
private void ShowLinks(string selectedDatabase)
{
tbResults.Clear();
SortedList<int, string> srtPrefixes = new SortedList<int, string>(new DegreeComparer());
foreach (string pre in DicPrefix.Keys)
{
srtPrefixes.Add(-DicPrefix[pre], pre);
}
tbResults.AppendText(string.Format("{0} Prefixes\r\n", selectedDatabase));
foreach (string pre in srtPrefixes.Values)
{
tbResults.AppendText(string.Format("{0},'{1}'\r\n", DicPrefix[pre], pre));
}
SortedList<int, string> srtSuffixes = new SortedList<int, string>(new DegreeComparer());
foreach (string suf in DicSuffix.Keys)
{
srtSuffixes.Add(-DicSuffix[suf], suf);
}
tbResults.AppendText(string.Format("\r\n{0} Suffixes\r\n", selectedDatabase));
foreach (string suf in srtSuffixes.Values)
{
tbResults.AppendText(string.Format("{0},'{1}'\r\n", DicSuffix[suf], suf));
}
}
private void FindLinks()
{
// loop through contents
foreach (int ic in _MyContents.Keys)// for each content record
{
string Text = _MyContents[ic];
// find all links
//string findLink = @"<START\](.*?)#Link:T(.*?)\[END>"; // need to only process transitions (no ros)
string findLink = @"<START\](.*?)\[END>"; // need to only process transitions (no ros)
MatchCollection ms = Regex.Matches(Text, findLink);
int ii = 0;
foreach (Match mlink in ms)// for each link
{
if (mlink.ToString().Contains("#Link:T"))
{
string key = string.Format("{0}.{1}.{2}", _SelectedDatabase, ic, ii);
if (key == "VEPROMS_BWD.16964.0") Console.WriteLine("Here");
string oldval = OldTransitionValue(mlink.ToString());
string newval = NewTransitionValue(mlink.ToString());
//if (oldval != newval && (!(oldval == "" && newval.Contains("Prerequisite {Prereq")) && !oldval.Contains("{First Step")) && !oldval.Contains("{Page Num")) tbResults.AppendText(string.Format("'{0}','{1}','{2}'\r\n", _SelectedDatabase, oldval, newval));
if (oldval != newval) tbResults.AppendText(string.Format("'{0}','{1}','{2}','{3}'\r\n", _SelectedDatabase, oldval, newval, mlink.ToString()));
ii++; // instance of transition
}
}
}
}
private string OldTransitionValue(string _TextAndLink)
{
Match m = Regex.Match(_TextAndLink, @"<START\](\\[^v \\]+)*\\v0(\\[^v \{\\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(.*?)\[END>");
return m.Groups[3].ToString();
}
private string NewTransitionValue(string _TextAndLink)
{
Match m = Regex.Match(_TextAndLink, @"<START\](.*?)#Link:(.*?)\[END>"); // get value string including formatting.
string mtxt = m.Groups[1].ToString();
mtxt = Regex.Replace(mtxt, @"^(\\[^v \\]+)*\\v0", ""); // replace the rtf commands that occur prior to the value string
if (mtxt.StartsWith(" ")) mtxt = mtxt.Substring(1);
mtxt = Regex.Replace(mtxt, @"\\v(\\[^v \\]+)* $", ""); // replace the rtf commands that occur after to the value string
mtxt = Regex.Replace(mtxt, @"(\\ulnone|\\b0)+$", "");
return mtxt;
}
private string GetValuePrefix(string Text, Match mlink, int lastlink)
{
throw new Exception("The method or operation is not implemented.");
}
private string SuffixPattern(string suffix)
{
string firstchar = "";
suffix = suffix.Replace("\r", "{CR}");
suffix = suffix.Replace("\n", "{LF}");
if (Regex.IsMatch(suffix, @"^(\\(b0|b|ulnone|ul))+\\"))
{
firstchar = "{RTFCommand}";
suffix = Regex.Replace(suffix, @"^(\\(b0|b|ulnone|ul))+", "");
}
if (suffix == @"\v0 ")
return @"Pattern','" + firstchar + @"\v0{Space}";
if (suffix == @"\v0")
return @"Pattern','" + firstchar + @"\v0";
return _SelectedDatabase + "','" + suffix;
}
private string GetSuffix(string Text, Match mlink, int iEnd)
{
int iStart = mlink.Index + mlink.Length;
//int iEnd = (mlink.NextMatch() == null) ? Text.Length : mlink.NextMatch().Index;
string follows = Text.Substring(iStart,iEnd-iStart);
int iEndComment = follows.IndexOf("\\v0");
if (follows.Length > 3 + iEndComment)
{
if (follows.Substring(iEndComment + 3, 1) == " ")
return follows.Substring(0, iEndComment + 4);
if (follows.Substring(iEndComment + 3, 1) == "\\")
return follows.Substring(0, iEndComment + 3);
return follows.Substring(0, iEndComment + 3);
}
return follows;
}
public class DegreeComparer : IComparer<int>
{
#region IComparer<int> Members
public int Compare(int x, int y)
{
if (x < y)
return -1;
else
return 1;
}
#endregion
}
private string PrefixPattern(string prefix)
{
string firstchar = "";
if(prefix.StartsWith(" "))
{
firstchar = "{Space}";
prefix = prefix.Substring(1);
}
else if (prefix.StartsWith("\n"))
{
firstchar = "{Newline}";
prefix = prefix.Substring(1);
}
else if (prefix.StartsWith("\xa0"))
{
firstchar = "{HardSpace}";
prefix = prefix.Substring(1);
}
else if (Regex.IsMatch(prefix, @"^\\u[0-9]{1,4}\?"))
{
firstchar = "{Unicode}";
prefix=Regex.Replace(prefix, @"^\\u[0-9]{1,4}\?","");
}
else if (Regex.IsMatch(prefix, @"^\\'[0-9a-fA-F]{2}"))
{
firstchar = "{Hexcode}";
prefix = Regex.Replace(prefix, @"^\\'[0-9a-fA-F]{2}", "");
}
else if (Regex.IsMatch(prefix, @"^[:.()\[\]""*=<>]"))
{
firstchar = "{Punctuation}";
prefix = Regex.Replace(prefix, @"^[:.()\[\]""*=<>]", "");
}
else if (Regex.IsMatch(prefix, @"^\\[{}~]"))
{
firstchar = "{Special}";
prefix = Regex.Replace(prefix, @"^\\[{}~]", "");
}
else if (Regex.IsMatch(prefix, @"^\\(b0|b|ulnone|ul|line)\\"))
{
firstchar = "{RTFCommand}";
prefix = Regex.Replace(prefix, @"^\\(b0|b|ulnone|ul|line)", "");
}
if (prefix == @"\v ")
return @"Pattern','" + firstchar +@"\v ";
//if (prefix == @" \v ")
// return @"Pattern-{Space}\v ";
//if (prefix == "\xA0\\v ")
// return @"Pattern-{HardSpace}\v ";
//if (Regex.IsMatch(prefix, @"^\\u[0-9]{1,4}\?\\v $"))
// return @"Pattern-" + firstchar + @"{Unicode}\v ";
//if (Regex.IsMatch(prefix, @"^\\u[0-9]{1,4}\?.*\\v $"))
// return @"Pattern-" + firstchar + @"{Unicode}{Text}\v ";
// if (Regex.IsMatch(prefix, @"^\\[{}~]\\v $"))
// return @"Pattern-" + firstchar + @"{Special}\v ";
// if (Regex.IsMatch(prefix, @"^ ?[()""\[\]]\\v $"))
// return @"Pattern-" + firstchar + @"{Puctuation}\v ";
if (Regex.IsMatch(prefix, @"^ ?[-%A-Za-z0-9.,/()\[\]]+\\v $"))
return @"Pattern','" + firstchar + @"{Text}\v ";
//if (prefix == "\n\\v ")
// return @"Pattern-{Newline}\v ";
return SelectedDatabase + "','" + prefix;
}
private string GetPrefix(string Text, Match mlink, int lastlink)
{
string precedes = Text.Substring(lastlink, mlink.Index - lastlink);
if(mlink.Index - lastlink <= 3)
return precedes;
if (precedes.EndsWith(@"\v "))
{
//int indexSpace = Text.LastIndexOf(' ', mlink.Index - 4);
////if (indexSpace > mlink.Index) indexSpace = 0;
//int indexCR = Text.LastIndexOf('\n', mlink.Index - 4);
////if (indexCR > mlink.Index) indexCR = 0;
//if (indexCR >= 0 && indexCR > indexSpace)
// indexSpace = indexCR;
//int indexHS = Text.LastIndexOf('\xA0', mlink.Index - 4);
////if (indexHS > mlink.Index) indexHS = 0;
//if (indexHS >= 0 && indexHS > indexSpace)
// indexSpace = indexHS;
int indexSpace = Text.LastIndexOfAny(" \n\xA0:.()[]\"<>*=".ToCharArray(), mlink.Index - 4);
int indexSlash = Text.LastIndexOf('\\', mlink.Index - 4);
if (indexSlash >= 0)
{
if (indexSlash > indexSpace)
return Text.Substring(indexSlash, mlink.Index - indexSlash);
}
if (indexSpace >= 0)
{
return Text.Substring(indexSpace, mlink.Index - indexSpace);
}
}
return precedes;
}
private void LoadContents()
{
SqlConnection cn = new SqlConnection(_ConnectionString);
cn.Open();
//SqlDataAdapter da = new SqlDataAdapter("select ContentID,Text from Contents where ContentID in(select fromID from transitions union select contentid from rousages)", cn);
SqlDataAdapter da = new SqlDataAdapter("select ContentID,Text from Contents where ContentID in(select fromID from transitions)", cn);
da.SelectCommand.CommandTimeout = 300; // 300 sec timeout
DataSet ds = new DataSet();
try
{
da.Fill(ds);
_MyContents = new Dictionary<int, string>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
_MyContents.Add((int)dr["ContentID"], dr["Text"].ToString());
}
//MessageBox.Show(string.Format("{0} Content Records Found", ds.Tables[0].Rows.Count), "Contents Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message, ex.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
throw (new Exception("Cannot Load Data List", ex));
}
cn.Close();
}
private void allDBsToolStripMenuItem_Click(object sender, EventArgs e)
{
DateTime tStart = DateTime.Now;
ResetLinks();
foreach (string dbName in DBNames)
{
SelectedDatabase = dbName;
LoadContents();
MyStatus = string.Format("{0} - {1} Contents", SelectedDatabase, _MyContents.Count);
FindLinks();
}
//ShowLinks("All Databases");
DateTime tEnd = DateTime.Now;
TimeSpan ts = TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks);
MyStatus = string.Format("{0:0.000} Seconds", ts.TotalSeconds);
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

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=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>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
</root>