protected static FuzzyTable GetBytes(Stream stream) { BinaryReader r = new BinaryReader(stream); int check1, check2, x, y, z, d; check1 = ReadLong(r); d = r.ReadInt32(); x = r.ReadInt32(); y = r.ReadInt32(); z = r.ReadInt32(); //Console.WriteLine("c1" + check1.ToString() + "d" + d.ToString() + "x" + x.ToString() + "y" + y.ToString() + "z" + z.ToString()); check2 = r.ReadInt32(); FuzzyTable ft = new FuzzyTable(x, y, z); ft.dimension = d; for (int i = 0; i < z; i++) { for (int j = 0; j < y; j++) { for (int k = 0; k < x; k++) { ft.value[k, j, i] = r.ReadInt16(); } } } return(ft); }
static protected FuzzyTable GetDocument(XmlNode node) { int d = 3, x = 1, y = 1, z = 1; foreach (XmlAttribute a in node.Attributes) { if (a.Name == "dimension") { d = GetInt(a); } else if (a.Name == "xsize") { x = GetInt(a); } else if (a.Name == "yszie") { y = GetInt(a); } else if (a.Name == "zsize") { z = GetInt(a); } } int zc = -1, yc = 0, xc = 0; FuzzyTable ft = new FuzzyTable(x, y, z); ft.dimension = d; foreach (XmlNode z_Node in node.ChildNodes) { foreach (XmlNode y_Node in z_Node.ChildNodes) { foreach (XmlNode x_Node in y_Node.ChildNodes) { ft[xc, yc, zc] = GetShort(x_Node); xc += 1; } yc += 1; xc = 0; } zc += 1; yc = 0; xc = 0; } return(ft); }
public object _dump(Stream stream, XmlNode node) { return(FuzzyTable.GetDocument(node)); }
public object _dump(Stream stream, byte[] bytes) { return(FuzzyTable.GetBytes(stream)); }