Volian.Base.Library & Baseline
This commit is contained in:
@@ -67,6 +67,7 @@
|
|||||||
<Compile Include="frmSettings.Designer.cs">
|
<Compile Include="frmSettings.Designer.cs">
|
||||||
<DependentUpon>frmSettings.cs</DependentUpon>
|
<DependentUpon>frmSettings.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="GlobalSuppressions.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<EmbeddedResource Include="frmBaseline.resx">
|
<EmbeddedResource Include="frmBaseline.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,7 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Baseline
|
namespace Baseline
|
||||||
|
|||||||
+64
-187
@@ -43,12 +43,9 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
@@ -73,12 +70,7 @@ namespace Baseline
|
|||||||
}
|
}
|
||||||
public partial class frmBaseline : Form
|
public partial class frmBaseline : Form
|
||||||
{
|
{
|
||||||
private IgnoreLines _MyIgnore = new IgnoreLines();
|
public IgnoreLines MyIgnore { get; set; } = new IgnoreLines();
|
||||||
public IgnoreLines MyIgnore
|
|
||||||
{
|
|
||||||
get { return _MyIgnore; }
|
|
||||||
set { _MyIgnore = value; }
|
|
||||||
}
|
|
||||||
private LastWas myLast = LastWas.Search;
|
private LastWas myLast = LastWas.Search;
|
||||||
private Settings MySettings;
|
private Settings MySettings;
|
||||||
public string MyStatus
|
public string MyStatus
|
||||||
@@ -151,8 +143,10 @@ namespace Baseline
|
|||||||
this.WindowState = Properties.Settings.Default.WidnowState;
|
this.WindowState = Properties.Settings.Default.WidnowState;
|
||||||
if(Properties.Settings.Default.Ignore != null && Properties.Settings.Default.Ignore != "")
|
if(Properties.Settings.Default.Ignore != null && Properties.Settings.Default.Ignore != "")
|
||||||
MyIgnore = IgnoreLines.Get(Properties.Settings.Default.Ignore);
|
MyIgnore = IgnoreLines.Get(Properties.Settings.Default.Ignore);
|
||||||
MySettings= new Settings();
|
MySettings = new Settings
|
||||||
MySettings.IgnoreLines = new BindingList<string>();
|
{
|
||||||
|
IgnoreLines = new BindingList<string>()
|
||||||
|
};
|
||||||
splitContainer1.SplitterDistance = Properties.Settings.Default.Split1;
|
splitContainer1.SplitterDistance = Properties.Settings.Default.Split1;
|
||||||
splitContainer2.SplitterDistance = Properties.Settings.Default.Split2;
|
splitContainer2.SplitterDistance = Properties.Settings.Default.Split2;
|
||||||
splitContainer3.SplitterDistance = Properties.Settings.Default.Split3;
|
splitContainer3.SplitterDistance = Properties.Settings.Default.Split3;
|
||||||
@@ -240,8 +234,7 @@ namespace Baseline
|
|||||||
lbProcedures.Items.Clear();
|
lbProcedures.Items.Clear();
|
||||||
lbResults1.Items.Clear();
|
lbResults1.Items.Clear();
|
||||||
lbResults2.Items.Clear();
|
lbResults2.Items.Clear();
|
||||||
FindFile ff = lbDifferent.SelectedItem as FindFile;
|
if (lbDifferent.SelectedItem is FindFile ff)
|
||||||
if (ff != null)
|
|
||||||
{
|
{
|
||||||
// Fill Procedure or Result ListBoxes
|
// Fill Procedure or Result ListBoxes
|
||||||
switch (myLast)
|
switch (myLast)
|
||||||
@@ -361,13 +354,6 @@ namespace Baseline
|
|||||||
lines1 = list1.AsEnumerable<string>();// Convert back to Enumerable to work with LINQ
|
lines1 = list1.AsEnumerable<string>();// Convert back to Enumerable to work with LINQ
|
||||||
return lines1;
|
return lines1;
|
||||||
}
|
}
|
||||||
private string GetProcNum(string line)
|
|
||||||
{
|
|
||||||
string retval = line.Substring(3, line.IndexOf(" | ") - 3);
|
|
||||||
if (retval.Contains("_"))
|
|
||||||
retval = retval.Substring(0, retval.IndexOf("_") - 1);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Include lines for Procedure or Page or Search is true
|
/// Include lines for Procedure or Page or Search is true
|
||||||
/// Account for Case Insensitive CheckBox
|
/// Account for Case Insensitive CheckBox
|
||||||
@@ -450,8 +436,8 @@ namespace Baseline
|
|||||||
private void lbResults1_SelectedIndexChanged(object sender, EventArgs e)
|
private void lbResults1_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string line=null;
|
string line=null;
|
||||||
if (lbResults1.SelectedItem is string)
|
if (lbResults1.SelectedItem is string v)
|
||||||
line = (string)lbResults1.SelectedItem;
|
line = v;
|
||||||
Line myLine = lbResults1.SelectedItem as Line;
|
Line myLine = lbResults1.SelectedItem as Line;
|
||||||
switch (myLast)
|
switch (myLast)
|
||||||
{
|
{
|
||||||
@@ -472,8 +458,8 @@ namespace Baseline
|
|||||||
{
|
{
|
||||||
|
|
||||||
string line=null;
|
string line=null;
|
||||||
if(lbResults2.SelectedItem is string)
|
if(lbResults2.SelectedItem is string v)
|
||||||
line = (string)lbResults2.SelectedItem;
|
line = v;
|
||||||
Line myLine = lbResults2.SelectedItem as Line;
|
Line myLine = lbResults2.SelectedItem as Line;
|
||||||
|
|
||||||
switch (myLast)
|
switch (myLast)
|
||||||
@@ -515,15 +501,9 @@ namespace Baseline
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private string ParseOutProcedureNumberFromLine(string txt)
|
private string ParseOutProcedureNumberFromLine(string txt)
|
||||||
{
|
{
|
||||||
// old logic was looking for the first occurence of ".S" in the txt string as the ending point of the procedure nuumber
|
|
||||||
// Beaver Valley has a procedure number "1.SBGEN" in which the old logic would not work
|
|
||||||
// 1.SBGEN.SC. ==> short path of attachment section "C"
|
|
||||||
// 1.SBGEN.SC..S1. ==> short path of Step 1 in attachment section "C"
|
|
||||||
string rtnstr = null;
|
|
||||||
int lidx = -1;
|
|
||||||
// if the item is to a high levels step or sub-step the short path as "..S" for each part of the step
|
// if the item is to a high levels step or sub-step the short path as "..S" for each part of the step
|
||||||
// so look for the last occurence of ".." which will be the end of the section information
|
// so look for the last occurence of ".." which will be the end of the section information
|
||||||
lidx = txt.LastIndexOf("..");
|
int lidx = txt.LastIndexOf("..");
|
||||||
if (lidx > 0)
|
if (lidx > 0)
|
||||||
{
|
{
|
||||||
lidx = txt.LastIndexOf(".S", lidx); // this will position us to the end of the procedure number
|
lidx = txt.LastIndexOf(".S", lidx); // this will position us to the end of the procedure number
|
||||||
@@ -532,8 +512,12 @@ namespace Baseline
|
|||||||
{
|
{
|
||||||
lidx = txt.LastIndexOf(".S"); // this will position us to the end of the procedure number if there was no step information
|
lidx = txt.LastIndexOf(".S"); // this will position us to the end of the procedure number if there was no step information
|
||||||
}
|
}
|
||||||
|
// old logic was looking for the first occurence of ".S" in the txt string as the ending point of the procedure nuumber
|
||||||
|
// Beaver Valley has a procedure number "1.SBGEN" in which the old logic would not work
|
||||||
|
// 1.SBGEN.SC. ==> short path of attachment section "C"
|
||||||
|
// 1.SBGEN.SC..S1. ==> short path of Step 1 in attachment section "C"
|
||||||
// B2018-113 - Replace slashes and backslashes with underscores just as PROMS does when creating a PDF file.
|
// B2018-113 - Replace slashes and backslashes with underscores just as PROMS does when creating a PDF file.
|
||||||
rtnstr = txt.Substring(8, lidx - 8).Replace("/", "_").Replace("\\", "_");
|
string rtnstr = txt.Substring(8, lidx - 8).Replace("/", "_").Replace("\\", "_");
|
||||||
return rtnstr;
|
return rtnstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,10 +600,10 @@ namespace Baseline
|
|||||||
progname = @"C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\UC.exe";
|
progname = @"C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\UC.exe";
|
||||||
System.Diagnostics.ProcessStartInfo psi =
|
System.Diagnostics.ProcessStartInfo psi =
|
||||||
new System.Diagnostics.ProcessStartInfo(progname, string.Format(@" -t ""{0}"" ""{1}""", compareFile, baseFile));
|
new System.Diagnostics.ProcessStartInfo(progname, string.Format(@" -t ""{0}"" ""{1}""", compareFile, baseFile));
|
||||||
System.Diagnostics.Process prc = System.Diagnostics.Process.Start(psi);
|
_ = System.Diagnostics.Process.Start(psi);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProcessLocationQueue myQueue= new ProcessLocationQueue();
|
private readonly ProcessLocationQueue myQueue= new ProcessLocationQueue();
|
||||||
private Timer queueTimer = null;
|
private Timer queueTimer = null;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Move a Process to a specific screen location - This is done with a timer so
|
/// Move a Process to a specific screen location - This is done with a timer so
|
||||||
@@ -632,8 +616,10 @@ namespace Baseline
|
|||||||
{
|
{
|
||||||
if (queueTimer == null)
|
if (queueTimer == null)
|
||||||
{
|
{
|
||||||
queueTimer = new Timer();
|
queueTimer = new Timer
|
||||||
queueTimer.Enabled = false;
|
{
|
||||||
|
Enabled = false
|
||||||
|
};
|
||||||
queueTimer.Tick += queueTimer_Tick;
|
queueTimer.Tick += queueTimer_Tick;
|
||||||
queueTimer.Interval = 1000;
|
queueTimer.Interval = 1000;
|
||||||
}
|
}
|
||||||
@@ -669,7 +655,7 @@ namespace Baseline
|
|||||||
string procPatern = string.Format("*{0}*.pdf", proc == string.Empty ? "noProcNumber" : proc);
|
string procPatern = string.Format("*{0}*.pdf", proc == string.Empty ? "noProcNumber" : proc);
|
||||||
int pagenum = myLine.MyPage.Number;
|
int pagenum = myLine.MyPage.Number;
|
||||||
FindFile ff = lbDifferent.SelectedItem as FindFile;
|
FindFile ff = lbDifferent.SelectedItem as FindFile;
|
||||||
string PDFfileName = null;
|
string PDFfileName;
|
||||||
if (list == 1)
|
if (list == 1)
|
||||||
{
|
{
|
||||||
FileInfo fi1 = new FileInfo(ff.File1);
|
FileInfo fi1 = new FileInfo(ff.File1);
|
||||||
@@ -702,9 +688,11 @@ namespace Baseline
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// open the PDF and jump to the page number
|
// open the PDF and jump to the page number
|
||||||
System.Diagnostics.ProcessStartInfo psi1 = new System.Diagnostics.ProcessStartInfo(exePath, string.Format("/A \"page={0}\" \"{1}\" ", pagenum,PDFfileName));
|
System.Diagnostics.ProcessStartInfo psi1 = new System.Diagnostics.ProcessStartInfo(exePath, string.Format("/A \"page={0}\" \"{1}\" ", pagenum, PDFfileName))
|
||||||
psi1.UseShellExecute = false;
|
{
|
||||||
System.Diagnostics.Process p1 = System.Diagnostics.Process.Start(psi1);
|
UseShellExecute = false
|
||||||
|
};
|
||||||
|
_ = System.Diagnostics.Process.Start(psi1);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform Debug Meta file comparison for all of the folders within the automated testing folders
|
/// Perform Debug Meta file comparison for all of the folders within the automated testing folders
|
||||||
@@ -786,8 +774,7 @@ namespace Baseline
|
|||||||
private void lbProcedures_SelectedIndexChanged(object sender, EventArgs e)
|
private void lbProcedures_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//Initialize Results List Box
|
//Initialize Results List Box
|
||||||
Procedure myProc = lbProcedures.SelectedItem as Procedure;
|
if (!(lbProcedures.SelectedItem is Procedure myProc)) return; // clicked on the white space (blank line) in the list of different procedures
|
||||||
if (myProc == null) return; // clicked on the white space (blank line) in the list of different procedures
|
|
||||||
//TODO: May need to consider if there are duplicate procedure numers and titles
|
//TODO: May need to consider if there are duplicate procedure numers and titles
|
||||||
Procedure myProc1 = MyProcs1.Find(x => x.Number == myProc.Number && x.Title == myProc.Title);
|
Procedure myProc1 = MyProcs1.Find(x => x.Number == myProc.Number && x.Title == myProc.Title);
|
||||||
// Build the results ListBox for the left window
|
// Build the results ListBox for the left window
|
||||||
@@ -836,27 +823,12 @@ namespace Baseline
|
|||||||
};
|
};
|
||||||
public class Settings
|
public class Settings
|
||||||
{
|
{
|
||||||
private BindingList<string> _IgnoreLines;
|
public BindingList<string> IgnoreLines { get; set; }
|
||||||
public BindingList<string> IgnoreLines
|
|
||||||
{
|
|
||||||
get { return _IgnoreLines; }
|
|
||||||
set { _IgnoreLines = value; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public partial class FindFile
|
public partial class FindFile
|
||||||
{
|
{
|
||||||
private string _File1;
|
public string File1 { get; set; }
|
||||||
public string File1
|
public string File2 { get; set; }
|
||||||
{
|
|
||||||
get { return _File1; }
|
|
||||||
set { _File1 = value; }
|
|
||||||
}
|
|
||||||
private string _File2;
|
|
||||||
public string File2
|
|
||||||
{
|
|
||||||
get { return _File2; }
|
|
||||||
set { _File2 = value; }
|
|
||||||
}
|
|
||||||
public FindFile(string file1, string file2)
|
public FindFile(string file1, string file2)
|
||||||
{
|
{
|
||||||
File1 = file1;
|
File1 = file1;
|
||||||
@@ -865,11 +837,8 @@ namespace Baseline
|
|||||||
}
|
}
|
||||||
public partial class FindFiles : List<FindFile>
|
public partial class FindFiles : List<FindFile>
|
||||||
{
|
{
|
||||||
private string _FileName;
|
private readonly string _FileName;
|
||||||
public string FileName
|
public string FileName => _FileName;
|
||||||
{
|
|
||||||
get { return _FileName; }
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Build list of DocVersion Folders with differences
|
/// Build list of DocVersion Folders with differences
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1103,33 +1072,15 @@ namespace Baseline
|
|||||||
// Text - the line of text
|
// Text - the line of text
|
||||||
public partial class Procedure
|
public partial class Procedure
|
||||||
{
|
{
|
||||||
private string _Number;
|
public string Number { get; set; }
|
||||||
public string Number
|
public string Title { get; set; }
|
||||||
{
|
public Pages MyPages { get; set; } = new Pages();
|
||||||
get { return _Number; }
|
|
||||||
set { _Number = value; }
|
|
||||||
}
|
|
||||||
private string _Title;
|
|
||||||
public string Title
|
|
||||||
{
|
|
||||||
get { return _Title; }
|
|
||||||
set { _Title = value; }
|
|
||||||
}
|
|
||||||
private Pages _MyPages = new Pages();
|
|
||||||
public Pages MyPages
|
|
||||||
{
|
|
||||||
get { return _MyPages; }
|
|
||||||
set { _MyPages = value; }
|
|
||||||
}
|
|
||||||
public Procedure(string number, string title)
|
public Procedure(string number, string title)
|
||||||
{
|
{
|
||||||
_Number = number;
|
Number = number;
|
||||||
_Title = title;
|
Title = title;
|
||||||
}
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return string.Format("{0} - {1}", Number, Title);
|
|
||||||
}
|
}
|
||||||
|
public override string ToString() => string.Format("{0} - {1}", Number, Title);
|
||||||
}
|
}
|
||||||
public partial class Procedures : List<Procedure>
|
public partial class Procedures : List<Procedure>
|
||||||
{
|
{
|
||||||
@@ -1161,76 +1112,33 @@ namespace Baseline
|
|||||||
}
|
}
|
||||||
public partial class Page
|
public partial class Page
|
||||||
{
|
{
|
||||||
private int _Number;
|
public int Number { get; set; }
|
||||||
public int Number
|
|
||||||
{
|
|
||||||
get { return _Number; }
|
|
||||||
set { _Number = value; }
|
|
||||||
}
|
|
||||||
private Lines _MyLines = new Lines();
|
|
||||||
|
|
||||||
public Lines MyLines
|
public Lines MyLines { get; set; } = new Lines();
|
||||||
{
|
public Page(int number) => Number = number;
|
||||||
get { return _MyLines; }
|
public override string ToString() => string.Format("Page {0}", Number);
|
||||||
set { _MyLines = value; }
|
|
||||||
}
|
|
||||||
public Page(int number)
|
|
||||||
{
|
|
||||||
_Number = number;
|
|
||||||
}
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return string.Format("Page {0}", Number);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public partial class Pages : List<Page>
|
public partial class Pages : List<Page>
|
||||||
{
|
{
|
||||||
public void Add(int number)
|
public void Add(int number) => Add(new Page(number));
|
||||||
{
|
|
||||||
Add(new Page(number));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public partial class Line
|
public partial class Line
|
||||||
{
|
{
|
||||||
private Procedure _MyProc;
|
public Procedure MyProc { get; set; }
|
||||||
public Procedure MyProc
|
public Page MyPage { get; set; }
|
||||||
{
|
public string Text { get; set; }
|
||||||
get { return _MyProc; }
|
public Line(string text) => Text = text;
|
||||||
set { _MyProc = value; }
|
|
||||||
}
|
|
||||||
private Page _MyPage;
|
|
||||||
public Page MyPage
|
|
||||||
{
|
|
||||||
get { return _MyPage; }
|
|
||||||
set { _MyPage = value; }
|
|
||||||
}
|
|
||||||
private string _Text;
|
|
||||||
public string Text
|
|
||||||
{
|
|
||||||
get { return _Text; }
|
|
||||||
set { _Text = value; }
|
|
||||||
}
|
|
||||||
public Line(string text)
|
|
||||||
{
|
|
||||||
_Text = text;
|
|
||||||
}
|
|
||||||
public Line(string text, Procedure myProc, Page myPage)
|
public Line(string text, Procedure myProc, Page myPage)
|
||||||
{
|
{
|
||||||
_Text = text;
|
Text = text;
|
||||||
_MyProc = myProc;
|
MyProc = myProc;
|
||||||
_MyPage = myPage;
|
MyPage = myPage;
|
||||||
}
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Text;
|
|
||||||
}
|
}
|
||||||
|
public override string ToString() => Text;
|
||||||
}
|
}
|
||||||
public partial class Lines : List<Line>
|
public partial class Lines : List<Line>
|
||||||
{
|
{
|
||||||
public void Add(string text)
|
public void Add(string text) => Add(new Line(text));
|
||||||
{
|
|
||||||
Add(new Line(text));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public partial class IgnoreLine
|
public partial class IgnoreLine
|
||||||
@@ -1269,20 +1177,11 @@ namespace Baseline
|
|||||||
public IgnoreLines()
|
public IgnoreLines()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public void Add(string text, Relation searchType, bool active)
|
public void Add(string text, Relation searchType, bool active) => Add(new IgnoreLine(text, searchType, active));
|
||||||
{
|
|
||||||
Add(new IgnoreLine(text, searchType, active));
|
|
||||||
}
|
|
||||||
// Convert IgnoreLines to string (XML)
|
// Convert IgnoreLines to string (XML)
|
||||||
public override string ToString()
|
public override string ToString() => GenericSerializer<IgnoreLines>.StringSerialize(this);
|
||||||
{
|
|
||||||
return GenericSerializer<IgnoreLines>.StringSerialize(this);
|
|
||||||
}
|
|
||||||
// Convert string to IgnoreLines
|
// Convert string to IgnoreLines
|
||||||
public static IgnoreLines Get(string xml)
|
public static IgnoreLines Get(string xml) => GenericSerializer<IgnoreLines>.StringDeserialize(xml);
|
||||||
{
|
|
||||||
return GenericSerializer<IgnoreLines>.StringDeserialize(xml);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is a simple serializer that takes a class and converts it to and from string (XML)
|
/// This is a simple serializer that takes a class and converts it to and from string (XML)
|
||||||
@@ -1311,7 +1210,7 @@ namespace Baseline
|
|||||||
string ss = s.Replace("encoding=\"utf-16\"", "");
|
string ss = s.Replace("encoding=\"utf-16\"", "");
|
||||||
XmlSerializer xs = new XmlSerializer(typeof(T));
|
XmlSerializer xs = new XmlSerializer(typeof(T));
|
||||||
UTF8Encoding enc = new UTF8Encoding();
|
UTF8Encoding enc = new UTF8Encoding();
|
||||||
Byte[] arrBytData = enc.GetBytes(ss);
|
byte[] arrBytData = enc.GetBytes(ss);
|
||||||
using (MemoryStream ms = new MemoryStream(arrBytData))
|
using (MemoryStream ms = new MemoryStream(arrBytData))
|
||||||
{
|
{
|
||||||
t = (T)xs.Deserialize(ms);
|
t = (T)xs.Deserialize(ms);
|
||||||
@@ -1326,10 +1225,7 @@ namespace Baseline
|
|||||||
{
|
{
|
||||||
public NonXsiTextWriter(TextWriter w) : base(w) { }
|
public NonXsiTextWriter(TextWriter w) : base(w) { }
|
||||||
public NonXsiTextWriter(Stream w, Encoding encoding)
|
public NonXsiTextWriter(Stream w, Encoding encoding)
|
||||||
: base(w, encoding)
|
: base(w, encoding) => Formatting = Formatting.Indented;
|
||||||
{
|
|
||||||
this.Formatting = Formatting.Indented;
|
|
||||||
}
|
|
||||||
public NonXsiTextWriter(string filename, Encoding encoding) : base(filename, encoding) { }
|
public NonXsiTextWriter(string filename, Encoding encoding) : base(filename, encoding) { }
|
||||||
bool _skip = false;
|
bool _skip = false;
|
||||||
public override void WriteStartAttribute(string prefix, string localName, string ns)
|
public override void WriteStartAttribute(string prefix, string localName, string ns)
|
||||||
@@ -1372,32 +1268,16 @@ namespace Baseline
|
|||||||
public const short SWP_NOZORDER = 0X4;
|
public const short SWP_NOZORDER = 0X4;
|
||||||
public const int SWP_SHOWWINDOW = 0x0040;
|
public const int SWP_SHOWWINDOW = 0x0040;
|
||||||
|
|
||||||
private System.Diagnostics.Process _Process;
|
public System.Diagnostics.Process Process { get; set; }
|
||||||
|
public int X { get; set; }
|
||||||
public System.Diagnostics.Process Process
|
public int Y { get; set; }
|
||||||
{
|
|
||||||
get { return _Process; }
|
|
||||||
set { _Process = value; }
|
|
||||||
}
|
|
||||||
private int _X;
|
|
||||||
public int X
|
|
||||||
{
|
|
||||||
get { return _X; }
|
|
||||||
set { _X = value; }
|
|
||||||
}
|
|
||||||
private int _Y;
|
|
||||||
public int Y
|
|
||||||
{
|
|
||||||
get { return _Y; }
|
|
||||||
set { _Y = value; }
|
|
||||||
}
|
|
||||||
public ProcessLocation(System.Diagnostics.Process process, int x, int y)
|
public ProcessLocation(System.Diagnostics.Process process, int x, int y)
|
||||||
{
|
{
|
||||||
Process = process;
|
Process = process;
|
||||||
X = x;
|
X = x;
|
||||||
Y = y;
|
Y = y;
|
||||||
}
|
}
|
||||||
private static Boolean FoxitSettingInfo = true;
|
private static bool FoxitSettingInfo = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MoveIt() moves the window containing the PDF viewer to the right so the two pdf viewer windows will not overlap.
|
/// MoveIt() moves the window containing the PDF viewer to the right so the two pdf viewer windows will not overlap.
|
||||||
@@ -1418,10 +1298,7 @@ namespace Baseline
|
|||||||
}
|
}
|
||||||
public class ProcessLocationQueue: Queue<ProcessLocation>
|
public class ProcessLocationQueue: Queue<ProcessLocation>
|
||||||
{
|
{
|
||||||
public void Add(System.Diagnostics.Process process, int x, int y)
|
public void Add(System.Diagnostics.Process process, int x, int y) => Enqueue(new ProcessLocation(process, x, y));
|
||||||
{
|
|
||||||
Enqueue(new ProcessLocation(process,x,y));
|
|
||||||
}
|
|
||||||
public void ProcessNext()
|
public void ProcessNext()
|
||||||
{
|
{
|
||||||
ProcessLocation pl = Dequeue();
|
ProcessLocation pl = Dequeue();
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Baseline
|
namespace Baseline
|
||||||
@@ -19,17 +12,7 @@ namespace Baseline
|
|||||||
set {
|
set {
|
||||||
_MyIgnore = value;
|
_MyIgnore = value;
|
||||||
dgv.DataSource=null;
|
dgv.DataSource=null;
|
||||||
//dgvcSearchType.ValueType = typeof(Relation);
|
|
||||||
//dgvcSearchType.ValueMember = "Value";
|
|
||||||
//dgvcSearchType.DisplayMember = "Display";
|
|
||||||
//dgvcSearchType.DataSource = new Relation[] { Relation.Contains, Relation.StartsWith, Relation.EndsWith, Relation.Regex }
|
|
||||||
//.Select(x => new { Display = x.ToString(), Value = x })
|
|
||||||
//.ToList();
|
|
||||||
dgv.DataSource=value;
|
dgv.DataSource=value;
|
||||||
//dgvcSearchType.DataSource =
|
|
||||||
//new List<Relation>((Relation[]) Enum.GetValues(typeof(Relation)))
|
|
||||||
//.Select(x => new { Display=x.ToString(), Value=(int)x })
|
|
||||||
//.ToList();;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public frmSettings(IgnoreLines myIgnore)
|
public frmSettings(IgnoreLines myIgnore)
|
||||||
@@ -46,19 +29,16 @@ namespace Baseline
|
|||||||
col.ValueType = typeof(Relation);
|
col.ValueType = typeof(Relation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dgv_DataError(object sender, DataGridViewDataErrorEventArgs e)
|
private void dgv_DataError(object sender, DataGridViewDataErrorEventArgs e) => Console.WriteLine("Here");
|
||||||
{
|
|
||||||
Console.WriteLine("Here");
|
|
||||||
}
|
|
||||||
private void btnOK_Click(object sender, EventArgs e)
|
private void btnOK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||||
this.Close();
|
Close();
|
||||||
}
|
}
|
||||||
private void btnCancel_Click(object sender, EventArgs e)
|
private void btnCancel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ using System.Xml.Serialization;
|
|||||||
namespace Volian.Base.Library
|
namespace Volian.Base.Library
|
||||||
{
|
{
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
//[XmlRoot("BigNum")]
|
|
||||||
public class BigNum
|
public class BigNum
|
||||||
{
|
{
|
||||||
#region fields
|
#region fields
|
||||||
@@ -22,18 +21,9 @@ namespace Volian.Base.Library
|
|||||||
public BigNum()
|
public BigNum()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public BigNum(int value)
|
public BigNum(int value) => SetFlag(value);
|
||||||
{
|
public BigNum(string values) => SetFlags(values);
|
||||||
SetFlag(value);
|
public BigNum(ICollection<int> values) => SetFlags(values);
|
||||||
}
|
|
||||||
public BigNum(string values)
|
|
||||||
{
|
|
||||||
SetFlags(values);
|
|
||||||
}
|
|
||||||
public BigNum(ICollection<int> values)
|
|
||||||
{
|
|
||||||
SetFlags(values);
|
|
||||||
}
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return FlagList;
|
return FlagList;
|
||||||
@@ -58,10 +48,6 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region methods
|
#region methods
|
||||||
//public override string ToString()
|
|
||||||
//{
|
|
||||||
// return GenericSerializer<BigNum>.StringSerialize(this);
|
|
||||||
//}
|
|
||||||
public bool Includes(BigNum other)
|
public bool Includes(BigNum other)
|
||||||
{
|
{
|
||||||
List<int> mine = GetFlags();
|
List<int> mine = GetFlags();
|
||||||
@@ -82,12 +68,6 @@ namespace Volian.Base.Library
|
|||||||
public List<int> GetFlags()
|
public List<int> GetFlags()
|
||||||
{
|
{
|
||||||
List<int> myints = new List<int>();
|
List<int> myints = new List<int>();
|
||||||
//if (MyValue.Count == 0)//1 && MyValue.ContainsKey(0) && MyValue[0] == 0)
|
|
||||||
//{
|
|
||||||
// myints.Add(-1);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
foreach (uint key in MyValue.Keys)
|
foreach (uint key in MyValue.Keys)
|
||||||
{
|
{
|
||||||
ulong y = MyValue[key];
|
ulong y = MyValue[key];
|
||||||
@@ -97,18 +77,10 @@ namespace Volian.Base.Library
|
|||||||
myints.Add((int)(i + (key * 64)));
|
myints.Add((int)(i + (key * 64)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
return myints;
|
return myints;
|
||||||
}
|
}
|
||||||
public void SetFlag(int flag)
|
public void SetFlag(int flag)
|
||||||
{
|
{
|
||||||
//if (flag == -1)
|
|
||||||
//{
|
|
||||||
// MyValue = new SortedDictionary<uint, ulong>();
|
|
||||||
// //MyValue.Add(0, 0);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
uint offset = (uint)(flag / 64);
|
uint offset = (uint)(flag / 64);
|
||||||
ulong x = one << (flag % 64);
|
ulong x = one << (flag % 64);
|
||||||
if (MyValue.ContainsKey(offset))
|
if (MyValue.ContainsKey(offset))
|
||||||
@@ -122,12 +94,7 @@ namespace Volian.Base.Library
|
|||||||
foreach (int f in flags)
|
foreach (int f in flags)
|
||||||
SetFlag(f);
|
SetFlag(f);
|
||||||
}
|
}
|
||||||
public static BigNum MakeBigNum(string numbers)
|
public static BigNum MakeBigNum(string numbers) => numbers == "-1" ? null : new BigNum(numbers);
|
||||||
{
|
|
||||||
if (numbers == "-1")
|
|
||||||
return null;
|
|
||||||
return new BigNum(numbers);
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
#region properties
|
#region properties
|
||||||
[XmlAttribute]
|
[XmlAttribute]
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Volian.Base.Library
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Volian.Base.Library
|
|
||||||
{
|
{
|
||||||
public static class ByteArrayCompare
|
public static class ByteArrayCompare
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Volian.Base.Library
|
namespace Volian.Base.Library
|
||||||
{
|
{
|
||||||
public class DebugPrint:IDisposable
|
public class DebugPrint:IDisposable
|
||||||
{
|
{
|
||||||
public void Dispose()
|
public void Dispose() => Close();
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
private StreamWriter _MyStreamWriter = null;
|
private StreamWriter _MyStreamWriter = null;
|
||||||
public StreamWriter MyStreamWriter
|
public StreamWriter MyStreamWriter
|
||||||
{
|
{
|
||||||
@@ -25,10 +20,7 @@ namespace Volian.Base.Library
|
|||||||
_MyStreamWriter = value;
|
_MyStreamWriter = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool IsOpen
|
public bool IsOpen => MyStreamWriter != null;
|
||||||
{
|
|
||||||
get { return MyStreamWriter != null; }
|
|
||||||
}
|
|
||||||
private string _FileName = null;
|
private string _FileName = null;
|
||||||
public string FileName
|
public string FileName
|
||||||
{
|
{
|
||||||
@@ -40,21 +32,14 @@ namespace Volian.Base.Library
|
|||||||
MyFileInfo = new FileInfo(value);
|
MyFileInfo = new FileInfo(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private FileInfo _MyFileInfo;
|
|
||||||
public FileInfo MyFileInfo
|
public FileInfo MyFileInfo { get; set; }
|
||||||
{
|
|
||||||
get { return _MyFileInfo; }
|
|
||||||
set { _MyFileInfo = value; }
|
|
||||||
}
|
|
||||||
public void Open(string fileName)
|
public void Open(string fileName)
|
||||||
{
|
{
|
||||||
FileName = fileName;
|
FileName = fileName;
|
||||||
MyStreamWriter = MyFileInfo.CreateText();
|
MyStreamWriter = MyFileInfo.CreateText();
|
||||||
}
|
}
|
||||||
public void Close()
|
public void Close() => MyStreamWriter = null;
|
||||||
{
|
|
||||||
MyStreamWriter = null;
|
|
||||||
}
|
|
||||||
public void Write(string format, params object[] args)
|
public void Write(string format, params object[] args)
|
||||||
{
|
{
|
||||||
if (IsOpen) MyStreamWriter.Write(format, args);
|
if (IsOpen) MyStreamWriter.Write(format, args);
|
||||||
@@ -73,98 +58,62 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
public static class DebugPagination
|
public static class DebugPagination
|
||||||
{
|
{
|
||||||
private static int _TotalPages = 0;
|
public static int TotalPages { get; set; } = 0;
|
||||||
public static int TotalPages
|
private static readonly DebugPrint _MyDebugPrint = new DebugPrint();
|
||||||
{
|
public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
|
||||||
get { return _TotalPages; }
|
|
||||||
set { _TotalPages = value; }
|
|
||||||
}
|
|
||||||
private static DebugPrint _MyDebugPrint = new DebugPrint();
|
|
||||||
public static void Open(string fileName)
|
|
||||||
{ _MyDebugPrint.Open(fileName); }
|
|
||||||
public static void Close()
|
public static void Close()
|
||||||
{
|
{
|
||||||
WriteLine("{0} Total Pages", TotalPages);
|
WriteLine("{0} Total Pages", TotalPages);
|
||||||
_MyDebugPrint.Close();
|
_MyDebugPrint.Close();
|
||||||
}
|
}
|
||||||
public static void Write(string format, params object[] args)
|
public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
|
||||||
{ _MyDebugPrint.Write(format, args); }
|
public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
|
||||||
public static void WriteLine(string format, params object[] args)
|
public static void Show() => _MyDebugPrint.Show();
|
||||||
{ _MyDebugPrint.WriteLine(format, args); }
|
public static bool IsOpen => _MyDebugPrint.IsOpen;
|
||||||
public static void Show()
|
|
||||||
{ _MyDebugPrint.Show(); }
|
|
||||||
public static bool IsOpen
|
|
||||||
{ get { return _MyDebugPrint.IsOpen; } }
|
|
||||||
}
|
}
|
||||||
public static class DebugText
|
public static class DebugText
|
||||||
{
|
{
|
||||||
private static DebugPrint _MyDebugPrint = new DebugPrint();
|
private static readonly DebugPrint _MyDebugPrint = new DebugPrint();
|
||||||
public static void Open(string fileName)
|
public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
|
||||||
{ _MyDebugPrint.Open(fileName); }
|
public static void Close() => _MyDebugPrint.Close();
|
||||||
public static void Close()
|
public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
|
||||||
{ _MyDebugPrint.Close(); }
|
public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
|
||||||
public static void Write(string format, params object[] args)
|
public static void Show() => _MyDebugPrint.Show();
|
||||||
{ _MyDebugPrint.Write(format, args); }
|
public static bool IsOpen => _MyDebugPrint.IsOpen;
|
||||||
public static void WriteLine(string format, params object[] args)
|
|
||||||
{ _MyDebugPrint.WriteLine(format, args); }
|
|
||||||
public static void Show()
|
|
||||||
{ _MyDebugPrint.Show(); }
|
|
||||||
public static bool IsOpen
|
|
||||||
{ get { return _MyDebugPrint.IsOpen; } }
|
|
||||||
}
|
}
|
||||||
public static class DebugProfile
|
public static class DebugProfile
|
||||||
{
|
{
|
||||||
private static DebugPrint _MyDebugPrint = new DebugPrint();
|
private static DebugPrint _MyDebugPrint = new DebugPrint();
|
||||||
public static void Open(string fileName)
|
public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
|
||||||
{ _MyDebugPrint.Open(fileName); }
|
|
||||||
public static void Close()
|
public static void Close()
|
||||||
{ _MyDebugPrint.Close(); _MyDebugPrint = null; }
|
{ _MyDebugPrint.Close(); _MyDebugPrint = null; }
|
||||||
public static void Write(string format, params object[] args)
|
public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
|
||||||
{ _MyDebugPrint.Write(format, args); }
|
public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
|
||||||
public static void WriteLine(string format, params object[] args)
|
public static void Show() => _MyDebugPrint.Show();
|
||||||
{ _MyDebugPrint.WriteLine(format, args); }
|
public static bool IsOpen => _MyDebugPrint.IsOpen;
|
||||||
public static void Show()
|
|
||||||
{ _MyDebugPrint.Show(); }
|
|
||||||
public static bool IsOpen
|
|
||||||
{ get { return _MyDebugPrint.IsOpen; } }
|
|
||||||
}
|
}
|
||||||
public static class DebugDBTrack
|
public static class DebugDBTrack
|
||||||
{
|
{
|
||||||
private static DebugPrint _MyDebugPrint = new DebugPrint();
|
private static DebugPrint _MyDebugPrint = new DebugPrint();
|
||||||
public static void Open(string fileName)
|
public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
|
||||||
{ _MyDebugPrint.Open(fileName); }
|
|
||||||
public static void Close()
|
public static void Close()
|
||||||
{ _MyDebugPrint.Close(); _MyDebugPrint = null; }
|
{ _MyDebugPrint.Close(); _MyDebugPrint = null; }
|
||||||
public static void Write(string format, params object[] args)
|
public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
|
||||||
{ _MyDebugPrint.Write(format, args); }
|
public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
|
||||||
public static void WriteLine(string format, params object[] args)
|
public static void Show() => _MyDebugPrint.Show();
|
||||||
{ _MyDebugPrint.WriteLine(format, args); }
|
public static bool IsOpen => _MyDebugPrint.IsOpen;
|
||||||
public static void Show()
|
|
||||||
{ _MyDebugPrint.Show(); }
|
|
||||||
public static bool IsOpen
|
|
||||||
{ get { return _MyDebugPrint.IsOpen; } }
|
|
||||||
}
|
}
|
||||||
// C2018-004 create meta file for baseline compares
|
// C2018-004 create meta file for baseline compares
|
||||||
public static class BaselineMetaFile
|
public static class BaselineMetaFile
|
||||||
{
|
{
|
||||||
private static DebugPrint _MyDebugPrint = new DebugPrint();
|
private static readonly DebugPrint _MyDebugPrint = new DebugPrint();
|
||||||
public static void Open(string fileName)
|
public static void Open(string fileName) => _MyDebugPrint.Open(fileName);
|
||||||
{ _MyDebugPrint.Open(fileName); }
|
public static void Close() => _MyDebugPrint.Close();
|
||||||
public static void Close()
|
public static void Write(string format, params object[] args) => _MyDebugPrint.Write(format, args);
|
||||||
{ _MyDebugPrint.Close(); }
|
public static void WriteLine(string format, params object[] args) => _MyDebugPrint.WriteLine(format, args);
|
||||||
public static void Write(string format, params object[] args)
|
public static void Show() => _MyDebugPrint.Show();
|
||||||
{ _MyDebugPrint.Write(format, args); }
|
public static bool IsOpen => _MyDebugPrint.IsOpen;
|
||||||
public static void WriteLine(string format, params object[] args)
|
|
||||||
{ _MyDebugPrint.WriteLine(format, args); }
|
public static bool IncludeWordSecText { get; set; } = true;
|
||||||
public static void Show()
|
|
||||||
{ _MyDebugPrint.Show(); }
|
|
||||||
public static bool IsOpen
|
|
||||||
{ get { return _MyDebugPrint.IsOpen; } }
|
|
||||||
private static bool _IncludeWordSecText = true;
|
|
||||||
public static bool IncludeWordSecText
|
|
||||||
{
|
|
||||||
get { return BaselineMetaFile._IncludeWordSecText; }
|
|
||||||
set { BaselineMetaFile._IncludeWordSecText = value; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -11,11 +9,7 @@ namespace Volian.Base.Library
|
|||||||
#region Log4Net
|
#region Log4Net
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
public static string GetROEditorPath()
|
public static string GetROEditorPath() => $@"{PROMSExecutableFolderPath()}\ROEDITOR.EXE";
|
||||||
{
|
|
||||||
string roapp = PROMSExecutableFolderPath() + @"\ROEDITOR.EXE";
|
|
||||||
return roapp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns the path to the executable folder
|
// returns the path to the executable folder
|
||||||
public static string PROMSExecutableFolderPath()
|
public static string PROMSExecutableFolderPath()
|
||||||
@@ -24,7 +18,7 @@ namespace Volian.Base.Library
|
|||||||
if (pathPROMSexe[7] == ':') // either a local drive or a mapped network drive
|
if (pathPROMSexe[7] == ':') // either a local drive or a mapped network drive
|
||||||
pathPROMSexe = pathPROMSexe.Substring(6);
|
pathPROMSexe = pathPROMSexe.Substring(6);
|
||||||
else
|
else
|
||||||
pathPROMSexe = @"\" + pathPROMSexe.Substring(5); // non-mapped network drive - need to add extra back slash in front
|
pathPROMSexe = $@"\{pathPROMSexe.Substring(5)}"; // non-mapped network drive - need to add extra back slash in front
|
||||||
return pathPROMSexe;
|
return pathPROMSexe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +28,7 @@ namespace Volian.Base.Library
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Build the path to the PROMSFixes.sql file located in the PROMS exe folder
|
// Build the path to the PROMSFixes.sql file located in the PROMS exe folder
|
||||||
string pathPROMSFixes = PROMSExecutableFolderPath() + @"\PROMSFixes.sql";
|
string pathPROMSFixes = $@"{PROMSExecutableFolderPath()}\PROMSFixes.sql";
|
||||||
|
|
||||||
// open the PROMSFixes.sql file and grab the line of text containing the PROMSFixes RevDate
|
// open the PROMSFixes.sql file and grab the line of text containing the PROMSFixes RevDate
|
||||||
// using Linq to open and read the PROMSFixes file
|
// using Linq to open and read the PROMSFixes file
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
|
||||||
using System.Data;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Drawing.Design;
|
using System.Drawing.Design;
|
||||||
using System.Windows.Forms.Design;
|
using System.Windows.Forms.Design;
|
||||||
@@ -13,7 +10,6 @@ namespace Volian.Base.Library
|
|||||||
|
|
||||||
public class FlagCheckedListBox : CheckedListBox
|
public class FlagCheckedListBox : CheckedListBox
|
||||||
{
|
{
|
||||||
private System.ComponentModel.Container components = null;
|
|
||||||
|
|
||||||
public FlagCheckedListBox()
|
public FlagCheckedListBox()
|
||||||
{
|
{
|
||||||
@@ -21,16 +17,6 @@ namespace Volian.Base.Library
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
if (components != null)
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Component Designer generated code
|
#region Component Designer generated code
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
@@ -124,7 +110,7 @@ namespace Volian.Base.Library
|
|||||||
|
|
||||||
// If the item has been unchecked, remove its bits from the sum
|
// If the item has been unchecked, remove its bits from the sum
|
||||||
if (cs == CheckState.Unchecked)
|
if (cs == CheckState.Unchecked)
|
||||||
sum = sum & (~composite.value);
|
sum &= (~composite.value);
|
||||||
// If the item has been checked, combine its bits with the sum
|
// If the item has been checked, combine its bits with the sum
|
||||||
else
|
else
|
||||||
sum |= composite.value;
|
sum |= composite.value;
|
||||||
@@ -207,25 +193,13 @@ namespace Volian.Base.Library
|
|||||||
caption = c;
|
caption = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString() => caption;
|
||||||
{
|
|
||||||
return caption;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if the value corresponds to a single bit being set
|
// Returns true if the value corresponds to a single bit being set
|
||||||
public bool IsFlag
|
public bool IsFlag => (value & (value - 1)) == 0;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ((value & (value - 1)) == 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if this value is a member of the composite bit value
|
// Returns true if this value is a member of the composite bit value
|
||||||
public bool IsMemberFlag(FlagCheckedListBoxItem composite)
|
public bool IsMemberFlag(FlagCheckedListBoxItem composite) => IsFlag && ((value & composite.value) == value);
|
||||||
{
|
|
||||||
return (IsFlag && ((value & composite.value) == value));
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint value;
|
public uint value;
|
||||||
public string caption;
|
public string caption;
|
||||||
@@ -236,12 +210,14 @@ namespace Volian.Base.Library
|
|||||||
public class FlagEnumUIEditor : UITypeEditor
|
public class FlagEnumUIEditor : UITypeEditor
|
||||||
{
|
{
|
||||||
// The checklistbox
|
// The checklistbox
|
||||||
private FlagCheckedListBox flagEnumCB;
|
private readonly FlagCheckedListBox flagEnumCB;
|
||||||
|
|
||||||
public FlagEnumUIEditor()
|
public FlagEnumUIEditor()
|
||||||
{
|
{
|
||||||
flagEnumCB = new FlagCheckedListBox();
|
flagEnumCB = new FlagCheckedListBox
|
||||||
flagEnumCB.BorderStyle = BorderStyle.None;
|
{
|
||||||
|
BorderStyle = BorderStyle.None
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
|
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
|
||||||
@@ -266,10 +242,7 @@ namespace Volian.Base.Library
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
|
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) => UITypeEditorEditStyle.DropDown;
|
||||||
{
|
|
||||||
return UITypeEditorEditStyle.DropDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
using System;
|
using System.Windows.Forms;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Volian.Base.Library
|
namespace Volian.Base.Library
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
@@ -17,7 +16,6 @@ namespace Volian.Base.Library
|
|||||||
using (MemoryStream ms = new MemoryStream())
|
using (MemoryStream ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
xs.Serialize(new NonXsiTextWriter(ms, Encoding.Unicode), t);
|
xs.Serialize(new NonXsiTextWriter(ms, Encoding.Unicode), t);
|
||||||
//xs.Serialize(ms, t);
|
|
||||||
ms.Position = 0;
|
ms.Position = 0;
|
||||||
StreamReader sr = new StreamReader(ms);
|
StreamReader sr = new StreamReader(ms);
|
||||||
strOutput = sr.ReadToEnd();
|
strOutput = sr.ReadToEnd();
|
||||||
@@ -38,26 +36,6 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
//public static void WriteFile(T t, string fileName)
|
|
||||||
//{
|
|
||||||
// string strOutput = string.Empty;
|
|
||||||
// XmlSerializer xs = new XmlSerializer(typeof(T));
|
|
||||||
// using (FileStream fs = new FileStream(fileName, FileMode.Create))
|
|
||||||
// {
|
|
||||||
// xs.Serialize(new NonXsiTextWriter(fs, Encoding.UTF8), t);
|
|
||||||
// fs.Close();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//public static T ReadFile(string fileName)
|
|
||||||
//{
|
|
||||||
// T t;
|
|
||||||
// XmlSerializer xs = new XmlSerializer(typeof(T));
|
|
||||||
// using (FileStream fs = new FileStream(fileName, FileMode.Open))
|
|
||||||
// {
|
|
||||||
// t = (T)xs.Deserialize(fs);
|
|
||||||
// }
|
|
||||||
// return t;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
public class NonXsiTextWriter : XmlTextWriter
|
public class NonXsiTextWriter : XmlTextWriter
|
||||||
{
|
{
|
||||||
@@ -79,8 +57,6 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
if (localName == "xlink_href")
|
if (localName == "xlink_href")
|
||||||
base.WriteStartAttribute(prefix, "xlink:href", ns);
|
base.WriteStartAttribute(prefix, "xlink:href", ns);
|
||||||
//else if (localName == "encoding")
|
|
||||||
// _skip = true;
|
|
||||||
else
|
else
|
||||||
base.WriteStartAttribute(prefix, localName, ns);
|
base.WriteStartAttribute(prefix, localName, ns);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Text;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.ComponentModel.Design;
|
using System.ComponentModel.Design;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -17,10 +13,10 @@ namespace Volian.Base.Library
|
|||||||
// PropertyValueChanged event args...
|
// PropertyValueChanged event args...
|
||||||
public delegate void MyPropertyValueChangedEventHandler(object sender, PropertyValueChangedEventArgs e);
|
public delegate void MyPropertyValueChangedEventHandler(object sender, PropertyValueChangedEventArgs e);
|
||||||
public static event MyPropertyValueChangedEventHandler MyPropertyValueChanged;
|
public static event MyPropertyValueChangedEventHandler MyPropertyValueChanged;
|
||||||
private bool AllowAddDel = false; // flags whether the Add/Delete buttons should be displayed:
|
private readonly bool AllowAddDel = false; // flags whether the Add/Delete buttons should be displayed:
|
||||||
// Inherit the default constructor from the standard
|
// Inherit the default constructor from the standard
|
||||||
// Collection Editor...
|
// Collection Editor...
|
||||||
private Type _origType;
|
private readonly Type _origType;
|
||||||
public PropGridCollEditor(Type type)
|
public PropGridCollEditor(Type type)
|
||||||
: base(type)
|
: base(type)
|
||||||
{
|
{
|
||||||
@@ -29,10 +25,7 @@ namespace Volian.Base.Library
|
|||||||
if (type.Name == "ReplaceStrData") AllowAddDel = true; // Defaults to not having the 'Add' & 'Remove' buttons.
|
if (type.Name == "ReplaceStrData") AllowAddDel = true; // Defaults to not having the 'Add' & 'Remove' buttons.
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Type CreateCollectionItemType()
|
protected override Type CreateCollectionItemType() => base.CreateCollectionItemType();
|
||||||
{
|
|
||||||
return base.CreateCollectionItemType();
|
|
||||||
}
|
|
||||||
private Button resetbtn = null;
|
private Button resetbtn = null;
|
||||||
// Override this method in order to access the containing user controls
|
// Override this method in order to access the containing user controls
|
||||||
// from the default Collection Editor form or to add new ones...
|
// from the default Collection Editor form or to add new ones...
|
||||||
@@ -50,18 +43,19 @@ namespace Volian.Base.Library
|
|||||||
if (!AllowAddDel)
|
if (!AllowAddDel)
|
||||||
{
|
{
|
||||||
// add a reset button and put next to ok button:
|
// add a reset button and put next to ok button:
|
||||||
resetbtn = new Button();
|
resetbtn = new Button
|
||||||
resetbtn.Text = "Reset";
|
{
|
||||||
resetbtn.Location = new System.Drawing.Point(okbtn.Location.X - 20, okbtn.Location.Y);
|
Text = "Reset",
|
||||||
resetbtn.Width = 250;
|
Location = new System.Drawing.Point(okbtn.Location.X - 20, okbtn.Location.Y),
|
||||||
resetbtn.Visible = true;
|
Width = 250,
|
||||||
resetbtn.Enabled = false; // only enabled on data change
|
Visible = true,
|
||||||
|
Enabled = false // only enabled on data change
|
||||||
|
};
|
||||||
resetbtn.Click += resetbtn_Click;
|
resetbtn.Click += resetbtn_Click;
|
||||||
okbtn.Parent.Controls.Add(resetbtn);
|
okbtn.Parent.Controls.Add(resetbtn);
|
||||||
}
|
}
|
||||||
SetMembersLabel(collectionForm);
|
SetMembersLabel(collectionForm);
|
||||||
TableLayoutPanel tlpLayout = frmCollectionEditorForm.Controls[0] as TableLayoutPanel;
|
if (frmCollectionEditorForm.Controls[0] is TableLayoutPanel tlpLayout)
|
||||||
if (tlpLayout != null)
|
|
||||||
{
|
{
|
||||||
// Get a reference to the inner PropertyGrid and hook an event handler to it.
|
// Get a reference to the inner PropertyGrid and hook an event handler to it.
|
||||||
if (tlpLayout.Controls[5] is PropertyGrid)
|
if (tlpLayout.Controls[5] is PropertyGrid)
|
||||||
@@ -93,20 +87,7 @@ namespace Volian.Base.Library
|
|||||||
else if (SelectedGridField.Contains("Active CheckOff"))
|
else if (SelectedGridField.Contains("Active CheckOff"))
|
||||||
ResetValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
|
ResetValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
|
||||||
}
|
}
|
||||||
private void ShowReflection(Object data)
|
|
||||||
{
|
|
||||||
if (data == null) return;
|
|
||||||
//Object data = new A();
|
|
||||||
FieldInfo[] fields = data.GetType().GetFields(BindingFlags.Public |
|
|
||||||
BindingFlags.NonPublic |
|
|
||||||
BindingFlags.Instance);
|
|
||||||
String str = "";
|
|
||||||
foreach (FieldInfo f in fields)
|
|
||||||
{
|
|
||||||
str += f.Name + " = " + f.GetValue(data) + "\r\n";
|
|
||||||
}
|
|
||||||
Console.WriteLine("reflection = {0}", str);
|
|
||||||
}
|
|
||||||
PropertyGrid propertyGrid = null;
|
PropertyGrid propertyGrid = null;
|
||||||
private string SelectedGridField = "";
|
private string SelectedGridField = "";
|
||||||
// The following method is used to enable and set text on the 'Reset' button. When a grid item is selected, if it has
|
// The following method is used to enable and set text on the 'Reset' button. When a grid item is selected, if it has
|
||||||
@@ -114,7 +95,7 @@ namespace Volian.Base.Library
|
|||||||
void PG_SelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e)
|
void PG_SelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (resetbtn == null) return;
|
if (resetbtn == null) return;
|
||||||
if (propertyGrid != null) Console.WriteLine(LabelPath(propertyGrid.SelectedGridItem)); // PG.SelectedGridItem.Label + " : " + PG.SelectedGridItem.Value;
|
if (propertyGrid != null) Console.WriteLine(LabelPath(propertyGrid.SelectedGridItem));
|
||||||
// see if data has changed, and if so, enable the Reset button.
|
// see if data has changed, and if so, enable the Reset button.
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
resetbtn.Text = "Reset";
|
resetbtn.Text = "Reset";
|
||||||
@@ -124,7 +105,7 @@ namespace Volian.Base.Library
|
|||||||
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "WindowsFont");
|
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "WindowsFont");
|
||||||
if (origForButton != null)
|
if (origForButton != null)
|
||||||
{
|
{
|
||||||
resetbtn.Text = "Reset to " + origForButton;
|
resetbtn.Text = $"Reset to {origForButton}";
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +114,7 @@ namespace Volian.Base.Library
|
|||||||
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "LeftMargin");
|
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "LeftMargin");
|
||||||
if (origForButton != null)
|
if (origForButton != null)
|
||||||
{
|
{
|
||||||
resetbtn.Text = "Reset to " + origForButton;
|
resetbtn.Text = $"Reset to {origForButton}";
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,7 +123,7 @@ namespace Volian.Base.Library
|
|||||||
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "PageLength");
|
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Value, "PageLength");
|
||||||
if (origForButton != null)
|
if (origForButton != null)
|
||||||
{
|
{
|
||||||
resetbtn.Text = "Reset to " + origForButton;
|
resetbtn.Text = $"Reset to {origForButton}";
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,7 +132,7 @@ namespace Volian.Base.Library
|
|||||||
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
|
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
|
||||||
if (origForButton != null)
|
if (origForButton != null)
|
||||||
{
|
{
|
||||||
resetbtn.Text = "Reset to " + origForButton;
|
resetbtn.Text = $"Reset to {origForButton}";
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,7 +141,7 @@ namespace Volian.Base.Library
|
|||||||
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
|
string origForButton = OrigValue(propertyGrid.SelectedGridItem.Parent.Parent.Value, "Active");
|
||||||
if (origForButton != null)
|
if (origForButton != null)
|
||||||
{
|
{
|
||||||
resetbtn.Text = "Reset to " + origForButton;
|
resetbtn.Text = $"Reset to {origForButton}";
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,8 +163,8 @@ namespace Volian.Base.Library
|
|||||||
// field to compare the 2 to see if a change was made, i.e. UCF data exists.
|
// field to compare the 2 to see if a change was made, i.e. UCF data exists.
|
||||||
foreach (FieldInfo f in fields)
|
foreach (FieldInfo f in fields)
|
||||||
{
|
{
|
||||||
if (f.Name == "_" + fieldName) fldVal = f;
|
if (f.Name == $"_{fieldName}") fldVal = f;
|
||||||
if (f.Name == "_Orig" + fieldName) fldOrig = f;
|
if (f.Name == $"_Orig{fieldName}") fldOrig = f;
|
||||||
}
|
}
|
||||||
if (fldVal != null && fldOrig != null)
|
if (fldVal != null && fldOrig != null)
|
||||||
{
|
{
|
||||||
@@ -200,7 +181,7 @@ namespace Volian.Base.Library
|
|||||||
if (orig != newv) return retval;
|
if (orig != newv) return retval;
|
||||||
else return null;
|
else return null;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -218,8 +199,8 @@ namespace Volian.Base.Library
|
|||||||
BindingFlags.Instance);
|
BindingFlags.Instance);
|
||||||
foreach (FieldInfo f in fields)
|
foreach (FieldInfo f in fields)
|
||||||
{
|
{
|
||||||
if (f.Name == "_" + fieldName) fldVal = f;
|
if (f.Name == $"_{fieldName}") fldVal = f;
|
||||||
if (f.Name == "_Orig" + fieldName) fldOrig = f;
|
if (f.Name == $"_Orig{fieldName}") fldOrig = f;
|
||||||
}
|
}
|
||||||
if (fldVal != null && fldOrig != null)
|
if (fldVal != null && fldOrig != null)
|
||||||
{
|
{
|
||||||
@@ -228,10 +209,7 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remove this on release, and any uses of it.
|
// Remove this on release, and any uses of it.
|
||||||
private string LabelPath(GridItem gi)
|
private string LabelPath(GridItem gi) => gi.Parent == null ? "" : $"{LabelPath(gi.Parent)}:{gi.Label}";
|
||||||
{
|
|
||||||
return (gi.Parent == null ? "" : LabelPath(gi.Parent) + ":" + gi.Label);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the 'members' label to better reflect what is displayed:
|
// set the 'members' label to better reflect what is displayed:
|
||||||
private bool SetMembersLabel(Control myControl)
|
private bool SetMembersLabel(Control myControl)
|
||||||
@@ -292,10 +270,7 @@ namespace Volian.Base.Library
|
|||||||
void propertyGrid_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
|
void propertyGrid_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
// Fire our customized collection event...
|
// Fire our customized collection event...
|
||||||
if (PropGridCollEditor.MyPropertyValueChanged != null)
|
PropGridCollEditor.MyPropertyValueChanged?.Invoke(this, e);
|
||||||
{
|
|
||||||
PropGridCollEditor.MyPropertyValueChanged(this, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using Volian.Base.Library;
|
|
||||||
|
|
||||||
namespace Volian.Base.Library
|
namespace Volian.Base.Library
|
||||||
{
|
{
|
||||||
@@ -451,11 +448,6 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Structures
|
#region Structures
|
||||||
//struct CharRange
|
|
||||||
//{
|
|
||||||
// public int cpMin;
|
|
||||||
// public int cpMax;
|
|
||||||
//}
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)]
|
[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Auto)]
|
||||||
public struct CharFormat2
|
public struct CharFormat2
|
||||||
{
|
{
|
||||||
@@ -483,16 +475,10 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
public class CharFormatTwo
|
public class CharFormatTwo
|
||||||
{
|
{
|
||||||
public CharFormatTwo(CharFormat2 cf)
|
public CharFormatTwo(CharFormat2 cf) => _CharFormat2 = cf;
|
||||||
{
|
|
||||||
_CharFormat2 = cf;
|
|
||||||
}
|
|
||||||
private CharFormat2 _CharFormat2;
|
private CharFormat2 _CharFormat2;
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public CharFormat2 CharFormat2
|
public CharFormat2 CharFormat2 => _CharFormat2;
|
||||||
{
|
|
||||||
get { return _CharFormat2; }
|
|
||||||
}
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public int cbSize
|
public int cbSize
|
||||||
{
|
{
|
||||||
@@ -521,14 +507,8 @@ namespace Volian.Base.Library
|
|||||||
get { return _CharFormat2.yOffset; }
|
get { return _CharFormat2.yOffset; }
|
||||||
set { _CharFormat2.yOffset = value; }
|
set { _CharFormat2.yOffset = value; }
|
||||||
}
|
}
|
||||||
private Color Int2Color(int color)
|
private Color Int2Color(int color) => Color.FromArgb(color % 256, (color / 256) % 256, color / (256 * 256));
|
||||||
{
|
private int Color2Int(Color color) => color.R + (color.G * 256) + (color.B * 256 * 256);
|
||||||
return Color.FromArgb(color % 256, (color / 256) % 256, color / (256 * 256));
|
|
||||||
}
|
|
||||||
private int Color2Int(Color color)
|
|
||||||
{
|
|
||||||
return color.R + (color.G * 256) + (color.B * 256 * 256);
|
|
||||||
}
|
|
||||||
public Color crTextColor
|
public Color crTextColor
|
||||||
{
|
{
|
||||||
get { return Int2Color(_CharFormat2.crTextColor); }
|
get { return Int2Color(_CharFormat2.crTextColor); }
|
||||||
@@ -637,14 +617,8 @@ namespace Volian.Base.Library
|
|||||||
public class ParaFormatTwo
|
public class ParaFormatTwo
|
||||||
{
|
{
|
||||||
private ParaFormat2 _ParaFormat2;
|
private ParaFormat2 _ParaFormat2;
|
||||||
public ParaFormatTwo(ParaFormat2 pf)
|
public ParaFormatTwo(ParaFormat2 pf) => _ParaFormat2 = pf;
|
||||||
{
|
public ParaFormat2 ParaFormat2 => _ParaFormat2;
|
||||||
_ParaFormat2 = pf;
|
|
||||||
}
|
|
||||||
public ParaFormat2 ParaFormat2
|
|
||||||
{
|
|
||||||
get { return _ParaFormat2; }
|
|
||||||
}
|
|
||||||
public int cbSize
|
public int cbSize
|
||||||
{
|
{
|
||||||
get { return _ParaFormat2.cbSize; }
|
get { return _ParaFormat2.cbSize; }
|
||||||
@@ -769,16 +743,8 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Static Methods
|
#region Static Methods
|
||||||
public static bool HasVertScroll(Control ctl)
|
public static bool HasVertScroll(Control ctl) => (GetWindowLong(ctl.Handle, GWL_STYLE) & WS_VSCROLL) != 0;
|
||||||
{
|
public static bool HasHorzScroll(Control ctl) => (GetWindowLong(ctl.Handle, GWL_STYLE) & WS_HSCROLL) != 0;
|
||||||
int dwstyle = GetWindowLong(ctl.Handle, GWL_STYLE);
|
|
||||||
return (dwstyle & WS_VSCROLL) != 0;
|
|
||||||
}
|
|
||||||
public static bool HasHorzScroll(Control ctl)
|
|
||||||
{
|
|
||||||
int dwstyle = GetWindowLong(ctl.Handle, GWL_STYLE);
|
|
||||||
return (dwstyle & WS_HSCROLL) != 0;
|
|
||||||
}
|
|
||||||
public static void SetScrollLocation(RichTextBox richTextBox, Point point)
|
public static void SetScrollLocation(RichTextBox richTextBox, Point point)
|
||||||
{
|
{
|
||||||
if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETSCROLLPOS, 0, ref point) == 0)
|
if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETSCROLLPOS, 0, ref point) == 0)
|
||||||
@@ -815,7 +781,6 @@ namespace Volian.Base.Library
|
|||||||
ParaFormat2 pf2 = pft.ParaFormat2;
|
ParaFormat2 pf2 = pft.ParaFormat2;
|
||||||
if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETPARAFORMAT, 0, ref pf2) == 0)
|
if (SendMessage(new HandleRef(richTextBox, richTextBox.Handle), Messages.EM_SETPARAFORMAT, 0, ref pf2) == 0)
|
||||||
{
|
{
|
||||||
//if(Marshal.GetLastWin32Error()!=0)
|
|
||||||
throw new Win32Exception();
|
throw new Win32Exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -849,15 +814,6 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public static void SetHighlightColor(RichTextBox richTextBox, RTBSelection selection, Color color)
|
|
||||||
{
|
|
||||||
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
|
||||||
cft.crBackColor = color;
|
|
||||||
cft.dwEffects = 0;
|
|
||||||
cft.dwMask = 0;
|
|
||||||
cft.dwMask |= CharFormatMasks.CFM_BACKCOLOR;
|
|
||||||
SetCharFormat(richTextBox, selection, cft);
|
|
||||||
}
|
|
||||||
public static void SetSpaceBefore(RichTextBox richTextBox, int spaceBefore)
|
public static void SetSpaceBefore(RichTextBox richTextBox, int spaceBefore)
|
||||||
{
|
{
|
||||||
ParaFormatTwo pft = GetParaFormat(richTextBox);
|
ParaFormatTwo pft = GetParaFormat(richTextBox);
|
||||||
@@ -875,236 +831,6 @@ namespace Volian.Base.Library
|
|||||||
pft.dySpaceBefore = spaceBefore * 1440 / dpi;
|
pft.dySpaceBefore = spaceBefore * 1440 / dpi;
|
||||||
SetParaFormat(richTextBox, pft);
|
SetParaFormat(richTextBox, pft);
|
||||||
}
|
}
|
||||||
//developed for equation editor interface work, but ended up not needing it. Kept it in
|
|
||||||
// case it is needed in the future.
|
|
||||||
//public static void SetSpaceAfter(RichTextBox richTextBox, int spaceAfter)
|
|
||||||
//{
|
|
||||||
// ParaFormatTwo pft = GetParaFormat(richTextBox);
|
|
||||||
// pft.dwMask = 0;
|
|
||||||
// pft.dwMask |= ParaFormatMasks.PFM_SPACEAFTER;
|
|
||||||
// // get the monitor's resolution in DPI and use it to set the linespacing value for
|
|
||||||
// // the richtextbox. Note that without this, the Arial Unicode font made the appearance of
|
|
||||||
// // almost double linespacing. Using PFS_Exact makes it appear as regular single spacing.
|
|
||||||
// Graphics g = richTextBox.CreateGraphics();
|
|
||||||
// int dpi = Convert.ToInt32((g.DpiX + g.DpiY) / 2);
|
|
||||||
// g.Dispose();
|
|
||||||
// // dyLineSpacing is Spacing between lines. the PFS_EXACT sets line spacing as the spacing from one
|
|
||||||
// //line to the next, in twips - thus the 1440.
|
|
||||||
|
|
||||||
// pft.dySpaceAfter = spaceAfter * 1440 / dpi;
|
|
||||||
// SetParaFormat(richTextBox, pft);
|
|
||||||
//}
|
|
||||||
public static void SetLineSpacing(RichTextBox richTextBox, ParaSpacing type)
|
|
||||||
{
|
|
||||||
ParaFormatTwo pft = GetParaFormat(richTextBox);
|
|
||||||
pft.bLineSpacingRule = type;
|
|
||||||
pft.dwMask = 0;
|
|
||||||
pft.dwMask |= ParaFormatMasks.PFM_LINESPACING;
|
|
||||||
pft.dwMask |= ParaFormatMasks.PFM_SPACEAFTER;
|
|
||||||
|
|
||||||
// get the monitor's resolution in DPI and use it to set the linespacing value for
|
|
||||||
// the richtextbox. Note that without this, the Arial Unicode font made the appearance of
|
|
||||||
// almost double linespacing. Using PFS_Exact makes it appear as regular single spacing.
|
|
||||||
Graphics g = richTextBox.CreateGraphics();
|
|
||||||
int dpi = Convert.ToInt32((g.DpiX + g.DpiY) / 2);
|
|
||||||
g.Dispose();
|
|
||||||
// dyLineSpacing is Spacing between lines. the PFS_EXACT sets line spacing as the spacing from one
|
|
||||||
//line to the next, in twips - thus the 1440.
|
|
||||||
|
|
||||||
pft.dyLineSpacing = Convert.ToInt32(.5 + richTextBox.Font.GetHeight(dpi)) * 1440 / dpi;
|
|
||||||
SetParaFormat(richTextBox, pft);
|
|
||||||
}
|
|
||||||
public static E_FontStyle GetFontStyle(RichTextBox richTextBox)
|
|
||||||
{
|
|
||||||
E_FontStyle fs = E_FontStyle.FS_NONE;
|
|
||||||
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
|
|
||||||
if (((cft.dwMask & CharFormatMasks.CFM_BOLD) == CharFormatMasks.CFM_BOLD) &&
|
|
||||||
((cft.dwEffects & CharFormatEffects.CFE_BOLD) == CharFormatEffects.CFE_BOLD)) fs |= E_FontStyle.FS_BOLD;
|
|
||||||
if (((cft.dwMask & CharFormatMasks.CFM_UNDERLINE) == CharFormatMasks.CFM_UNDERLINE) &&
|
|
||||||
((cft.dwEffects & CharFormatEffects.CFE_UNDERLINE) == CharFormatEffects.CFE_UNDERLINE)) fs |= E_FontStyle.FS_UNDERLINE;
|
|
||||||
if (((cft.dwMask & CharFormatMasks.CFM_ITALIC) == CharFormatMasks.CFM_ITALIC) &&
|
|
||||||
((cft.dwEffects & CharFormatEffects.CFE_ITALIC) == CharFormatEffects.CFE_ITALIC)) fs |= E_FontStyle.FS_ITALIC;
|
|
||||||
if (richTextBox.SelectionCharOffset == -2) fs |= E_FontStyle.FS_SUBSCRIPT;
|
|
||||||
if (richTextBox.SelectionCharOffset == 2) fs |= E_FontStyle.FS_SUPERSCRIPT;
|
|
||||||
return fs;
|
|
||||||
}
|
|
||||||
public static void SetFontStyle(RichTextBox richTextBox, E_FontStyle fs)
|
|
||||||
{
|
|
||||||
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
|
|
||||||
if ((fs & E_FontStyle.FS_BOLD) == E_FontStyle.FS_BOLD)
|
|
||||||
{
|
|
||||||
cft.dwEffects |= CharFormatEffects.CFE_BOLD;
|
|
||||||
cft.dwMask |= CharFormatMasks.CFM_BOLD;
|
|
||||||
}
|
|
||||||
if ((fs & E_FontStyle.FS_UNDERLINE) == E_FontStyle.FS_UNDERLINE)
|
|
||||||
{
|
|
||||||
cft.dwEffects |= CharFormatEffects.CFE_UNDERLINE;
|
|
||||||
cft.dwMask |= CharFormatMasks.CFM_UNDERLINE;
|
|
||||||
}
|
|
||||||
if ((fs & E_FontStyle.FS_ITALIC) == E_FontStyle.FS_ITALIC)
|
|
||||||
{
|
|
||||||
cft.dwEffects |= CharFormatEffects.CFE_ITALIC;
|
|
||||||
cft.dwMask |= CharFormatMasks.CFM_ITALIC;
|
|
||||||
}
|
|
||||||
if ((fs & E_FontStyle.FS_SUBSCRIPT) == E_FontStyle.FS_SUBSCRIPT)
|
|
||||||
{
|
|
||||||
richTextBox.SelectionCharOffset = -2;
|
|
||||||
}
|
|
||||||
if ((fs & E_FontStyle.FS_SUPERSCRIPT) == E_FontStyle.FS_SUPERSCRIPT)
|
|
||||||
{
|
|
||||||
richTextBox.SelectionCharOffset = 2;
|
|
||||||
}
|
|
||||||
SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
|
|
||||||
}
|
|
||||||
public static bool IsSuperScript(RichTextBox richTextBox)
|
|
||||||
{
|
|
||||||
return (richTextBox.SelectionCharOffset>0);
|
|
||||||
}
|
|
||||||
public static bool IsSubScript(RichTextBox richTextBox)
|
|
||||||
{
|
|
||||||
return (richTextBox.SelectionCharOffset < 0);
|
|
||||||
}
|
|
||||||
public static void ToggleSubscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
|
||||||
{
|
|
||||||
if (bSet)
|
|
||||||
richTextBox.SelectionCharOffset = -2;
|
|
||||||
else
|
|
||||||
richTextBox.SelectionCharOffset = 0;
|
|
||||||
}
|
|
||||||
public static void ToggleSuperscript(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
|
||||||
{
|
|
||||||
if (bSet)
|
|
||||||
richTextBox.SelectionCharOffset = 2;
|
|
||||||
else
|
|
||||||
richTextBox.SelectionCharOffset = 0;
|
|
||||||
}
|
|
||||||
public static bool IsBold(RichTextBox richTextBox)
|
|
||||||
{
|
|
||||||
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
|
|
||||||
return (((cft.dwMask & CharFormatMasks.CFM_BOLD) == CharFormatMasks.CFM_BOLD) &&
|
|
||||||
((cft.dwEffects & CharFormatEffects.CFE_BOLD) == CharFormatEffects.CFE_BOLD));
|
|
||||||
}
|
|
||||||
public static void ToggleBold(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
|
||||||
{
|
|
||||||
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
|
||||||
if (bSet)
|
|
||||||
{
|
|
||||||
cft.dwEffects = CharFormatEffects.CFE_BOLD;
|
|
||||||
cft.dwMask = CharFormatMasks.CFM_BOLD;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cft.dwEffects = CharFormatEffects.CFE_NONE;
|
|
||||||
cft.dwMask = CharFormatMasks.CFM_BOLD;
|
|
||||||
}
|
|
||||||
SetCharFormat(richTextBox, selection, cft);
|
|
||||||
}
|
|
||||||
public static bool IsUnderline(RichTextBox richTextBox)
|
|
||||||
{
|
|
||||||
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
|
|
||||||
return (((cft.dwMask & CharFormatMasks.CFM_UNDERLINE) == CharFormatMasks.CFM_UNDERLINE) &&
|
|
||||||
((cft.dwEffects & CharFormatEffects.CFE_UNDERLINE) == CharFormatEffects.CFE_UNDERLINE));
|
|
||||||
}
|
|
||||||
public static void ToggleUnderline(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
|
||||||
{
|
|
||||||
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
|
||||||
if (bSet)
|
|
||||||
{
|
|
||||||
cft.dwEffects = CharFormatEffects.CFE_UNDERLINE;
|
|
||||||
cft.dwMask = CharFormatMasks.CFM_UNDERLINE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cft.dwEffects = CharFormatEffects.CFE_NONE;
|
|
||||||
cft.dwMask = CharFormatMasks.CFM_UNDERLINE;
|
|
||||||
}
|
|
||||||
SetCharFormat(richTextBox, selection, cft);
|
|
||||||
}
|
|
||||||
public static bool IsItalic(RichTextBox richTextBox)
|
|
||||||
{
|
|
||||||
CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
|
|
||||||
return (((cft.dwMask & CharFormatMasks.CFM_ITALIC) == CharFormatMasks.CFM_ITALIC) &&
|
|
||||||
((cft.dwEffects & CharFormatEffects.CFE_ITALIC) == CharFormatEffects.CFE_ITALIC));
|
|
||||||
}
|
|
||||||
public static void ToggleItalic(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
|
||||||
{
|
|
||||||
CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
|
||||||
if (bSet)
|
|
||||||
{
|
|
||||||
cft.dwEffects = CharFormatEffects.CFE_ITALIC;
|
|
||||||
cft.dwMask = CharFormatMasks.CFM_ITALIC;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cft.dwEffects = CharFormatEffects.CFE_NONE;
|
|
||||||
cft.dwMask = CharFormatMasks.CFM_ITALIC;
|
|
||||||
}
|
|
||||||
SetCharFormat(richTextBox, selection, cft);
|
|
||||||
}
|
|
||||||
//public static bool IsLink(RichTextBox richTextBox)
|
|
||||||
//{
|
|
||||||
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION);
|
|
||||||
// return ((cft.dwEffects & CharFormatEffects.CFE_PROTECTED) == CharFormatEffects.CFE_PROTECTED);
|
|
||||||
//}
|
|
||||||
//public static void ToggleLink(bool bSet, RichTextBox richTextBox, RTBSelection selection)
|
|
||||||
//{
|
|
||||||
// CharFormatTwo cft = GetCharFormat(richTextBox, selection);
|
|
||||||
// if (bSet)
|
|
||||||
// {
|
|
||||||
// cft.dwEffects |= CharFormatEffects.CFE_LINK;
|
|
||||||
// cft.dwMask |= CharFormatMasks.CFM_LINK;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// cft.dwEffects &= ~RTBAPI.CharFormatEffects.CFE_LINK;
|
|
||||||
// }
|
|
||||||
// SetCharFormat(richTextBox, selection, cft);
|
|
||||||
//}
|
|
||||||
//public static void UnProtect(RichTextBox richTextBox) //, string type, string text, string link)
|
|
||||||
//{
|
|
||||||
// //richTextBox.DetectUrls = false;
|
|
||||||
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
|
|
||||||
// //int position = richTextBox.SelectionStart = richTextBox.TextLength;
|
|
||||||
// //richTextBox.SelectionLength = 0;
|
|
||||||
// //richTextBox.SelectedRtf = @"{\rtf1\ansi " + text + @"\v #" + link + @"\v0}";
|
|
||||||
// //richTextBox.SelectedRtf = "{" + string.Format(@"\rtf1\ansi\protect\v {0}\v0 {1}\v #{2}", type, text, link) + "}";
|
|
||||||
// //richTextBox.Select(position, type.Length + text.Length + link.Length + 1);
|
|
||||||
// cft.dwMask = RTBAPI.CharFormatMasks.CFM_PROTECTED;
|
|
||||||
// cft.dwEffects = 0;
|
|
||||||
// // The lines below can be used to allow link text to be edited
|
|
||||||
// //charFormat.dwMask = RTBAPI.CharFormatMasks.CFM_LINK;
|
|
||||||
// //charFormat.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK;
|
|
||||||
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
|
|
||||||
// //rtbRTF.SetSelectionLink(true);
|
|
||||||
// //richTextBox.SelectionStart = richTextBox.TextLength;
|
|
||||||
// //richTextBox.SelectionLength = 0;
|
|
||||||
//}
|
|
||||||
//public static void Protect(RichTextBox richTextBox) //, string type, string text, string link)
|
|
||||||
//{
|
|
||||||
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
|
|
||||||
// cft.dwMask = CharFormatMasks.CFM_PROTECTED;
|
|
||||||
// cft.dwEffects = CharFormatEffects.CFE_PROTECTED;
|
|
||||||
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
|
|
||||||
//}
|
|
||||||
//public static void SetLink(RichTextBox richTextBox, string type, string text, string link)
|
|
||||||
//{
|
|
||||||
// richTextBox.DetectUrls = false;
|
|
||||||
// CharFormatTwo cft = GetCharFormat(richTextBox, RTBAPI.RTBSelection.SCF_SELECTION); ;
|
|
||||||
// int position = richTextBox.SelectionStart = richTextBox.TextLength;
|
|
||||||
// richTextBox.SelectionLength = 0;
|
|
||||||
// //richTextBox.SelectedRtf = @"{\rtf1\ansi " + text + @"\v #" + link + @"\v0}";
|
|
||||||
// richTextBox.SelectedRtf = "{" + string.Format(@"\rtf1\ansi\protect\v {0}\v0 {1}\v #{2}", type, text, link) + "}";
|
|
||||||
// richTextBox.Select(position, type.Length + text.Length + link.Length + 1);
|
|
||||||
// cft.dwMask = RTBAPI.CharFormatMasks.CFM_LINK | RTBAPI.CharFormatMasks.CFM_PROTECTED;
|
|
||||||
// cft.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK | RTBAPI.CharFormatEffects.CFE_PROTECTED;
|
|
||||||
// // The lines below can be used to allow link text to be edited
|
|
||||||
// //charFormat.dwMask = RTBAPI.CharFormatMasks.CFM_LINK;
|
|
||||||
// //charFormat.dwEffects = RTBAPI.CharFormatEffects.CFE_LINK;
|
|
||||||
// SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft);
|
|
||||||
// //rtbRTF.SetSelectionLink(true);
|
|
||||||
// richTextBox.SelectionStart = richTextBox.TextLength;
|
|
||||||
// richTextBox.SelectionLength = 0;
|
|
||||||
//}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Volian.Base.Library
|
namespace Volian.Base.Library
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
@@ -8,18 +6,8 @@ namespace Volian.Base.Library
|
|||||||
{
|
{
|
||||||
public static class TmpFile
|
public static class TmpFile
|
||||||
{
|
{
|
||||||
public static string CreateFileName(string procNumber, string sectNumber, string sectTitle)
|
public static string CreateFileName(string procNumber) => FixFileName(procNumber);
|
||||||
{
|
public static string FixFileName(string name) => $"{Regex.Replace(name, "[ .,/]", "_")}.pdf";
|
||||||
return FixFileName(procNumber + "_" + ((sectNumber ?? "") != "" ? sectNumber : sectTitle));
|
|
||||||
}
|
|
||||||
public static string CreateFileName(string procNumber)
|
|
||||||
{
|
|
||||||
return FixFileName(procNumber);
|
|
||||||
}
|
|
||||||
public static string FixFileName(string name)
|
|
||||||
{
|
|
||||||
return Regex.Replace(name, "[ .,/]", "_") + ".pdf";
|
|
||||||
}
|
|
||||||
public static void RemoveAllTmps()
|
public static void RemoveAllTmps()
|
||||||
{
|
{
|
||||||
RemoveTmpPDFs();
|
RemoveTmpPDFs();
|
||||||
@@ -41,7 +29,7 @@ namespace Volian.Base.Library
|
|||||||
if (fi.LastAccessTime.Ticks < (DateTime.Now.Ticks - TimeSpan.TicksPerHour))
|
if (fi.LastAccessTime.Ticks < (DateTime.Now.Ticks - TimeSpan.TicksPerHour))
|
||||||
fi.Delete();
|
fi.Delete();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
continue; // if an error, go onto next file.
|
continue; // if an error, go onto next file.
|
||||||
}
|
}
|
||||||
@@ -70,7 +58,7 @@ namespace Volian.Base.Library
|
|||||||
if(fi.LastWriteTimeUtc < DateTime.Now.AddDays(-2.0))
|
if(fi.LastWriteTimeUtc < DateTime.Now.AddDays(-2.0))
|
||||||
fi.Delete();
|
fi.Delete();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
continue; // if an error, go onto next file.
|
continue; // if an error, go onto next file.
|
||||||
}
|
}
|
||||||
@@ -90,7 +78,7 @@ namespace Volian.Base.Library
|
|||||||
// it may be open from another process.
|
// it may be open from another process.
|
||||||
fi.Delete();
|
fi.Delete();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
continue; // if an error, go onto next file.
|
continue; // if an error, go onto next file.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Volian.Base.Library
|
namespace Volian.Base.Library
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using iTextSharp.text.factories;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using iTextSharp.text;
|
using iTextSharp.text;
|
||||||
|
|
||||||
@@ -53,7 +47,7 @@ namespace Volian.Base.Library
|
|||||||
_MyLog.WarnFormat("PROMS Font Folder = {0}", _PromsFontDir); // C2019-028 Add info in the error log
|
_MyLog.WarnFormat("PROMS Font Folder = {0}", _PromsFontDir); // C2019-028 Add info in the error log
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int profileDepth1 = ProfileTimer.Push(">>>> RegisterDirectory " + _PromsFontDir);
|
int profileDepth1 = ProfileTimer.Push($">>>> RegisterDirectory {_PromsFontDir}");
|
||||||
//_MyLog.DebugFormat("Register this Font Folder = {0}", _PromsFontDir); // debug
|
//_MyLog.DebugFormat("Register this Font Folder = {0}", _PromsFontDir); // debug
|
||||||
iTextSharp.text.FontFactory.RegisterDirectory(_PromsFontDir);
|
iTextSharp.text.FontFactory.RegisterDirectory(_PromsFontDir);
|
||||||
ProfileTimer.Pop(profileDepth1);
|
ProfileTimer.Pop(profileDepth1);
|
||||||
@@ -70,7 +64,7 @@ namespace Volian.Base.Library
|
|||||||
_MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, _PromsFontDir);
|
_MyLog.WarnFormat("Problem with Font {0} in {1}", fontName, _PromsFontDir);
|
||||||
if (_PromsFontDir != FontFind.FontDir)
|
if (_PromsFontDir != FontFind.FontDir)
|
||||||
{
|
{
|
||||||
int profileDepth2 = ProfileTimer.Push(">>>> RegisterDirectory " + FontFind.FontDir);
|
int profileDepth2 = ProfileTimer.Push($">>>> RegisterDirectory {FontFind.FontDir}");
|
||||||
//_MyLog.DebugFormat("Register this Font Folder = {0}", FontFind.FontDir); // debug
|
//_MyLog.DebugFormat("Register this Font Folder = {0}", FontFind.FontDir); // debug
|
||||||
iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir);
|
iTextSharp.text.FontFactory.RegisterDirectory(FontFind.FontDir);
|
||||||
ProfileTimer.Pop(profileDepth2);
|
ProfileTimer.Pop(profileDepth2);
|
||||||
@@ -109,9 +103,8 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
ProfileTimer.Pop(profileDepth);
|
ProfileTimer.Pop(profileDepth);
|
||||||
}
|
}
|
||||||
private static RegistryKey _FontKey = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion").OpenSubKey("Fonts");
|
private static readonly RegistryKey _FontKey = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion").OpenSubKey("Fonts");
|
||||||
public static RegistryKey FontKey
|
public static RegistryKey FontKey => _FontKey;
|
||||||
{ get { return _FontKey; } }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Try to register a particular font, if it fails register the entire font folder
|
/// Try to register a particular font, if it fails register the entire font folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -128,7 +121,7 @@ namespace Volian.Base.Library
|
|||||||
try // B2019-118 Add error handling for FontFacory.Register (Windows Registry contains a node that
|
try // B2019-118 Add error handling for FontFacory.Register (Windows Registry contains a node that
|
||||||
// points to a file that no longer exists
|
// points to a file that no longer exists
|
||||||
{
|
{
|
||||||
FontFactory.Register(fontFile.Contains("\\") ? fontFile : FontFind.FontDir + "\\" + fontFile);
|
FontFactory.Register(fontFile.Contains("\\") ? fontFile : $"{FontFind.FontDir}\\{fontFile}");
|
||||||
}
|
}
|
||||||
catch (Exception ex) // catch any exception and add the error to the error log.
|
catch (Exception ex) // catch any exception and add the error to the error log.
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -17,24 +15,10 @@ namespace Volian.Base.Library
|
|||||||
// <add key ="OperatingMode" value ="Debug"|"Demo"|"Production"/>
|
// <add key ="OperatingMode" value ="Debug"|"Demo"|"Production"/>
|
||||||
// For DataLoader, this is set via the Debug checkbox on the form.
|
// For DataLoader, this is set via the Debug checkbox on the form.
|
||||||
private static bool WasLoaded = false;
|
private static bool WasLoaded = false;
|
||||||
private static bool _DoUpdateRO = true;
|
|
||||||
public static bool DoUpdateRO
|
public static bool DoUpdateRO { get; set; } = true;
|
||||||
{
|
public static bool DebugPagination { get; set; } = false;
|
||||||
get { return VlnSettings._DoUpdateRO; }
|
public static bool DebugText { get; set; } = false;
|
||||||
set { VlnSettings._DoUpdateRO = value; }
|
|
||||||
}
|
|
||||||
private static bool _DebugPagination = false;
|
|
||||||
public static bool DebugPagination
|
|
||||||
{
|
|
||||||
get { return VlnSettings._DebugPagination; }
|
|
||||||
set { VlnSettings._DebugPagination = value; }
|
|
||||||
}
|
|
||||||
private static bool _DebugText = false;
|
|
||||||
public static bool DebugText
|
|
||||||
{
|
|
||||||
get { return VlnSettings._DebugText; }
|
|
||||||
set { VlnSettings._DebugText = value; }
|
|
||||||
}
|
|
||||||
private static bool _DebugMode = false;
|
private static bool _DebugMode = false;
|
||||||
public static bool DebugMode
|
public static bool DebugMode
|
||||||
{
|
{
|
||||||
@@ -135,8 +119,7 @@ namespace Volian.Base.Library
|
|||||||
{
|
{
|
||||||
if (parameter.ToUpper().StartsWith("/" + commandName.ToUpper() + "="))
|
if (parameter.ToUpper().StartsWith("/" + commandName.ToUpper() + "="))
|
||||||
{
|
{
|
||||||
float result = def;
|
if (float.TryParse(parameter.Substring(commandName.Length + 2), out float result))
|
||||||
if (float.TryParse(parameter.Substring(commandName.Length + 2), out result))
|
|
||||||
return result;
|
return result;
|
||||||
else
|
else
|
||||||
return def;
|
return def;
|
||||||
@@ -182,7 +165,7 @@ namespace Volian.Base.Library
|
|||||||
// This will create a Temp\VE-PROMS folder in the LocalSettings Folder.
|
// This will create a Temp\VE-PROMS folder in the LocalSettings Folder.
|
||||||
//XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VEPROMS
|
//XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VEPROMS
|
||||||
//Vista - C:\Users\{user}\AppData\Local\Temp\VEPROMS
|
//Vista - C:\Users\{user}\AppData\Local\Temp\VEPROMS
|
||||||
_TemporaryFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Temp";
|
_TemporaryFolder = $@"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\Temp";
|
||||||
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
|
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
|
||||||
_TemporaryFolder += @"\VEPROMS";
|
_TemporaryFolder += @"\VEPROMS";
|
||||||
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
|
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
|
||||||
@@ -190,25 +173,10 @@ namespace Volian.Base.Library
|
|||||||
return _TemporaryFolder;
|
return _TemporaryFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static string _UserID=Environment.UserName.ToUpper();
|
|
||||||
public static string UserID
|
public static string UserID { get; set; } = Environment.UserName.ToUpper();
|
||||||
{
|
public static bool StepTypeToolTip { get; set; } = false;
|
||||||
get { return VlnSettings._UserID; }
|
public static bool cbShwRplWrdsColor { get; set; } = false;
|
||||||
set { VlnSettings._UserID = value; }
|
|
||||||
}
|
|
||||||
private static bool _StepTypeToolTip = false;
|
|
||||||
public static bool StepTypeToolTip
|
|
||||||
{
|
|
||||||
get { return VlnSettings._StepTypeToolTip; }
|
|
||||||
set { VlnSettings._StepTypeToolTip = value; }
|
|
||||||
}
|
|
||||||
// C2029-025 Show or hide replace words. Can highlight replace words in editor.
|
|
||||||
private static bool _cbShwRplWrdsColor = false;
|
|
||||||
public static bool cbShwRplWrdsColor
|
|
||||||
{
|
|
||||||
get { return VlnSettings._cbShwRplWrdsColor; }
|
|
||||||
set { VlnSettings._cbShwRplWrdsColor = value; }
|
|
||||||
}
|
|
||||||
private static string _ReleaseMode = null;
|
private static string _ReleaseMode = null;
|
||||||
public static string ReleaseMode
|
public static string ReleaseMode
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,26 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Volian.Base.Library
|
namespace Volian.Base.Library
|
||||||
{
|
{
|
||||||
public class VlnTimer
|
public class VlnTimer
|
||||||
{
|
{
|
||||||
private DateTime _LastTime = DateTime.Now;
|
public DateTime LastTime { get; set; } = DateTime.Now;
|
||||||
public DateTime LastTime
|
public string LastProcess { get; set; } = "Initialize";
|
||||||
{
|
|
||||||
get { return _LastTime; }
|
|
||||||
set { _LastTime = value; }
|
|
||||||
}
|
|
||||||
private string _LastProcess = "Initialize";
|
|
||||||
public string LastProcess
|
|
||||||
{
|
|
||||||
get { return _LastProcess; }
|
|
||||||
set { _LastProcess = value; }
|
|
||||||
}
|
|
||||||
public string ActiveProcess
|
public string ActiveProcess
|
||||||
{
|
{
|
||||||
get { return _LastProcess; }
|
get { return LastProcess; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
DateTime tNow = DateTime.Now;
|
DateTime tNow = DateTime.Now;
|
||||||
@@ -33,12 +22,8 @@ namespace Volian.Base.Library
|
|||||||
LastProcess = value;
|
LastProcess = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dictionary<string, TimeSpan> _ElapsedTimes = new Dictionary<string, TimeSpan>();
|
|
||||||
public Dictionary<string, TimeSpan> ElapsedTimes
|
public Dictionary<string, TimeSpan> ElapsedTimes { get; set; } = new Dictionary<string, TimeSpan>();
|
||||||
{
|
|
||||||
get { return _ElapsedTimes; }
|
|
||||||
set { _ElapsedTimes = value; }
|
|
||||||
}
|
|
||||||
public void ShowElapsedTimes()
|
public void ShowElapsedTimes()
|
||||||
{
|
{
|
||||||
ActiveProcess = "fini";
|
ActiveProcess = "fini";
|
||||||
@@ -54,26 +39,15 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
public static class ProfileTimer
|
public static class ProfileTimer
|
||||||
{
|
{
|
||||||
|
#pragma warning disable S6669
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private static Stack<string> _MyStack = new Stack<string>();
|
#pragma warning restore S6669
|
||||||
|
|
||||||
public static Stack<string> MyStack
|
public static Stack<string> MyStack { get; set; } = new Stack<string>();
|
||||||
{
|
public static DateTime StartTime { get; set; } = DateTime.Now;
|
||||||
get { return _MyStack; }
|
|
||||||
set { _MyStack = value; }
|
|
||||||
}
|
|
||||||
private static DateTime _StartTime = DateTime.Now;
|
|
||||||
public static DateTime StartTime
|
|
||||||
{
|
|
||||||
get { return _StartTime; }
|
|
||||||
set { _StartTime = value; }
|
|
||||||
}
|
|
||||||
delegate int DoPushTrack(string start);
|
delegate int DoPushTrack(string start);
|
||||||
private static DoPushTrack myDoPush = new DoPushTrack(IgnorePush);
|
private static DoPushTrack myDoPush = new DoPushTrack(IgnorePush);
|
||||||
public static int Push(string start)
|
public static int Push(string start) => DoPush(start);
|
||||||
{
|
|
||||||
return DoPush(start);
|
|
||||||
}
|
|
||||||
private static int DoPush(string start)
|
private static int DoPush(string start)
|
||||||
{
|
{
|
||||||
MyStack.Push(Start);
|
MyStack.Push(Start);
|
||||||
@@ -87,10 +61,7 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
delegate int DoPopTrack(int depth);
|
delegate int DoPopTrack(int depth);
|
||||||
private static DoPopTrack myDoPop = new DoPopTrack(IgnorePop);
|
private static DoPopTrack myDoPop = new DoPopTrack(IgnorePop);
|
||||||
public static int Pop(int depth)
|
public static int Pop(int depth) => DoPop(depth);
|
||||||
{
|
|
||||||
return DoPop(depth);
|
|
||||||
}
|
|
||||||
private static int DoPop(int depth)
|
private static int DoPop(int depth)
|
||||||
{
|
{
|
||||||
if (MyStack.Count != depth)
|
if (MyStack.Count != depth)
|
||||||
@@ -98,28 +69,15 @@ namespace Volian.Base.Library
|
|||||||
Start = MyStack.Pop();
|
Start = MyStack.Pop();
|
||||||
return MyStack.Count;
|
return MyStack.Count;
|
||||||
}
|
}
|
||||||
private static int IgnorePop(int depth)
|
private static int IgnorePop(int depth) => 0;
|
||||||
{
|
public static int Depth => MyStack.Count;
|
||||||
return 0;
|
|
||||||
}
|
public static Dictionary<string, long> TimerTable { get; set; } = new Dictionary<string, long>();
|
||||||
public static int Depth
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return MyStack.Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static Dictionary<string, long> _TimerTable = new Dictionary<string, long>();
|
|
||||||
public static Dictionary<string, long> TimerTable
|
|
||||||
{
|
|
||||||
get { return ProfileTimer._TimerTable; }
|
|
||||||
set { ProfileTimer._TimerTable = value; }
|
|
||||||
}
|
|
||||||
delegate void DoTrack(string module);
|
delegate void DoTrack(string module);
|
||||||
private static DoTrack myDoTrack = new DoTrack(IgnoreModule);
|
private static DoTrack myDoTrack = new DoTrack(IgnoreModule);
|
||||||
public static void TurnOnTracking(string filename)
|
public static void TurnOnTracking(string filename)
|
||||||
{
|
{
|
||||||
DebugProfile.Open(VlnSettings.TemporaryFolder + "\\" + filename);
|
DebugProfile.Open($"{VlnSettings.TemporaryFolder}\\{filename}");
|
||||||
myDoTrack = new DoTrack(TrackModule);
|
myDoTrack = new DoTrack(TrackModule);
|
||||||
myDoPush = new DoPushTrack(DoPush);
|
myDoPush = new DoPushTrack(DoPush);
|
||||||
myDoPop = new DoPopTrack(DoPop);
|
myDoPop = new DoPopTrack(DoPop);
|
||||||
@@ -145,12 +103,9 @@ namespace Volian.Base.Library
|
|||||||
//Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description);
|
//Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description);
|
||||||
AddTimerInfo(_Start, dtNext.Ticks - LastTime.Ticks);
|
AddTimerInfo(_Start, dtNext.Ticks - LastTime.Ticks);
|
||||||
_Start = module;
|
_Start = module;
|
||||||
_LastTime = dtNext;
|
LastTime = dtNext;
|
||||||
}
|
|
||||||
private static void IgnoreModule(string module)
|
|
||||||
{
|
|
||||||
_Start = module;
|
|
||||||
}
|
}
|
||||||
|
private static void IgnoreModule(string module) => _Start = module;
|
||||||
private static void AddTimerInfo(string description, long ticks)
|
private static void AddTimerInfo(string description, long ticks)
|
||||||
{
|
{
|
||||||
if (TimerTable.ContainsKey(description))
|
if (TimerTable.ContainsKey(description))
|
||||||
@@ -205,16 +160,12 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
public static void Reset()
|
public static void Reset()
|
||||||
{
|
{
|
||||||
_TimerTable = new Dictionary<string, long>();
|
TimerTable = new Dictionary<string, long>();
|
||||||
_Start = "Start";
|
_Start = "Start";
|
||||||
_LastTime = DateTime.Now;
|
LastTime = DateTime.Now;
|
||||||
_MyStack = new Stack<string>();
|
MyStack = new Stack<string>();
|
||||||
}
|
|
||||||
private static DateTime _LastTime = DateTime.Now;
|
|
||||||
public static DateTime LastTime
|
|
||||||
{
|
|
||||||
get { return _LastTime; }
|
|
||||||
set { _LastTime = value; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DateTime LastTime { get; set; } = DateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
<DependentUpon>FrmPopupStatusMessage.cs</DependentUpon>
|
<DependentUpon>FrmPopupStatusMessage.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="GenericSerializer.cs" />
|
<Compile Include="GenericSerializer.cs" />
|
||||||
|
<Compile Include="GlobalSuppressions.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="PropGridCollEditor.cs" />
|
<Compile Include="PropGridCollEditor.cs" />
|
||||||
<Compile Include="RTBAPI.cs" />
|
<Compile Include="RTBAPI.cs" />
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Volian.Base.Library
|
namespace Volian.Base.Library
|
||||||
{
|
{
|
||||||
@@ -12,45 +10,16 @@ namespace Volian.Base.Library
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class VolianTimer
|
public class VolianTimer
|
||||||
{
|
{
|
||||||
|
#pragma warning disable S6669
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
#pragma warning restore S6669
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||||
static List<VolianTimer> _Timers = new List<VolianTimer>();
|
static List<VolianTimer> _Timers = new List<VolianTimer>();
|
||||||
/// <summary>
|
|
||||||
/// User defined name - should be as specific as possible
|
public string Name { get; set; }
|
||||||
/// Include Method Name, File Name and Line Number
|
public DateTime Start { get; set; }
|
||||||
/// </summary>
|
public long Ticks { get; set; }
|
||||||
private string _Name;
|
public int Count { get; set; }
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return _Name; }
|
|
||||||
set { _Name = value; }
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Set on open
|
|
||||||
/// </summary>
|
|
||||||
private DateTime _Start;
|
|
||||||
public DateTime Start
|
|
||||||
{
|
|
||||||
get { return _Start; }
|
|
||||||
set { _Start = value; }
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Calculate on Close
|
|
||||||
/// </summary>
|
|
||||||
private long _Ticks;
|
|
||||||
public long Ticks
|
|
||||||
{
|
|
||||||
get { return _Ticks; }
|
|
||||||
set { _Ticks = value; }
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Number of times open/close has been run
|
|
||||||
/// </summary>
|
|
||||||
private int _Count;
|
|
||||||
public int Count
|
|
||||||
{
|
|
||||||
get { return _Count; }
|
|
||||||
set { _Count = value; }
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -60,6 +29,18 @@ namespace Volian.Base.Library
|
|||||||
Ticks = 0;
|
Ticks = 0;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Constructor with Module and line number
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="module">Method Name, File Name</param>
|
||||||
|
/// <param name="line">Code Line Number</param>
|
||||||
|
public VolianTimer(string module, int line)
|
||||||
|
{
|
||||||
|
Count = 0;
|
||||||
|
Ticks = 0;
|
||||||
|
Name = string.Format("{0}:{1}", module, line);
|
||||||
|
if (TimingsOn) _Timers.Add(this);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// Command Line Parameter /Timing turns timing on
|
/// Command Line Parameter /Timing turns timing on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static bool? _TimingsOn = null;
|
private static bool? _TimingsOn = null;
|
||||||
@@ -73,18 +54,6 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor with Module and line number
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="module">Method Name, File Name</param>
|
|
||||||
/// <param name="line">Code Line Number</param>
|
|
||||||
public VolianTimer(string module, int line)
|
|
||||||
{
|
|
||||||
Count = 0;
|
|
||||||
Ticks = 0;
|
|
||||||
Name = string.Format("{0}:{1}", module, line);
|
|
||||||
if(TimingsOn) _Timers.Add(this);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Start Timer
|
/// Start Timer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Open()
|
public void Open()
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.Drawing;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Drawing.Text;
|
using System.Drawing.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
@@ -11,7 +7,7 @@ namespace Volian.Base.Library
|
|||||||
public static class vlnFont
|
public static class vlnFont
|
||||||
{
|
{
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private static InstalledFontCollection _MyFontCollection = new InstalledFontCollection();
|
private static readonly InstalledFontCollection _MyFontCollection = new InstalledFontCollection();
|
||||||
private static string _ProportionalSymbolFont = null;
|
private static string _ProportionalSymbolFont = null;
|
||||||
// C2017-036 Look for suitable proportional font that will support the symbol characters used in PROMS
|
// C2017-036 Look for suitable proportional font that will support the symbol characters used in PROMS
|
||||||
// Microsoft removed Arial Unicode MS starting with Word16 (office 365 containing that version of Word)
|
// Microsoft removed Arial Unicode MS starting with Word16 (office 365 containing that version of Word)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -9,30 +8,8 @@ namespace Volian.Base.Library
|
|||||||
// This provides a more robust stack trace than what visual studio offers
|
// This provides a more robust stack trace than what visual studio offers
|
||||||
public static class vlnStackTrace
|
public static class vlnStackTrace
|
||||||
{
|
{
|
||||||
public static string GetStack(string str, params object[] objects)
|
public static string GetStack(bool showSame) => StackToString(showSame);
|
||||||
{
|
public static string StackToString() => StackToString(true);
|
||||||
return string.Format(str, objects) + StackToString();
|
|
||||||
}
|
|
||||||
public static void ShowStack(string str, params object[] objects)
|
|
||||||
{
|
|
||||||
Console.WriteLine(string.Format(str, objects) + StackToString());
|
|
||||||
}
|
|
||||||
public static string GetStack()
|
|
||||||
{
|
|
||||||
return StackToString();
|
|
||||||
}
|
|
||||||
public static string GetStack(bool showSame)
|
|
||||||
{
|
|
||||||
return StackToString(showSame);
|
|
||||||
}
|
|
||||||
public static void ShowStack()
|
|
||||||
{
|
|
||||||
Console.WriteLine(StackToString());
|
|
||||||
}
|
|
||||||
public static string StackToString()
|
|
||||||
{
|
|
||||||
return StackToString(true);
|
|
||||||
}
|
|
||||||
private static string StackToString(bool showSame)
|
private static string StackToString(bool showSame)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -71,22 +48,6 @@ namespace Volian.Base.Library
|
|||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
public static void ShowStackLocal(string str, params object[] objects)
|
|
||||||
{
|
|
||||||
Console.WriteLine(string.Format(str, objects) + StackToStringLocal(2,10));
|
|
||||||
}
|
|
||||||
public static void ShowStackFirstLocal(string str)
|
|
||||||
{
|
|
||||||
Console.WriteLine(str + "\r\n" + StackToStringLocal(3, 0));
|
|
||||||
}
|
|
||||||
public static void ShowStackLocal(string str,int start)
|
|
||||||
{
|
|
||||||
Console.WriteLine(str + "\r\n" + StackToStringLocal(start,1));
|
|
||||||
}
|
|
||||||
public static void ShowStackLocal(int start, int limit, string str, params object[] objects)
|
|
||||||
{
|
|
||||||
Console.WriteLine(string.Format(str, objects) + StackToStringLocal(start, limit));
|
|
||||||
}
|
|
||||||
public static string StackToStringLocal(int start, int limit)
|
public static string StackToStringLocal(int start, int limit)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -118,36 +79,12 @@ namespace Volian.Base.Library
|
|||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
return "No Local Method";
|
return "No Local Method";
|
||||||
}
|
}
|
||||||
public static string CalledFrom
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
StackTrace st = new StackTrace(true);
|
|
||||||
StackFrame[] sfs = st.GetFrames();
|
|
||||||
int count = 0;
|
|
||||||
foreach (StackFrame sf in sfs)
|
|
||||||
{
|
|
||||||
if (sf.GetFileLineNumber() != 0) // Only look at Local Methods
|
|
||||||
{
|
|
||||||
count++;
|
|
||||||
if (count > 4) // The fourth entry should be the Calling Method
|
|
||||||
{
|
|
||||||
string sType = sf.GetMethod().ReflectedType.Name;
|
|
||||||
string sMethod = sf.GetMethod().Name;
|
|
||||||
return string.Format("{0}.{1}[{2}]", sType, sMethod, sf.GetFileLineNumber());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "No Local Method";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static string CalledFromCSLA
|
public static string CalledFromCSLA
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
StackTrace st = new StackTrace(true);
|
StackTrace st = new StackTrace(true);
|
||||||
StackFrame[] sfs = st.GetFrames();
|
StackFrame[] sfs = st.GetFrames();
|
||||||
int count = 0;
|
|
||||||
string lastWasCSLA = null;
|
string lastWasCSLA = null;
|
||||||
foreach (StackFrame sf in sfs)
|
foreach (StackFrame sf in sfs)
|
||||||
{
|
{
|
||||||
@@ -187,71 +124,5 @@ namespace Volian.Base.Library
|
|||||||
if (stackFrame1.GetILOffset() != stackFrame2.GetILOffset()) return false;
|
if (stackFrame1.GetILOffset() != stackFrame2.GetILOffset()) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public static bool ScrollInStack()
|
|
||||||
{
|
|
||||||
StackTrace st = new StackTrace(true);
|
|
||||||
StackFrame[] sfs = st.GetFrames();
|
|
||||||
bool retval = false;
|
|
||||||
foreach (StackFrame sf in sfs)
|
|
||||||
{
|
|
||||||
string sMethod = sf.GetMethod().Name;
|
|
||||||
string sNamespace = sf.GetMethod().ReflectedType.Namespace;
|
|
||||||
string sType = sf.GetMethod().ReflectedType.Name;
|
|
||||||
if (sMethod.ToUpper().Contains("SCROLL") || sType.ToUpper().Contains("SCROLL"))
|
|
||||||
{
|
|
||||||
retval = true;
|
|
||||||
Console.WriteLine("{0}.{1}.{2}", sNamespace, sType, sMethod);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// This will clear the Output window when run in the Development Environment
|
|
||||||
/// Add EnvDTE and EnvDTE80 to references from .NET
|
|
||||||
/// </summary>
|
|
||||||
public static void ClearOutputWindow()
|
|
||||||
{
|
|
||||||
#if (DEBUG)
|
|
||||||
try
|
|
||||||
{
|
|
||||||
EnvDTE80.DTE2 dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.8.0");
|
|
||||||
dte2.ToolWindows.OutputWindow.ActivePane.Clear();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("ClearOutputWindow {0} - {1}\r\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static class HWndCounter
|
|
||||||
{
|
|
||||||
[DllImport("kernel32.dll")]
|
|
||||||
private static extern IntPtr GetCurrentProcess();
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
private static extern uint GetGuiResources(IntPtr hProcess, uint uiFlags);
|
|
||||||
|
|
||||||
private enum ResourceType
|
|
||||||
{
|
|
||||||
Gdi = 0,
|
|
||||||
User = 1
|
|
||||||
}
|
|
||||||
public static void GetWindowHandlesForCurrentProcess(IntPtr hWnd)
|
|
||||||
{
|
|
||||||
GetWindowHandlesForCurrentProcess(hWnd, "");
|
|
||||||
}
|
|
||||||
private static uint lastUserObject = 0;
|
|
||||||
public static void GetWindowHandlesForCurrentProcess(IntPtr hWnd, string str, params object[] objects)
|
|
||||||
{
|
|
||||||
IntPtr processHandle = GetCurrentProcess();
|
|
||||||
uint gdiObjects = GetGuiResources(processHandle, (uint)ResourceType.Gdi);
|
|
||||||
uint userObjects = GetGuiResources(processHandle, (uint)ResourceType.User);
|
|
||||||
if (lastUserObject != userObjects)
|
|
||||||
Console.WriteLine("winhandle count = {0} GDIObjs {1} UserObjs {2} dif {3} {4}", gdiObjects + userObjects, gdiObjects, userObjects,(int)userObjects - (int)lastUserObject, string.Format(str, objects));
|
|
||||||
lastUserObject = userObjects;
|
|
||||||
//return Convert.ToInt32(gdiObjects + userObjects);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ namespace Volian.Controls.Library
|
|||||||
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
||||||
fs.Write(myDoc.DocContent, 0, myDoc.DocContent.Length);
|
fs.Write(myDoc.DocContent, 0, myDoc.DocContent.Length);
|
||||||
fs.Close();
|
fs.Close();
|
||||||
MyDSOFile.SaveFile(0, "", _ItemInfo, false, StatusChanged); // B2017-219 save the restored document to database
|
MyDSOFile.SaveFile("", _ItemInfo, false, StatusChanged); // B2017-219 save the restored document to database
|
||||||
this._MyEdWord = null; // B2017-219 Set MyEdWord to null - we will check for this in the calling functions
|
this._MyEdWord = null; // B2017-219 Set MyEdWord to null - we will check for this in the calling functions
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
MyDSOFile.SaveFile(0, "", _ItemInfo, false, StatusChanged); // B2017-219 save the blank document to database
|
MyDSOFile.SaveFile("", _ItemInfo, false, StatusChanged); // B2017-219 save the blank document to database
|
||||||
MessageBox.Show("Reverting to Blank Document", "Error in MS Word section",
|
MessageBox.Show("Reverting to Blank Document", "Error in MS Word section",
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
this._MyEdWord = null; // B2017-219 Set MyEdWord to null - we will check for this in the calling functions
|
this._MyEdWord = null; // B2017-219 Set MyEdWord to null - we will check for this in the calling functions
|
||||||
@@ -357,7 +357,7 @@ namespace Volian.Controls.Library
|
|||||||
if (ans == DialogResult.No) cvtLibDoc = true;
|
if (ans == DialogResult.No) cvtLibDoc = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MyDSOFile.SaveFile(doc.Length, doc.Ascii, MyDisplayTabItem.MyItemInfo, cvtLibDoc, StatusChanged);
|
MyDSOFile.SaveFile(doc.Ascii, MyDisplayTabItem.MyItemInfo, cvtLibDoc, StatusChanged);
|
||||||
if (cvtLibDoc)
|
if (cvtLibDoc)
|
||||||
{
|
{
|
||||||
MyDisplayTabItem.Text = MyDisplayTabItem.MyItemInfo.TabTitle;
|
MyDisplayTabItem.Text = MyDisplayTabItem.MyItemInfo.TabTitle;
|
||||||
|
|||||||
Reference in New Issue
Block a user