Added comments & commented out unused dictionary

This commit is contained in:
Kathy Ruffing 2022-02-14 13:39:30 +00:00
parent 9098c58ea8
commit bb81c62e3e

View File

@ -45,6 +45,7 @@ namespace VEPROMS.CSLA.Library
public int ParentID; public int ParentID;
public rochild[] children; public rochild[] children;
}; };
// rogrp defines tree structure
public struct rogrp public struct rogrp
{ {
public int ID; public int ID;
@ -53,19 +54,27 @@ namespace VEPROMS.CSLA.Library
public string value; public string value;
public string appid; public string appid;
}; };
// rochild can be read directory from the ro.fst. Read in from ro.fst as bytes.
public struct rochild public struct rochild
{ {
public int ID; public int ID;
public int ParentID; public int ParentID;
public int type; public int type;
public string title; public string title; // gets used for treeview
public string roid; public string roid; // roid unique identifier
public string appid; public string appid; // accessory page id - user specified unique id
public string value; public string value; // return value, can be multiple values
public rochild[] children; public rochild[] children;
}; };
// roChild is a container for rochild
public class roChild public class roChild
{ {
//private static int _roChildUnique = 0;
//private static int roChildUnique
//{ get { return ++_roChildUnique; } }
//private int _MyRoChildUnique = roChildUnique;
//public int MyRoChildUnique // Absolutely Unique ID - Info
//{ get { return _MyRoChildUnique; } }
rochild _MyChild; rochild _MyChild;
public rochild MyChild public rochild MyChild
{ {
@ -86,7 +95,7 @@ namespace VEPROMS.CSLA.Library
private string _ROValue = ""; private string _ROValue = "";
private List<string> lstRoValues; private List<string> lstRoValues;
private List<string> multiRoValues; private List<string> multiRoValues;
private Dictionary<string, string> DictROVar = new Dictionary<string, string>(); private Dictionary<string, string> DictROVar = new Dictionary<string, string>(); //use this to find values within return value
#endregion #endregion
#region Constructors #region Constructors
private ROFst _ROFst; private ROFst _ROFst;
@ -162,12 +171,12 @@ namespace VEPROMS.CSLA.Library
public roHdr myHdr; public roHdr myHdr;
private int TableID; private int TableID;
private Dictionary<string, rochild> dicRos; private Dictionary<string, rochild> dicRos;
private Dictionary<int, rochild> dicRosIntIDs; // private Dictionary<int, rochild> dicRosIntIDs; - not used
private Dictionary<string, string> dicRoDBs; private Dictionary<string, string> dicRoDBs;
public void Reset() public void Reset()
{ {
dicRos = null; dicRos = null;
dicRosIntIDs = null; //dicRosIntIDs = null;
dicRoDBs = null; dicRoDBs = null;
} }
#endregion #endregion
@ -175,29 +184,29 @@ namespace VEPROMS.CSLA.Library
public void Close() public void Close()
{ {
// remove the dictionary // remove the dictionary
if (dicRosIntIDs != null)dicRosIntIDs.Clear(); //if (dicRosIntIDs != null)dicRosIntIDs.Clear();
dicRosIntIDs = null; //dicRosIntIDs = null;
if (dicRos != null)dicRos.Clear(); if (dicRos != null)dicRos.Clear();
dicRos = null; dicRos = null;
if (dicRoDBs != null) dicRoDBs.Clear(); if (dicRoDBs != null) dicRoDBs.Clear();
dicRoDBs = null; dicRoDBs = null;
} }
private Dictionary<string, string> _dicROAPIDLookup; //private Dictionary<string, string> _dicROAPIDLookup;
public string GetAccPageID(string roid) //public string GetAccPageID(string roid)
{ //{
if(_dicROAPIDLookup==null) // if(_dicROAPIDLookup==null)
{ // {
_dicROAPIDLookup = new Dictionary<string,string>(); // _dicROAPIDLookup = new Dictionary<string,string>();
if (_dicROAPID == null) // if (_dicROAPID == null)
BuildROAPIDDictionary(); // BuildROAPIDDictionary();
foreach (string appid in _dicROAPID.Keys) // foreach (string appid in _dicROAPID.Keys)
_dicROAPIDLookup.Add(_dicROAPID[appid].roid,appid); // _dicROAPIDLookup.Add(_dicROAPID[appid].roid,appid);
} // }
String roidkey = roid.Substring(0, 12).ToUpper(); // String roidkey = roid.Substring(0, 12).ToUpper();
if(_dicROAPIDLookup.ContainsKey(roidkey)) // if(_dicROAPIDLookup.ContainsKey(roidkey))
return _dicROAPIDLookup[roidkey]; // return _dicROAPIDLookup[roidkey];
return null; // return null;
} //}
public List<string> GetValueDifferences(ROFSTLookup origROFst, ref List<string> delList) public List<string> GetValueDifferences(ROFSTLookup origROFst, ref List<string> delList)
{ {
// use this list to see what differences are between it and the original // use this list to see what differences are between it and the original
@ -644,7 +653,7 @@ namespace VEPROMS.CSLA.Library
// the first RO with a specific id will be found regardless of the RO Database id. // the first RO with a specific id will be found regardless of the RO Database id.
//public rochild GetRoChildFromID(int id) //public rochild GetRoChildFromID(int id)
//{ //{
// if (dicRosIntIDs == null) ParseIntoDictionary(_ROFst != null ? _ROFst.ROLookup : _ROFstInfo.ROLookup); // if (dicRosIntIDs == null) ParseIntoDictionary(_ROFst != null ? _ROFst.ROLookup : _ROFstInfo.ROLookup);
// // Use the id to get the value from the dictionary // // Use the id to get the value from the dictionary
// if (dicRosIntIDs.ContainsKey(id)) // if (dicRosIntIDs.ContainsKey(id))
// { // {
@ -893,10 +902,10 @@ namespace VEPROMS.CSLA.Library
{ {
foreach (rochild child in tmp.children) foreach (rochild child in tmp.children)
if (!dicRos.ContainsKey(child.roid.ToUpper())) if (!dicRos.ContainsKey(child.roid.ToUpper()))
dicRos.Add(child.roid.ToUpper(), child); dicRos.Add(child.roid.ToUpper(), child); // child is a struct not a class.
} }
dicRos.Add(tmp.roid.ToUpper(), tmp); dicRos.Add(tmp.roid.ToUpper(), tmp);
if (!dicRosIntIDs.ContainsKey(tmp.ID)) dicRosIntIDs.Add(tmp.ID, tmp); //if (!dicRosIntIDs.ContainsKey(tmp.ID)) dicRosIntIDs.Add(tmp.ID, tmp);
int j; int j;
for (j = i - 1; j >= 0 && tmp.ID < myGrp.children[j].ID; j--) for (j = i - 1; j >= 0 && tmp.ID < myGrp.children[j].ID; j--)
{ {
@ -966,7 +975,7 @@ namespace VEPROMS.CSLA.Library
private void ParseIntoDictionary(byte[] ab) private void ParseIntoDictionary(byte[] ab)
{ {
if (dicRos == null) dicRos = new Dictionary<string, rochild>(); if (dicRos == null) dicRos = new Dictionary<string, rochild>();
if (dicRosIntIDs == null) dicRosIntIDs = new Dictionary<int, rochild>(); //if (dicRosIntIDs == null) dicRosIntIDs = new Dictionary<int, rochild>();
if (dicRoDBs == null) dicRoDBs = new Dictionary<string, string>(); if (dicRoDBs == null) dicRoDBs = new Dictionary<string, string>();
myHdr.hSize = BitConverter.ToInt32(ab, 0); myHdr.hSize = BitConverter.ToInt32(ab, 0);
@ -1202,7 +1211,7 @@ namespace VEPROMS.CSLA.Library
else else
{ {
List<roChild> children = new List<roChild>(); List<roChild> children = new List<roChild>();
children.Add(new roChild(child)); children.Add(new roChild(child)); // adding entries to this dictionary for every ro!!
_ValueLookupDictionary.Add(value, children); _ValueLookupDictionary.Add(value, children);
} }
} }