/// <summary>
    /// Runs the search.
    /// </summary>
    private void Search()
    {
        if (!string.IsNullOrEmpty(txtWord.Text))
        {
            string url = SearchResultsPageUrl;

            if (url.StartsWithCSafe("~"))
            {
                url = ResolveUrl(url.Trim());
            }

            if (url.Contains("?"))
            {
                url = URLHelper.RemoveParameterFromUrl(url, "searchtext");
                url = URLHelper.RemoveParameterFromUrl(url, "searchMode");
            }

            url = URLHelper.AddParameterToUrl(url, "searchtext", HttpUtility.UrlEncode(txtWord.Text));
            url = URLHelper.AddParameterToUrl(url, "searchMode", SearchMode.ToString());

            // Log "internal search" activity
            Activity internalSearch = new ActivityInternalSearch(txtWord.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
            internalSearch.Log();

            URLHelper.Redirect(url.Trim());
        }
    }
예제 #2
0
    /// <summary>
    /// Runs the search.
    /// </summary>
    private void Search()
    {
        if (!string.IsNullOrEmpty(txtWord.Text))
        {
            string url = SearchResultsPageUrl;

            if (url.StartsWithCSafe("~"))
            {
                url = ResolveUrl(url.Trim());
            }

            if (url.Contains("?"))
            {
                url = URLHelper.RemoveParameterFromUrl(url, "searchtext");
                url = URLHelper.RemoveParameterFromUrl(url, "searchMode");
            }

            url = URLHelper.AddParameterToUrl(url, "searchtext", HttpUtility.UrlEncode(txtWord.Text));
            url = URLHelper.AddParameterToUrl(url, "searchMode", SearchMode.ToString());

            // Log "internal search" activity
            mPagesActivityLogger.LogInternalSearch(txtWord.Text, DocumentContext.CurrentDocument);

            URLHelper.Redirect(UrlResolver.ResolveUrl(url.Trim()));
        }
    }
예제 #3
0
    /// <summary>
    /// Runs the search.
    /// </summary>
    private void Search()
    {
        if (!string.IsNullOrEmpty(txtWord.Text))
        {
            string url = SearchResultsPageUrl;

            if (url.StartsWith("~"))
            {
                url = ResolveUrl(url.Trim());
            }

            if (url.Contains("?"))
            {
                url = URLHelper.RemoveParameterFromUrl(url, "searchtext");
                url = URLHelper.RemoveParameterFromUrl(url, "searchMode");
            }

            url = URLHelper.AddParameterToUrl(url, "searchtext", HttpUtility.UrlEncode(txtWord.Text));
            url = URLHelper.AddParameterToUrl(url, "searchMode", SearchMode.ToString());

            // Log activity
            string siteName = CMSContext.CurrentSiteName;
            if ((CMSContext.ViewMode == ViewModeEnum.LiveSite) && ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(siteName) &&
                ActivitySettingsHelper.ActivitiesEnabledForThisUser(CMSContext.CurrentUser) &&
                ActivitySettingsHelper.SearchEnabled(siteName))
            {
                ActivityLogProvider.LogInternalSearchActivity(CMSContext.CurrentDocument, ModuleCommands.OnlineMarketingGetCurrentContactID(),
                                                              CMSContext.CurrentSiteID, URLHelper.CurrentRelativePath, txtWord.Text, CMSContext.Campaign);
            }

            URLHelper.Redirect(url.Trim());
        }
    }
예제 #4
0
        protected void CreateSearchParameterList(string newSearch, int searchMode)
        {
            char[]         separator  = new char[] { ' ' };
            string[]       strArray   = newSearch.ToLower().Split(separator);
            List <Element> collection = new List <Element>();
            List <Element> list2      = new List <Element>();

            foreach (Element element in this.m_Tree)
            {
                if (searchMode != 0)
                {
                    string     str  = element.m_Parameter.type.ToString();
                    SearchMode mode = (SearchMode)searchMode;
                    if (str != mode.ToString())
                    {
                        continue;
                    }
                }
                string str2  = element.name.ToLower().Replace(" ", "");
                bool   flag  = true;
                bool   flag2 = false;
                for (int i = 0; i < strArray.Length; i++)
                {
                    string str3 = strArray[i];
                    if (str2.Contains(str3))
                    {
                        if ((i == 0) && str2.StartsWith(str3))
                        {
                            flag2 = true;
                        }
                    }
                    else
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    if (flag2)
                    {
                        collection.Add(element);
                    }
                    else
                    {
                        list2.Add(element);
                    }
                }
            }
            collection.Sort();
            list2.Sort();
            List <Element> list3 = new List <Element>();

            list3.AddRange(collection);
            list3.AddRange(list2);
            this.m_SearchTree = list3.ToArray();
        }
예제 #5
0
 void IXmlSerializable.WriteXml(System.Xml.XmlWriter a)
 {
     a.WriteElementString("DefaultValueGroupId", DefaultValueGroupId.ToString());
     a.WriteElementString("FullName", FullName);
     a.WriteElementString("GroupRoleId", GroupRoleId.ToString());
     a.WriteStartElement("IsAnonymous");
     a.WriteValue(IsAnonymous);
     a.WriteEndElement();
     a.WriteElementString("SearchMode", SearchMode.ToString());
     a.WriteDateTimeOffset(LastActivityDate, "LastActivityDate");
     a.WriteDateTimeOffset(LastUpdatedDate, "LastUpdatedDate");
     a.WriteElementString("ProfileId", ProfileId.ToString());
     a.WriteStartElement("Properties");
     if (Properties != null)
     {
         var b = new XmlSerializer(typeof(ProfileProperty), new XmlRootAttribute("ProfileProperty"));
         foreach (IXmlSerializable i in Properties)
         {
             b.Serialize(a, i);
         }
     }
     a.WriteEndElement();
     a.WriteStartElement("RoleSet");
     if (RoleSet != null)
     {
         ((IXmlSerializable)RoleSet).WriteXml(a);
     }
     a.WriteEndElement();
     a.WriteStartElement("Source");
     if (Source != null)
     {
         ((IXmlSerializable)Source).WriteXml(a);
     }
     a.WriteEndElement();
     a.WriteElementString("SourceId", SourceId.ToString());
     a.WriteElementString("UserId", UserId.ToString());
     a.WriteElementString("UserName", UserName);
     a.WriteStartElement("MarkGroupId");
     if (MarkGroupId.HasValue)
     {
         a.WriteValue(MarkGroupId.Value);
     }
     a.WriteEndElement();
     a.WriteStartElement("SellerTreeId");
     if (SellerTreeId.HasValue)
     {
         a.WriteValue(SellerTreeId.Value);
     }
     a.WriteEndElement();
     a.WriteStartElement("IntermediateId");
     if (IntermediateId.HasValue)
     {
         a.WriteValue(IntermediateId.Value);
     }
     a.WriteEndElement();
 }
        private static void AddInputField()
        {
            //dirty - extract lowercase mode from enum value
            string mode        = searchMode.ToString().Substring(2).ToLower();
            string caption     = "Type object " + mode + ":";
            string description = "Enter the " + mode + "of object to be found";

            GUIContent content = new GUIContent(caption, description);

            typedName = EditorGUILayout.TextField(content, typedName);
            GUILayout.Space(5f);
        }
예제 #7
0
        /// <summary>
        /// A Basic Amazon Search
        /// </summary>
        /// <param name="mode">The search mode to use</param>
        /// <param name="search">The search</param>
        /// <see cref="http://msdn.microsoft.com/coding4fun/web/services/article.aspx?articleid=912260"/>
        public string BasicSearch(SearchMode mode, string search)
        {
            System.Text.StringBuilder details = new StringBuilder("Search Results:\n\n");

            try
            {
                AmazonWebService.KeywordRequest request = new AmazonWebService.KeywordRequest();
                request.locale  = "us";
                request.type    = "lite";
                request.sort    = "reviewrank";
                request.mode    = mode.ToString();
                request.keyword = search;
                request.tag     = accessKeyId;
                request.devtag  = accessKeyId;

                AmazonWebService.AmazonSearchService searchService = new Alexandria.Amazon.AmazonWebService.AmazonSearchService();
                AmazonWebService.ProductInfo         info          = searchService.KeywordSearchRequest(request);
                foreach (AmazonWebService.Details detail in info.Details)
                {
                    details.Append(detail.ProductName + " [ ASIN: " + detail.Asin);
                    if (!string.IsNullOrEmpty(detail.OurPrice))
                    {
                        details.Append(" Amazon: " + detail.OurPrice);
                    }
                    int usedCount;
                    int.TryParse(detail.UsedCount, out usedCount);
                    if (usedCount > 0 && !string.IsNullOrEmpty(detail.UsedPrice))
                    {
                        details.Append(", Used: " + detail.UsedPrice);
                    }
                    details.Append("]\n");

                    System.Diagnostics.Debug.WriteLine("Product Name: " + detail.ProductName);
                }

                return(details.ToString());
            }
            catch (Exception ex)
            {
                throw new AlexandriaException("The was an error attempting to search Amazon", ex);
            }
        }
예제 #8
0
		/// <summary>
		/// A Basic Amazon Search
		/// </summary>
		/// <param name="mode">The search mode to use</param>
		/// <param name="search">The search</param>
		/// <see cref="http://msdn.microsoft.com/coding4fun/web/services/article.aspx?articleid=912260"/>
		public string BasicSearch(SearchMode mode, string search)
		{
			System.Text.StringBuilder details = new StringBuilder("Search Results:\n\n");
		
			try
			{
				AmazonWebService.KeywordRequest request = new AmazonWebService.KeywordRequest();
				request.locale = "us";
				request.type = "lite";
				request.sort = "reviewrank";
				request.mode = mode.ToString();
				request.keyword = search;
				request.tag = accessKeyId;
				request.devtag = accessKeyId;
				
				AmazonWebService.AmazonSearchService searchService = new Alexandria.Amazon.AmazonWebService.AmazonSearchService();
				AmazonWebService.ProductInfo info = searchService.KeywordSearchRequest(request);
				foreach(AmazonWebService.Details detail in info.Details)
				{
					details.Append(detail.ProductName + " [ ASIN: " + detail.Asin);					
					if (!string.IsNullOrEmpty(detail.OurPrice))
						details.Append(" Amazon: " + detail.OurPrice);
					int usedCount;
					int.TryParse(detail.UsedCount, out usedCount);
					if (usedCount > 0 && !string.IsNullOrEmpty(detail.UsedPrice))
						details.Append(", Used: " + detail.UsedPrice);
					details.Append("]\n");
					
					System.Diagnostics.Debug.WriteLine("Product Name: " + detail.ProductName);
				}
				
				return details.ToString();
			}
			catch (Exception ex)
			{
				throw new AlexandriaException("The was an error attempting to search Amazon", ex);
			}
		}
        internal static void FindShortestPathOfPoints_Internal(PathFinder manager, Vector3 startPoint, Vector3 endPoint, PathLineType pathType, Execution execution, SearchMode searchMode, System.Action <List <Vector3> > OnPathFound)
        {
            bool makeItMoreAccurate    = searchMode == SearchMode.Intermediate || searchMode == SearchMode.Complex;
            int  nearestPointFromStart = manager.FindNearestNode(startPoint);
            int  nearestPointFromEnd   = -1;

            if (nearestPointFromStart != -1)
            {
                nearestPointFromEnd = manager.FindNearestNode(endPoint);
            }

            if (QPathFinder.Logger.CanLogInfo)
            {
                QPathFinder.Logger.LogInfo("Nearest point from start" + startPoint + " is " + nearestPointFromStart, true);
            }
            if (QPathFinder.Logger.CanLogInfo)
            {
                QPathFinder.Logger.LogInfo("Nearest point from end:" + endPoint + " is " + nearestPointFromEnd, true);
            }

            if (nearestPointFromEnd == -1 || nearestPointFromStart == -1)
            {
                if (QPathFinder.Logger.CanLogError)
                {
                    QPathFinder.Logger.LogError("Could not find path between " + nearestPointFromStart + " and " + nearestPointFromEnd, true);
                }
                OnPathFound(null);
                return;
            }

            float startTime = Time.realtimeSinceStartup;


            System.Action <List <Node> > onPathOfNodesFound = delegate(List <Node> nodes)
            {
                if (nodes == null || nodes.Count == 0)
                {
                    OnPathFound(null);
                    return;
                }

                List <System.Object> allNodes = new List <System.Object>();
                if (nodes != null)
                {
                    foreach (var a in nodes)
                    {
                        allNodes.Add(a);
                    }
                }

                if (QPathFinder.Logger.CanLogInfo)
                {
                    QPathFinder.Logger.LogInfo("Search Mode " + searchMode.ToString() + " opted", true);
                }

                if (makeItMoreAccurate)
                {
                    if (allNodes.Count > 1)
                    {
                        Vector3 shortestPointOnPath;
                        int     nearestNode    = -1;
                        Path    currentPath    = null;
                        int     shortestPathID = -1;


                        {
                            nearestNode    = ((Node)allNodes[0]).autoGeneratedID;
                            shortestPathID = -1;
                            currentPath    = manager.graphData.GetPathBetween(GetNodeFromNodeOrVector(allNodes, 0), GetNodeFromNodeOrVector(allNodes, 1));

                            if (currentPath != null)
                            {
                                shortestPointOnPath = GetClosestPointOnAnyPath(nearestNode, manager, startPoint, out shortestPathID);

                                if (shortestPathID == currentPath.autoGeneratedID)
                                {
                                    allNodes[0] = shortestPointOnPath;
                                }
                                else
                                {
                                    allNodes.Insert(0, shortestPointOnPath);
                                }
                            }
                            else
                            {
                                if (QPathFinder.Logger.CanLogError)
                                {
                                    QPathFinder.Logger.LogInfo("Error occured while finding path");
                                }
                            }
                        }

                        {
                            shortestPathID = -1;
                            nearestNode    = ((Node)allNodes[allNodes.Count - 1]).autoGeneratedID;
                            currentPath    = manager.graphData.GetPathBetween(GetNodeFromNodeOrVector(allNodes, allNodes.Count - 2), GetNodeFromNodeOrVector(allNodes, allNodes.Count - 1));

                            if (currentPath != null)
                            {
                                shortestPointOnPath = GetClosestPointOnAnyPath(nearestNode, manager, endPoint, out shortestPathID);

                                if (shortestPathID == currentPath.autoGeneratedID)
                                {
                                    allNodes[allNodes.Count - 1] = shortestPointOnPath;
                                }
                                else
                                {
                                    allNodes.Add(shortestPointOnPath);
                                }
                            }
                            else
                            {
                                if (QPathFinder.Logger.CanLogError)
                                {
                                    QPathFinder.Logger.LogInfo("Error occured while finding path");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (QPathFinder.Logger.CanLogWarning)
                        {
                            QPathFinder.Logger.LogWarning("Unable to get the best result due to less node count", true);
                        }
                    }
                }

                List <Vector3> path = null;

                {
                    allNodes.Insert(0, startPoint);
                    allNodes.Add(endPoint);

                    path = (pathType == PathLineType.Straight ? GetStraightPathPoints(allNodes) : GetCatmullRomCurvePathPoints(allNodes));
                }

                if (QPathFinder.Logger.CanLogInfo)
                {
                    for (int i = 1; i < path.Count; i++)
                    {
                        Debug.DrawLine(path[i - 1], path[i], Color.red, QPathFinder.Logger.DrawLineDuration);
                    }
                }

                OnPathFound(path);
            };

            manager.FindShortestPathOfNodes(nearestPointFromStart, nearestPointFromEnd, execution, onPathOfNodesFound);
        }
예제 #10
0
        bool DrawSearch(WindowSettings window, bool changeText2)
        {
            List <Search> searchList = window.searchList;

            if (searchList.Count == 0)
            {
                searchList.Add(new Search());
            }

            bool hasChanged = false;

            for (int i = 0; i < searchList.Count; i++)
            {
                Search     search     = searchList[i];
                SearchMode searchMode = search.mode;

                if (!search.useSearch)
                {
                    GUI.color = Color.grey;
                }
                else if (search.hasSearch)
                {
                    GUI.backgroundColor = GetColor(Color.magenta);
                }

                GUILayout.BeginHorizontal();

                if (GUILayout.Button(Helper.GetGUIContent("Search", windowData.texSearch, "Toggle Search On/Off"), GUILayout.Width(75), GUILayout.Height(21)))
                {
                    search.useSearch = !search.useSearch;
                    hasChanged       = true;
                }
                GUI.backgroundColor = GetColor(Color.white);

                if (i == 0)
                {
                    if (GUILayout.Button(Helper.GetGUIContent("+", "Add another Search Condition"), GUILayout.Width(20)))
                    {
                        searchList.Add(new Search());
                    }
                }
                else
                {
                    if (GUILayout.Button(Helper.GetGUIContent("-", "Remove this Search Condition"), GUILayout.Width(20)))
                    {
                        if (search.useSearch && search.hasSearch)
                        {
                            hasChanged = true;
                        }
                        searchList.RemoveAt(i--);
                        continue;
                    }
                }

                if (GUILayout.Button(Helper.GetGUIContent(searchMode.ToString(), "Toggle between searching for Names/Types"), GUILayout.Width(47)))
                {
                    if (searchMode == SearchMode.Name)
                    {
                        search.mode = SearchMode.Type;
                    }
                    else
                    {
                        search.mode = SearchMode.Name;
                    }

                    if (search.useSearch && search.hasSearch)
                    {
                        hasChanged = true;
                    }
                }

                if (i == 0)
                {
                    // if (searchList.Count > 1) GUILayout.Space(24);
                    if (GUILayout.Button(Helper.GetGUIContent(window.showSearchNonFound ? windowData.texVisible : windowData.texInvisible, "Enabled: Shows all if parent object is unfolded.\n\nDisabled: Shows only found results."), GUILayout.Width(25)))
                    {
                        window.showSearchNonFound = !window.showSearchNonFound;
                    }
                }
                else
                {
                    skin.button.alignment = TextAnchor.MiddleCenter;
                    if (GUILayout.Button(Helper.GetGUIContent(search.condition == SearchCondition.Or ? "||" : "&", "|| = Or\n& = And"), GUILayout.Width(25)))
                    {
                        if (search.useSearch && search.hasSearch)
                        {
                            hasChanged = true;
                        }
                        if (search.condition == SearchCondition.Or)
                        {
                            search.condition = SearchCondition.And;
                        }
                        else
                        {
                            search.condition = SearchCondition.Or;
                        }
                    }
                    skin.button.alignment = TextAnchor.MiddleLeft;
                }

                if (GUILayout.Button(Helper.GetGUIContent("X", "Delete search text"), GUILayout.Width(22)))
                {
                    search.text      = string.Empty;
                    search.hasSearch = false;
                }

                if (search.hasSearch && search.mode == SearchMode.Type && search.types.Count == 0)
                {
                    GUI.color = Color.red;
                }
                GUI.changed = false;
                search.text = GUILayout.TextField(search.text);

                if (search.useSearch || GUI.changed)
                {
                    if (GUI.changed)
                    {
                        hasChanged = true;
                    }
                    search.hasSearch = (search.text != string.Empty);

                    if (search.mode == SearchMode.Type)
                    {
                        FastList <Type> typeList;

                        if (search.text.Contains("[]"))
                        {
                            if (typeNameLookup.TryGetValue(search.text.Replace("[]", ""), out typeList))
                            {
                                search.types.FastClear();
                                search.types.AddRange(typeList);
                                search.MakeArrayTypes();
                            }
                            // Debug.Log(search.type.FullName);
                        }
                        else if (typeNameLookup.TryGetValue(search.text, out typeList))
                        {
                            search.types.FastClear();
                            search.types.AddRange(typeList);
                        }
                        else
                        {
                            search.types.FastClear();
                        }

                        if (search.types.Count > 0 && window == hierarchyWindow && !drawAssemblies.Value && !drawMemory.Value)
                        {
                            for (int j = 0; j < search.types.Count; j++)
                            {
                                if (!search.types.items[j].IsSubclassOf(typeof(Component)))
                                {
                                    search.types.RemoveAt(j--);
                                }
                            }
                        }
                    }
                }

                GUILayout.EndHorizontal();
                GUI.color = Color.white;
            }

            return(hasChanged);
        }
예제 #11
0
 public static string GetSearchThreadUrl(string codeName, int threadID, int postID, SearchMode mode, string searchText)
 {
     return(GetThreadUrl(codeName, threadID) + "?postID=" + postID + "&page=1&SearchMode=" + mode.ToString() + "&searchText=" + searchText);
     //return BbsRouter.GetUrl(string.Format("showthread/{0}/tid-{1}/{2}/pid-{3}/smode-{4}/keyword-{5}", codeName, threadID, 1, postID,mode.ToString(),searchText));
     //string threadUrl = UrlManager.GetFriendlyUrl("ShowThread.html?codename={0}&ThreadID={1}&postID={2}&page=1&SearchMode={3}&searchText={4}", true);
     //return string.Format(threadUrl, codeName, threadID, postID, mode.ToString(), searchText);
 }
예제 #12
0
    public IEnumerator SearchRoutine(float timeStep = 0.1f)
    {
        float timeStart = Time.realtimeSinceStartup;

        yield return(null);

        while (!isComplete)
        {
            if (m_frontierNodes.Count > 0)
            {
                Node currentNode = m_frontierNodes.Dequeue();
                m_iterations++;

                if (!m_exploredNodes.Contains(currentNode))
                {
                    m_exploredNodes.Add(currentNode);
                }

                if (searchMode == SearchMode.BreadthFirst)
                {
                    ExpandFrontierBreadthFirst(currentNode);
                }
                else if (searchMode == SearchMode.Dijkstra)
                {
                    ExpandFrontierDijkstra(currentNode);
                }
                else if (searchMode == SearchMode.GreedyBestFirst)
                {
                    ExpandFrontierGreedyBestFirst(currentNode);
                }
                else if (searchMode == SearchMode.AStar)
                {
                    ExpandFrontierAStar(currentNode);
                }


                if (m_frontierNodes.Contains(m_goalNode))
                {
                    m_pathNodes = GetPathNodes(m_goalNode);
                    if (exitOnGoal)
                    {
                        isComplete = true;
                        Debug.Log("PathFinder Mode: " + searchMode.ToString() +
                                  "  Path Length = " + m_goalNode.distanceTraveled.ToString());
                    }
                }

                if (showIterations)
                {
                    ShowDiagnostics(true, 0.5f);
                    yield return(new WaitForSeconds(timeStep));
                }
            }
            else
            {
                isComplete = true;
            }
        }

        ShowDiagnostics(true, 0.5f); // 最后在调用一下ShowDiagnostics()来应对当 showIterations == false 时计算完成后调用一次
        Debug.Log("PathFinder SearchRoutine: Elapse Time = " + (Time.realtimeSinceStartup - timeStart).ToString() + " seconds");
    }
예제 #13
0
 public static string GetSearchThreadUrl(string codeName, int threadID, int postID, SearchMode mode, string searchText)
 {
     return GetThreadUrl(codeName, threadID) + "?postID=" + postID + "&page=1&SearchMode=" + mode.ToString() + "&searchText=" + searchText;
     //return BbsRouter.GetUrl(string.Format("showthread/{0}/tid-{1}/{2}/pid-{3}/smode-{4}/keyword-{5}", codeName, threadID, 1, postID,mode.ToString(),searchText));
     //string threadUrl = UrlManager.GetFriendlyUrl("ShowThread.html?codename={0}&ThreadID={1}&postID={2}&page=1&SearchMode={3}&searchText={4}", true);
     //return string.Format(threadUrl, codeName, threadID, postID, mode.ToString(), searchText);
 }
예제 #14
0
        static int Main(string[] args)
        {
            bool   printHelp        = true;
            bool   printHeader      = true;
            string currentDirectory = System.Environment.CurrentDirectory;
            List <KeyValuePair <SearchMode, string> > hashCommands = new List <KeyValuePair <SearchMode, string> >();
            HashAlgorithms selectedHash = HashAlgorithms.sha265;

            if (args.Length == 1)
            {
                if (args[0] == "-?" || args[0] == "--help")
                {
                    PrintHelpMessage();
                    return(0);
                }
                if (args[0] == "-v" || args[0] == "--version")
                {
                    Console.WriteLine("checksum for Windows by Max Zoeller - Version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
                    return(0);
                }
            }
            // Evaluate Parameters, change parameters, save hash commands
            if (args.Length > 0)
            {
                for (int thisArg = 0; thisArg < args.Length; thisArg++)
                {
                    if (args[thisArg] == "-h" || args[thisArg] == "--hash")
                    {
                        if (args.Length <= thisArg + 1)
                        {
                            PrintHelpMessage("Hash-Algorythm not selected.");
                            return(1);
                        }
                        switch (args[++thisArg].ToLower())
                        {
                        case "md5":
                            selectedHash = HashAlgorithms.md5;
                            break;

                        case "sha1":
                            selectedHash = HashAlgorithms.sha1;
                            break;

                        case "sha256":
                            selectedHash = HashAlgorithms.sha265;
                            break;

                        case "sha384":
                            selectedHash = HashAlgorithms.sha384;
                            break;

                        case "sha512":
                            selectedHash = HashAlgorithms.sha512;
                            break;

                        default:
                            PrintHelpMessage("Unknown hash algorithm selected.");
                            return(1);
                        }
                    }

                    if (args[thisArg] == "-n" || args[thisArg] == "--no-header")
                    {
                        printHeader = false;
                        continue;
                    }
                    if (args[thisArg] == "-s" || args[thisArg] == "--string")
                    {
                        if (args.Length <= thisArg + 1)
                        {
                            PrintHelpMessage("String to be hashed is missing.");
                            return(1);
                        }
                        hashCommands.Add(new KeyValuePair <SearchMode, string>(SearchMode.String, args[++thisArg]));
                        continue;
                    }
                    if (args[thisArg] == "-f" || args[thisArg] == "--file" || args[thisArg] == "-d" || args[thisArg] == "--directory")
                    {
                        SearchMode searchMode = SearchMode.File;
                        if (args[thisArg] == "-d" || args[thisArg] == "--directory")
                        {
                            searchMode = SearchMode.Directory;
                        }

                        if (args.Length <= thisArg + 1)
                        {
                            PrintHelpMessage($"Path to {searchMode.ToString().ToLower()} is not provided.");
                            return(1);
                        }
                        hashCommands.Add(new KeyValuePair <SearchMode, string>(searchMode, args[++thisArg]));
                        continue;
                    }
                }
            }
            foreach (KeyValuePair <SearchMode, string> hashCommand in hashCommands)
            {
                if (hashCommand.Key == SearchMode.String)
                {
                    string outputHash = GetStringHash(selectedHash, hashCommand.Value);
                    PrintHeader(printHeader);
                    Console.WriteLine($"{outputHash} : \"{hashCommand.Value}\"");
                    printHelp = false;
                    continue;
                }
                else
                {
                    string originalPattern = hashCommand.Value;

                    // Get directory and file parts of complete relative pattern
                    string[] files;
                    if (hashCommand.Key == SearchMode.File)
                    {
                        // Get directory and file parts of complete relative pattern
                        string pattern = Path.GetFileName(originalPattern);
                        string relDir  = originalPattern.Substring(0, originalPattern.Length - pattern.Length);
                        // Get absolute path (root+relative)
                        string absPath = Path.GetFullPath(Path.Combine(currentDirectory, relDir));
                        // Search files mathing the pattern
                        files = Directory.GetFiles(absPath, pattern, SearchOption.TopDirectoryOnly);
                    }
                    else
                    {
                        // Get directory part of complete relative pattern
                        string pattern = originalPattern;
                        // Get absolute path (root+relative)
                        string absPath = Path.GetFullPath(Path.Combine(currentDirectory, pattern));
                        if (!Directory.Exists(absPath))
                        {
                            PrintHelpMessage($"Directory \"{absPath}\" not found.");
                            return(1);
                        }
                        // Search files mathing the pattern
                        files = Directory.GetFiles(absPath);
                    }
                    if (files.Length == 0)
                    {
                        PrintHelpMessage("File(s) not found.");
                        return(1);
                    }
                    PrintHeader(printHeader);
                    foreach (string file in files)
                    {
                        FileInfo inputFile  = new FileInfo(file);
                        string   outputHash = GetFileHash(selectedHash, inputFile);
                        Console.WriteLine($"{outputHash} : {inputFile.Name}");
                    }
                    printHelp = false;
                    continue;
                }
            }
            if (printHelp)
            {
                PrintHelpMessage();
            }
            return(0);
        }