using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Foto_Scanner_New
{
    /// <summary>
    /// Properties for MainForm
    /// </summary>
    public class MainFormPropertiescs
    {
        public const string CH1 = "checkBoxRect1";
        public const string CH2 = "checkBoxRect2";
        public const string CH3 = "checkBoxRect3";
        public const string CH4 = "checkBoxRect4";
        public const string CH5 = "checkBoxRect5";
        public const string CH6 = "checkBoxRect6";
        public const string CH7 = "checkBoxRect7";
        public const string CH8 = "checkBoxRect8";
        public const string CH9 = "checkBoxRect9";
        public const string CH10 = "checkBoxRect10";

        public static string WORKING_DIR = "/Fotoalben/";
        public static string IV_DIR = "/res/iv/IrfanView/";
        public static string TEST_ALBUM = "Test_Album/";
        private string statusText = "";
 
        /// <summary>
        /// Path of the working directory
        /// </summary>
        public string StatusText {
            get { return this.statusText; }
            set { this.statusText = value; }
        }

        //--------------------------------------------------------------------------------
        //-UTILS--------------------------------------------------------------------------
        //--------------------------------------------------------------------------------
        
        /// <summary>
        /// Returns path of the standard working directory
        /// </summary>
        /// <returns>Working directory</returns>
        public static string getDirAlbums() 
        {
            string currentDir = Environment.CurrentDirectory;
            DirectoryInfo directory = new DirectoryInfo(currentDir);
            DirectoryInfo infoParent1 = Directory.GetParent(directory.FullName);
            DirectoryInfo infoParent2 = Directory.GetParent(infoParent1.FullName);
            
            return infoParent2.FullName + WORKING_DIR + TEST_ALBUM;
        }

        /// <summary>
        /// Returns path of IrfanView directory
        /// </summary>
        /// <returns>Working directory</returns>
        public static string getDirIV()
        {
            string currentDir = Environment.CurrentDirectory;
            DirectoryInfo directory = new DirectoryInfo(currentDir);
            DirectoryInfo infoParent1 = Directory.GetParent(directory.FullName);
            DirectoryInfo infoParent2 = Directory.GetParent(infoParent1.FullName);

            string path = infoParent2 + IV_DIR;

            return path;
        }

        /// <summary>
        /// Returns the number of scanned images (in the working directory)
        /// to create the next number
        /// </summary>
        /// <param name="workingDir">Working directory</param>
        public static int getNumberOfScansInDir(string workingDir)
        {
            int num = -1;
            // Only get directories that begin with the letter "scan_"
            Console.Out.WriteLine(Directory.Exists(workingDir));
            string[] dirs = Directory.GetDirectories(workingDir, "scan_*");
            num = dirs.Length;

            return num;
        }

    }
}
