コード例 #1
0
 /// <summary> A function that safely adds single lines to the history. If a String
 /// contains more than one line it will be splitted line by line.
 /// 
 /// If the history size is greater than history_max_size we remove elements
 /// that are old and too much.
 /// 
 /// </summary>
 /// <param name="">historyString
 /// The String that should be added to the history.
 /// 
 /// </param>
 private void addToHistory(System.String historyString)
 {
     //UPGRADE_ISSUE: Method 'java.lang.System.getProperty' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javalangSystemgetProperty_javalangString"'
     System.String[] lines = historyString.split(System.getProperty("line.separator"));
     for (int i = 0; i < lines.Length; ++i)
     {
         if (!lines[i].Equals(""))
         {
             history.add(lines[i]);
         }
     }
     // remove items as long as there are too much of them
     // and a valid history_max_size is set
     while (history.size() > history_max_size && history_max_size >= 0)
     {
         history.remove(0);
     }
     // reset the history index after a command
     history_offset = 0;
 }