コード例 #1
0
ファイル: MK52_Host.cs プロジェクト: myak555/MK-52_Resurrect
        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);
 }