Tested DevEnv Interface, fixed up several Code Contract errors / misuses.
Added Export as an DevEnv interface function, exporting a single object to txt. Builds a filter string and writes the whole stuff out. Works like a breeze. Added Charset conversion for finsql.exe result values (command output and error log), which uses something similar (but not quite) to CP850. For any error message, this should be enough, however, be aware that the format of the TXT files generated by ExportObject is in the same strange encoding. Details can be found here: http://forum.mibuso.com/discussion/37078/encoding-of-exported-navision-objects-txt-files It should be considered if it makes sense to normalize the objects as best as possible into the Unicode plane and convert them back on exit - though this will probably generate a whole different set problems when automating Build jobs. For now, leave it as-is, better safe than sorry.
This commit is contained in:
@ -52,7 +52,7 @@ namespace NavScm.NavInterface
|
||||
partial void OnLoaded()
|
||||
{
|
||||
Contract.Requires(Company_Name.Length == 0);
|
||||
Contract.Requires(Type >= 0 && Type <= 9 && Type != 2 && Type != 4 );
|
||||
Contract.Requires(Type >= 1 && Type <= 9 && Type != 2 && Type != 4 );
|
||||
/*
|
||||
if (Company_Name.Length > 0)
|
||||
throw new InvalidOperationException($"The object {CacheKey} holds a variant with the company name {Company_Name}, which is unsupported");
|
||||
@ -93,6 +93,27 @@ namespace NavScm.NavInterface
|
||||
get { return Date.Add(Time.TimeOfDay); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a filter string suitable to filter the NAV Object table during finsql operation.
|
||||
/// </summary>
|
||||
/// <returns>Filter-String usable f.x. in ExportObjects.</returns>
|
||||
[Pure]
|
||||
public string GetFilter()
|
||||
{
|
||||
switch(NavType)
|
||||
{
|
||||
case NavObjectType.Codeunit: return $"Type=Codeunit;ID={ID}";
|
||||
case NavObjectType.MenuSuite: return $"Type=MenuSuite;ID={ID}";
|
||||
case NavObjectType.Page: return $"Type=Page;ID={ID}";
|
||||
case NavObjectType.Query: return $"Type=Query;ID={ID}";
|
||||
case NavObjectType.Report: return $"Type=Report;ID={ID}";
|
||||
case NavObjectType.Table: return $"Type=Table;ID={ID}";
|
||||
case NavObjectType.XmlPort: return $"Type=XmlPort;ID={ID}";
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"The Type {Type} is unknown, cannot convert to filter.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a hash key based on Type and ID.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user