Ejemplo n.º 1
0
Archivo: u3d.cs Proyecto: Klanly/ncnn
        public static void q2str(string[] g, qStringGroup qs, StringGroup sg)
        {
            int y = qs.substr.Count;

            if (y == 0)
            {
                return;
            }

            if (y > 1)
            {
                if (qs.substr[0].topstr == -1 && qs.substr[1].topstr != -1)
                {
                    fixqs(qs);
                    y = qs.substr.Count;
                }
            }


            sg.substr = new StringGroup[y];
            for (int i = 0; i < y; i++)
            {
                var nsg = new StringGroup(g, qs.substr[i].topstr);
                sg.substr[i] = nsg;
                q2str(g, qs.substr[i], nsg);
            }
        }
Ejemplo n.º 2
0
Archivo: u3d.cs Proyecto: Klanly/ncnn
        public void Load(string metapath, yElement metain, string[] txt)
        {
            int len = UnityYAMLAsset.GameBase.Length + 1;

            Path = metapath.Substring(len, metapath.Length - len - 5);
            meta = metain;



            List <int>   addrlist = new List <int>();
            List <ulong> idlist   = new List <ulong>();

            len = txt.Length;
            for (int i = 2; i < len; i++)
            {
                if (txt[i].StartsWith("--- !u!"))
                {
                    addrlist.Add(i);
                    string[] paar = txt[i].Substring(7).Split(kongge, StringSplitOptions.RemoveEmptyEntries);
                    ulong    idd  = ulong.Parse(paar[1]);
                    idlist.Add(idd);
                    Blocks[idd] = new yBlock(this, int.Parse(paar[0]), idd);
                }
            }

            addrlist.Add(len);
            len = addrlist.Count - 1;



            for (int i = 0; i < len; i++)
            {
                int start = addrlist[i];
                int end   = addrlist[i + 1];



                Blocks[idlist[i]].Load(StringGroup.Parse(txt, start + 1, end), Blocks);
            }
            isDummy = false;
        }
Ejemplo n.º 3
0
Archivo: u3d.cs Proyecto: Klanly/ncnn
 public void Load(StringGroup sgp, Dictionary <ulong, yBlock> LookUp)
 {
     qnum     = sgp.topstr_n;
     ClassStr = sgp.topstr;
     content  = new yElement(sgp.substr, LookUp, this, sgp.topstr_n + 1);
 }
Ejemplo n.º 4
0
Archivo: u3d.cs Proyecto: Klanly/ncnn
        public static YAMLfile Create(string path)
        {
            if (!File.Exists(path))
            {
                path = UnityYAMLAsset.GameBase + '\\' + path;
            }

            string azet = path.Substring(0, path.Length - 5).ToLower();

            if (!File.Exists(azet))
            {
                return(null);
            }


            var    tmpmeta = new yElement(StringGroup.Parse(File.ReadAllLines(path), 0, -1).substr, null, null, 0);
            bool   isDm    = false;
            string rtig    = null;

            string[] txt = null;

            foreach (var tig in nonYAML)
            {
                if (azet.EndsWith(tig))
                {
                    isDm = true;
                    rtig = tig;
                    goto aftalo;
                }
            }



            txt = File.ReadAllLines(azet);

            if (!txt[0].StartsWith("%YAML"))
            {
                return(null);
            }



aftalo:

            azet = ((yValue)tmpmeta.Fields["guid"]).ToString();

            YAMLfile yaoi;

            if (!UnityYAMLAsset.Guid2File.TryGetValue(azet, out yaoi))
            {
                if (isDm)
                {
                    yaoi = new YAMLfile(path, tmpmeta, rtig);
                }
                else
                {
                    yaoi = new YAMLfile(path, tmpmeta, txt);
                }

                UnityYAMLAsset.Guid2File[azet] = yaoi;
            }

            if (yaoi.isDummy)
            {
                if (isDm)
                {
                    yaoi.LoadnonYAML(path, tmpmeta, rtig);
                }
                else
                {
                    yaoi.Load(path, tmpmeta, txt);
                }
            }


            return(yaoi);
        }
Ejemplo n.º 5
0
Archivo: u3d.cs Proyecto: Klanly/ncnn
        public static StringGroup Parse(string[] g, int start, int endpos)
        {
            if (endpos < 0)
            {
                endpos = g.Length;
            }

            qStringGroup root  = new qStringGroup(-2);
            qStringGroup moth  = root;
            qStringGroup lastt = root;

            int curind = qStringGroup.CountInd(g[start]).a;

            for (int i = start; i < endpos; i++)
            {
                bswap nxindbs = qStringGroup.CountInd(g[i]);
                int   nxind   = nxindbs.a;

                g[i] = g[i].Substring(nxind * 2);
                qStringGroup nxsg = new qStringGroup(i);

                if (nxind > curind)
                {
                    moth = lastt;
                }
                else if (nxind < curind)
                {
                    moth = qStringGroup.GetNParent(moth, curind - nxind);
                }


                if (nxindbs.b == 1)
                {
                    if (moth.isArrayHead)
                    {
                        moth = moth.parent;
                    }

                    moth = qStringGroup.MakeZu(moth, nxsg);
                }
                else
                {
                    moth.substr.Add(nxsg);
                    qStringGroup.setmoth(moth, nxsg);
                }



                lastt  = nxsg;
                curind = nxind;
            }

            if (root.substr.Count == 1)
            {
                var vroot = root.substr[0];
                root.substr = null;
                root        = vroot;
                root.parent = null;
            }

            StringGroup Realroot = new StringGroup(g, root.topstr);

            q2str(g, root, Realroot);

            return(Realroot);
        }