예제 #1
0
        public void listFunctions(string filename)
        {
            FileStream   fs = null;
            StreamWriter sw = null;

            try
            {
                fs = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.Read);
                sw = new StreamWriter(fs);

                sw.Write("#\n");
                sw.Write("# MK-52 implemented functions " + DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss\n"));
                sw.Write("#\n");
                for (int i = 0; i < RPN_Functions.MK52_NFUNCTIONS; i++)
                {
                    sw.Write(i.ToString("000"));
                    sw.Write("\t");
                    RPN_Function f = _m_RPN_Functions.getFunctionByID((uint)i);
                    if (f == null)
                    {
                        sw.Write("slot empty\n");
                        continue;
                    }
                    if (f.IOName() == null || f.IOName().Length == 0)
                    {
                        sw.Write("No name");
                    }
                    else
                    {
                        sw.Write(f.IOName());
                    }
                    sw.Write("\t");
                    sw.Write(f.Description);
                    sw.Write("\n");
                }
            }
            catch
            {
                this._m_RPN_Stack.setLabel_P(0, "Error: file save");
            }
            finally
            {
                if (sw != null)
                {
                    sw.Close();
                }
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }
예제 #2
0
 public RPN_Function getFunctionByIOName(string command)
 {
     if (command.Length <= 0)
     {
         return(null);
     }
     for (int i = 0; i < _functions.Count; i++)
     {
         RPN_Function pf = _functions[i];
         if (!UniversalValue._startsWith_P(command, pf.IOName()))
         {
             continue;
         }
         return(pf);
     }
     return(null);
 }