Exemplo n.º 1
0
        /// <summary>
        /// Sets the path.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="path">The path.</param>
        /// <param name="strPath">The string path.</param>
        public static void SetPath(this RivieraApplication app, DaNTePath path, String strPath)
        {
            switch (path)
            {
            case DaNTePath.DANTE_BASES:
                app[CAT_DANTE][PROP_DAN_MDB_PATH] = strPath;
                break;

            case DaNTePath.ASOC_DIR:
                app[CAT_DANTE][PROP_DAN_ASOC_PATH] = strPath;
                break;

            case DaNTePath.ASOC_MDB:
                app[CAT_DANTE][PROP_DAN_ASOC] = new FileInfo(strPath).Name;
                break;

            case DaNTePath.MOD_DIR:
                app[CAT_DANTE][PROP_DAN_MOD_PATH] = strPath;
                break;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the path.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="path">The application desired path.</param>
        /// <returns>The path as string</returns>
        public static string GetPath(this RivieraApplication app, DaNTePath path, string dftl_pth = null)
        {
            string  pth       = null;
            Boolean isDirPath = true;

            switch (path)
            {
            case DaNTePath.DANTE_BASES:
                pth       = app[CAT_DANTE][PROP_DAN_MDB_PATH];
                isDirPath = false;
                break;

            case DaNTePath.ASOC_DIR:
                pth = app[CAT_DANTE][PROP_DAN_ASOC_PATH];
                break;

            case DaNTePath.ASOC_MDB:
                pth       = Path.Combine(app[CAT_DANTE][PROP_DAN_ASOC_PATH], app[CAT_DANTE][PROP_DAN_ASOC]);
                isDirPath = false;
                break;

            case DaNTePath.MOD_DIR:
                pth = app[CAT_DANTE][PROP_DAN_MOD_PATH];
                break;

            case DaNTePath.DANTE_DIR:
                pth = new FileInfo(app[CAT_DANTE][PROP_DAN_MDB_PATH]).DirectoryName;
                break;
            }
            if ((dftl_pth != null) && ((isDirPath && !Directory.Exists(pth)) || (!isDirPath && !File.Exists(pth))))
            {
                return(dftl_pth);
            }
            else
            {
                return(pth);
            }
        }