This commit is contained in:
		@@ -131,6 +131,197 @@ namespace VEPROMS.CSLA.Library
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			_DocVersionConfig = null;
 | 
								_DocVersionConfig = null;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							private string GetProfile(string grp, string nam)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return GetProfile(grp, nam, false);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							private string GetProfile(string grp, string nam, bool flag)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								DocVersionConfig dvcfg = DocVersionConfig;
 | 
				
			||||||
 | 
								string buff = null;
 | 
				
			||||||
 | 
								if (grp != null && !grp.Equals(string.Empty))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									buff = dvcfg.GetValue(grp, nam); // get the value of 'nam' in 'grp'
 | 
				
			||||||
 | 
									if (buff == null || buff.Equals(string.Empty))
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										if (!flag)
 | 
				
			||||||
 | 
											buff = string.Format("<{0}-{1}>", grp, nam);
 | 
				
			||||||
 | 
										else
 | 
				
			||||||
 | 
											buff = null;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return buff;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public string UnitSpecific(string str, int len)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// This routine retrieves the procedure number format from the
 | 
				
			||||||
 | 
								// current directory and uses it to adjust the procedure number
 | 
				
			||||||
 | 
								// in the specified string
 | 
				
			||||||
 | 
								string retvalu = "";
 | 
				
			||||||
 | 
								string asis = "#";
 | 
				
			||||||
 | 
								if (str == null || str.Equals(string.Empty)) return null;
 | 
				
			||||||
 | 
								/*
 | 
				
			||||||
 | 
								 * Bug fix: B2005-017 3/2/2005
 | 
				
			||||||
 | 
								 * Need to use the largest procedure number length that's in the
 | 
				
			||||||
 | 
								 * SET.DFF file.  "LargestNumber" is the largest length after the
 | 
				
			||||||
 | 
								 * procedure number is replaced via the SET.INI file "replace" list.
 | 
				
			||||||
 | 
								 *
 | 
				
			||||||
 | 
									if(len==0)len=LargestNumber;
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								// TODO: Do we need this line?-->>>	if(len==0)len=LargestRawSetNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								//GetPrivateProfileString("unit", "procedure number", asis, mstr, MAXPATH, "proc.ini");
 | 
				
			||||||
 | 
								string pnum = asis;
 | 
				
			||||||
 | 
								string mstr = GetProfile("Unit", "Procedure Number");
 | 
				
			||||||
 | 
								if (!mstr.Equals(string.Empty))
 | 
				
			||||||
 | 
									pnum = mstr;
 | 
				
			||||||
 | 
								if (pnum.Equals(asis))
 | 
				
			||||||
 | 
									retvalu = str;
 | 
				
			||||||
 | 
								else if (pnum[0] == '!')
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									// look for mstr in SET.INI
 | 
				
			||||||
 | 
									//		GetPrivateProfileString("replace", mstr, mstr, tonum, 24, "set.ini");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									// TODO:  NOT SURE IF SET.INI AND PROC.INI HAVE UNIQUE GROUP NAMES!!!!!!!
 | 
				
			||||||
 | 
									mstr = GetProfile("Replace", mstr);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									retvalu = "";
 | 
				
			||||||
 | 
									string[] pnumsplit = pnum.Split(new Char[] { '#' });
 | 
				
			||||||
 | 
									int cnt = 0;
 | 
				
			||||||
 | 
									foreach (string s in pnumsplit)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										if (!s.Equals(string.Empty))
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											if ((cnt == 0) && (str.StartsWith(" ")))
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												string padding = new string(' ', s.Length);
 | 
				
			||||||
 | 
												retvalu += padding;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											else
 | 
				
			||||||
 | 
												retvalu += s;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										else
 | 
				
			||||||
 | 
											retvalu += str.Trim();
 | 
				
			||||||
 | 
										cnt++;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									// append trailing blanks or procedure number (str)
 | 
				
			||||||
 | 
									if (str.EndsWith(" "))
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										// count number of trailing blanks and append them to retvalu
 | 
				
			||||||
 | 
										cnt = str.Length - 1;
 | 
				
			||||||
 | 
										while (cnt > 0 && str[cnt] == ' ') cnt--;
 | 
				
			||||||
 | 
										retvalu += new string(' ', str.Length - cnt - 1);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return retvalu;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public string Evaluate(string str, int len)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								string retval = null;
 | 
				
			||||||
 | 
								string swhir = "PSU"; /* order inwhich to check */
 | 
				
			||||||
 | 
								string pn;
 | 
				
			||||||
 | 
								if (str.Length > 1 && str[1] == '-')
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									int swptr = swhir.IndexOf((str.ToUpper())[0]);
 | 
				
			||||||
 | 
									//char swchar = '';
 | 
				
			||||||
 | 
									//if (swptr != -1) 
 | 
				
			||||||
 | 
									//   swchar = swhir[swptr];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									string sav = str.Substring(len);
 | 
				
			||||||
 | 
									str = str.Substring(0, len);
 | 
				
			||||||
 | 
									string substr = str.Substring(2);
 | 
				
			||||||
 | 
									substr = substr.Replace(" ","");
 | 
				
			||||||
 | 
									while (swptr >= 0 && swptr < swhir.Length && retval == null) //retval.Equals(string.Empty))
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										switch (swhir[swptr])
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											case 'U':
 | 
				
			||||||
 | 
												retval = GetProfile("Unit", substr, true);
 | 
				
			||||||
 | 
												break;
 | 
				
			||||||
 | 
											case 'S':
 | 
				
			||||||
 | 
												retval = GetProfile("Procedure_Set", substr, true);
 | 
				
			||||||
 | 
												break;
 | 
				
			||||||
 | 
											case 'P':
 | 
				
			||||||
 | 
												//TODO:  THIS IS A GLOBAL IN THE 16 BIT CODE!!!!
 | 
				
			||||||
 | 
												string procnumber = "";
 | 
				
			||||||
 | 
												pn = UnitSpecific(procnumber, 0);
 | 
				
			||||||
 | 
												retval = GetProfile(pn, substr, true);
 | 
				
			||||||
 | 
												break;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										if (retval == null) // .Equals(string.Empty))
 | 
				
			||||||
 | 
											swptr++;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									str += sav;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else if (len == 1 && (str.ToUpper())[0] == 'U')
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									retval = GetProfile("Unit", "Number");
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else if (len == 2 && str.StartsWith("ID"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									retval = GetProfile("Unit", "ID");
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								// if the return value is empty, then the resulting
 | 
				
			||||||
 | 
								//			evaluation should repeat the token string including
 | 
				
			||||||
 | 
								//			the braces. - the beginning brace is not passed in.
 | 
				
			||||||
 | 
								//if (retval.Equals(string.Empty))
 | 
				
			||||||
 | 
								//{
 | 
				
			||||||
 | 
								//   retval = (char*)mallocq(len + 3);
 | 
				
			||||||
 | 
								//   strncpy(retval, str - 1, len + 2);
 | 
				
			||||||
 | 
								//}
 | 
				
			||||||
 | 
								if (retval == null)
 | 
				
			||||||
 | 
									retval = string.Format("<{0}>", str.Substring(0, len));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								return retval;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public string ProcessDocVersionSpecificInfo(string rawvalue)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								string str = rawvalue;
 | 
				
			||||||
 | 
								string rtnstr = "";
 | 
				
			||||||
 | 
								int l = rawvalue.Length;
 | 
				
			||||||
 | 
								while (l > 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									int ptr = str.IndexOf('<'); //nextDelimiter("<", str, l);
 | 
				
			||||||
 | 
									int cptr = (ptr == -1) ? -1 : str.IndexOf('>'); //nextDelimiter(">", ptr, strlen(ptr));
 | 
				
			||||||
 | 
									if (ptr == -1 || (ptr > -1 && cptr == -1))
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										//add(new seText(str, l));
 | 
				
			||||||
 | 
										//str += l;
 | 
				
			||||||
 | 
										rtnstr += str;
 | 
				
			||||||
 | 
										l = 0; // jump out of while loop
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										int cnt = ptr;
 | 
				
			||||||
 | 
										if (cnt > 0)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											//add(new seText(str, cnt));
 | 
				
			||||||
 | 
											rtnstr += str.Substring(0, cnt);
 | 
				
			||||||
 | 
											l -= cnt;
 | 
				
			||||||
 | 
											str = str.Substring(ptr);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										ptr = str.IndexOf('>')+1; //nextDelimiter(">", str, l) + 1;
 | 
				
			||||||
 | 
										cnt = ptr; //(int)(ptr - str);
 | 
				
			||||||
 | 
										//add(new seUser(str + 1, cnt - 2));
 | 
				
			||||||
 | 
										rtnstr += Evaluate(str.Substring(1, cnt - 2),cnt-2);
 | 
				
			||||||
 | 
										l -= cnt;
 | 
				
			||||||
 | 
										str = str.Substring(ptr); //ptr;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return rtnstr;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		#endregion
 | 
							#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ItemInfoList _Procedures = null;
 | 
							ItemInfoList _Procedures = null;
 | 
				
			||||||
@@ -227,6 +418,7 @@ namespace VEPROMS.CSLA.Library
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
				tmp.DocVersionConfigRefresh();
 | 
									tmp.DocVersionConfigRefresh();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		#endregion
 | 
							#endregion
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user