public yArray(string[] pure, Dictionary <ulong, yBlock> LookUp, yObject sender) { Parent = sender; yType = yObjType.Array; string oldkey = string.Empty; int yd = pure.Length; bool nohead = true; PureValueHead = new string[yd]; array = new yObject[yd]; for (int i = 0; i < yd; i++) { if (pure[i].StartsWith("{fileID:")) { array[i] = yElement.mkLinks(pure[i], LookUp, this); } else if (pure[i].StartsWith("{")) { array[i] = new yMultiValue(pure[i]); } else if (pure[i].StartsWith("'")) { array[i] = new yValue(pure[i]); } else { var keypair = pure[i].Split(yElement.Maohao, 2, StringSplitOptions.RemoveEmptyEntries); if (keypair.Length == 2) { nohead = false; var ky = keypair[0].Trim(); if (!String.Equals(oldkey, ky)) { oldkey = ky; } PureValueHead[i] = oldkey; array[i] = yElement.mkpurevalue(keypair[1], LookUp, this); } else { array[i] = new yValue(pure[i]); } } } if (nohead) { PureValueHead = null; } }
public static yObject mkLinks(string g, Dictionary <ulong, yBlock> LookUp, yObject sender) { string[] fyd = g.Split(yMultiValue.kuohao, StringSplitOptions.RemoveEmptyEntries); if (fyd.Length == 2) { return(UnityYAMLAsset.LookUpBlock(fyd[1], LookUp, sender)); } else if (fyd.Length == 6) { return(UnityYAMLAsset.LookUpFile(fyd, sender)); } return(null); }
public yArray(StringGroup[] mixed, Dictionary <ulong, yBlock> LookUp, yObject sender, int qpos) { qnum = qpos; Parent = sender; yType = yObjType.Array; int yd = mixed.Length; array = new yObject[yd]; for (int i = 0; i < yd; i++) { array[i] = new yElement(mixed[i].substr, LookUp, this, mixed[i].substr[0].topstr_n); } }
public static YAMLfile LookUpFile(string[] info, yObject sender) { info[1] = info[1].Trim(); string ky = info[3] = info[3].Trim(); info[5] = info[5].Trim(); YAMLfile yy; if (Guid2File.TryGetValue(ky, out yy)) { int cy = int.Parse(info[1]); if (yy.catalog < 0) { yy.catalog = cy; } else if (yy.catalog != cy) { UnityEngine.Debug.Log($"CurCatalog={cy}, OrigCatalog={yy.catalog}, dummy={yy.isDummy}"); } cy = int.Parse(info[5]); if (yy.usage < 0) { yy.usage = cy; } else if (yy.usage != cy) { UnityEngine.Debug.Log($"CurUse={cy}, OrigUse={yy.usage}, dummy={yy.isDummy}"); } } else { yy = new YAMLfile(info); } yy.refs.Add(sender); return(yy); }
public yElement(StringGroup[] sgplist, Dictionary <ulong, yBlock> LookUp, yObject sender, int qpos) { qnum = qpos; Parent = sender; yType = yObjType.Element; foreach (var sg in sgplist) { if (sg.substr == null) { var keypair = sg.topstr.Split(Maohao, 2, StringSplitOptions.RemoveEmptyEntries); if (keypair.Length == 1) { Fields[keypair[0].Trim()] = null; } else { var jj = mkpurevalue(keypair[1], LookUp, this); jj.qnum = sg.topstr_n; Fields[keypair[0].Trim()] = jj; } } else if (sg.substr[0].topstr[0] == '>') { string[] strarr = isArrayStr(sg.substr); if (strarr == null) { Fields[sg.topstr.Trim()] = new yArray(sg.substr, LookUp, this, sg.topstr_n); } else { Fields[sg.topstr.Trim()] = new yArray(strarr, LookUp, this); } } else { Fields[sg.topstr.Trim()] = new yElement(sg.substr, LookUp, this, sg.topstr_n); } } }
public static yObject mkpurevalue(string g, Dictionary <ulong, yBlock> LookUp, yObject sender) { g = g.Trim(); if (g == "{}") { return(new yMultiValue()); } else if (g == "[]") { return(new yArray()); } else if (g.StartsWith("{fileID:")) { return(mkLinks(g, LookUp, sender)); } else if (g.StartsWith("{")) { return(new yMultiValue(g)); } else { return(new yValue(g)); } }
public static yBlock LookUpBlock(string fidstr, Dictionary <ulong, yBlock> LookUp, yObject sender) { yBlock yy; ulong fid = ulong.Parse(fidstr.Trim()); if (fid == 0) { return(yBlock.fZero); } if (!LookUp.TryGetValue(fid, out yy)) { yy = new yBlock(string.Empty); LookUp[fid] = yy; } yy.refs.Add(sender); return(yy); }