Ejemplo n.º 1
0
        internal List <WikiFileInfo> _WikiFileCreateFilesList(string dir, WikiFileType type)
        {
            List <WikiFileInfo> flst = new List <WikiFileInfo>();

            foreach (string f in Directory.GetFiles(dir))
            {
                FileInfo     fi = new FileInfo(f);
                WikiFileInfo wl = new WikiFileInfo();
                wl.TimeWrite  = fi.LastWriteTime;
                wl.TimeAccess = fi.LastAccessTime;
                wl.TimeAdd    = DateTime.Now;
                wl.FilePath   = f;
                wl.FileLock   = DateTime.MinValue;
                wl.FileType   = type;

                if (wl.FileType == WikiFileType.FileReadMd)
                {
                    wl.FileName = Path.GetFileNameWithoutExtension(f);
                    wl.FileExt  = DokuUtil.WikiFileExtToString(f);
                }
                else
                {
                    wl.FileName = Path.GetFileName(f);
                    wl.FileExt  = DokuUtil.WikiFileExtToString(f);
                }
                flst.Add(wl);
            }
            return(flst);
        }
Ejemplo n.º 2
0
 internal string _WikiFileCacheId(WikiFileType wft, string src)
 {
     return
         (DokuUtil.WikiFileTypeToString(wft) + cacheReplace1 +
          src
          .Replace(":", cacheReplace1)
          .Replace(WikiFile.wikiDefaultSeparator, cacheReplace2));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// get Home location, Exception to load Home page default (html template)
 /// </summary>
 private void _WikiGetHome(string namesspace)
 {
     if (DokuUtil.WikiFileStringToType(WikiRequestType.None, namesspace) == WikiFileType.None)
     {
         throw new WikiEngineErrorPageException(
                   ((namesspace.Contains(":")) ? namesspace : String.Empty)
                   );
     }
     throw new WikiEngineErrorPageException();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Merge data WikiFile.WikiFileParse to WikiData
        /// </summary>
        /// <param name="wfp">internal WikiFile.WikiFileParse</param>
        /// <param name="path">root path</param>
        internal void MergeWFT(WikiFile.WikiFileParse wfp, string path)
        {
            if (wfp == null)
            {
                return;
            }

            this.FileType = wfp.FolderType;
            if (string.IsNullOrEmpty(wfp.SearchPatern))
            {
                this.FileExt  = __getFileExt(wfp.FolderType);
                this.FileName = string.Format(
                    "{0}_{1}{2}",
                    DokuUtil.WikiFileTypeToString(wfp.FolderType),
                    WikiFile.wikiDefaultEmptyNS, ".",
                    this.FileExt
                    );
            }
            else
            {
                this.FileName = wfp.SearchPatern;
                this.FileExt  = Path.GetExtension(this.FileName);
                if (string.IsNullOrEmpty(this.FileExt))
                {
                    this.FileExt  = __getFileExt(wfp.FolderType);
                    this.FileName = string.Concat(
                        this.FileName, ".",
                        this.FileExt
                        );
                }
            }
            this.NameSpace = wfp.NameSpacePatern;
            this.FilePath  = Path.Combine(path, DokuUtil.WikiFileTypeToString(wfp.FolderType));
            if (wfp.UriPart.Count > 0)
            {
                wfp.UriPart.ForEach(o =>
                {
                    this.FilePath = Path.Combine(this.FilePath, o);
                });
            }
            this.FilePath = Path.Combine(
                this.FilePath,
                this.FileName
                );
            this.FileName  = Path.GetFileNameWithoutExtension(this.FileName);
            this.IsFileNew = true;
        }
Ejemplo n.º 5
0
 internal void _CreateFilesList()
 {
     try
     {
         if (this._lockFs.TryEnterWriteLock((this._isOnstart) ? waitWriteFsOnStart : waitWriteFsOnProcess))
         {
             try
             {
                 DateTime dtStart = DateTime.Now;
                 this._wikiFSDict.Clear();
                 this._rootTree.ForEach(r =>
                 {
                     WikiFolderInfo wfi = new WikiFolderInfo();
                     WikiFileType type  = DokuUtil.WikiFileStringToType(WikiRequestType.None, r);
                     wfi.Files          = this._WikiFileCreateFilesList(Path.Combine(this._rootPath, r), type);
                     wfi.Dirs           = this._WikiFileCreateDictFolders(Path.Combine(this._rootPath, r), type);
                     this._wikiFSDict.Add(r, wfi);
                 });
                 this._isFsModify         = true;
                 this.waitReadFsOnProcess = ((DateTime.Now.Millisecond - dtStart.Millisecond) + 1000);
                 this.Fire_WikiFSChange(new WikiFSChangeEventArgs(this, this._wikiFSDict.Count, (this.waitReadFsOnProcess - 1000)));
             }
             finally
             {
                 try
                 {
                     this._lockFs.ExitWriteLock();
                 }
                 catch (LockRecursionException e)
                 {
                     this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                 }
                 catch (SynchronizationLockException e)
                 {
                     this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                 }
             }
         }
     }
     catch (Exception e)
     {
         this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor WikiFileAction
 /// </summary>
 /// <param name="namesspace">full Namespace path</param>
 /// <param name="search">search string</param>
 /// <param name="isallfiles">process all files</param>
 /// <param name="status">set status</param>
 /// <param name="sb">String Builder instance</param>
 public WikiFileAction(string namesspace, string search, bool isallfiles = false, bool status = false, StringBuilder sb = null)
 {
     if (string.IsNullOrWhiteSpace(search))
     {
         throw new WikiEngineInternalStructErrorException(
                   string.Format(
                       Properties.ResourceWikiEngine.fmtErrorGetResource,
                       Properties.ResourceWikiEngine.txtErrorSearchEmpty,
                       this.GetType().Name
                       )
                   );
     }
     Status         = status;
     IsAllFiles     = isallfiles;
     ConutNameSpace = ConutFile = ConutDirs = ConutFiles = 0;
     Search         = search;
     Key            = String.Empty;
     LastNameSpace  = String.Empty;
     NameSpace      = DokuUtil.WikiFileNameSpaceNormalize(namesspace);
     IsSBuilder     = (sb != null);
     SBuilder       = sb;
 }
Ejemplo n.º 7
0
        internal void _ActionResourceList(WikiFileAction wfa)
        {
            if (
                (wfa == null) ||
                (wfa.FileInfo == null)
                )
            {
                return;
            }
            bool isNewNameSpace = ((string.IsNullOrWhiteSpace(wfa.LastNameSpace)) ? true :
                                   ((wfa.LastNameSpace.Equals(wfa.NameSpace)) ? false : true)
                                   );

            if (isNewNameSpace)
            {
                wfa.LastNameSpace = wfa.NameSpace;
                wfa.SBuilder.AppendFormat(
                    Properties.ResourceWikiEngine.ListFormatNameSpace,
                    WikiFile.wikiLocalPath,
                    DokuUtil.WikiFileTypeToString(wfa.FileInfo.FileType),
                    wfa.NameSpace,
                    ((string.IsNullOrWhiteSpace(wfa.NameSpace)) ?
                     Properties.ResourceWikiEngine.txtHomePageTitle :
                     wfa.NameSpace
                    ),
                    Environment.NewLine
                    );
            }
            switch (wfa.FileInfo.FileType)
            {
            case WikiFileType.FileReadAttic:
            case WikiFileType.FileWriteAttic:
            {
                string FileNameUri, FileNameTxt, FileTimeStamp;
                FileNameUri   = Path.GetFileNameWithoutExtension(wfa.FileInfo.FileName);
                FileNameUri   = Path.GetFileNameWithoutExtension(FileNameUri);
                FileNameTxt   = Path.GetFileNameWithoutExtension(FileNameUri);
                FileTimeStamp = Path.GetExtension(FileNameUri);
                DateTime TimeStamp = Util.DokuUtil.GetDateTimeFromUnixTimeStampString(
                    FileTimeStamp.Substring(1, (FileTimeStamp.Length - 1))
                    );
                wfa.SBuilder.AppendFormat(
                    Properties.ResourceWikiEngine.ListFormatAttic,
                    WikiFile.wikiLocalPath,
                    WikiFile.wikiLocalAttic,
                    wfa.NameSpace,
                    FileNameUri,
                    FileNameTxt,
                    TimeStamp.ToString(),
                    Environment.NewLine
                    );
                break;
            }

            case WikiFileType.FileReadMd:
            case WikiFileType.FileWriteMd:
            {
                wfa.SBuilder.AppendFormat(
                    Properties.ResourceWikiEngine.ListFormatPage,
                    WikiFile.wikiLocalPath,
                    WikiFile.wikiLocalPage,
                    wfa.NameSpace,
                    wfa.FileInfo.FileName,
                    wfa.FileInfo.TimeWrite.ToShortDateString(),
                    Environment.NewLine
                    );
                break;
            }

            case WikiFileType.FileReadBinary:
            case WikiFileType.FileWriteBinary:
            {
                wfa.SBuilder.AppendFormat(
                    Properties.ResourceWikiEngine.ListFormatMedia,
                    WikiFile.wikiLocalPath,
                    WikiFile.wikiLocalMedia,
                    wfa.NameSpace,
                    wfa.FileInfo.FileName,
                    Path.GetFileNameWithoutExtension(wfa.FileInfo.FileName),
                    wfa.FileInfo.FileExt,
                    wfa.FileInfo.TimeWrite.ToShortDateString(),
                    Environment.NewLine
                    );
                break;
            }

            default:
            {
                return;
            }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// internal find Namespace
        /// </summary>
        /// <param name="wfp"><see cref="WikiFile.WikiFileParse"/>WikiFile.WikiFileParse data</param>
        /// <returns><see cref="WikiEngine.WikiFolderInfo"/>WikiEngine.WikiFolderInfo</returns>
        internal WikiFolderInfo __WikiFilesFindNamespace(WikiFileParse wfp)
        {
            WikiFolderInfo wfi = null;

            try
            {
                if (this._taskFilesList.Status == TaskStatus.Running)
                {
                    this._taskFilesList.Wait();
                    if (this._taskFilesList.Exception != null)
                    {
                        throw this._taskFilesList.Exception;
                    }
                }
                if (this._lockFs.TryEnterReadLock((this._isOnstart) ? waitReadFsOnStart : waitReadFsOnProcess))
                {
                    try
                    {
                        if (
                            (this._wikiFSDict == null) ||
                            (this._wikiFSDict.Count == 0)
                            )
                        {
                            throw new WikiEngineInternalSearchErrorException("FS base is empty");
                        }
                        if ((wfi =
                                 this._wikiFSDict.Where(o => o.Key.Equals(DokuUtil.WikiFileTypeToString(wfp.FolderType)))
                                 .Select(o =>
                        {
                            return((WikiFolderInfo)o.Value);
                        })
                                 .FirstOrDefault <WikiFolderInfo>()) == null)
                        {
                            throw new WikiEngineInternalSearchErrorException();
                        }
                        if (
                            (wfp.UriPart == null) ||
                            (wfp.UriPart.Count == 0)
                            )
                        {
                            throw new WikiEngineInternalSearchOkException();
                        }

                        int i = 0, count = ((wfp.IsNameSpaceOnly) ? wfp.UriPart.Count : (wfp.UriPart.Count - 1));

                        wfp.UriPart.ForEach(fpart =>
                        {
                            if (i == count)
                            {
                                return;
                            }
                            if ((wfi = this.__WikiFilesFindNamespaceFolder(wfi, fpart)) == null)
                            {
                                return;
                            }
                            i++;
                        });
                        if (wfi != null)
                        {
                            wfi.SearchPatern = ((wfp.IsNameSpaceOnly) ? String.Empty : wfp.UriPart[count]);
                            throw new WikiEngineInternalSearchOkException();
                        }
                        else
                        {
                            throw new WikiEngineInternalSearchErrorException();
                        }
                    }
                    finally
                    {
                        try
                        {
                            this._lockFs.ExitReadLock();
                        }
                        catch (LockRecursionException e)
                        {
                            this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                        }
                        catch (SynchronizationLockException e)
                        {
                            this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                        }
                    }
                }
                throw new WikiEngineInternalSearchErrorException();
            }
            catch (WikiEngineInternalSearchOkException)
            {
                return(wfi);
            }
            catch (WikiEngineInternalSearchErrorException)
            {
                return(null);
            }
            catch (Exception e)
            {
                this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                return(null);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// internal Wiki find files
        /// </summary>
        /// <param name="wfp"><see cref="WikiFile.WikiFileParse"/>WikiFile.WikiFileParse data</param>
        /// <returns>WikiFolderInfo data</returns>
        internal WikiFolderInfo __WikiFilesFindFiles(WikiFileParse wfp)
        {
            WikiFolderInfo wfi = null, wfo = null;
            string         key = String.Empty;

            try
            {
                if (this._taskFilesList.Status == TaskStatus.Running)
                {
                    this._taskFilesList.Wait();
                    if (this._taskFilesList.Exception != null)
                    {
                        throw new WikiEngineInternalSearchErrorException(this._taskFilesList.Exception.Message);
                    }
                }
                if (this._lockFs.TryEnterReadLock((this._isOnstart) ? waitReadFsOnStart : waitReadFsOnProcess))
                {
                    try
                    {
                        if (
                            (this._wikiFSDict == null) ||
                            (this._wikiFSDict.Count == 0)
                            )
                        {
                            throw new WikiEngineInternalSearchErrorException("FS base is empty");
                        }
                        key = DokuUtil.WikiFileTypeToString(wfp.FolderType);
                        if ((wfi =
                                 this._wikiFSDict.Where(o => o.Key.Equals(key))
                                 .Select(o =>
                        {
                            return((WikiFolderInfo)o.Value);
                        })
                                 .FirstOrDefault <WikiFolderInfo>()) == null)
                        {
                            throw new WikiEngineInternalSearchEmptyException();
                        }
                        if (
                            (wfp.UriPart != null) &&
                            (wfp.UriPart.Count > 0)
                            )
                        {
                            wfp.UriPart.ForEach(fpart =>
                            {
                                if ((wfi = this.__WikiFilesFindNamespaceFolder(wfi, fpart)) == null)
                                {
                                    return;
                                }
                                key = fpart;
                            });
                        }
                        if (wfi == null)
                        {
                            throw new WikiEngineInternalSearchEmptyException();
                        }

                        wfo = new WikiFolderInfo();
                        wfo.SearchPatern = wfp.SearchPatern;
                        wfo.SearchStrong = wfp.IsStrongSearch;

                        if (this.__WikiFilesFindNamespaceFiles(ref wfo, wfi, key))
                        {
                            throw new WikiEngineInternalSearchOkException();
                        }
                        throw new WikiEngineInternalSearchEmptyException();
                    }
                    finally
                    {
                        try
                        {
                            this._lockFs.ExitReadLock();
                        }
                        catch (LockRecursionException e)
                        {
                            this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                        }
                        catch (SynchronizationLockException e)
                        {
                            this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                        }
                    }
                }
                throw new WikiEngineInternalSearchEmptyException();
            }
            catch (WikiEngineInternalSearchOkException)
            {
                // Cache write result
                if (this._isCacheEnable)
                {
                    _WikiFileCacheWrite(wfo, wfp.CacheId);
                }
                //
                return(wfo);
            }
            catch (WikiEngineInternalSearchEmptyException)
            {
                return(null);
            }
            catch (WikiEngineInternalSearchErrorException e)
            {
                this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                return(null);
            }
            catch (Exception e)
            {
                this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                return(null);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// internal Uri/Namespace parse
        /// </summary>
        /// <param name="wfp"></param>
        /// <returns><see cref="WikiFile.WikiFileParse"/>WikiFile.WikiFileParse</returns>
        internal WikiFileParse __WikiFilesParse(WikiFileParse wfp)
        {
            try
            {
                bool checkNs = !string.IsNullOrWhiteSpace(wfp.NameSpacePatern),
                     checkFn = !string.IsNullOrWhiteSpace(wfp.SearchPatern);

                if ((!checkNs) && (!checkFn))
                {
                    throw new WikiEngineInternalNameSpaceErrorException(
                              ((checkNs) ? wfp.NameSpacePatern : "") +
                              ((checkFn) ? wfp.SearchPatern : "")
                              );
                }
                else if ((checkNs) && (!checkFn))
                {
                    if (!wfp.IsNameSpaceValid)
                    {
                        wfp.SearchPatern    = wfp.NameSpacePatern;
                        wfp.NameSpacePatern = ":";
                        checkNs             = !checkNs;
                        checkFn             = !checkFn;
                    }
                }
                else if ((!checkNs) && (checkFn))
                {
                    if (!wfp.IsSearchPaternValid)
                    {
                        wfp.NameSpacePatern = wfp.SearchPatern;
                        wfp.SearchPatern    = String.Empty;
                        checkNs             = !checkNs;
                        checkFn             = !checkFn;
                    }
                }
                if (checkNs)
                {
                    WikiFileType dwft = DokuUtil.WikiFileStringToDefaultType(wfp.NameSpacePatern, wfp.IsWriteOperation);
                    switch (dwft)
                    {
                    case WikiFileType.None:
                    case WikiFileType.FileUnknown:
                    {
                        switch (wfp.FolderType)
                        {
                        case WikiFileType.None:
                        case WikiFileType.FileUnknown:
                        {
                            throw new WikiEngineInternalFileTypeException(
                                      ((checkNs) ? wfp.NameSpacePatern : "") +
                                      ((checkFn) ? wfp.SearchPatern : "")
                                      );
                        }

                        default:
                        {
                            break;
                        }
                        }
                        break;
                    }

                    case WikiFileType.NameSpace:
                    {
                        /*
                         * // strong check files
                         * if (!checkFn)
                         * {
                         *  throw new WikiEngineInternalNameSpaceErrorException(
                         *      ((checkFn) ? wfp.SearchPatern : "")
                         *  );
                         * }
                         */
                        break;
                    }

                    default:
                    {
                        switch (wfp.FolderType)
                        {
                        case WikiFileType.None:
                        case WikiFileType.FileUnknown:
                        {
                            wfp.FolderType = dwft;
                            break;
                        }

                        default:
                        {
                            break;
                        }
                        }
                        break;
                    }
                    }
                }
                switch (wfp.FolderType)
                {
                case WikiFileType.None:
                case WikiFileType.FileUnknown:
                {
                    throw new WikiEngineInternalFileTypeException(
                              ((checkNs) ? wfp.NameSpacePatern : "") +
                              ((checkFn) ? wfp.SearchPatern : "")
                              );
                }

                case WikiFileType.FileReadAttic:
                case WikiFileType.FileWriteAttic:
                {
                    this.__WikiFilesParseAtticExtension(ref wfp, checkNs, checkFn, atticExtension);
                    break;
                }

                case WikiFileType.FileReadMeta:
                case WikiFileType.FileWriteMeta:
                {
                    this.__WikiFilesParseMetaExtension(ref wfp, checkNs, checkFn, metaExtension);
                    break;
                }

                default:
                {
                    break;
                }
                }

                // Cache read request
                wfp.CacheId = ((this._isCacheEnable) ?
                               _WikiFileCacheId(
                                   wfp.FolderType,
                                   string.Concat(
                                       ((checkNs) ? wfp.NameSpacePatern : "-"),
                                       (((!checkNs) && (checkFn)) ? wfp.SearchPatern : "-")
                                       )
                                   ) :
                               String.Empty
                               );
                if ((this._isCacheEnable) && ((wfp.FolderInfo = _WikiFileCacheRead(wfp.CacheId)) != null))
                {
                    return(wfp);
                }
                // End Cache

                if ((wfp.UriPart = wfp.NameSpacePatern
                                   .Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)
                                   .ToList <string>()) == null)
                {
                    throw new WikiEngineInternalSearchOkException();
                }
                if (
                    (!checkFn) &&
                    (wfp.UriPart.Count > 1)
                    )
                {
                    wfp.SearchPatern = wfp.UriPart[(wfp.UriPart.Count - 1)];
                    wfp.UriPart.RemoveAt(wfp.UriPart.Count - 1);
                }
                return(wfp);
            }
            catch (WikiEngineInternalSearchOkException)
            {
                return(null);
            }
            catch (Exception e)
            {
                this.Fire_ProcessError(new WikiErrorEventArgs(e, MethodBase.GetCurrentMethod().Name));
                return(null);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Wiki Route tree (Web)
        /// return requested resource from wiki file system.
        /// </summary>
        /// <example>
        /// Uri: /wiki/get/pages|attic|media|meta/clan:test1
        /// Uri: /wiki/put/pages|attic|media/clan:test1
        /// Uri: /wiki/del/pages|attic|media/clan:test1
        /// Uri: /wiki/list/pages|attic|media/clan:
        /// Uri: /wiki/find/part-of-serch-page-name
        /// enum <see cref="WikiEngine.WikiRequestType"/>WikiEngine.WikiRequestType: get|put|del|list|find
        /// enum <see cref="WikiEngine.WikiFileType"/>WikiEngine.WikiFileType: pages|attic|media|meta
        /// </example>
        /// <remarks>
        /// Example routing Uri:
        ///
        /// "/wiki/get/pages/clan:test1" OK
        /// "/wiki/get/clan:test1" OK
        /// "/wiki/clan:test1" -> HomeException
        /// "/wiki/clan:" -> HomeException
        /// "/wiki/" -> HomeException (redirect)
        ///
        /// "/wiki/list/pages/clan:" OK
        /// "/wiki/list/clan:" OK (default pages)
        /// "/wiki/list/" OK (default pages and default namespace)
        ///
        /// "/wiki/list/media/clan:" OK
        /// "/wiki/list/media/" OK (default namespace)
        ///
        /// "/wiki/find/pages/tes" OK
        /// "/wiki/find/media/tes" OK
        /// "/wiki/find/attic/tes" OK
        /// "/wiki/find/tes" OK (default pages and default namespace)
        ///
        /// </remarks>
        /// <exception cref="WikiEngine.Exceptions.WikiEngineAuthException">WikiEngineAuthException</exception>
        /// <exception cref="WikiEngine.Exceptions.WikiEngineSearchException">WikiEngineSearchException</exception>
        /// <exception cref="WikiEngine.Exceptions.WikiEngineHomePageException">WikiEngineHomePageException</exception>
        /// <exception cref="WikiEngine.Exceptions.WikiEngineErrorPageException">WikiEngineErrorPageException</exception>
        /// <exception cref="WikiEngine.Exceptions.WikiEngineNotImplementPageException">WikiEngineNotImplementPageException</exception>
        /// <param name="url">given raw url requested</param>
        /// <param name="wfm"><see cref="WikiEngine.WikiFileMeta"/>WikiEngine.WikiFileMeta</param>
        /// <returns>byte[] from requested source</returns>
        public byte [] RouteTree(string url, WikiFileMeta wfm = null)
        {
            try
            {
                List <string> urlPart = url.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries).Skip(1).ToList();

                // Uri part, folders array
                switch (urlPart.Count)
                {
                case 0:
                {
                    // root, get home page template
                    // return Exception WikiHomePageException
                    Console.WriteLine("0: Count");
                    throw new WikiEngine.Exceptions.WikiEngineHomePageException();
                }

                case 1:
                {
                    // command line: (/get | /put | /del | /list)
                    // not complette request,
                    // only WikiRequestType is set?
                    switch (DokuUtil.WikiFileStringToMethod(urlPart[0]))
                    {
                    default:
                    case WikiRequestType.None:
                    {
                        // get Exception Home page default (html template)
                        // return Exception WikiHomePageException
                        Console.WriteLine("1: WikiRequestType.None:0");
                        if (!string.IsNullOrWhiteSpace(urlPart[0]))
                        {
                            if (urlPart[0].EndsWith(":"))
                            {
                                return(_WikiGetList(
                                           WikiFileType.FileReadMd,
                                           urlPart[0]
                                           ));
                            }
                            else if (urlPart[0].Contains(":"))
                            {
                                return(_WikiGetFile(
                                           WikiFileType.FileReadMd,
                                           urlPart[0]
                                           ));
                            }
                        }
                        throw new WikiEngine.Exceptions.WikiEngineHomePageException(urlPart[0]);
                    }

                    case WikiRequestType.List:
                    {
                        // get page list default ?
                        // return Md format txt
                        Console.WriteLine("1: WikiRequestType.List:0");
                        return(_WikiGetList(WikiFileType.FileReadMd, String.Empty));
                    }

                    case WikiRequestType.Find:
                    {
                        // get find page default ?
                        // return Md format txt
                        Console.WriteLine("1: WikiRequestType.Find:0");
                        throw new WikiEngineSearchException("search pattern is empty");
                    }
                    }
                }

                case 2:
                {
                    // command line: /get (/pages | /media | /attic | /meta)
                    // get List/Page/Media ?
                    string          nssource = String.Empty;
                    WikiRequestType wrt      = DokuUtil.WikiFileStringToMethod(urlPart[0]);
                    WikiFileType    wft      = DokuUtil.WikiFileStringToType(wrt, urlPart[1]);
                    switch (wrt)
                    {
                    case WikiRequestType.None:
                    {
                        if (wft == WikiFileType.None)
                        {
                            if ((wft = DokuUtil.WikiFileStringToType(wrt, urlPart[0])) != WikiFileType.None)
                            {
                                wrt      = WikiRequestType.Get;
                                nssource = urlPart[1];
                            }
                        }
                        break;
                    }

                    default:
                    {
                        if (wft == WikiFileType.None)
                        {
                            nssource = urlPart[1];
                            wft      = WikiFileType.FileReadMd;
                        }
                        else
                        {
                            nssource = this._defaultNameSpace;
                        }
                        break;
                    }
                    }
                    switch (wrt)
                    {
                    default:
                    case WikiRequestType.Del:
                    case WikiRequestType.Put:
                    case WikiRequestType.None:
                    {
                        // get Exception Home page default (html template)
                        // return Exception WikiHomePageException
                        Console.WriteLine("2: _WikiGetHome");
                        throw new WikiEngine.Exceptions.WikiEngineHomePageException(
                                  nssource
                                  );
                    }

                    case WikiRequestType.Find:
                    {
                        // find pages list (default from nssource)
                        Console.WriteLine("2: _WikiFindList");
                        return(_WikiFindList(wft, nssource));
                    }

                    case WikiRequestType.List:
                    {
                        // get pages list (default from nssource)
                        Console.WriteLine("2: _WikiGetList");
                        return(_WikiGetList(wft, nssource));
                    }

                    case WikiRequestType.Get:
                    {
                        // get page/media resource (default from nssource)
                        Console.WriteLine("2: _WikiGetFile");
                        return(_WikiGetFile(wft, nssource));
                    }
                    }
                }

                case 3:
                {
                    WikiRequestType wrtAct    = DokuUtil.WikiFileStringToMethod(urlPart[0]);
                    WikiFileType    wrtTarget = DokuUtil.WikiFileStringToType(wrtAct, urlPart[1]);

                    if (
                        (wrtAct == WikiRequestType.None) ||
                        (wrtTarget == WikiFileType.None) ||
                        (string.IsNullOrWhiteSpace(urlPart[2])) ||
                        (
                            (wrtAct != WikiRequestType.Find) &&
                            (!urlPart[2].Contains(":"))
                        )
                        )
                    {
                        // error request param
                        // return Exception WikiHomePageException
                        throw new WikiEngineHomePageException(urlPart[2]);
                    }

                    List <string> wikiPart = urlPart[2].Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries).ToList();

                    switch (wikiPart.Count)
                    {
                    case 0:
                    {
                        // WikiRequestType and WikiFileType is valid,
                        // namespace not found, return default
                        switch (wrtAct)
                        {
                        case WikiRequestType.Get:
                        {
                            return(_WikiGetFile(wrtTarget, this._defaultNameSpace));
                        }

                        case WikiRequestType.List:
                        {
                            return(_WikiGetList(wrtTarget, this._defaultNameSpace));
                        }

                        case WikiRequestType.Find:
                        {
                            if (string.IsNullOrWhiteSpace(urlPart[2]))
                            {
                                throw new WikiEngineSearchException(
                                          string.Format(
                                              Properties.ResourceWikiEngine.txtErrorSearchPaternEmpty,
                                              "0"
                                              )
                                          );
                            }
                            return(_WikiFindList(wrtTarget, urlPart[2]));
                        }

                        case WikiRequestType.Put:
                        case WikiRequestType.Del:
                        {
                            throw new WikiEngineErrorPageException(
                                      string.Format(
                                          Properties.ResourceWikiEngine.fmtErrorNSError,
                                          wrtAct.ToString(),
                                          urlPart[2]
                                          )
                                      );
                        }
                        }
                        break;
                    }

                    default:
                    {
                        // wikiPart.Count > 0
                        // namespace and page/file name
                        switch (wrtAct)
                        {
                        case WikiRequestType.Get:
                        {
                            Console.WriteLine("3:default _WikiGetFile: " + urlPart[2]);
                            return(_WikiGetFile(wrtTarget, urlPart[2]));
                        }

                        case WikiRequestType.List:
                        {
                            Console.WriteLine("3:default _WikiGetList: " + " : " + wrtTarget + " : " + urlPart[2]);
                            return(_WikiGetList(wrtTarget, urlPart[2]));
                        }

                        case WikiRequestType.Find:
                        {
                            Console.WriteLine("3:default _WikiFindList: " + " : " + wrtTarget + " : " + urlPart[2] + " : " + wikiPart[(wikiPart.Count - 1)]);
                            int idx = (wikiPart.Count - 1);
                            if (
                                (idx < 0) ||
                                (string.IsNullOrWhiteSpace(wikiPart[idx]))
                                )
                            {
                                throw new WikiEngineSearchException(
                                          string.Format(
                                              Properties.ResourceWikiEngine.txtErrorSearchPaternEmpty,
                                              idx
                                              )
                                          );
                            }
                            return(_WikiFindList(wrtTarget, wikiPart[idx]));
                        }

                        case WikiRequestType.Put:
                        case WikiRequestType.Del:
                        {
                            Console.WriteLine("3:default _WikiPutFile: " + urlPart[2]);
                            if (wfm == null)
                            {
                                throw new WikiEngineAuthException(
                                          string.Format(
                                              Properties.ResourceWikiEngine.fmtErrorMetaEmpty,
                                              urlPart[2]
                                              )
                                          );
                            }
                            if (!wfm.IsAuth)
                            {
                                throw new WikiEngineAuthException(
                                          string.Format(
                                              Properties.ResourceWikiEngine.fmtErrorAuthEmpty,
                                              urlPart[2]
                                              ),
                                          wfm
                                          );
                            }
                            return(this._WikiPutFile(wrtTarget, urlPart[2], wfm));
                        }
                        }
                        break;
                    }
                    }
                    break;
                }

                default:
                {
                    throw new WikiEngineHomePageException(urlPart[0]);
                }
                }
            }
            catch (Exception e)
            {
                if (!this._isMapExceptions)
                {
                    throw e;
                }
            }
            return(null);
        }