コード例 #1
0
ファイル: Utils.cs プロジェクト: codemerx/CodemerxDecompile
 public static string GenerateSlug(string str, bool hierarchical = true)
 {
     if (App.get_Hooks() != null && App.get_Hooks().get_OnGenerateSlug() != null)
     {
         return(App.get_Hooks().get_OnGenerateSlug().Invoke(str));
     }
     V_0 = str.Trim().ToLower();
     V_0 = V_0.Replace("å", "a").Replace("ä", "a").Replace("á", "a").Replace("à", "a").Replace("ö", "o").Replace("ó", "o").Replace("ò", "o").Replace("é", "e").Replace("è", "e").Replace("í", "i").Replace("ì", "i");
     V_0 = Regex.Replace(V_0, "[^a-z0-9-/ ]", "").Replace("--", "-");
     V_0 = Regex.Replace(V_0.Replace("-", " "), "\\s+", " ").Replace(" ", "-");
     if (!hierarchical)
     {
         V_0 = V_0.Replace("/", "-");
     }
     V_0 = Regex.Replace(V_0, "[-]+", "-");
     if (V_0.EndsWith("-"))
     {
         V_0 = V_0.Substring(0, V_0.LastIndexOf("-"));
     }
     if (V_0.StartsWith("-"))
     {
         V_0 = V_0.Substring(Math.Min(V_0.IndexOf("-") + 1, V_0.get_Length()));
     }
     return(V_0);
 }
コード例 #2
0
 private string GetFriendlyGenericName(TypeReference typeReference)
 {
     V_0 = typeReference.GetFriendlyTypeName(null, "<", ">");
     if (V_0.Contains("<"))
     {
         V_0 = V_0.Substring(0, V_0.IndexOf('<'));
     }
     return(V_0);
 }
コード例 #3
0
 private bool IsTempVariable(VariableReference variable)
 {
     V_0 = this.methodContext.get_VariableDefinitionToNameMap().get_Item(variable.Resolve());
     if (!V_0.StartsWith("CS$") && !V_0.StartsWith("VB$") && V_0.IndexOf("__init") <= 0 && !V_0.StartsWith("stackVariable") && !V_0.StartsWith("exception_"))
     {
         return(false);
     }
     return(true);
 }
コード例 #4
0
 private string GetMethodName(MethodDefinition method)
 {
     V_0 = method.GetFriendlyMemberName(null);
     if (V_0.Contains("<"))
     {
         V_0 = V_0.Substring(0, V_0.IndexOf("<"));
     }
     if (method.get_IsGetter() && V_0.IndexOf("get_") == 0 || method.get_IsSetter() && V_0.IndexOf("set_") == 0)
     {
         return(V_0.Substring(4));
     }
     if (!method.get_IsConstructor())
     {
         return(V_0);
     }
     return(method.get_DeclaringType().GetFriendlyTypeName(this.context.get_Language(), "<", ">"));
 }