|
6 | 6 |
|
7 | 7 | namespace CsvQuery.PluginInfrastructure |
8 | 8 | { |
| 9 | + public static class LegacyCheck |
| 10 | + { |
| 11 | + private static int _version = -1; |
| 12 | + private static int _majorVersion = -1; |
| 13 | + private static int _minorVersion = -1; |
| 14 | + |
| 15 | + |
| 16 | + private static void Init() |
| 17 | + { |
| 18 | + int Unused = 0; |
| 19 | + _version = Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETNPPVERSION, Unused, Unused).ToInt32(); |
| 20 | + _majorVersion = _version >> 16; |
| 21 | + |
| 22 | + // Minor version is stored really strange in Npp, e.g. 8.1 has lower bits = 1, but 8.1.9.3 has lower bits = 193 |
| 23 | + var minorBits = _version & 0xffff; |
| 24 | + var firstDigit = minorBits.ToString().Substring(0,1); |
| 25 | + if (!int.TryParse(firstDigit, out _version)) _minorVersion = -1; |
| 26 | + } |
| 27 | + |
| 28 | + public static bool OldIconCode |
| 29 | + { |
| 30 | + get |
| 31 | + { |
| 32 | + if(_version==-1)Init(); |
| 33 | + return _majorVersion < 8; |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + public static bool Old64BitScintilla |
| 38 | + { |
| 39 | + get |
| 40 | + { |
| 41 | + if (_version == -1) Init(); |
| 42 | + return (_majorVersion < 8) || (_majorVersion == 8 && _minorVersion < 3); |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | + |
9 | 47 | /// <summary> |
10 | 48 | /// Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour is set in the range 0 to 255. |
11 | 49 | /// If you have three such intensities, they are combined as: red | (green << 8) | (blue << 16). |
@@ -180,6 +218,16 @@ public struct CharacterRange |
180 | 218 | public IntPtr cpMax; |
181 | 219 | } |
182 | 220 |
|
| 221 | + /// <summary> |
| 222 | + /// This is used before N++ 8.3 |
| 223 | + /// </summary> |
| 224 | + [StructLayout(LayoutKind.Sequential)] |
| 225 | + public struct CharacterRangeLegacy |
| 226 | + { |
| 227 | + public int cpMin; |
| 228 | + public int cpMax; |
| 229 | + } |
| 230 | + |
183 | 231 | public class Cells |
184 | 232 | { |
185 | 233 | public Cells(char[] charactersAndStyles) |
|
0 commit comments