AddonManager.AddonEx.readAddonProperty C# (CSharp) Метод

readAddonProperty() статический приватный Метод

static private readAddonProperty ( this filePath, dynamic typeDef ) : dynamic
filePath this
typeDef dynamic
Результат dynamic
        internal static dynamic readAddonProperty(this String filePath, dynamic[] typeDef)
        {
            using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                try
                {
                    int bytesToRead = typeDef[0] != AddonProperty.AddonFile ? typeDef[2] * 4 : (int)fileStream.Length - typeDef[1];
                    int bytesRead = 0;
                    int count = 0;
                    byte[] buffer = new byte[bytesToRead];
                    fileStream.Position = typeDef[1];

                    do
                    {
                        bytesRead += count;
                        bytesToRead -= count;
                        count = fileStream.Read(buffer, bytesRead, bytesToRead);
                    } while (count > 0);
                    if (typeDef[0] != AddonProperty.AddonFile)
                        return new UTF8Encoding(false, false).GetString(buffer).TrimEnd('\0');
                    return buffer;
                }
                catch (Exception ex)
                {
                    Debug.Print("Something isn't quite right...");
                    Debug.Print(ex.ToString());
                    return null;
                }
            }
        }
        internal static void saveAddonProperty(this String filePath, dynamic[] typeDef, String strValue, Boolean resetFile = false)