Beispiel #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();
                }
            }
        }