public static SourceAppInfo FromData(SourceAppInfoData data)
        {
            if (data.DataType == SourceAppInfoDataType.FromAppUserModelId)
            {
                if (string.IsNullOrEmpty(data.AppUserModelId) ||
                    string.IsNullOrWhiteSpace(data.AppUserModelId))
                {
                    return(null);
                }

                if (IsAppUnpackaged(data))
                {
                    return(new SourceDesktopAppInfo(data));
                }
                else
                {
                    return(new SourceModernAppInfo(data));
                }
            }
            else if (data.DataType == SourceAppInfoDataType.FromProcessId)
            {
                if (data.ProcessId == 0)
                {
                    return(null);
                }

                if (IsAppPackaged(data))
                {
                    return(new SourceModernAppInfo(data));
                }
                else
                {
                    return(new SourceDesktopAppInfo(data));
                }
            }

            return(null);
        }
 internal static bool IsAppUnpackaged(SourceAppInfoData data)
 {
     return(data.AppUserModelId.EndsWith(".exe", StringComparison.OrdinalIgnoreCase));
 }
 public SourceModernAppInfo(SourceAppInfoData data)
 {
     Data = data;
 }
 internal static bool IsAppPackaged(SourceAppInfoData data)
 {
     using var process = Process.GetProcessById((int)data.ProcessId);
     return(IsImmersiveProcess(process.Handle));
 }
 public SourceDesktopAppInfo(SourceAppInfoData data)
 {
     Data = data;
 }