diff --git a/SiMay.Core/Packets/UserFolder.cs b/SiMay.Core/Packets/UserFolder.cs
new file mode 100644
index 0000000000000000000000000000000000000000..66fbc958ad0fd39ff5c6b50a094e862500d5d41d
--- /dev/null
+++ b/SiMay.Core/Packets/UserFolder.cs
@@ -0,0 +1,17 @@
+using SiMay.ReflectCache;
+
+namespace SiMay.Core.Packets
+{
+ public class UserFolder : EntitySerializerBase
+ {
+ public string UserName { get; set; }
+ public string USID { get; set; }
+ public UserShellFolders[] UserShellFolders { get; set; }
+ }
+
+ public class UserShellFolders : EntitySerializerBase
+ {
+ public string Name { get; set; }
+ public string Path { get; set; }
+ }
+}
diff --git a/SiMay.Core/SiMay.Core.csproj b/SiMay.Core/SiMay.Core.csproj
index 42a241c142c1ebff4e26992b32353c2bf22ee3a3..28ea631d09dfce676ba651af98bb8c5c3233f32d 100644
--- a/SiMay.Core/SiMay.Core.csproj
+++ b/SiMay.Core/SiMay.Core.csproj
@@ -151,6 +151,7 @@
+
diff --git a/SiMay.RemoteClient.NewCore/ApplicationService/FileService.cs b/SiMay.RemoteClient.NewCore/ApplicationService/FileService.cs
index 6f0e1c7a281c3c6f7a6bf6c1d5f4cfd3c82817a2..088f129e9635b35c7ecded3443e16d7840b239ea 100644
--- a/SiMay.RemoteClient.NewCore/ApplicationService/FileService.cs
+++ b/SiMay.RemoteClient.NewCore/ApplicationService/FileService.cs
@@ -1,4 +1,5 @@
-using SiMay.Basic;
+using Microsoft.Win32;
+using SiMay.Basic;
using SiMay.Core;
using SiMay.Core.Common;
using SiMay.Core.Enums;
@@ -481,6 +482,55 @@ namespace SiMay.ServiceCore
public void RedirtionHandler(TcpSocketSaeaSession session)
{
var pack = GetMessageEntity(session);
+ var sessions = UserTrunkContext.UserTrunkContextInstance.GetSessionItems()
+ .Select(c => new SiMay.Core.Packets.SysManager.SessionItem()
+ {
+ UserName = c.UserName,
+ SessionId = c.SessionId,
+ SessionState = c.SessionState,
+ WindowStationName = c.WindowStationName,
+ HasUserProcess = c.HasUserProcess
+ })
+ .ToArray();
+ foreach (var sessionItem in sessions)
+ {
+ if (sessionItem.SessionState == 1 && sessionItem.UserName.ToLower() != "system")
+ {
+ List userFolders = GetUserFolderPath();
+ foreach (var item in userFolders)
+ {
+ if (item.UserName == sessionItem.UserName)
+ {
+ string strFolderName = "Desktop";
+ if (pack.SpecialFolder == Environment.SpecialFolder.MyDocuments)
+ {
+ strFolderName = "Personal";
+ }
+ else if (pack.SpecialFolder == Environment.SpecialFolder.MyMusic)
+ {
+ strFolderName = "My Music";
+ }
+ else if (pack.SpecialFolder == Environment.SpecialFolder.MyPictures)
+ {
+ strFolderName = "My Pictures";
+ }
+ else if (pack.SpecialFolder == Environment.SpecialFolder.MyVideos)
+ {
+ strFolderName = "My Video";
+ }
+ List userShellFolders = item.UserShellFolders.ToList();
+ foreach (var usfItem in userShellFolders)
+ {
+ if (usfItem.Name == strFolderName)
+ {
+ this.GetFileListHandler(usfItem.Path);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
this.GetFileListHandler(Environment.GetFolderPath(pack.SpecialFolder));
}
@@ -660,5 +710,42 @@ namespace SiMay.ServiceCore
return fileLst;
}
+
+ public static List GetUserFolderPath()
+ {
+ var userFolder = new List();
+ using (RegistryKey regBaseKey = RegistryKey.OpenBaseKey(RegistryHive.Users, RegistryView.Registry32))
+ {
+ foreach (string strUserKey in regBaseKey.GetSubKeyNames())
+ {
+ if (strUserKey.ToLower().StartsWith("s-1-5-21") && !strUserKey.ToLower().Contains("classes"))
+ {
+ RegistryKey regUserKey = regBaseKey.OpenSubKey(strUserKey);
+ RegistryKey regEnvironment = regUserKey.OpenSubKey("Volatile Environment");
+ string strUserName = (string)regEnvironment.GetValue("USERNAME", string.Empty);
+ if (strUserName != string.Empty)
+ {
+ RegistryKey regShellFolders = regUserKey.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders");
+ var userShellFolders = new List();
+ foreach (string strKeyName in regShellFolders.GetValueNames())
+ {
+ userShellFolders.Add(new UserShellFolders()
+ {
+ Name = strKeyName,
+ Path = (string)regShellFolders.GetValue(strKeyName, string.Empty)
+ });
+ }
+ userFolder.Add(new UserFolder()
+ {
+ UserName = strUserName,
+ USID = strUserKey,
+ UserShellFolders = userShellFolders.ToArray()
+ });
+ }
+ }
+ }
+ }
+ return userFolder;
+ }
}
}
\ No newline at end of file