Exemplo n.º 1
0
        static void Main(string[] args)
        {
            FCCommandLine cl = new FCCommandLine();

            cl.ProcessCmdLine(args);
            if (cl.IsInvalid())
            {
                cl.WriteUsage();
            }
            else
            {
                try
                {
                    // to go from static to (non-static) member function, we need a class to
                    // reference from (i.e. 'this').
                    ECFileConverter This = new ECFileConverter();

                    This.DoFileConvert(
                        cl.ConverterName,
                        cl.OutputFileName, cl.OutputEncoding,
                        cl.InputFileName, cl.InputEncoding,
                        cl.DirectionForward);
                }
                catch (NullReferenceException e)
                {
                    Console.WriteLine("program error: Caught exception #1.", e);
                    throw e;
                }
                catch (ArgumentNullException e)
                {
                    Console.WriteLine("File name missing: ", e);
                    throw e;
                }
                catch (FileNotFoundException e)
                {
                    Console.WriteLine("File not found: ", e);
                    throw e;
                }
                catch (IOException e)
                {
                    Console.WriteLine("IO error: ", e);
                    throw e;
                }
                catch
                {
                    Console.WriteLine("program error!");
                    throw;
                }
            }
        }
Exemplo n.º 2
0
		static void Main(string[] args)
		{
			FCCommandLine cl = new FCCommandLine();
			cl.ProcessCmdLine(args);
			if( cl.IsInvalid() )
			{
				cl.WriteUsage();
			}
			else
			{
				try
				{
					// to go from static to (non-static) member function, we need a class to
					// reference from (i.e. 'this').
					ECFileConverter This = new ECFileConverter();

					This.DoFileConvert(
						cl.ConverterName,
						cl.OutputFileName, cl.OutputEncoding,
						cl.InputFileName, cl.InputEncoding,
						cl.DirectionForward);
				}
				catch(NullReferenceException e)
				{
					Console.WriteLine("program error: Caught exception #1.", e);
					throw e;
				}
				catch(ArgumentNullException e)
				{
					Console.WriteLine("File name missing: ", e);
					throw e;
				}
				catch(FileNotFoundException e)
				{
					Console.WriteLine("File not found: ", e);
					throw e;
				}
				catch(IOException e)
				{
					Console.WriteLine("IO error: ", e);
					throw e;
				}
				catch
				{
					Console.WriteLine("program error!");
					throw;
				}
			}
		}