public string GetAllObjectText(NavObjectType navObjectType, string filter) { MemoryStream memStream = ReadObjectToStream(filter); memStream.Seek(0, SeekOrigin.Begin); byte[] buffer = new byte[memStream.Length]; memStream.Read(buffer, 0, buffer.Length); string objectText = Encoding.GetEncoding(NavisionEncoding).GetString(buffer); return(CheckTextValid(objectText, navObjectType)); }
public NAVObject(String line) { if (line.IndexOf("OBJECT") != 0) { throw (new InvalidDataException("Not OBJECT line")); } String pattern = "OBJECT (\\w+) (\\d+) (.+)"; string[] parts = Regex.Split(line, pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled); id = Convert.ToInt32(parts[2]); name = parts[3]; type = (NavObjectType)Enum.Parse(typeof(NavObjectType), parts[1], true); }
public void ReadObjectToFStream(NavObjectType navObjectType, int objectId, FileStream fStream) { IntPtr pLEN = Marshal.AllocHGlobal(4); IStream pOutStm; int res = NativeMethods.CreateStreamOnHGlobal(0, true, out pOutStm); String filter = "WHERE(Type=CONST(";//),ID=CONST(3)) switch (navObjectType) { case NavObjectType.Table: filter += "Table"; break; case NavObjectType.Form: filter += "Form"; break; case NavObjectType.Report: filter += "Report"; break; case NavObjectType.Dataport: filter += "Dataport"; break; case NavObjectType.Codeunit: filter += "Codeunit"; break; case NavObjectType.XMLPort: filter += "XMLport"; break; case NavObjectType.Page: filter += "Page"; break; case NavObjectType.MenuSuite: filter += "MenuSuite"; break; } filter += "),ID=CONST(" + objectId.ToString() + "))"; int result = this._objectDesigner.ReadObjects(filter, pOutStm); //int result = this._objectDesigner.ReadObject((int)navObjectType, objectId, pOutStm); pOutStm.Seek(0, 0, pLEN); int cnt, LEN = 4096; byte[] buffer = new byte[LEN]; do { pOutStm.Read(buffer, LEN, pLEN); cnt = Marshal.ReadInt32(pLEN); fStream.Write(buffer, 0, cnt); }while (cnt == LEN); this.ProcessResult(result); }
private static string CheckTextValid(string objectText, NavObjectType navObjectType) { string returnString = objectText.IndexOfAny(new[] { '\0', '\t', '\b' }) != -1 ? null : objectText; if (returnString != null) { return(returnString); } if (navObjectType != NavObjectType.Report) { return(null); } int beginIndex = objectText.IndexOf(" RDLDATA\r\n {", StringComparison.OrdinalIgnoreCase); if (beginIndex == -1) { return(null); } if (objectText.IndexOfAny(new[] { '\0', '\t', '\b' }, 0, beginIndex) != -1) { return(null); } int endIndex = objectText.IndexOf(" END_OF_RDLDATA\r\n }", beginIndex, StringComparison.OrdinalIgnoreCase); if (endIndex == -1) { return(null); } if (objectText.IndexOfAny(new[] { '\0', '\t', '\b' }, endIndex, objectText.Length - endIndex) != -1) { return(null); } return(objectText); }
public void CompileObject(NavObjectType navObjectType, int objectId) { int result = this._objectDesigner.CompileObject((int)navObjectType, objectId); this.ProcessResult(result); }
public void CompileObject(NavObjectType navObjectType, int objectId) { int result = this._objectDesigner.CompileObject((int) navObjectType, objectId); this.ProcessResult(result); }
public MemoryStream ReadObjectToStream(NavObjectType navObjectType, int objectId) { IStream pOutStm = null; CreateStreamOnHGlobal(0, true, out pOutStm); int result = this._objectDesigner.ReadObject((int) navObjectType, objectId, pOutStm); this.ProcessResult(result); return this.ToMemoryStream(pOutStm); }
public NAVObject(NavObjectType _type, int _id, String _name = "") { type = _type; id = _id; name = _name; }