Ejemplo n.º 1
0
        public async Task <JObject> HitomiGalleryInfo()
        {
            gstring html = await Load(url);

            JObject jObject = JObject.Parse(html.Replace("var galleryinfo = ", ""));

            return(jObject);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 字符串连接
 /// </summary>
 public static string c(object argv = null, object arg1 = null, object arg2 = null, object arg3 = null,
                        object arg4 = null, object arg5 = null, object arg6 = null, object arg7 = null)
 {
     using (gstring.Block()) {
         if (argv == null)
         {
             Debugger.LogError("argv cannot null!!");
             return(null);
         }
         gstring result = argv.ToString();
         if (arg1 != null)
         {
             gstring argv1 = arg1.ToString();
             result = result + argv1;
         }
         if (arg2 != null)
         {
             gstring argv2 = arg2.ToString();
             result = result + argv2;
         }
         if (arg3 != null)
         {
             gstring argv3 = arg3.ToString();
             result = result + argv3;
         }
         if (arg4 != null)
         {
             gstring argv4 = arg4.ToString();
             result = result + argv4;
         }
         if (arg5 != null)
         {
             gstring argv5 = arg5.ToString();
             result = result + argv5;
         }
         if (arg6 != null)
         {
             gstring argv6 = arg6.ToString();
             result = result + argv6;
         }
         if (arg7 != null)
         {
             gstring argv7 = arg7.ToString();
             result = result + argv7;
         }
         return(result.Intern());
     }
 }
Ejemplo n.º 3
0
    private void Start()
    {
        //gstring a = "a";
        using (gstring.Block())
        {
            gstring.gstring_block block01 = gstring.g_current_block;
            gstring.gstring_block block02;
            using (gstring.Block())
            {
                block02 = gstring.g_current_block;
            }
            gstring.gstring_block block03 = gstring.g_current_block;

            Debug.Log(object.ReferenceEquals(block01, block02)); //False  False
            Debug.Log(object.ReferenceEquals(block01, block03)); //False  True
            Debug.Log(object.ReferenceEquals(block02, block03)); //False   false
        }
        gstring b = "a";
    }
Ejemplo n.º 4
0
    void gstringTest()
    {
        using (profiler.Sample("gstring"))
        {
            using (gstring.Block())
            {
                using (profiler.Sample("Format"))
                {
                    gstring gf = gstring.Format("Number = {0}, Float = {1} String = {2}", 123, 3.148f, "Text");
                    int     x  = 10;
                }

                using (profiler.Sample("Concat"))
                {
                    gstring it = gstring.Concat("That's ", "a lot", " of", " strings", " to ", "concat");
                    int     x  = 10;
                }

                using (profiler.Sample("Substring + IndexOf + LastIndexOf"))
                {
                    gstring path   = "Path/To/Some/File.txt";
                    int     period = path.IndexOf('.');
                    var     ext    = path.Substring(period + 1);
                    var     file   = path.Substring(path.LastIndexOf('/') + 1, 4);
                    int     x      = 10;
                }

                using (profiler.Sample("Replace (char)"))
                {
                    gstring input       = "This is some sort of text";
                    gstring replacement = input.Replace('o', '0').Replace('i', '1');
                    int     x           = 10;
                }

                using (profiler.Sample("Replace (string)"))
                {
                    gstring input       = "m_This is the is is form of text";
                    gstring replacement = input.Replace("m_", "").Replace("is", "si");
                    int     x           = 10;
                }
                using (profiler.Sample("Concat + Intern"))
                {
                    for (int i = 0; i < 4; i++)
                    {
                        dict[gstring.Concat("Item", i).Intern()] = i;
                    }
                    outsideString1 = gstring.Concat("I'm ", "long ", "gone ", "by ", "the ", "end ", "of ", "this ", "gstring block");
                    outsideString  = gstring.Concat("I'll ", "be ", "still ", "around ", "here").Intern();
                    int x = 10;
                }

                using (profiler.Sample("ToUpper + ToLower"))
                {
                    gstring s1 = "Hello";
                    gstring s2 = s1.ToUpper();
                    gstring s3 = s2 + s1.ToLower();
                    int     x  = 10;
                }
                if (!bigStringTest)
                {
                    return;
                }
                using (profiler.Sample("BigStringEval"))
                {
                    gstring s1 = bigString;
                    gstring s2 = s1 + "hello";
                }
            }
        }
    }
Ejemplo n.º 5
0
    void Update()
    {
        using (profiler.Sample("gstring"))
        {
            using (gstring.Block())
            {
                using (profiler.Sample("Format"))
                {
                    gstring gf = gstring.Format("Number = {0}, Float = {1} String = {2}", 123, 3.148f, "Text");
                    int     x  = 10; // declare an int, just so we can step over to it and inspect values when debugging
                }

                using (profiler.Sample("Concat"))
                {
                    gstring it = gstring.Concat("That's ", "a lot", " of", " strings", " to ", "concat");
                    int     x  = 10;
                }

                using (profiler.Sample("Substring + IndexOf + LastIndexOf"))
                {
                    gstring path   = "Path/To/Some/File.txt";
                    int     period = path.IndexOf('.');
                    var     ext    = path.Substring(period + 1);
                    var     file   = path.Substring(path.LastIndexOf('/') + 1, 4);
                    int     x      = 10;
                }

                using (profiler.Sample("Replace (char)"))
                {
                    gstring input       = "This is some sort of text";
                    gstring replacement = input.Replace('o', '0').Replace('i', '1');
                    int     x           = 10;
                }

                using (profiler.Sample("Replace (string)"))
                {
                    gstring input       = "m_This is the is is form of text";
                    gstring replacement = input.Replace("m_", "").Replace("is", "si");
                    int     x           = 10;
                }

                using (profiler.Sample("Concat + Intern"))
                {
                    for (int i = 0; i < 4; i++)
                    {
                        dict[gstring.Concat("Item", i).Intern()] = i;
                    }
                    outsideString1 = gstring.Concat("I'm ", "long ", "gone ", "by ", "the ", "end ", "of ", "this ", "gstring block");
                    outsideString  = gstring.Concat("I'll ", "be ", "still ", "around ", "here").Intern();
                    int x = 10;
                }

                using (profiler.Sample("ToUpper + ToLower"))
                {
                    gstring s1 = "Hello";
                    gstring s2 = s1.ToUpper();
                    gstring s3 = s2 + s1.ToLower();
                    int     x  = 10;
                }
            }
        }

        //using (profiler.Sample("string"))
        //{
        //    using (profiler.Sample("Format"))
        //    {
        //        string gf = string.Format("Number = {0}, Float = {1} String = {2}", 123, 3.148f, "Text");
        //        int x = 10;
        //    }

        //    using (profiler.Sample("Concat"))
        //    {
        //        string it = string.Concat("That's ", "a lot ", " of", " strings", " to ", "concat");
        //        int x = 10;
        //    }

        //    using (profiler.Sample("Substring + IndexOf + LastIndexOf"))
        //    {
        //        string path = "Path/To/Some/File.txt";
        //        int period = path.IndexOf('.');
        //        var ext = path.Substring(period + 1);
        //        var file = path.Substring(path.LastIndexOf('/') + 1, 4);
        //        int x = 10;
        //    }

        //    using (profiler.Sample("Replace (char)"))
        //    {
        //        string input = "This is some sort of text";
        //        string replacement = input.Replace('o', 'O').Replace('i', 'I');
        //        int x = 10;
        //    }

        //    using (profiler.Sample("Replace (string)"))
        //    {
        //        string input = "m_This is the is is form of text";
        //        string replacement = input.Replace("m_", "").Replace("is", "si");
        //        int x = 10;
        //    }

        //    using (profiler.Sample("ToUpper + ToLower"))
        //    {
        //        string s1 = "Hello";
        //        string s2 = s1.ToUpper();
        //        string s3 = s2 + s1.ToLower();
        //        int x = 10;
        //    }

        //}
    }
Ejemplo n.º 6
0
 public static bool ispostfix(this gstring str, string postfix)
 {
     return(str.EndsWith(postfix));
 }
Ejemplo n.º 7
0
 public static bool IsPrefix(this gstring str, string value)
 {
     return(str.StartsWith(value));
 }
Ejemplo n.º 8
0
 public static bool IsNullOrEmpty(this gstring str)
 {
     return(str == null || str.Length == 0);
 }