AdjustBuildRevision, FlexMsgBx, Formats, LBWordLib, VlnStatus, RoAccessToSql, TablePicker, VG
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
@@ -35,31 +33,7 @@ namespace AdjustBuildRevision
|
||||
outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("2.4.yyMM.dHH") + "\")");
|
||||
else
|
||||
outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("2.3.yyMM.dHH") + "\")");
|
||||
// if (outline != line)
|
||||
// {
|
||||
// Console.WriteLine("Before: '{0}'", line);
|
||||
// Console.WriteLine("After: '{0}'", outline);
|
||||
// lines[i] = outline;
|
||||
// changed = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine("No change: '{0}'", line);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//if (changed)
|
||||
//{
|
||||
// if (!fi.IsReadOnly) fi.IsReadOnly = false;
|
||||
// StreamWriter sw = fi.CreateText();
|
||||
// foreach (string line in lines)
|
||||
// sw.WriteLine(line);
|
||||
// sw.Close();
|
||||
// string line = lines[i];
|
||||
// string outline = line;
|
||||
// if (line.Contains("AssemblyVersion") || line.Contains("AssemblyFileVersion"))
|
||||
// {
|
||||
//outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("1.1.yyMM.dHH") + "\")");
|
||||
|
||||
if (outline != line)
|
||||
{
|
||||
Console.WriteLine("Before: '{0}'", line);
|
||||
@@ -84,7 +58,7 @@ namespace AdjustBuildRevision
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("File " + fi.FullName + " does not exist");
|
||||
MessageBox.Show($"File {fi.FullName} does not exist");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -93,10 +67,6 @@ namespace AdjustBuildRevision
|
||||
}
|
||||
}
|
||||
|
||||
//private static DateTime GetLatestDateTime(string path)
|
||||
//{
|
||||
// return GetLatestDateTime(new DirectoryInfo(path));
|
||||
//}
|
||||
private static DateTime GetLatestDateTime(DirectoryInfo di, DateTime dtCheck)
|
||||
{
|
||||
DateTime dtMax = dtCheck;
|
||||
@@ -104,24 +74,14 @@ namespace AdjustBuildRevision
|
||||
foreach(FileInfo myFile in myFiles)
|
||||
{
|
||||
DateTime dt = myFile.LastWriteTime;
|
||||
//if (dt > dtCheck)
|
||||
//{
|
||||
//Console.WriteLine("\"File\"\t\"{0}\"\t\"{1}\"\t{2}\t{3}",myFile.FullName,dt.ToString("1.1.yyMM.dHH"),dt,dtCheck);
|
||||
if(dtMax < dt) dtMax = dt;
|
||||
//}
|
||||
if(dtMax < dt) dtMax = dt;
|
||||
}
|
||||
DirectoryInfo[] myFolders = di.GetDirectories();
|
||||
foreach (DirectoryInfo diChild in myFolders)
|
||||
{
|
||||
DateTime dtChild = GetLatestDateTime(diChild,dtCheck);
|
||||
//if (dtChild > dtCheck)
|
||||
//{
|
||||
//Console.WriteLine("\"SubFolder\"\t\"{0}\"\t\"{1}\"\t{2}\t{3}", diChild.FullName, dtChild.ToString("1.1.yyMM.dHH"),dtChild,dtCheck);
|
||||
if(dtChild > dtMax) dtMax = dtChild;
|
||||
//}
|
||||
if(dtChild > dtMax) dtMax = dtChild;
|
||||
}
|
||||
//if(dtMax > dtCheck)
|
||||
// Console.WriteLine("\"Folder\"\t\"{0}\"\t\"{1}\"", di.FullName, dtMax.ToString("1.1.yyMM.dHH"));
|
||||
return dtMax;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
//using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
@@ -121,10 +119,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// </summary>
|
||||
/// <param name="text">The text.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult Show(string text)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
public static DialogResult Show(string text) => FlexibleMessageBoxForm.Show(null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -132,10 +127,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="owner">The owner.</param>
|
||||
/// <param name="text">The text.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult Show(IWin32Window owner, string text)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
public static DialogResult Show(IWin32Window owner, string text) => FlexibleMessageBoxForm.Show(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -143,10 +135,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="text">The text.</param>
|
||||
/// <param name="caption">The caption.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult Show(string text, string caption)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
public static DialogResult Show(string text, string caption) => FlexibleMessageBoxForm.Show(null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -155,10 +144,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="text">The text.</param>
|
||||
/// <param name="caption">The caption.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption) => FlexibleMessageBoxForm.Show(owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -167,10 +153,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="caption">The caption.</param>
|
||||
/// <param name="buttons">The buttons.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(null, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons) => FlexibleMessageBoxForm.Show(null, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -180,10 +163,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="caption">The caption.</param>
|
||||
/// <param name="buttons">The buttons.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons) => FlexibleMessageBoxForm.Show(owner, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -193,10 +173,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="buttons">The buttons.</param>
|
||||
/// <param name="icon">The icon.</param>
|
||||
/// <returns></returns>
|
||||
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) => FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -207,10 +184,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="buttons">The buttons.</param>
|
||||
/// <param name="icon">The icon.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) => FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -221,10 +195,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="icon">The icon.</param>
|
||||
/// <param name="defaultButton">The default button.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, defaultButton);
|
||||
}
|
||||
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) => FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, defaultButton);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -236,10 +207,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="icon">The icon.</param>
|
||||
/// <param name="defaultButton">The default button.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
|
||||
{
|
||||
return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, defaultButton);
|
||||
}
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) => FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, defaultButton);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the specified message box.
|
||||
@@ -251,10 +219,8 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="icon">The icon.</param>
|
||||
/// <param name="defaultButton">The default button.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
{
|
||||
return FlexibleMessageBoxForm.ShowCustom(null, text, caption, buttons, icon);
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping owner for legacy reasons")]
|
||||
public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) => FlexibleMessageBoxForm.ShowCustom(null, text, caption, buttons, icon);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -341,7 +307,7 @@ namespace JR.Utils.GUI.Forms
|
||||
this.richTextBoxMessage.TabIndex = 0;
|
||||
this.richTextBoxMessage.TabStop = false;
|
||||
this.richTextBoxMessage.Text = "<Message>";
|
||||
this.richTextBoxMessage.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.richTextBoxMessage_LinkClicked);
|
||||
this.richTextBoxMessage.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.RichTextBoxMessage_LinkClicked);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
@@ -431,8 +397,8 @@ namespace JR.Utils.GUI.Forms
|
||||
#region Private constants
|
||||
|
||||
//These separators are used for the "copy to clipboard" standard operation, triggered by Ctrl + C (behavior and clipboard format is like in a standard MessageBox)
|
||||
private static readonly String STANDARD_MESSAGEBOX_SEPARATOR_LINES = "---------------------------\n";
|
||||
private static readonly String STANDARD_MESSAGEBOX_SEPARATOR_SPACES = " ";
|
||||
private static readonly string STANDARD_MESSAGEBOX_SEPARATOR_LINES = "---------------------------\n";
|
||||
private static readonly string STANDARD_MESSAGEBOX_SEPARATOR_SPACES = " ";
|
||||
|
||||
//These are the possible buttons (in a standard MessageBox)
|
||||
private enum ButtonID { OK = 0, CANCEL, YES, NO, ABORT, RETRY, IGNORE, OVERWRITE, RENAME };
|
||||
@@ -440,10 +406,10 @@ namespace JR.Utils.GUI.Forms
|
||||
//These are the buttons texts for different languages.
|
||||
//If you want to add a new language, add it here and in the GetButtonText-Function
|
||||
private enum TwoLetterISOLanguageID { en, de, es, it };
|
||||
private static readonly String[] BUTTON_TEXTS_ENGLISH_EN = { "OK", "Cancel", "&Yes", "&No", "&Abort", "&Retry", "&Ignore", "&Overwrite", "&Rename" }; //Note: This is also the fallback language
|
||||
private static readonly String[] BUTTON_TEXTS_GERMAN_DE = { "OK", "Abbrechen", "&Ja", "&Nein", "&Abbrechen", "&Wiederholen", "&Ignorieren", "&Overwrite", "&Rename" };
|
||||
private static readonly String[] BUTTON_TEXTS_SPANISH_ES = { "Aceptar", "Cancelar", "&Sí", "&No", "&Abortar", "&Reintentar", "&Ignorar", "&Overwrite", "&Rename" };
|
||||
private static readonly String[] BUTTON_TEXTS_ITALIAN_IT = { "OK", "Annulla", "&Sì", "&No", "&Interrompi", "&Riprova", "&Ignora", "&Overwrite", "&Rename" };
|
||||
private static readonly string[] BUTTON_TEXTS_ENGLISH_EN = { "OK", "Cancel", "&Yes", "&No", "&Abort", "&Retry", "&Ignore", "&Overwrite", "&Rename" }; //Note: This is also the fallback language
|
||||
private static readonly string[] BUTTON_TEXTS_GERMAN_DE = { "OK", "Abbrechen", "&Ja", "&Nein", "&Abbrechen", "&Wiederholen", "&Ignorieren", "&Overwrite", "&Rename" };
|
||||
private static readonly string[] BUTTON_TEXTS_SPANISH_ES = { "Aceptar", "Cancelar", "&Sí", "&No", "&Abortar", "&Reintentar", "&Ignorar", "&Overwrite", "&Rename" };
|
||||
private static readonly string[] BUTTON_TEXTS_ITALIAN_IT = { "OK", "Annulla", "&Sì", "&No", "&Interrompi", "&Riprova", "&Ignora", "&Overwrite", "&Rename" };
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -451,7 +417,7 @@ namespace JR.Utils.GUI.Forms
|
||||
|
||||
private MessageBoxDefaultButton defaultButton;
|
||||
private int visibleButtonsCount;
|
||||
private TwoLetterISOLanguageID languageID = TwoLetterISOLanguageID.en;
|
||||
private readonly TwoLetterISOLanguageID languageID = TwoLetterISOLanguageID.en;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -758,9 +724,9 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
|
||||
private void FlexibleMessageBoxForm_Shown(object sender, EventArgs e)
|
||||
{
|
||||
int buttonIndexToFocus = 1;
|
||||
Button buttonToFocus;
|
||||
|
||||
int buttonIndexToFocus;
|
||||
//Set the default button...
|
||||
switch (this.defaultButton)
|
||||
{
|
||||
@@ -799,7 +765,7 @@ namespace JR.Utils.GUI.Forms
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.Windows.Forms.LinkClickedEventArgs"/> instance containing the event data.</param>
|
||||
private void richTextBoxMessage_LinkClicked(object sender, LinkClickedEventArgs e)
|
||||
private void RichTextBoxMessage_LinkClicked(object sender, LinkClickedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -877,12 +843,14 @@ namespace JR.Utils.GUI.Forms
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
|
||||
{
|
||||
//Create a new instance of the FlexibleMessageBox form
|
||||
var flexibleMessageBoxForm = new FlexibleMessageBoxForm();
|
||||
flexibleMessageBoxForm.ShowInTaskbar = false;
|
||||
var flexibleMessageBoxForm = new FlexibleMessageBoxForm
|
||||
{
|
||||
ShowInTaskbar = false,
|
||||
|
||||
//Bind the caption and the message text
|
||||
flexibleMessageBoxForm.CaptionText = caption;
|
||||
flexibleMessageBoxForm.MessageText = text;
|
||||
//Bind the caption and the message text
|
||||
CaptionText = caption,
|
||||
MessageText = text
|
||||
};
|
||||
flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm;
|
||||
|
||||
//Set the buttons visibilities and texts. Also set a default button.
|
||||
@@ -914,15 +882,18 @@ namespace JR.Utils.GUI.Forms
|
||||
/// <param name="icon">The icon.</param>
|
||||
/// <param name="defaultButton">The default button.</param>
|
||||
/// <returns>The dialog result.</returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping buttons for legacy reasons")]
|
||||
public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
{
|
||||
//Create a new instance of the FlexibleMessageBox form
|
||||
var flexibleMessageBoxForm = new FlexibleMessageBoxForm();
|
||||
flexibleMessageBoxForm.ShowInTaskbar = false;
|
||||
var flexibleMessageBoxForm = new FlexibleMessageBoxForm
|
||||
{
|
||||
ShowInTaskbar = false,
|
||||
|
||||
//Bind the caption and the message text
|
||||
flexibleMessageBoxForm.CaptionText = caption;
|
||||
flexibleMessageBoxForm.MessageText = text;
|
||||
//Bind the caption and the message text
|
||||
CaptionText = caption,
|
||||
MessageText = text
|
||||
};
|
||||
flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm;
|
||||
|
||||
//Set the buttons visibilities and texts. Also set a default button.
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
<Compile Include="frmFormatCopy.Designer.cs">
|
||||
<DependentUpon>frmFormatCopy.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="frmFormatCopy.resx">
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Formats
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -28,7 +23,7 @@ namespace Formats
|
||||
txbxPROMSFormatsPath.Text = savedFormatPath;
|
||||
else
|
||||
{
|
||||
string curFolder = Environment.CurrentDirectory; // C:\development/PROMS/Formats/bin/debug
|
||||
string curFolder = Environment.CurrentDirectory; // .../PROMS/Formats/bin/debug
|
||||
int idx = curFolder.ToUpper().IndexOf(@"\PROMS\");
|
||||
txbxPROMSFormatsPath.Text = curFolder.Substring(0, idx);
|
||||
}
|
||||
@@ -40,9 +35,8 @@ namespace Formats
|
||||
DirectoryInfo di = new DirectoryInfo(path);
|
||||
if (di.Exists == false) //return;
|
||||
{
|
||||
DialogResult dlgrslt = DialogResult.No;
|
||||
dlgrslt = MessageBox.Show(string.Format("{0} does not exist. Create it?", path), "Create Folder?", MessageBoxButtons.YesNo);
|
||||
if (dlgrslt == DialogResult.Yes)
|
||||
DialogResult dlgrslt = MessageBox.Show(string.Format("{0} does not exist. Create it?", path), "Create Folder?", MessageBoxButtons.YesNo);
|
||||
if (dlgrslt == DialogResult.Yes)
|
||||
{
|
||||
di.Create();
|
||||
di.CreateSubdirectory("fmtall");
|
||||
@@ -86,10 +80,11 @@ namespace Formats
|
||||
|
||||
private void btnBrowse_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
||||
|
||||
fbd.SelectedPath = txbxPROMSFormatsPath.Text;
|
||||
if (fbd.ShowDialog() == DialogResult.OK)
|
||||
FolderBrowserDialog fbd = new FolderBrowserDialog
|
||||
{
|
||||
SelectedPath = txbxPROMSFormatsPath.Text
|
||||
};
|
||||
if (fbd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (Directory.Exists(fbd.SelectedPath)) txbxPROMSFormatsPath.Text = fbd.SelectedPath + @"\";
|
||||
}
|
||||
@@ -116,9 +111,9 @@ namespace Formats
|
||||
if (!txbxPROMSFormatsPath.Text.EndsWith(@"\")) txbxPROMSFormatsPath.Text += @"\";
|
||||
|
||||
// There should be a "fmtall" and "genmacall" folder in the delelopment project folder
|
||||
// ex: C:\development\PROMS\Formats\fmtall and C:\development\PROMS\Formats\genmacall
|
||||
string destFmtallPath = txbxPROMSFormatsPath.Text + @"fmtall\";
|
||||
string destGenmacallPath = txbxPROMSFormatsPath.Text + @"genmacall\";
|
||||
// ex: ...\PROMS\Formats\fmtall and ...\PROMS\Formats\genmacall
|
||||
string destFmtallPath = $@"{txbxPROMSFormatsPath.Text}fmtall\";
|
||||
string destGenmacallPath = $@"{txbxPROMSFormatsPath.Text}genmacall\";
|
||||
string srcFmtallPath = @"..\..\"; // up to levels from startup path
|
||||
|
||||
// clear the destination fmtall and genmacall folders
|
||||
@@ -156,14 +151,10 @@ namespace Formats
|
||||
}
|
||||
Properties.Settings.Default.FormatPath = txbxPROMSFormatsPath.Text.Substring(0,txbxPROMSFormatsPath.Text.Length-1); // save the copy format path minus the ending backslash
|
||||
Properties.Settings.Default.Save();
|
||||
//if(MessageBox.Show("Do you want to end the Format Copier?","Formats Copied.", MessageBoxButtons.YesNo, MessageBoxIcon.Question)== DialogResult.Yes)
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void buttonX2_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
}
|
||||
private void buttonX2_Click(object sender, EventArgs e) => Application.Exit();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
|
||||
+313
-883
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -79,6 +79,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="LBComObject.cs" />
|
||||
<Compile Include="LBObjectExtension.cs" />
|
||||
<Compile Include="OutlookLBComObject.cs" />
|
||||
|
||||
@@ -1,64 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LBOutlookLibrary
|
||||
{
|
||||
public abstract partial class LBComObject
|
||||
{
|
||||
private Object _Item;
|
||||
internal Object Item
|
||||
private object _Item;
|
||||
internal object Item
|
||||
{
|
||||
get { return _Item; }
|
||||
set
|
||||
{
|
||||
_Item = value;
|
||||
if (value != null) _MyType = _Item.GetType();
|
||||
if (value != null) MyType = _Item.GetType();
|
||||
}
|
||||
}
|
||||
private Type _MyType;
|
||||
public Type MyType
|
||||
{
|
||||
get { return _MyType; }
|
||||
set { _MyType = value; }
|
||||
}
|
||||
protected LBComObject() { }
|
||||
|
||||
public Type MyType { get; set; }
|
||||
protected LBComObject() { }
|
||||
protected LBComObject(string ProgID)
|
||||
{
|
||||
Type objClassType;
|
||||
objClassType = Type.GetTypeFromProgID(ProgID);
|
||||
Item = Activator.CreateInstance(objClassType);
|
||||
}
|
||||
protected LBComObject(Object item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
private Object DoInvokeMember(string name, Object[] parameters, BindingFlags bf, Binder b)
|
||||
protected LBComObject(object item) => Item = item;
|
||||
private object DoInvokeMember(string name, object[] parameters, BindingFlags bf, Binder b)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _MyType.InvokeMember(name, bf, b, _Item, parameters);
|
||||
return MyType.InvokeMember(name, bf, b, _Item, parameters);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", _MyType.Name, name), ex);
|
||||
throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", MyType.Name, name), ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
protected void SetProperty(string propertyName, params Object[] parameters)
|
||||
{
|
||||
DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
|
||||
}
|
||||
protected Object GetProperty(string propertyName)
|
||||
{
|
||||
return DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
|
||||
}
|
||||
protected Object GetProperty(string propertyName, params Object[] parameters)
|
||||
{
|
||||
return DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
|
||||
}
|
||||
protected Object InvokeMethod(string methodName, params Object[] parameters)
|
||||
protected void SetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
|
||||
protected object GetProperty(string propertyName) => DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
|
||||
protected object GetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
|
||||
protected object InvokeMethod(string methodName, params object[] parameters)
|
||||
{
|
||||
if (parameters != null)
|
||||
FixParameters(parameters);
|
||||
@@ -71,45 +52,15 @@ namespace LBOutlookLibrary
|
||||
if (parameters[i] is LBComObject)
|
||||
parameters[i] = (parameters[i] as LBComObject).Item;
|
||||
}
|
||||
protected Object InvokeMethod(string methodName)
|
||||
{
|
||||
return InvokeMethod(methodName, null);
|
||||
}
|
||||
}
|
||||
public class LBComObjectList<TList, TItem> : LBComObject
|
||||
where TList : LBComObjectList<TList, TItem>
|
||||
where TItem : LBComObject, new()
|
||||
{
|
||||
//public new(Object item):base(item){}
|
||||
public TItem Add()
|
||||
{
|
||||
TItem tmp = new TItem();
|
||||
tmp.Item = InvokeMethod("Add");
|
||||
return tmp;
|
||||
}
|
||||
//public TItem this[int item]
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// TItem tmp = new TItem();
|
||||
// tmp.Item = GetProperty("Item", item);
|
||||
// return tmp;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
protected object InvokeMethod(string methodName) => InvokeMethod(methodName, null);
|
||||
}
|
||||
public partial class LBApplicationClass : LBComObject
|
||||
{
|
||||
public LBApplicationClass() : base("Outlook.Application") { }
|
||||
public LBApplicationClass(Object item) : base(item) { }
|
||||
public System.Object CreateItem(LBOlItemType ItemType)
|
||||
{
|
||||
return InvokeMethod("CreateItem", ItemType);
|
||||
}
|
||||
public void Quit()
|
||||
{
|
||||
InvokeMethod("Quit");
|
||||
}
|
||||
}
|
||||
public LBApplicationClass(object item) : base(item) { }
|
||||
public object CreateItem(LBOlItemType ItemType) => InvokeMethod("CreateItem", ItemType);
|
||||
public void Quit() => InvokeMethod("Quit");
|
||||
}
|
||||
public enum LBOlItemType
|
||||
{
|
||||
olMailItem = 0,
|
||||
@@ -124,13 +75,13 @@ namespace LBOutlookLibrary
|
||||
public partial class LBMailItem : LBComObject
|
||||
{
|
||||
public LBMailItem() { }
|
||||
public LBMailItem(Object item) : base(item) { }
|
||||
public LBMailItem(object item) : base(item) { }
|
||||
}
|
||||
public partial class LBMailItemClass : LBComObject
|
||||
{
|
||||
public LBMailItemClass() { }
|
||||
public LBMailItemClass(Object item) : base(item) { }
|
||||
public String Body
|
||||
public LBMailItemClass(object item) : base(item) { }
|
||||
public string Body
|
||||
{
|
||||
get { return (GetProperty("Body").ToString()); }
|
||||
set { SetProperty("Body", value); }
|
||||
@@ -140,29 +91,20 @@ namespace LBOutlookLibrary
|
||||
get { return (LBOlBodyFormat)GetProperty("BodyFormat"); }
|
||||
set { SetProperty("BodyFormat", value); }
|
||||
}
|
||||
public LBAttachments Attachments
|
||||
{
|
||||
get { return new LBAttachments(GetProperty("Attachments")); }
|
||||
}
|
||||
public String Subject
|
||||
public LBAttachments Attachments => new LBAttachments(GetProperty("Attachments"));
|
||||
public string Subject
|
||||
{
|
||||
get { return (GetProperty("Subject").ToString()); }
|
||||
set { SetProperty("Subject", value); }
|
||||
}
|
||||
public LBRecipients Recipients
|
||||
{
|
||||
get { return new LBRecipients(GetProperty("Recipients")); }
|
||||
}
|
||||
public String To
|
||||
public LBRecipients Recipients => new LBRecipients(GetProperty("Recipients"));
|
||||
public string To
|
||||
{
|
||||
get { return (GetProperty("To").ToString()); }
|
||||
set { SetProperty("To", value); }
|
||||
}
|
||||
public void Send()
|
||||
{
|
||||
InvokeMethod("Send");
|
||||
}
|
||||
}
|
||||
public void Send() => InvokeMethod("Send");
|
||||
}
|
||||
public enum LBOlBodyFormat
|
||||
{
|
||||
olFormatUnspecified = 0,
|
||||
@@ -173,79 +115,40 @@ namespace LBOutlookLibrary
|
||||
public partial class LBAttachments : LBComObject
|
||||
{
|
||||
public LBAttachments() { }
|
||||
public LBAttachments(Object item) : base(item) { }
|
||||
public int Count
|
||||
{
|
||||
get { return (GetProperty("Count") as int? ?? 0); }
|
||||
}
|
||||
public LBAttachment Item
|
||||
{
|
||||
get { return new LBAttachment(GetProperty("Item")); }
|
||||
}
|
||||
public LBAttachment Add(object Source)
|
||||
{
|
||||
return new LBAttachment(InvokeMethod("Add", Source, Missing.Value, Missing.Value, Missing.Value));
|
||||
}
|
||||
public LBAttachment Add(object Source, object Type, object Position, object DisplayName)
|
||||
public LBAttachments(object item) : base(item) { }
|
||||
public int Count => (GetProperty("Count") as int? ?? 0);
|
||||
public new LBAttachment Item => new LBAttachment(GetProperty("Item"));
|
||||
public LBAttachment Add(object Source) => new LBAttachment(InvokeMethod("Add", Source, Missing.Value, Missing.Value, Missing.Value));
|
||||
public LBAttachment Add(object Source, object Type, object Position, object DisplayName)
|
||||
{
|
||||
return new LBAttachment(InvokeMethod("Add", Source, Type, Position, DisplayName));
|
||||
}
|
||||
public void Remove(int Index)
|
||||
{
|
||||
InvokeMethod("Remove", Index);
|
||||
}
|
||||
}
|
||||
public void Remove(int Index) => InvokeMethod("Remove", Index);
|
||||
}
|
||||
public partial class LBRecipients : LBComObject
|
||||
{
|
||||
public LBRecipients() { }
|
||||
public LBRecipients(Object item) : base(item) { }
|
||||
public int Count
|
||||
{
|
||||
get { return (GetProperty("Count") as int? ?? 0); }
|
||||
}
|
||||
public LBRecipient Item
|
||||
{
|
||||
get { return new LBRecipient(GetProperty("Item")); }
|
||||
}
|
||||
public LBRecipient Add(string Name)
|
||||
{
|
||||
return new LBRecipient(InvokeMethod("Add", Name));
|
||||
}
|
||||
public void Remove(int Index)
|
||||
{
|
||||
InvokeMethod("Remove", Index);
|
||||
}
|
||||
public Boolean ResolveAll()
|
||||
{
|
||||
return InvokeMethod("ResolveAll") as Boolean? ?? false;
|
||||
}
|
||||
}
|
||||
public LBRecipients(object item) : base(item) { }
|
||||
public int Count => (GetProperty("Count") as int? ?? 0);
|
||||
public new LBRecipient Item => new LBRecipient(GetProperty("Item"));
|
||||
public LBRecipient Add(string Name) => new LBRecipient(InvokeMethod("Add", Name));
|
||||
public void Remove(int Index) => InvokeMethod("Remove", Index);
|
||||
public bool ResolveAll() => InvokeMethod("ResolveAll") as bool? ?? false;
|
||||
}
|
||||
public partial class LBAttachment : LBComObject
|
||||
{
|
||||
public LBAttachment() { }
|
||||
public LBAttachment(Object item) : base(item) { }
|
||||
public LBOlAttachmentType Type
|
||||
{
|
||||
get { return (LBOlAttachmentType)GetProperty("Type"); }
|
||||
}
|
||||
}
|
||||
public LBAttachment(object item) : base(item) { }
|
||||
public LBOlAttachmentType Type => (LBOlAttachmentType)GetProperty("Type");
|
||||
}
|
||||
public partial class LBRecipient : LBComObject
|
||||
{
|
||||
public LBRecipient() { }
|
||||
public LBRecipient(Object item) : base(item) { }
|
||||
public String Address
|
||||
{
|
||||
get { return (GetProperty("Address").ToString()); }
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return (GetProperty("Name").ToString()); }
|
||||
}
|
||||
public Boolean Resolve()
|
||||
{
|
||||
return InvokeMethod("Resolve") as Boolean? ?? false;
|
||||
}
|
||||
}
|
||||
public LBRecipient(object item) : base(item) { }
|
||||
public string Address => (GetProperty("Address").ToString());
|
||||
public string Name => (GetProperty("Name").ToString());
|
||||
public bool Resolve() => InvokeMethod("Resolve") as bool? ?? false;
|
||||
}
|
||||
public enum LBOlAttachmentType
|
||||
{
|
||||
olByValue = 1,
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace LBOutlookLibrary
|
||||
{
|
||||
public partial class LBApplicationClass
|
||||
{
|
||||
public LBMailItemClass CreateMailItem()
|
||||
{
|
||||
return new LBMailItemClass(CreateItem(LBOlItemType.olMailItem));
|
||||
}
|
||||
}
|
||||
public LBMailItemClass CreateMailItem() => new LBMailItemClass(CreateItem(LBOlItemType.olMailItem));
|
||||
}
|
||||
public partial class LBMailItemClass
|
||||
{
|
||||
public void AddAttachment(string filename)
|
||||
{
|
||||
Attachments.Add(filename, LBOlAttachmentType.olByValue, Type.Missing, Type.Missing);
|
||||
}
|
||||
}
|
||||
public void AddAttachment(string filename) => Attachments.Add(filename, LBOlAttachmentType.olByValue, Type.Missing, Type.Missing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,19 +49,13 @@ namespace Read64bitRegistryFrom32bitApp
|
||||
ref uint lpType,
|
||||
System.Text.StringBuilder lpData,
|
||||
ref uint lpcbData);
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Functions
|
||||
static public string GetRegKey64Value(UIntPtr inHive, String inKeyName, String inPropertyName)
|
||||
{
|
||||
return GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_64Key, inPropertyName);
|
||||
}
|
||||
static public string GetRegKey32Value(UIntPtr inHive, String inKeyName, String inPropertyName)
|
||||
{
|
||||
return GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_32Key, inPropertyName);
|
||||
}
|
||||
static public string GetRegKey64Value(UIntPtr inHive, String inKeyName, RegSAM in32or64key, String inPropertyName)
|
||||
#region Functions
|
||||
static public string GetRegKey64Value(UIntPtr inHive, string inKeyName, string inPropertyName) => GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_64Key, inPropertyName);
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "inHive kept to match dll signature")]
|
||||
static public string GetRegKey64Value(UIntPtr inHive, string inKeyName, RegSAM in32or64key, string inPropertyName)
|
||||
{
|
||||
int hkey = 0;
|
||||
try
|
||||
@@ -80,15 +74,10 @@ namespace Read64bitRegistryFrom32bitApp
|
||||
if (0 != hkey) RegCloseKey(hkey);
|
||||
}
|
||||
}
|
||||
static public bool CheckRegKey64Valid(UIntPtr inHive, String inKeyName)
|
||||
{
|
||||
return CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_64Key);
|
||||
}
|
||||
static public bool GetRegKey32Valid(UIntPtr inHive, String inKeyName)
|
||||
{
|
||||
return CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_32Key);
|
||||
}
|
||||
static public bool CheckRegKey64Valid(UIntPtr inHive, String inKeyName, RegSAM in32or64key)
|
||||
static public bool CheckRegKey64Valid(UIntPtr inHive, string inKeyName) => CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_64Key);
|
||||
static public bool GetRegKey32Valid(UIntPtr inHive, string inKeyName) => CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_32Key);
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "inHive kept to match dll signature")]
|
||||
static public bool CheckRegKey64Valid(UIntPtr inHive, string inKeyName, RegSAM in32or64key)
|
||||
{
|
||||
int hkey = 0;
|
||||
try
|
||||
@@ -103,8 +92,5 @@ namespace Read64bitRegistryFrom32bitApp
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Enums
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,6 @@
|
||||
*********************************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
//using ROProfiler; //don't forget to add VlnProfiler to the reference list
|
||||
|
||||
namespace VlnStatus
|
||||
{
|
||||
@@ -35,11 +30,6 @@ namespace VlnStatus
|
||||
private System.Windows.Forms.ProgressBar progressBar1;
|
||||
private System.Windows.Forms.Label lblBar;
|
||||
private System.Windows.Forms.Label StatMsg;
|
||||
// private string strLblLast="";
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public StatusBarFrm()
|
||||
{
|
||||
@@ -61,21 +51,6 @@ namespace VlnStatus
|
||||
Text = StatusBoxTitle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
@@ -190,14 +165,6 @@ namespace VlnStatus
|
||||
{
|
||||
lblBar.Text = (Math.Round((decimal)(progressBar1.Value * 100) / progressBar1.Maximum)).ToString();
|
||||
lblBar.Text += "% Complete";
|
||||
// if( lblBar.Text != strLblLast)
|
||||
// {
|
||||
// Profiler.Start("UpdateLabel");
|
||||
lblBar.Refresh();
|
||||
// lblBar.Update();
|
||||
// Profiler.End("UpdateLabel");
|
||||
// }
|
||||
// strLblLast = lblBar.Text;
|
||||
}
|
||||
|
||||
public string StatusMessage
|
||||
@@ -209,10 +176,7 @@ namespace VlnStatus
|
||||
set
|
||||
{
|
||||
StatMsg.Text = value;
|
||||
// Profiler.Start("StatusMessage");
|
||||
StatMsg.Refresh();
|
||||
// StatMsg.Update();
|
||||
// Profiler.End("StatusMessage");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,6 @@
|
||||
* Added overbounds check
|
||||
*********************************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VlnStatus
|
||||
{
|
||||
/// <summary>
|
||||
@@ -31,10 +25,6 @@ namespace VlnStatus
|
||||
public class StatusMessageFrm : System.Windows.Forms.Form
|
||||
{
|
||||
private System.Windows.Forms.Label lblStatMsg;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public StatusMessageFrm()
|
||||
{
|
||||
@@ -54,21 +44,6 @@ namespace VlnStatus
|
||||
Text = StatTitle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace VlnStatus
|
||||
/// </summary>
|
||||
public class VlnStatusBar
|
||||
{
|
||||
StatusBarFrm StatBar;
|
||||
readonly StatusBarFrm StatBar;
|
||||
private int Cnt;
|
||||
|
||||
// Create a status window with the default title of "Status"
|
||||
@@ -53,8 +53,6 @@ namespace VlnStatus
|
||||
// Increament the the status bar by the passed in value.
|
||||
public void PerformStep(int val)
|
||||
{
|
||||
// StatBar.Value = val;
|
||||
// Cnt = val;
|
||||
BarValue = val;
|
||||
StatBar.PerformStep();
|
||||
}
|
||||
@@ -62,7 +60,6 @@ namespace VlnStatus
|
||||
// Increament the the status bar by one
|
||||
public void PerformStep()
|
||||
{
|
||||
// StatBar.Value = StatBar.Value + 1;
|
||||
Cnt++;
|
||||
BarValue = Cnt;
|
||||
StatBar.PerformStep();
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
* Added overbounds check
|
||||
*********************************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace VlnStatus
|
||||
{
|
||||
/// <summary>
|
||||
@@ -28,7 +26,7 @@ namespace VlnStatus
|
||||
/// </summary>
|
||||
public class VlnStatusMessage
|
||||
{
|
||||
StatusMessageFrm StatusMessageBox;
|
||||
readonly StatusMessageFrm StatusMessageBox;
|
||||
|
||||
// Create a status window with the default title of "Status"
|
||||
public VlnStatusMessage()
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RoAccessToSql
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data.OleDb;
|
||||
using Volian.Base.Library;
|
||||
|
||||
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
||||
|
||||
@@ -33,25 +27,11 @@ namespace RoAccessToSql
|
||||
public partial class RoAccessToSql : Form
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private string _MSAccessPath = null;
|
||||
public string MSAccessPath
|
||||
{
|
||||
get { return _MSAccessPath; }
|
||||
set { _MSAccessPath = value; }
|
||||
}
|
||||
private string _SqlServerName = null;
|
||||
public string SqlServerName
|
||||
{
|
||||
get { return _SqlServerName; }
|
||||
set { _SqlServerName = value; }
|
||||
}
|
||||
private string _SqlDatabaseName = null;
|
||||
public string SqlDatabaseName
|
||||
{
|
||||
get { return _SqlDatabaseName; }
|
||||
set { _SqlDatabaseName = value; }
|
||||
}
|
||||
bool _Initializing = false;
|
||||
|
||||
public string MSAccessPath { get; set; } = null;
|
||||
public string SqlServerName { get; set; } = null;
|
||||
public string SqlDatabaseName { get; set; } = null;
|
||||
readonly bool _Initializing = false;
|
||||
|
||||
public RoAccessToSql(string[] args)
|
||||
{
|
||||
@@ -66,7 +46,7 @@ namespace RoAccessToSql
|
||||
}
|
||||
else if (parm.StartsWith("/sqldb="))
|
||||
{
|
||||
SqlDatabaseName = parm.Substring(7) + "_RO";
|
||||
SqlDatabaseName = $"{parm.Substring(7)}_RO";
|
||||
}
|
||||
else if (parm.StartsWith("/server="))
|
||||
{
|
||||
@@ -92,7 +72,7 @@ namespace RoAccessToSql
|
||||
if (UserInRoEditor()) this.Close();
|
||||
tbSqlDbName.Text = SqlDatabaseName;
|
||||
_TmpFileForConnectStr = Path.GetTempPath();
|
||||
_TmpFileForConnectStr = _TmpFileForConnectStr + @"\PromsConnect.txt";
|
||||
_TmpFileForConnectStr += @"\PromsConnect.txt";
|
||||
File.Delete(_TmpFileForConnectStr);
|
||||
_Initializing = false;
|
||||
}
|
||||
@@ -100,10 +80,10 @@ namespace RoAccessToSql
|
||||
private bool UserInRoEditor()
|
||||
{
|
||||
FileInfo fiown = null;
|
||||
FileStream fsown = null;
|
||||
// The following code was taken from the roeditor. It uses the 'RoEditor.own' file to assure that
|
||||
// no one is in the roeditor. This file is located in the microsoft access database directory.
|
||||
try
|
||||
FileStream fsown;
|
||||
// The following code was taken from the roeditor. It uses the 'RoEditor.own' file to assure that
|
||||
// no one is in the roeditor. This file is located in the microsoft access database directory.
|
||||
try
|
||||
{
|
||||
string filename = MSAccessPath + @"\RoEditor.own";
|
||||
fiown = new FileInfo(filename);
|
||||
@@ -119,7 +99,7 @@ namespace RoAccessToSql
|
||||
fsown = fiown.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
TextReader tr1 = new StreamReader(fsown);
|
||||
string who1 = tr1.ReadToEnd();
|
||||
MessageBox.Show(ex.Message + "\r\n\r\n" + who1, "RO Editor In Use", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
MessageBox.Show($"{ex.Message}\r\n\r\n{who1}", "RO Editor In Use", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
fsown = fiown.Open(FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
|
||||
TextReader tr = new StreamReader(fsown);
|
||||
@@ -142,8 +122,8 @@ namespace RoAccessToSql
|
||||
tw.WriteLine("Current User: {0}, Date and Time Started: {1}", Environment.UserName.ToUpper(), DateTime.Now.ToString("MM/dd/yyyy @ hh:mm"));
|
||||
tw.Flush();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
catch (IOException)
|
||||
{
|
||||
fsown = fiown.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
TextReader tr = new StreamReader(fsown);
|
||||
string who = tr.ReadToEnd();
|
||||
@@ -154,25 +134,20 @@ namespace RoAccessToSql
|
||||
}
|
||||
return false;
|
||||
}
|
||||
static string _ErrorLogFileName;
|
||||
public static string ErrorLogFileName
|
||||
{
|
||||
get { return _ErrorLogFileName; }
|
||||
set { _ErrorLogFileName = value; }
|
||||
}
|
||||
// make error log file name (uses same logic as proms error log)
|
||||
static bool ChangeLogFileName(string AppenderName, string NewFilename)
|
||||
|
||||
public static string ErrorLogFileName { get; set; }
|
||||
// make error log file name (uses same logic as proms error log)
|
||||
static bool ChangeLogFileName(string AppenderName, string NewFilename)
|
||||
{
|
||||
log4net.Repository.ILoggerRepository RootRep;
|
||||
RootRep = log4net.LogManager.GetRepository();
|
||||
foreach (log4net.Appender.IAppender iApp in RootRep.GetAppenders())
|
||||
{
|
||||
if (iApp.Name.CompareTo(AppenderName) == 0
|
||||
&& iApp is log4net.Appender.FileAppender)
|
||||
{
|
||||
log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp;
|
||||
&& iApp is log4net.Appender.FileAppender fApp)
|
||||
{
|
||||
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
fApp.File = folderPath + @"\VEPROMS\" + (Volian.Base.Library.VlnSettings.GetCommand("prefix", "") + "_").TrimStart("_".ToCharArray()) + NewFilename;
|
||||
fApp.File = $@"{folderPath}\VEPROMS\{($"{Volian.Base.Library.VlnSettings.GetCommand("prefix", "")}_").TrimStart("_".ToCharArray())}{NewFilename}";
|
||||
ErrorLogFileName = fApp.File;
|
||||
fApp.ActivateOptions();
|
||||
return true;
|
||||
@@ -189,7 +164,7 @@ namespace RoAccessToSql
|
||||
if (Directory.Exists(fbd.SelectedPath))
|
||||
tbAccessPath.Text = fbd.SelectedPath;
|
||||
else
|
||||
MessageBox.Show("Path doesn't exist " + tbAccessPath.Text);
|
||||
MessageBox.Show($"Path doesn't exist {tbAccessPath.Text}");
|
||||
}
|
||||
}
|
||||
// Convert the data
|
||||
@@ -212,7 +187,7 @@ namespace RoAccessToSql
|
||||
{
|
||||
DateTime dtSunday = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek));
|
||||
|
||||
ChangeLogFileName("LogFileAppender", SqlDatabaseName + " " + dtSunday.ToString("yyyyMMdd") + " ErrorLog.txt");
|
||||
ChangeLogFileName("LogFileAppender", $"{SqlDatabaseName} {dtSunday:yyyyMMdd} ErrorLog.txt");
|
||||
_MyLog.InfoFormat("\r\nSession Beginning\r\n<===={0}[SQL:{1:yyMM.ddHH}]====== User: {2}/{3} Started {4} ===============>{5}"
|
||||
, Application.ProductVersion, RevDate, DateTime.Now, Environment.UserDomainName, Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"), "");
|
||||
}
|
||||
@@ -229,7 +204,7 @@ namespace RoAccessToSql
|
||||
if (sqlConnection.State == ConnectionState.Open)
|
||||
{
|
||||
// now try to open access db:
|
||||
string strDatabaseConnectionCommand = "Provider=Microsoft.ACE.OLEDB.12.0;Password=\"\";User ID=Admin;Data Source=" + MSAccessPath + "\\ROMaster.mdb;Mode=Share Deny None;Extended Properties=\"\";Jet OLEDB:System database=\"\";Jet OLEDB:Registry Path=\"\";Jet OLEDB:Database Password=\"\";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password=\"\";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False";
|
||||
string strDatabaseConnectionCommand = $"Provider=Microsoft.ACE.OLEDB.12.0;Password=\"\";User ID=Admin;Data Source={MSAccessPath}\\ROMaster.mdb;Mode=Share Deny None;Extended Properties=\"\";Jet OLEDB:System database=\"\";Jet OLEDB:Registry Path=\"\";Jet OLEDB:Database Password=\"\";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password=\"\";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False";
|
||||
using (OleDbConnection accessConnection = new OleDbConnection(strDatabaseConnectionCommand))
|
||||
{
|
||||
try
|
||||
@@ -251,13 +226,13 @@ namespace RoAccessToSql
|
||||
}
|
||||
else
|
||||
{
|
||||
_MyLog.Error("SQL Connection is not open. Check connection string: " + tbSqlDbName.Text);
|
||||
MessageBox.Show("Check connection string: " + tbSqlDbName.Text, "SQL Connection is not open.");
|
||||
_MyLog.Error($"SQL Connection is not open. Check connection string: {tbSqlDbName.Text}");
|
||||
MessageBox.Show($"Check connection string: {tbSqlDbName.Text}", "SQL Connection is not open.");
|
||||
}
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
_MyLog.Error("SQL Connection is not open. Check connection string: " + tbSqlDbName.Text);
|
||||
_MyLog.Error($"SQL Connection is not open. Check connection string: {tbSqlDbName.Text}");
|
||||
MessageBox.Show(ex.Message, "Unknown error when migrating RO data from MS Access to SQL");
|
||||
}
|
||||
}
|
||||
@@ -274,11 +249,10 @@ namespace RoAccessToSql
|
||||
lastTimeDbs = ProgressBarUpdate(pBarDbs, null, 0, 1, 0, 0, lastTimeDbs, false);
|
||||
lastTimeRos = ProgressBarUpdate(pBarROs, null, 0, maxCntRo, 0, 0, lastTimeRos, false);
|
||||
lastTimeDbs = ProgressBarUpdate(pBarDbs, "ROMaster Table", 0, 5, 0, 1, lastTimeDbs, false);
|
||||
OleDbDataReader reader = null;
|
||||
OleDbCommand command = new OleDbCommand("select * from ROMaster", accessConnection);
|
||||
reader = command.ExecuteReader();
|
||||
// Do access's romaster table first so that the list of other tables to process is found. While doing this, migrate this table's data.
|
||||
int cntRo = 0;
|
||||
OleDbCommand command = new OleDbCommand("select * from ROMaster", accessConnection);
|
||||
OleDbDataReader reader = command.ExecuteReader();
|
||||
// Do access's romaster table first so that the list of other tables to process is found. While doing this, migrate this table's data.
|
||||
int cntRo = 0;
|
||||
int cntDb = 0;
|
||||
int maxCntDb = 0;
|
||||
while (reader.Read()) // reading from Access Database
|
||||
@@ -303,13 +277,12 @@ namespace RoAccessToSql
|
||||
maxCntDb++;
|
||||
}
|
||||
}
|
||||
lastTimeRos = ProgressBarUpdate(pBarROs, "ROMaster", 0, maxCntRo, maxCntRo, 1, lastTimeRos, true);
|
||||
ProgressBarUpdate(pBarROs, "ROMaster", 0, maxCntRo, maxCntRo, 1, lastTimeRos, true);
|
||||
lastTimeDbs = ProgressBarUpdate(pBarDbs, null, 0, maxCntDb, 0, 0, lastTimeDbs, false);
|
||||
reader.Close();
|
||||
reader = null;
|
||||
|
||||
// now migrate all the tables that were found
|
||||
foreach (string tableName in allTables)
|
||||
|
||||
// now migrate all the tables that were found
|
||||
foreach (string tableName in allTables)
|
||||
{
|
||||
lastTimeRos = DateTime.Now;
|
||||
cntRo = 0;
|
||||
@@ -318,7 +291,7 @@ namespace RoAccessToSql
|
||||
lastTimeRos = ProgressBarUpdate(pBarROs, null, 0, maxCntRo, 0, 0, lastTimeRos, true);
|
||||
lastTimeDbs = ProgressBarUpdate(pBarDbs, allTablesText[cntDb], 0, maxCntDb, cntDb, 1, lastTimeDbs, false);
|
||||
command = null;
|
||||
command = new OleDbCommand("select * from " + tableName, accessConnection);
|
||||
command = new OleDbCommand($"select * from {tableName}", accessConnection);
|
||||
reader = command.ExecuteReader();
|
||||
while (reader.Read()) // read all of the records from the current access table
|
||||
{
|
||||
@@ -338,7 +311,7 @@ namespace RoAccessToSql
|
||||
reader = null;
|
||||
lastTimeRos = ProgressBarUpdate(pBarROs, tableName, 0, maxCntRo, maxCntRo, 1, lastTimeRos, false);
|
||||
}
|
||||
lastTimeDbs = ProgressBarUpdate(pBarDbs, allTablesText[maxCntDb - 1], 0, maxCntDb, maxCntDb, 1, lastTimeDbs, false);
|
||||
ProgressBarUpdate(pBarDbs, allTablesText[maxCntDb - 1], 0, maxCntDb, maxCntDb, 1, lastTimeDbs, false);
|
||||
pBarDbs.Text = "Referenced Object Tables Migration Completed";
|
||||
pBarROs.Text = "Referenced Objects Migration Completed";
|
||||
btnConvert.Enabled = false;
|
||||
@@ -357,7 +330,7 @@ namespace RoAccessToSql
|
||||
string dt = string.Format("{0:yyyyMMddHHmmss}", System.DateTime.Now);
|
||||
string strInsert = "INSERT INTO ROMaster (RecID, RecType, ModDateTime, Info) ";
|
||||
// note that '8' for rectype flags database converted:
|
||||
strInsert = strInsert + " VALUES ('09999999', 8, '" + dt + "', '" + _SqlConnectStr + "');";
|
||||
strInsert = $"{strInsert} VALUES ('09999999', 8, '{dt}', '{_SqlConnectStr}');";
|
||||
OleDbCommand command = new OleDbCommand(strInsert, accessConnection);
|
||||
reader = command.ExecuteReader();
|
||||
if (reader.Read()) return;
|
||||
@@ -367,7 +340,7 @@ namespace RoAccessToSql
|
||||
MessageBox.Show(e.Message, "Error on insert to flag migration completed");
|
||||
}
|
||||
}
|
||||
private string _TmpFileForConnectStr = null;
|
||||
private readonly string _TmpFileForConnectStr = null;
|
||||
private void WriteSqlPathToTempFile()
|
||||
{
|
||||
System.IO.File.WriteAllText(_TmpFileForConnectStr, _SqlConnectStr);
|
||||
@@ -375,13 +348,12 @@ namespace RoAccessToSql
|
||||
// the following is used to update the progress bars, it finds how many records are in a table.
|
||||
private int GetRecordCountForTable(string tableName, OleDbConnection accessConnection)
|
||||
{
|
||||
OleDbDataReader reader = null;
|
||||
int retcnt = 100;
|
||||
int retcnt = 100;
|
||||
try
|
||||
{
|
||||
OleDbCommand command = new OleDbCommand("SELECT COUNT (RecID) as cnt FROM " + tableName, accessConnection);
|
||||
reader = command.ExecuteReader();
|
||||
if (reader.Read())
|
||||
OleDbCommand command = new OleDbCommand($"SELECT COUNT (RecID) as cnt FROM {tableName}", accessConnection);
|
||||
OleDbDataReader reader = command.ExecuteReader();
|
||||
if (reader.Read())
|
||||
{
|
||||
retcnt = reader.GetInt32(0);
|
||||
}
|
||||
@@ -393,7 +365,8 @@ namespace RoAccessToSql
|
||||
}
|
||||
return retcnt;
|
||||
}
|
||||
DateTime ProgressBarUpdate(DevComponents.DotNetBar.Controls.ProgressBarX pbi, string msg, int min, int max, int progress, int flag, DateTime lastUpdateDisplay, bool doTimeCheck)
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping min for Debugging")]
|
||||
DateTime ProgressBarUpdate(DevComponents.DotNetBar.Controls.ProgressBarX pbi, string msg, int min, int max, int progress, int flag, DateTime lastUpdateDisplay, bool doTimeCheck)
|
||||
{
|
||||
if (flag == 0) // setup
|
||||
pbi.Maximum = max;
|
||||
@@ -412,11 +385,13 @@ namespace RoAccessToSql
|
||||
{
|
||||
try
|
||||
{
|
||||
SqlCommand command = new SqlCommand();
|
||||
command.Connection = sqlConnection;
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
command.CommandText = "insertAllRectypes";
|
||||
command.Parameters.AddWithValue("@RecType", RecType);
|
||||
SqlCommand command = new SqlCommand
|
||||
{
|
||||
Connection = sqlConnection,
|
||||
CommandType = CommandType.StoredProcedure,
|
||||
CommandText = "insertAllRectypes"
|
||||
};
|
||||
command.Parameters.AddWithValue("@RecType", RecType);
|
||||
if (AccPageID == null || AccPageID == "")
|
||||
command.Parameters.AddWithValue("@AccPageID", string.Empty);
|
||||
else
|
||||
@@ -428,9 +403,8 @@ namespace RoAccessToSql
|
||||
command.Parameters.AddWithValue("@ModDateTime", ModDateTime);
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
bool success = true;
|
||||
}
|
||||
command = null;
|
||||
}
|
||||
command = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -438,32 +412,15 @@ namespace RoAccessToSql
|
||||
_MyLog.Error(msg, ex);
|
||||
}
|
||||
}
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
// the user selected the button to test the sql connection string
|
||||
private void btnTestConnect_Click(object sender, EventArgs e)
|
||||
{
|
||||
TestConnection(true);
|
||||
}
|
||||
// the RevDate & RevDescription are found in a stored procedure, vesp_GetSQLCodeRevision, in the sql database. These get updated each
|
||||
// time a revision is made to the sql database using ROFixes.sql script.
|
||||
private static DateTime _RevDate = DateTime.MinValue;
|
||||
public static DateTime RevDate
|
||||
{
|
||||
get { return _RevDate; }
|
||||
set { _RevDate = value; }
|
||||
}
|
||||
private static string _RevDescription = "Unknown";
|
||||
public static string RevDescription
|
||||
{
|
||||
get { return _RevDescription; }
|
||||
set { _RevDescription = value; }
|
||||
}
|
||||
// This is called to test the sql connection, either from the button when pressed by user, or from the convert button, before
|
||||
// the conversion is done. See below for what is checked
|
||||
private bool TestConnection(bool notifyUser)
|
||||
private void btnExit_Click(object sender, EventArgs e) => this.Close();
|
||||
// the user selected the button to test the sql connection string
|
||||
private void btnTestConnect_Click(object sender, EventArgs e) => TestConnection(true);
|
||||
|
||||
public static DateTime RevDate { get; set; } = DateTime.MinValue;
|
||||
public static string RevDescription { get; set; } = "Unknown";
|
||||
// This is called to test the sql connection, either from the button when pressed by user, or from the convert button, before
|
||||
// the conversion is done. See below for what is checked
|
||||
private bool TestConnection(bool notifyUser)
|
||||
{
|
||||
// The following conditions must be true in order to migrate the ro data to sql. Only the first condition can be
|
||||
// tested in this executable since the roall database is interfaced to by the roeditor & the program that migrates the data.
|
||||
@@ -485,12 +442,14 @@ namespace RoAccessToSql
|
||||
connection.Open();
|
||||
if (connection.State == ConnectionState.Open)
|
||||
{
|
||||
// now see if there is an roall table
|
||||
SqlCommand command = new SqlCommand();
|
||||
command.Connection = connection;
|
||||
command.CommandType = CommandType.Text;
|
||||
command.CommandText = "(SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ROALL]') AND type in (N'U'))";
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
// now see if there is an roall table
|
||||
SqlCommand command = new SqlCommand
|
||||
{
|
||||
Connection = connection,
|
||||
CommandType = CommandType.Text,
|
||||
CommandText = "(SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ROALL]') AND type in (N'U'))"
|
||||
};
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
@@ -509,11 +468,13 @@ namespace RoAccessToSql
|
||||
{
|
||||
// now see if there are stored procedures:
|
||||
command = null; // reset command
|
||||
command = new SqlCommand();
|
||||
command.Connection = connection;
|
||||
command.CommandType = CommandType.Text;
|
||||
command.CommandText = "(SELECT count(*) FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteByROTable]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)";
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
command = new SqlCommand
|
||||
{
|
||||
Connection = connection,
|
||||
CommandType = CommandType.Text,
|
||||
CommandText = "(SELECT count(*) FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteByROTable]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)"
|
||||
};
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
@@ -533,11 +494,13 @@ namespace RoAccessToSql
|
||||
{
|
||||
// now test that the roall table is empty:
|
||||
command = null; // reset command
|
||||
command = new SqlCommand();
|
||||
command.Connection = connection;
|
||||
command.CommandType = CommandType.Text;
|
||||
command.CommandText = "SELECT count(*) FROM roall";
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
command = new SqlCommand
|
||||
{
|
||||
Connection = connection,
|
||||
CommandType = CommandType.Text,
|
||||
CommandText = "SELECT count(*) FROM roall"
|
||||
};
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
@@ -557,16 +520,18 @@ namespace RoAccessToSql
|
||||
{
|
||||
// now test that the database version is ok
|
||||
command = null; // reset command
|
||||
command = new SqlCommand();
|
||||
command.Connection = connection;
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
command.CommandText = "vesp_GetSQLCodeRevision";
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
command = new SqlCommand
|
||||
{
|
||||
Connection = connection,
|
||||
CommandType = CommandType.StoredProcedure,
|
||||
CommandText = "vesp_GetSQLCodeRevision"
|
||||
};
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
_RevDate = reader.GetDateTime(0);
|
||||
_RevDescription = reader.GetString(1);
|
||||
RevDate = reader.GetDateTime(0);
|
||||
RevDescription = reader.GetString(1);
|
||||
dbsuc = true;
|
||||
}
|
||||
else
|
||||
@@ -582,13 +547,13 @@ namespace RoAccessToSql
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
if (notifyUser) MessageBox.Show("Connection failed: " + ex, "Connection Failed");
|
||||
if (notifyUser) MessageBox.Show($"Connection failed: {ex}", "Connection Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (notifyUser) MessageBox.Show("Connection failed: " + ex, "Connection Failed");
|
||||
if (notifyUser) MessageBox.Show($"Connection failed: {ex}", "Connection Failed");
|
||||
}
|
||||
|
||||
if (notifyUser && success) MessageBox.Show("You have been successfully connected to the database!", "Connection Succeeded");
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="RoAccessToSql.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Accentra.Controls
|
||||
@@ -11,11 +8,6 @@ namespace Accentra.Controls
|
||||
/// </summary>
|
||||
public class TablePicker : System.Windows.Forms.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public TablePicker()
|
||||
{
|
||||
// Activates double buffering
|
||||
@@ -29,21 +21,6 @@ namespace Accentra.Controls
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
@@ -75,82 +52,41 @@ namespace Accentra.Controls
|
||||
}
|
||||
#endregion
|
||||
|
||||
private Pen BeigePen = new Pen(Color.Beige, 1);
|
||||
private Brush BeigeBrush = System.Drawing.Brushes.Beige;
|
||||
private Brush GrayBrush = System.Drawing.Brushes.Gray;
|
||||
private Brush BlackBrush = System.Drawing.Brushes.Black;
|
||||
private Brush WhiteBrush = System.Drawing.Brushes.White;
|
||||
private readonly Brush BlackBrush = System.Drawing.Brushes.Black;
|
||||
private readonly Brush WhiteBrush = System.Drawing.Brushes.White;
|
||||
|
||||
private Brush Jbrush = System.Drawing.Brushes.LightBlue;
|
||||
//private Brush Jbrush = System.Drawing.Brushes.LightSteelBlue;
|
||||
//private Brush Jbrush = System.Drawing.Brushes.SteelBlue;
|
||||
//private Brush Jbrush = System.Drawing.Brushes.PowderBlue;
|
||||
private readonly Brush Jbrush = System.Drawing.Brushes.LightBlue;
|
||||
|
||||
private Pen BorderPen = new Pen(SystemColors.ControlDark);
|
||||
private Pen BluePen = new Pen(Color.SlateGray, 1);
|
||||
private readonly Pen BorderPen = new Pen(SystemColors.ControlDark);
|
||||
private readonly Pen BluePen = new Pen(Color.SlateGray, 1);
|
||||
|
||||
private string DispText = "Esc to Cancel"; // Display text
|
||||
private int DispHeight = 40;//20; // Display ("Table 1x1", "Cancel")
|
||||
private Font DispFont = new Font("Tahoma", 8.25F);
|
||||
private int SquareX = 20; // Width of squares
|
||||
private int SquareY = 20; // Height of squares
|
||||
private readonly int DispHeight = 40; // Display ("Table 1x1", "Cancel")
|
||||
private readonly Font DispFont = new Font("Tahoma", 8.25F);
|
||||
private readonly int SquareX = 20; // Width of squares
|
||||
private readonly int SquareY = 20; // Height of squares
|
||||
private int SquareQX = 3; // Number of visible squares (X)
|
||||
private int SquareQY = 3; // Number of visible squares (Y)
|
||||
private int SelQX = 1; // Number of selected squares (x)
|
||||
private int SelQY = 1; // Number of selected squares (y)
|
||||
|
||||
private bool bHiding = false;
|
||||
private bool bCancel = true; // Determines whether to Cancel
|
||||
public int MaxRows { get; set; } = -1;
|
||||
|
||||
// Added my Volian 4/27/11
|
||||
private int _MaxRows = -1;
|
||||
public int MaxCols { get; set; } = -1;
|
||||
|
||||
public int MaxRows
|
||||
{
|
||||
get { return _MaxRows; }
|
||||
set { _MaxRows = value; }
|
||||
}
|
||||
private int _MaxCols = -1;
|
||||
/// <summary>
|
||||
/// Returns the number of columns, or the horizontal / X count,
|
||||
/// of the selection.
|
||||
/// </summary>
|
||||
public int SelectedColumns => SelQX;
|
||||
|
||||
public int MaxCols
|
||||
{
|
||||
get { return _MaxCols; }
|
||||
set { _MaxCols = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the number of rows, or the vertical / Y count,
|
||||
/// of the selection.
|
||||
/// </summary>
|
||||
public int SelectedRows => SelQY;
|
||||
|
||||
/// <summary>
|
||||
/// Similar to <code><see cref="DialogResult"/>
|
||||
/// == <see cref="DialogResult.Cancel"/></code>,
|
||||
/// but is used as a state value before the form
|
||||
/// is hidden and cancellation is finalized.
|
||||
/// </summary>
|
||||
public bool Cancel {
|
||||
get {
|
||||
return bCancel;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of columns, or the horizontal / X count,
|
||||
/// of the selection.
|
||||
/// </summary>
|
||||
public int SelectedColumns {
|
||||
get {
|
||||
return SelQX;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of rows, or the vertical / Y count,
|
||||
/// of the selection.
|
||||
/// </summary>
|
||||
public int SelectedRows {
|
||||
get {
|
||||
return SelQY;
|
||||
}
|
||||
}
|
||||
|
||||
private void TablePicker_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
|
||||
private void TablePicker_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
// First, increment the number of visible squares if the
|
||||
@@ -162,8 +98,8 @@ namespace Accentra.Controls
|
||||
if (SquareQX < 7) SquareQX = 7;
|
||||
if (SquareQY < 5) SquareQY = 5;
|
||||
|
||||
if (_MaxRows > 0 && SquareQY > _MaxRows) SquareQY = _MaxRows;
|
||||
if (_MaxCols > 0 && SquareQX > _MaxCols) SquareQX = _MaxCols;
|
||||
if (MaxRows > 0 && SquareQY > MaxRows) SquareQY = MaxRows;
|
||||
if (MaxCols > 0 && SquareQX > MaxCols) SquareQX = MaxCols;
|
||||
|
||||
// Second, expand the dimensions of this form according to the
|
||||
// number of visible squares.
|
||||
@@ -177,14 +113,7 @@ namespace Accentra.Controls
|
||||
// the text is left-justified, only the Y (vertical) position
|
||||
// is calculated.
|
||||
int dispY = ((SquareY - 1) * SquareQY) + SquareQY + 4;
|
||||
//if (this.Cancel) {
|
||||
// DispText = "Esc Key to Cancel";
|
||||
//} else {
|
||||
// DispText = SelQX.ToString() + " by " + SelQY.ToString() + " Table";
|
||||
//}
|
||||
//DispText = SelQX.ToString() + " by " + SelQY.ToString() + " Table\nEsc Key to Cancel";
|
||||
//DispText = SelQY.ToString() + " Row"+((SelQY>1)?"s by ":" by ") + SelQX.ToString() + " Column"+((SelQX>1)?"s\nEsc Key to Cancel":"\nEsc Key to Cancel");
|
||||
DispText = SelQY.ToString() + " Row" + ((SelQY > 1) ? "s" : "") + " " + SelQX.ToString() + " Column" + ((SelQX > 1) ? "s" : "")+ "\nEsc to Cancel";
|
||||
DispText = $"{SelQY} Row{((SelQY > 1) ? "s" : "")} {SelQX} Column{((SelQX > 1) ? "s" : "")}\nEsc to Cancel";
|
||||
g.DrawString(DispText, DispFont, BlackBrush, 3, dispY + 2);
|
||||
|
||||
// Draw each of the squares and fill with the default color.
|
||||
@@ -198,7 +127,6 @@ namespace Accentra.Controls
|
||||
// Go back and paint the squares with selection colors.
|
||||
for (int x=0; x<SelQX; x++) {
|
||||
for (int y=0; y<SelQY; y++) {
|
||||
//g.FillRectangle(BeigeBrush, (x*SquareX) + 3, (y*SquareY) + 3, SquareX - 2, SquareY - 2);
|
||||
g.FillRectangle(Jbrush, (x * SquareX) + 3, (y * SquareY) + 3, SquareX - 2, SquareY - 2);
|
||||
g.DrawRectangle(BluePen, (x * SquareX) + 3, (y * SquareY) + 3, SquareX - 2, SquareY - 2);
|
||||
}
|
||||
@@ -210,11 +138,6 @@ namespace Accentra.Controls
|
||||
/// </summary>
|
||||
private void TablePicker_Deactivate(object sender, System.EventArgs e) {
|
||||
|
||||
// bCancel = true
|
||||
// and DialogResult = DialogResult.Cancel
|
||||
// were previously already set in MouseLeave.
|
||||
|
||||
//this.Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -242,42 +165,24 @@ namespace Accentra.Controls
|
||||
/// escaped (canceling) state.
|
||||
/// </summary>
|
||||
private void TablePicker_MouseLeave(object sender, System.EventArgs e) {
|
||||
//if (!bHiding) bCancel = true;
|
||||
//this.DialogResult = DialogResult.Cancel;
|
||||
//this.Invalidate();
|
||||
if (this.DialogResult == DialogResult.None)
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancels the prior cancellation caused by MouseLeave.
|
||||
/// </summary>
|
||||
private void TablePicker_MouseEnter(object sender, System.EventArgs e) {
|
||||
//bHiding = false;
|
||||
//bCancel = false;
|
||||
//this.DialogResult = DialogResult.OK;
|
||||
this.Invalidate();
|
||||
}
|
||||
/// <summary>
|
||||
/// Cancels the prior cancellation caused by MouseLeave.
|
||||
/// </summary>
|
||||
private void TablePicker_MouseEnter(object sender, System.EventArgs e) => this.Invalidate();
|
||||
|
||||
/// <summary>
|
||||
/// Detects that the user made a selection by clicking.
|
||||
/// </summary>
|
||||
private void TablePicker_Click(object sender, System.EventArgs e) {
|
||||
//bHiding = true; // Not the same as Visible == false
|
||||
// // because bHiding suggests that the control
|
||||
// // is still "active" (not canceled).
|
||||
//this.Hide();
|
||||
this.DialogResult = DialogResult.OK;
|
||||
}
|
||||
/// <summary>
|
||||
/// Detects that the user made a selection by clicking.
|
||||
/// </summary>
|
||||
private void TablePicker_Click(object sender, System.EventArgs e) => this.DialogResult = DialogResult.OK;
|
||||
|
||||
private void TablePicker_KeyPress(object sender, KeyPressEventArgs e)
|
||||
private void TablePicker_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (e.KeyChar == (char)Keys.Escape)
|
||||
{
|
||||
//bHiding = true; // Not the same as Visible == false
|
||||
//// because bHiding suggests that the control
|
||||
//// is still "active" (not canceled).
|
||||
//this.Hide();
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-135
@@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text.factories;
|
||||
using Microsoft.Win32;
|
||||
using Volian.Base.Library;
|
||||
|
||||
namespace VG
|
||||
@@ -25,141 +20,25 @@ namespace VG
|
||||
}
|
||||
public partial class VGOut_Graphics: IVGOutput
|
||||
{
|
||||
private int _DebugStatus = 0;
|
||||
public int DebugStatus
|
||||
{
|
||||
get { return _DebugStatus; }
|
||||
set { _DebugStatus = value; }
|
||||
}
|
||||
private Graphics _VGOutput;
|
||||
//public Graphics VGOutput
|
||||
//{ get { return _VGOutput; } }
|
||||
public VGOut_Graphics(Graphics vgOutput)
|
||||
{ _VGOutput = vgOutput; }
|
||||
public float Scale
|
||||
{ get { return 1; } }
|
||||
//{ get { return _VGOutput.Transform.Elements[0]; } }
|
||||
public void DrawLine(Pen pn, float startx, float starty, float endx, float endy)
|
||||
{ _VGOutput.DrawLine(pn, startx, starty, endx, endy); }
|
||||
public void DrawRectangle(Pen pn, RectangleF rectf)
|
||||
public int DebugStatus { get; set; } = 0;
|
||||
private readonly Graphics _VGOutput;
|
||||
public VGOut_Graphics(Graphics vgOutput) => _VGOutput = vgOutput;
|
||||
public float Scale => 1;
|
||||
public void DrawLine(Pen pn, float startx, float starty, float endx, float endy) => _VGOutput.DrawLine(pn, startx, starty, endx, endy);
|
||||
public void DrawRectangle(Pen pn, RectangleF rectf)
|
||||
{
|
||||
_VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
|
||||
_VGOutput.FillRectangle(DebugStatus == 1 ? Brushes.Transparent : Brushes.White, rectf.X, rectf.Y, rectf.Width, rectf.Height);
|
||||
_VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
|
||||
_VGOutput.DrawRectangle(pn, rectf.X, rectf.Y, rectf.Width, rectf.Height);
|
||||
}
|
||||
public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy)
|
||||
{ _VGOutput.DrawEllipse(pn, cx, cy, dx, dy); }
|
||||
public void DrawImage(Bitmap bm, RectangleF rectf)
|
||||
{ _VGOutput.DrawImage(bm, rectf); }
|
||||
public void DrawString(string text, Font myFont, Brush brush, RectangleF rectf)
|
||||
{ _VGOutput.DrawString(text, myFont, brush, rectf, StringFormat.GenericTypographic); }
|
||||
public void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle)
|
||||
{ _VGOutput.DrawArc(pn, rectf, startAngle, sweepAngle); }
|
||||
public SizeF MeasureString(string text, Font myFont)
|
||||
{ return _VGOutput.MeasureString(text, myFont, new PointF(0, 0), StringFormat.GenericTypographic); }
|
||||
public void Save(string fileName)
|
||||
public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy) => _VGOutput.DrawEllipse(pn, cx, cy, dx, dy);
|
||||
public void DrawImage(Bitmap bm, RectangleF rectf) => _VGOutput.DrawImage(bm, rectf);
|
||||
public void DrawString(string text, Font myFont, Brush brush, RectangleF rectf) => _VGOutput.DrawString(text, myFont, brush, rectf, StringFormat.GenericTypographic);
|
||||
public void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle) => _VGOutput.DrawArc(pn, rectf, startAngle, sweepAngle);
|
||||
public SizeF MeasureString(string text, Font myFont) => _VGOutput.MeasureString(text, myFont, new PointF(0, 0), StringFormat.GenericTypographic);
|
||||
public void Save(string fileName)
|
||||
{ ;/* Don't do anything*/ }
|
||||
public float FontSizeAdjust
|
||||
{ get { return .71f * 96f / _VGOutput.DpiX; } } // Changed to adjust for Screen DPI Setting
|
||||
}
|
||||
public partial class VGOut_ITextSharp : IVGOutput
|
||||
{
|
||||
private int _DebugStatus = 0;
|
||||
public int DebugStatus
|
||||
{
|
||||
get { return _DebugStatus; }
|
||||
set { _DebugStatus = value; }
|
||||
}
|
||||
private PdfContentByte _VGOutput;
|
||||
//public Graphics VGOutput
|
||||
//{ get { return _VGOutput; } }
|
||||
public VGOut_ITextSharp(PdfContentByte vgOutput)
|
||||
{ _VGOutput = vgOutput; }
|
||||
public float Scale
|
||||
{ get { return 1; } }
|
||||
public void DrawLine(Pen pn, float startx, float starty, float endx, float endy)
|
||||
{
|
||||
_VGOutput.SaveState();
|
||||
SetStrokeData(pn);
|
||||
_VGOutput.MoveTo(startx, ScaleY(starty));
|
||||
_VGOutput.LineTo(endx, ScaleY(endy));
|
||||
_VGOutput.Stroke();
|
||||
_VGOutput.RestoreState();
|
||||
}
|
||||
private void SetStrokeData(Pen pn)
|
||||
{
|
||||
_VGOutput.SetLineWidth(pn.Width);
|
||||
_VGOutput.SetColorStroke(new iTextSharp.text.Color(pn.Color.R, pn.Color.G, pn.Color.B, pn.Color.A));
|
||||
}
|
||||
public void DrawRectangle(Pen pn, RectangleF rectf)
|
||||
{
|
||||
_VGOutput.SaveState();
|
||||
SetStrokeData(pn);
|
||||
_VGOutput.Rectangle(rectf.X, ScaleY(rectf.Y), rectf.Width, -rectf.Height);
|
||||
_VGOutput.Stroke();
|
||||
_VGOutput.RestoreState();
|
||||
}
|
||||
public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy)
|
||||
{
|
||||
_VGOutput.SaveState();
|
||||
SetStrokeData(pn);
|
||||
_VGOutput.Ellipse(cx, ScaleY(cy), dx, -dy);
|
||||
_VGOutput.Stroke();
|
||||
_VGOutput.RestoreState();
|
||||
}
|
||||
public void DrawImage(Bitmap bm, RectangleF rectf)
|
||||
{
|
||||
_VGOutput.SaveState();
|
||||
// TODO: Determine how I can create an iTextSharp.text.Image
|
||||
//_VGOutput.AddImage(new iTextSharp.text.Image(
|
||||
_VGOutput.RestoreState();
|
||||
}
|
||||
public void DrawString(string text, Font myFont, Brush brush, RectangleF rectf)
|
||||
{
|
||||
_VGOutput.SaveState();
|
||||
_VGOutput.BeginText();
|
||||
iTextSharp.text.Font itFont = GetFont(myFont.Name);
|
||||
iTextSharp.text.pdf.BaseFont baseFont = itFont.BaseFont;
|
||||
// _VGOutput.DrawString(text, myFont, brush, rectf, StringFormat.GenericTypographic);
|
||||
_VGOutput.MoveText(rectf.X, ScaleY(rectf.Y) - myFont.SizeInPoints);
|
||||
_VGOutput.SetFontAndSize(baseFont, myFont.SizeInPoints);
|
||||
_VGOutput.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
|
||||
_VGOutput.ShowTextKerned(text);
|
||||
_VGOutput.EndText();
|
||||
_VGOutput.RestoreState();
|
||||
}
|
||||
public void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle)
|
||||
{
|
||||
_VGOutput.SaveState();
|
||||
SetStrokeData(pn);
|
||||
_VGOutput.Arc(rectf.X, ScaleY(rectf.Y), rectf.X + rectf.Width, ScaleY(rectf.Y + rectf.Height), -startAngle, -sweepAngle);
|
||||
_VGOutput.Stroke();
|
||||
_VGOutput.RestoreState();
|
||||
}
|
||||
public SizeF MeasureString(string text, Font myFont)
|
||||
{
|
||||
iTextSharp.text.Font itFont = GetFont(myFont.Name);
|
||||
iTextSharp.text.pdf.BaseFont baseFont = itFont.BaseFont;
|
||||
return new SizeF(baseFont.GetWidthPoint(text,myFont.SizeInPoints)
|
||||
, baseFont.GetAscentPoint(text, myFont.SizeInPoints) + baseFont.GetDescentPoint(text, myFont.SizeInPoints));
|
||||
}
|
||||
public void Save(string fileName)
|
||||
{ ;/* Don't do anything*/ }
|
||||
public float FontSizeAdjust
|
||||
{ get { return 1; } } // Changed to adjust for Screen DPI Setting
|
||||
public static iTextSharp.text.Font GetFont(string fontName)
|
||||
{
|
||||
/// <summary>
|
||||
/// B2019-116 Volian.Base.Library This is a generic class for dealing with iTextSharp Fonts
|
||||
/// Code moved and consolidated from Volian.Print.Library Volian PDF.Library and VG
|
||||
/// </summary>
|
||||
VlnItextFont.RegisterFont(fontName);
|
||||
return iTextSharp.text.FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
|
||||
}
|
||||
private float ScaleY(float y)
|
||||
{
|
||||
return _VGOutput.PdfWriter.PageSize.Height - y;
|
||||
}
|
||||
}
|
||||
public float FontSizeAdjust => .71f * 96f / _VGOutput.DpiX; // Changed to adjust for Screen DPI Setting
|
||||
}
|
||||
}
|
||||
|
||||
+39
-168
@@ -20,64 +20,34 @@ namespace VG
|
||||
// Temporary page class to store portrait/landscape, Left Margin, Vertical offset, etc
|
||||
public class Page
|
||||
{
|
||||
private bool _Portrait = true;
|
||||
public bool Portrait
|
||||
public bool Portrait { get; set; } = true;
|
||||
public float LeftMargin { get; set; } = 0;
|
||||
public float TopMargin { get; set; } = 0;
|
||||
public float RightMargin { get; set; } = 0;
|
||||
public float BottomMargin { get; set; } = 0;
|
||||
public Page(bool portrait, float leftMargin, float topMargin, float rightMargin, float bottomMargin)
|
||||
{
|
||||
get { return _Portrait; }
|
||||
set { _Portrait = value; }
|
||||
}
|
||||
private float _LeftMargin = 0;
|
||||
public float LeftMargin
|
||||
{
|
||||
get { return _LeftMargin; }
|
||||
set { _LeftMargin = value; }
|
||||
}
|
||||
private float _TopMargin = 0;
|
||||
public float TopMargin
|
||||
{
|
||||
get { return _TopMargin; }
|
||||
set { _TopMargin = value; }
|
||||
}
|
||||
private float _RightMargin = 0;
|
||||
public float RightMargin
|
||||
{
|
||||
get { return _RightMargin; }
|
||||
set { _RightMargin = value; }
|
||||
}
|
||||
private float _BottomMargin = 0;
|
||||
public float BottomMargin
|
||||
{
|
||||
get { return _BottomMargin; }
|
||||
set { _BottomMargin = value; }
|
||||
}
|
||||
public Page(bool portrait, float leftMargin, float topMargin, float rightMargin, float bottomMargin)
|
||||
{
|
||||
_Portrait = portrait;
|
||||
_LeftMargin = leftMargin;
|
||||
_TopMargin = topMargin;
|
||||
_RightMargin = rightMargin;
|
||||
_BottomMargin = bottomMargin;
|
||||
Portrait = portrait;
|
||||
LeftMargin = leftMargin;
|
||||
TopMargin = topMargin;
|
||||
RightMargin = rightMargin;
|
||||
BottomMargin = bottomMargin;
|
||||
}
|
||||
public Page(bool portrait, float leftMargin, float topMargin)
|
||||
{
|
||||
_Portrait = portrait;
|
||||
_LeftMargin = leftMargin;
|
||||
_TopMargin = topMargin;
|
||||
Portrait = portrait;
|
||||
LeftMargin = leftMargin;
|
||||
TopMargin = topMargin;
|
||||
}
|
||||
}
|
||||
public class VG
|
||||
{
|
||||
private static Brush _BlackBrush = Brushes.Black;
|
||||
public static Brush BlackBrush
|
||||
{
|
||||
get { return _BlackBrush; }
|
||||
set { _BlackBrush = value; }
|
||||
}
|
||||
private static Color _BlackColor = Color.Black;
|
||||
public static Brush BlackBrush { get; set; } = Brushes.Black;
|
||||
private static Color _BlackColor = Color.Black;
|
||||
public static Color BlackColor
|
||||
{
|
||||
get { return _BlackColor; }
|
||||
set { _BlackColor = value; _BlackBrush = new SolidBrush(value); }
|
||||
set { _BlackColor = value; BlackBrush = new SolidBrush(value); }
|
||||
}
|
||||
// Values of vector graphics items are stored as twips (1440 twips in an inch)
|
||||
public int cx;
|
||||
@@ -105,16 +75,12 @@ namespace VG
|
||||
MoveAbsolute = ima;
|
||||
pg = ipg;
|
||||
}
|
||||
public float ToPoints(float twip)
|
||||
{
|
||||
float r = ((float)twip) * 0.05f;
|
||||
return r;
|
||||
}
|
||||
public void UpdatePageInfo(Page pa)
|
||||
public float ToPoints(float twip) => (float)(((float)twip) * 0.05f);
|
||||
public void UpdatePageInfo(Page pa)
|
||||
{
|
||||
pg.LeftMargin = pa.LeftMargin;
|
||||
pg.Portrait = pa.Portrait; // RHM 20081003 - This had been pg.portrait=pg.portrait
|
||||
pg.TopMargin = pa.TopMargin; // RHM 20081003 - This had been pg.VertOffset=pg.VertOffset
|
||||
pg.Portrait = pa.Portrait;
|
||||
pg.TopMargin = pa.TopMargin;
|
||||
}
|
||||
public string AddRTFBUI(string origStr, string bold, string underline, string italics)
|
||||
{
|
||||
@@ -145,7 +111,6 @@ namespace VG
|
||||
int B1 = (int)(colorFraction * color.B);
|
||||
int B2 = (int)((1 - colorFraction) * Color.White.B);
|
||||
pn = new Pen(Color.FromArgb(R1 + R2, G1 + G2, B1 + B2), scaleWid);
|
||||
//pn = new Pen(color, wid*wid);
|
||||
}
|
||||
else
|
||||
pn = new Pen(color, scaleWid);
|
||||
@@ -217,74 +182,14 @@ namespace VG
|
||||
vgOutput.DrawRectangle(pn, rc);
|
||||
}
|
||||
}
|
||||
public class VG_Image : VG
|
||||
{
|
||||
private int Scale;
|
||||
private string FileName;
|
||||
// Image is defined as starting point, scale factor (defaults to 1) & image file name
|
||||
public VG_Image(int sx, int sy, int iscale, string fname)
|
||||
{
|
||||
cx = sx;
|
||||
cy = sy;
|
||||
Scale = 1;
|
||||
FileName = fname;
|
||||
}
|
||||
public VG_Image(XmlElement svg, Page ipg)
|
||||
{
|
||||
cx = System.Convert.ToInt32(svg.GetAttribute("x"));
|
||||
cy = System.Convert.ToInt32(svg.GetAttribute("y"));
|
||||
Scale = 1;
|
||||
if (svg.HasAttribute("scale")) Scale = System.Convert.ToInt32(svg.GetAttribute("scale"));
|
||||
FileName = svg.GetAttribute("bname");
|
||||
pg = ipg;
|
||||
}
|
||||
public void Draw(IVGOutput vgOutput)
|
||||
{
|
||||
Pen pn = new Pen(VG.BlackBrush, lnwid);
|
||||
Bitmap bm = new Bitmap(FileName);
|
||||
RectangleF rc = new RectangleF();
|
||||
rc.Height = ToPoints((bm.Height * Scale) * 4.8f);
|
||||
rc.Width = ToPoints((bm.Width * Scale) * 4.8f);
|
||||
rc.X = ToPoints(pg.LeftMargin + cx);
|
||||
rc.Y = ToPoints(pg.TopMargin + cy);
|
||||
// TODO: grfx.DrawImage(bm, rc, ContentAlignment.MiddleCenter, ImageSizeModeEnum.Scale);
|
||||
}
|
||||
}
|
||||
public class VG_Ellipse : VG
|
||||
{
|
||||
// Ellipse (circle) is defined by a bounding rectangle specified by a coordinate pair, a width, and a height
|
||||
public VG_Ellipse(int sx, int sy, int ex, int ey, int w, Page ipg)
|
||||
{
|
||||
cx = sx;
|
||||
cy = sy;
|
||||
dx = ex;
|
||||
dy = ey;
|
||||
lnwid = w;
|
||||
pg = ipg;
|
||||
}
|
||||
public VG_Ellipse(XmlElement svg, Page ipg)
|
||||
{
|
||||
cx = System.Convert.ToInt32(svg.GetAttribute("cx"));
|
||||
cy = System.Convert.ToInt32(svg.GetAttribute("cy"));
|
||||
dx = System.Convert.ToInt32(svg.GetAttribute("rx"));
|
||||
dy = System.Convert.ToInt32(svg.GetAttribute("ry"));
|
||||
lnwid = System.Convert.ToInt32(svg.GetAttribute("stroke-width"));
|
||||
pg = ipg;
|
||||
}
|
||||
public void Draw(IVGOutput vgOutput)
|
||||
{
|
||||
Pen pn = new Pen(VG.BlackBrush, ToPoints(lnwid));
|
||||
vgOutput.DrawEllipse(pn, ToPoints(pg.LeftMargin + cx), ToPoints(pg.TopMargin + cy), ToPoints(dx), ToPoints(dy));
|
||||
}
|
||||
}
|
||||
public class VG_Text : VG
|
||||
{
|
||||
private string FontName;
|
||||
private int FontSize;
|
||||
private string Bold;
|
||||
private string Underline;
|
||||
private string Italics;
|
||||
private string Text;
|
||||
private readonly string FontName;
|
||||
private readonly int FontSize;
|
||||
private readonly string Bold;
|
||||
private readonly string Underline;
|
||||
private readonly string Italics;
|
||||
private readonly string Text;
|
||||
// Text is defined by a starting location, attributes & the string
|
||||
public VG_Text(int sx, int sy, int fs, string txt, string fn, string ibold, string iunder, string iitalics, Page ipg)
|
||||
{
|
||||
@@ -297,48 +202,28 @@ namespace VG
|
||||
Underline = iunder;
|
||||
Italics = iitalics;
|
||||
pg = ipg;
|
||||
// TODO: The following were in the 16-bit code - we may need to use these, wait and see
|
||||
// strokeWidth = stroke;
|
||||
// strokeWidthBold = strokebold;
|
||||
// ULOffset = UnderlineOffset;
|
||||
// ULWidth = UnderlineWidth;
|
||||
}
|
||||
public VG_Text(XmlElement svg, Page ipg)
|
||||
{
|
||||
cx = System.Convert.ToInt32(svg.GetAttribute("x"));
|
||||
cy = System.Convert.ToInt32(svg.GetAttribute("y"));
|
||||
FontSize = System.Convert.ToInt32(svg.GetAttribute("font-size"));
|
||||
Bold = svg.GetAttribute("font-weight");
|
||||
Underline = svg.GetAttribute("text-decoration");
|
||||
Italics = svg.GetAttribute("font-style");
|
||||
FontName = svg.GetAttribute("font-family");
|
||||
Text = svg.InnerText;
|
||||
pg = ipg;
|
||||
}
|
||||
public void Draw(IVGOutput vgOutput)
|
||||
{
|
||||
// TODO: Font myfont = new Font(FontName, (FontSize*9)/10);
|
||||
Font myfont = new Font(FontName, FontSize * vgOutput.FontSizeAdjust); // TODO: Trying 80%
|
||||
RectangleF rc = new RectangleF();
|
||||
// the returned value from c1 grfx code is already in points,
|
||||
// so need to convert the size.
|
||||
rc.Size = vgOutput.MeasureString(Text, myfont); // TODO: 500 or pagewidth, or what
|
||||
//rc.Size = grfx.MeasureString(Text, myfont, 500); // TODO: 500 or pagewidth, or what
|
||||
rc.X = ToPoints(pg.LeftMargin + cx);
|
||||
rc.Y = ToPoints(pg.TopMargin + cy) - FontSize;
|
||||
rc.Height *= 1.0000001F; // Small factor to make text visible.
|
||||
// add bold, underline & italics for entire object.
|
||||
// TODO: string rtfout = AddRTFBUI(Text, Bold, Underline, Italics);
|
||||
//using(Pen pn = new Pen(Color.DarkBlue, .1F))
|
||||
// grfx.DrawRectangle(pn, rc.X,rc.Y,rc.Width,rc.Height);
|
||||
RectangleF rc = new RectangleF
|
||||
{
|
||||
// the returned value from c1 grfx code is already in points,
|
||||
// so need to convert the size.
|
||||
Size = vgOutput.MeasureString(Text, myfont), // TODO: 500 or pagewidth, or what
|
||||
//rc.Size = grfx.MeasureString(Text, myfont, 500); // TODO: 500 or pagewidth, or what
|
||||
X = ToPoints(pg.LeftMargin + cx),
|
||||
Y = ToPoints(pg.TopMargin + cy) - FontSize
|
||||
};
|
||||
rc.Height *= 1.0000001F; // Small factor to make text visible.
|
||||
vgOutput.DrawString(Text, myfont, VG.BlackBrush, rc);
|
||||
//grfx.DrawString(Text, myfont, VG.BlackBrush, rc);
|
||||
}
|
||||
}
|
||||
public class VG_Arc : VG
|
||||
{
|
||||
public Single sweepAngle;
|
||||
public Single startAngle;
|
||||
public float sweepAngle;
|
||||
public float startAngle;
|
||||
public float stX, stY;
|
||||
public float rWid, rHgt;
|
||||
// Arc is defined by a bounding rectangle specified by a coordinate pair, a width, and a height
|
||||
@@ -365,9 +250,7 @@ namespace VG
|
||||
rHgt = -hight;
|
||||
}
|
||||
startAngle = stAngle;
|
||||
// startAngle = 90;
|
||||
sweepAngle = swpAngle;
|
||||
// sweepAngle = -45;
|
||||
lnwid = w;
|
||||
pg = ipg;
|
||||
}
|
||||
@@ -391,18 +274,6 @@ namespace VG
|
||||
float starty = pg.Portrait ? (stY + pg.TopMargin) : (pg.LeftMargin - stX);
|
||||
RectangleF rc = new RectangleF(ToPoints(startx), ToPoints(starty), ToPoints(rWid), ToPoints(rHgt));
|
||||
//Console.WriteLine("{0},'{1}',{2},{3},{4},{5},{6},{7}", iColor, pn.Color, rc.X, rc.Y, rc.Width, rc.Height, startAngle, sweepAngle);
|
||||
//if (iColor == 7 || iColor == 8) return;
|
||||
//if (iColor == 6) return;
|
||||
//if (iColor == 4 || iColor == 6)
|
||||
//{
|
||||
// using (Pen lightPen = new Pen(myColors[iColor % myColors.Length], .01F))
|
||||
//{
|
||||
// vgOutput.DrawEllipse(lightPen, rc.X, rc.Y, rc.Width, rc.Height);
|
||||
// float xc = rc.X + (rc.Width / 2);
|
||||
// float yc = rc.Y + (rc.Height / 2);
|
||||
// vgOutput.DrawEllipse(lightPen, xc - .5F, yc - .5F, 1F, 1F);
|
||||
//}
|
||||
//}
|
||||
if (sweepAngle > 0)
|
||||
vgOutput.DrawArc(pn, rc, startAngle, sweepAngle);
|
||||
else
|
||||
|
||||
@@ -15,7 +15,6 @@ using System.Linq;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
#pragma warning disable IDE1006 // Naming Styles
|
||||
#pragma warning disable IDE0044 // Add readonly modifier
|
||||
public partial class DisplaySearch : UserControl
|
||||
{
|
||||
@@ -339,14 +338,14 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rodbi db)
|
||||
{
|
||||
return $"{_MyRODbID.ToString()}:{string.Format("{0}", db.dbiID.ToString("X4"))}";
|
||||
return $"{_MyRODbID}:{string.Format("{0}", db.dbiID.ToString("X4"))}";
|
||||
}
|
||||
else if (cmboTreeROs.SelectedNode.Tag is ROFSTLookup.rochild roch)
|
||||
{
|
||||
ROFSTLookup.rochild[] chld = roch.children;
|
||||
// build a list of ROs to search
|
||||
// B2022-118: remove the ending comma otherwise query will fail
|
||||
string strRtnStr = $"{_MyRODbID.ToString()}:{GetROsToSearch(chld)}";
|
||||
string strRtnStr = $"{_MyRODbID}:{GetROsToSearch(chld)}";
|
||||
if (strRtnStr.EndsWith(","))
|
||||
strRtnStr = strRtnStr.Substring(0, strRtnStr.Length - 1);
|
||||
return strRtnStr;
|
||||
@@ -1008,7 +1007,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
Text = string.Format("{0}", (char)sym.Unicode),
|
||||
// to name button use unicode rather than desc, desc may have spaces or odd chars
|
||||
Name = $"btnCM{sym.Unicode.ToString()}",
|
||||
Name = $"btnCM{sym.Unicode}",
|
||||
Tooltip = sym.Desc,
|
||||
Tag = string.Format(@"{0}", sym.Unicode),
|
||||
FontBold = true
|
||||
@@ -2379,6 +2378,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
|
||||
// if the selected folder has a docversion, handle it:
|
||||
#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast -- this is by design
|
||||
if (n.Tag != SelectAllProcedureSetsText)
|
||||
{
|
||||
FolderInfo fi = (FolderInfo)n.Tag;
|
||||
@@ -2391,8 +2391,9 @@ namespace Volian.Controls.Library
|
||||
StartAdvTreeStepTypesFillIn();// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast
|
||||
|
||||
SetupContextMenu();
|
||||
SetupContextMenu();
|
||||
buildSetToSearchPanelTitle();
|
||||
|
||||
//C2025-005 Find Step Elements
|
||||
@@ -3627,7 +3628,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE1006 // Naming Styles
|
||||
#pragma warning restore IDE0044 // Add readonly modifier
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user