mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
fix: updated VideoCodecBase UpdateDirectoryXSig to handle directory results that are greater than 1023, XSig maximimum index
This commit is contained in:
@@ -1180,29 +1180,37 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
|||||||
|
|
||||||
private string UpdateDirectoryXSig(CodecDirectory directory, bool isRoot)
|
private string UpdateDirectoryXSig(CodecDirectory directory, bool isRoot)
|
||||||
{
|
{
|
||||||
var contactIndex = 1;
|
var xSigMaxIndex = 1023;
|
||||||
var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count];
|
var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count > xSigMaxIndex
|
||||||
|
? xSigMaxIndex
|
||||||
|
: directory.CurrentDirectoryResults.Count];
|
||||||
|
|
||||||
Debug.Console(2, this, "Is root {0} Directory Count: {1}", isRoot, directory.CurrentDirectoryResults.Count);
|
Debug.Console(2, this, "IsRoot: {0}, Directory Count: {1}, TokenArray.Length: {2}", isRoot, directory.CurrentDirectoryResults.Count, tokenArray.Length);
|
||||||
|
|
||||||
foreach (var entry in directory.CurrentDirectoryResults)
|
var contacts = directory.CurrentDirectoryResults.Count > xSigMaxIndex
|
||||||
|
? directory.CurrentDirectoryResults.Take(xSigMaxIndex)
|
||||||
|
: directory.CurrentDirectoryResults;
|
||||||
|
|
||||||
|
var counterIndex = 1;
|
||||||
|
foreach (var entry in contacts)
|
||||||
{
|
{
|
||||||
var arrayIndex = contactIndex - 1;
|
var arrayIndex = counterIndex - 1;
|
||||||
|
var entryIndex = counterIndex;
|
||||||
|
|
||||||
Debug.Console(2, this, "Entry Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId);
|
Debug.Console(2, this, "Entry{2:0000} Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId, entryIndex);
|
||||||
|
|
||||||
if (entry is DirectoryFolder && entry.ParentFolderId == "root")
|
if (entry is DirectoryFolder && entry.ParentFolderId == "root")
|
||||||
{
|
{
|
||||||
tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, String.Format("[+] {0}", entry.Name));
|
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, String.Format("[+] {0}", entry.Name));
|
||||||
|
|
||||||
contactIndex++;
|
counterIndex++;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, entry.Name);
|
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, entry.Name);
|
||||||
|
|
||||||
contactIndex++;
|
counterIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetXSigString(tokenArray);
|
return GetXSigString(tokenArray);
|
||||||
|
|||||||
@@ -2730,6 +2730,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
Debug.Console(2, this, "OnDirectoryResultReturned. Result has {0} contacts", result.Contacts.Count);
|
Debug.Console(2, this, "OnDirectoryResultReturned. Result has {0} contacts", result.Contacts.Count);
|
||||||
|
|
||||||
var directoryResult = result;
|
var directoryResult = result;
|
||||||
|
var directoryIsRoot = CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false;
|
||||||
|
|
||||||
// If result is Root, create a copy and filter out contacts whose parent folder is not root
|
// If result is Root, create a copy and filter out contacts whose parent folder is not root
|
||||||
//if (!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
//if (!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
||||||
@@ -2747,7 +2748,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
Debug.Console(2, this, "Updating directoryResult. IsOnRoot: {0} Contact Count: {1}",
|
Debug.Console(2, this, "Updating directoryResult. IsOnRoot: {0} Contact Count: {1}",
|
||||||
!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue, directoryResult.Contacts.Count);
|
directoryIsRoot, directoryResult.Contacts.Count);
|
||||||
|
|
||||||
// This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology
|
// This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology
|
||||||
var handler = DirectoryResultReturned;
|
var handler = DirectoryResultReturned;
|
||||||
@@ -2756,7 +2757,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
handler(this, new DirectoryEventArgs
|
handler(this, new DirectoryEventArgs
|
||||||
{
|
{
|
||||||
Directory = directoryResult,
|
Directory = directoryResult,
|
||||||
DirectoryIsOnRoot = !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue
|
DirectoryIsOnRoot = directoryIsRoot
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user