Пример #1
0
 public void Create(string infname)
 {
     try
     {
         m_inFile = new CsReader(infname, m_scriptEncoding);
     }
     catch (Exception ex)
     {
         erh.Error(new CSToolsFatalException(28, 0, 0, "", "Could not open input file " + infname + " (" + ex.Message + ")."));
         return;
     }
     if (infname.EndsWith(".txt"))
     {
         infname = infname.Substring(0, infname.Length - 4);
     }
     try
     {
         m_outFile = new StreamWriter(infname + ".cs", false);
     }
     catch (Exception ex)
     {
         erh.Error(new CSToolsFatalException(29, 0, 0, "", "Could not create output file " + infname + ".cs (" + ex.Message + ")."));
         return;
     }
     _Create();
     m_outFile.Close();
 }
Пример #2
0
 public void Create(string fname)
 {
     try
     {
         m_inFile = new CsReader(fname, m_scriptEncoding);
     }
     catch (Exception e)
     {
         if (m_tokens != null)
         {
             m_tokens.erh.Error(new CSToolsFatalException(4, 0, 0, "", String.Format("could not open {0} for reading [{1}]", fname, e.Message)));
             return;
         }
         throw(e);
     }
     if (fname.EndsWith(".txt"))
     {
         fname = fname.Substring(0, fname.Length - 4);
     }
     try
     {
         m_outFile = new StreamWriter(fname + ".cs", false);
     }
     catch (Exception e)
     {
         if (m_tokens != null)
         {
             m_tokens.erh.Error(new CSToolsFatalException(5, 0, 0, "", String.Format("could not open {0}.cs for writing [{1}]", fname, e.Message)));
             return;
         }
         throw(e);
     }
     _Create();
     m_outFile.Close();
 }