// clsFileIO.cs
// Copyright (C) 2008 Karel Jordaan karel_jordaan@yahoo.com.au
// 
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

using System;
using System.IO;
using GUIControlLogic.Error;

namespace GUIControlLogic
{
    /// <summary>
    /// clsFileIO does normal file IO.
    /// </summary>
    /// <remarks>Used to obtain locale information of satelite asseblies</remarks>
    public class clsFileIO : clsGlobalErr, IDisposable
    {
        #region Functions

        /// <summary>
        /// Dispose of the class.
        /// </summary>
        /// <remarks>None</remarks>
        public void Dispose()
        {
            // TODO:  Add clsFileIO.Dispose implementation
        }

        ///<summary>Get a array of satelite assemlies to change the language of the Client</summary>
        ///<returns>Returns a string array of available satelite languages in the current directory</returns>
        ///<remarks>There has to be a directory with the localeid in the same folder as the client executable</remarks>
        public string[] GetSateliteLanguages()
        {
            string[] dirs = new string[1];

            try
            {
                // Get only subdirectories 
                dirs = Directory.GetDirectories(Directory.GetCurrentDirectory());
                int jj = Directory.GetCurrentDirectory().Length;
                for (int i = 0; i <= dirs.Length - 1; i++)
                {
                    dirs[i] = dirs[i].Remove(0, jj + 1);
                }

                //throw(new clsExeption ());
                return dirs;
            }
            catch (Exception  ex)
            {
                new clsExeption(ex);
                ErrByte = 1;
                return dirs;
            }
        }

        #endregion
    }
}