Example #1
0
 static void AnalyzeEx(string data)
 {
     char[] buff = data.ToCharArray();
     c_buff = CharOperation.DeleteChar(ref buff, '\\');
     //Debug.WriteLine(new string(c_buff));
     if (create)
     {
         Analyze();
     }
     else
     {
         load = true;
     }
     loading = false;
 }
Example #2
0
 static void SharpChanged(int index)
 {
     if (index < 0)
     {
         return;
     }
     va.ChangeSharpA(index, (s) => {
         va.GetAddress(ref vic);
         string str;
         if (vic.type == 1)
         {
             str = vic.href;
         }
         else
         {
             str = vic.href + (current.play_part + 1).ToString() + vic.vkey;
         }
         me.Source = new Uri(str);
     });
     char[] c = vic.sharp[index].ToCharArray();
     Sharp = CharOperation.CharToInt(ref c);
 }
Example #3
0
        double CalcualArea(int s)
        {
            List <UpContent> lu = lci[s].detail_s;

            if (s >= lup.Count)
            {
                lup.Add(AreaLayout(lu, s));
            }
            else if (ls[s].width == width)
            {
                return(ls[s].height);
            }
            UIPoint[] up = lup[s];
            //0=all,1=left,2=right,3=piece
            int    c      = lu.Count;
            double ox     = 0;
            double oy     = 0;
            int    count  = (int)(width / 15.6f);
            int    count1 = count - 9;
            int    count2 = count - 7;

            for (int i = 0; i < c; i++)
            {
                if (lu[i].type == 'i')
                {
                    switch (up[i].layout)
                    {
                    case 0:
                        up[i].ox = ox;
                        up[i].oy = oy;
                        ox      += 140;
                        if (ox >= width)
                        {
                            ox  = 0;
                            oy += 144;
                        }
                        break;

                    case 1:
                        if (lu[i].width > lu[i].height)
                        {
                            up[i].ox = 5;
                            up[i].oy = oy - 18;
                        }
                        else
                        {
                            up[i].ox = -15;
                            up[i].oy = oy;
                        }
                        break;

                    case 2:
                        up[i].ox = width - 140;
                        up[i].oy = oy;
                        ox       = 0;
                        break;

                    case 3:
                        up[i].ox = ox;
                        up[i].oy = oy;
                        ox      += 140;
                        if (ox + 140 >= width)
                        {
                            ox  = 0;
                            oy += 140;
                        }
                        break;
                    }
                }
                else
                {
                    switch (up[i].layout)
                    {
                    case 0:
                        if (i > 0)
                        {
                            if (up[i - 1].layout == 3)
                            {
                                oy += 140;
                            }
                        }
                        up[i].oy = oy;
                        int    row;
                        char[] t = CharOperation.CharWarp(lu[i].text, count, out row);
                        up[i].content = new string(t);
                        up[i].width   = width;
                        int h = row * 20;
                        up[i].height = h;
                        oy          += h;
                        break;

                    default:
                        int a;
                        if (up[i].layout == 1)
                        {
                            a = i + 1;
                        }
                        else
                        {
                            a = i - 1;
                        }
                        if (lu[a].width > lu[a].height)
                        {
                            t = CharOperation.CharWarp(lu[i].text, count1, 5, count, out row);
                            if (up[i].layout == 2)
                            {
                                t = CharOperation.CharInsertSpace(ref t, 5, 36);
                            }
                        }
                        else
                        {
                            t = CharOperation.CharWarp(lu[i].text, count2, 8, count, out row);
                            if (up[i].layout == 2)
                            {
                                t = CharOperation.CharInsertSpace(ref t, 8, 28);
                            }
                        }
                        up[i].oy      = oy;
                        up[i].content = new string(t);
                        up[i].width   = width;
                        row++;
                        h            = row * 20;
                        up[i].height = h;
                        if (up[i].layout == 1)
                        {
                            if (lu[a].width > lu[a].height)
                            {
                                up[a].oy = oy - 18;
                                up[a].ox = width - 150;
                            }
                            else
                            {
                                up[a].oy = oy + 4;
                                up[a].ox = width - 130;
                            }
                            i++;
                        }
                        if (h < 144)
                        {
                            oy += 144;
                        }
                        else
                        {
                            oy += h;
                        }
                        break;
                    }
                }
            }
            if (c > 0)
            {
                if (up[c - 1].layout == 3)
                {
                    oy += 140;
                }
            }
            return(oy + 84);
        }
Example #4
0
        async static void StartMissionNextPart(int index)
        {
            ls :;
            byte[] b = current[index].progress;
            int    e = b.Length;
            int    s = current[index].part;

            for (int i = s; i < e; i++)
            {
                if (b[i] == 0)
                {
                    current[index].part = i; goto ss;
                }
            }
            current[index].index = -1;
            return;

            ss :;
            if (current[index].sf == null)
            {
                current[index].sf = await rsf.CreateFolderAsync(current[index].vid, CreationCollisionOption.OpenIfExists);
            }
            int         part = current[index].part;
            StorageFile ss   = await current[index].sf.CreateFileAsync(part.ToString(), CreationCollisionOption.ReplaceExisting);
            VideoInfo   vic  = current[index].vic;

            current[index].part++;
            string str;

            if (vic.type == 1)
            {
                str = vic.href;
            }
            else
            {
                str = vic.href + (part + 1).ToString() + vic.vkey + "&guid=" + vic.cmd5[part];
            }
            current[index].dp = BD.CreateDownload(new Uri(str), ss);
            switch (Setting.buffinterval)
            {
            case 0:
                current[index].delay = 120;
                break;

            case 1:
                current[index].delay = 30;
                break;

            case 2:
                current[index].delay = 60;
                break;

            case 3:
                current[index].delay = 90;
                break;

            default:
                current[index].delay = 150;
                break;
            }
            try
            {
                await current[index].dp.StartAsync();
                int   c = current[index].index;
                current[index].progress[part] = 1;
                part++;
                current[index].done++;
                Mission m = lm[c];
                m.done     = (byte)current[index].done;
                m.progress = current[index].progress;
                if (part >= current[index].max)
                {
                    current[index].index = -1;
                }
                if (current[index].done >= current[index].max)
                {
                    m.status             = 2;
                    m.done               = 1;
                    current[index].index = -1;
                }
                m.month = (byte)DateTime.Now.Month;
                m.day   = (byte)DateTime.Now.Day;
                m.hour  = (byte)DateTime.Now.Hour;
                m.min   = (byte)DateTime.Now.Minute;
                lm[c]   = m;
            }
            catch (Exception ex)
            {
                char[] temp = ex.Message.ToCharArray();
                if (CharOperation.FindCharArray(ref temp, ref error403, 0) > 0)
                {
                    Main.Notify("错误403: " + current[index].vic.tilte + "分段" + part.ToString()
                                + " 已被<<腾讯大大>>禁止访问", Component.warning_brush);
                }
                else
                {
                    Main.Notify(ex.Message, Component.warning_brush);
                }
                int     c = current[index].index;
                Mission m = lm[c];
                current[index].part++;
                part++;
                m.month  = (byte)DateTime.Now.Month;
                m.day    = (byte)DateTime.Now.Day;
                m.hour   = (byte)DateTime.Now.Hour;
                m.min    = (byte)DateTime.Now.Minute;
                m.status = 1;
                lm[c]    = m;
                if (part >= current[index].max)
                {
                    current[index].index = -1;
                }
                else
                {
                    goto ls;
                }
            }
        }