[Help Us!] Windows native ISO support (2 Viewers)

regeszter

Retired Team Member
  • Premium Supporter
  • October 29, 2005
    5,335
    4,954
    Home Country
    Hungary Hungary
    Finally, i have push the change, need to be tested, i have modified MP config to be able to set a drive letter not used by windows.
    Will see what happen :)

    I does not work here. The drive letter is always the next free letter (E here) but I set it to H for test.:(
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Hi,

    Just tested again and it's the same, i try to find the correct command from PS cmd directly because it seems to not work here.
    But didn't you test the rework for select the letter from MP config, it seems ok on my side and enable/disabled item too when change from native to other selection.
    So we can store an non used Letter and next will be to find the correct command to force to set the drive from MP.

    Here can be usefull but github project are no longer existant, i didn't search a lot if the code has moved to another repo lol
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    No way to force to use fixed letter drive, i succeed to make it work from powershell but don't succeed to port to C# lol.
    So i have let the selection to MP config for now and back the old way and it seems but i need to test more than using that code :

    Code:
            using (var ps = PowerShell.Create())
            {
              // Set mounted ISO file to be able to unmount it if something failed to load.
              _MountedIsoFile = IsoFile;
              Log.Debug("Mount-DiskImage {0}", IsoFile);
              ps.AddCommand("Mount-DiskImage").AddParameter("ImagePath", IsoFile).AddParameter("PassThru");
              Log.Debug("Mount-DiskImage Result {0}", psResult.Count);
            }
    
            using (var ps = PowerShell.Create())
            {
              ps.AddCommand("Get-DiskImage").AddParameter("ImagePath", IsoFile).AddCommand("Get-Volume");
              var psResult = ps.Invoke();
              Log.Debug("Mount-DiskImage Result {0}", psResult.Count);
              foreach (var driveLetter in psResult.Select(result => result.Members["DriveLetter"].Value.ToString()))
              {
                _Drive = String.Format("{0}:", driveLetter);
                Log.Debug("Mount-DiskImage DriveLetter {0}", _Drive);
              }
            }

    The newest letter drive is always get (result.count = 1).
    But i fear it's timing issue and then it will failed one day to another or one minute to another lol
    Attached is the modified file.

    The first i mount the iso and the second i ask from driveletter, when i use all ps.command in one, sometimes (most of the time), i didn't get result but doing that twice ps.addcommand and it seems to work better.

    Otherwise the powershell command used to change drive letter :

    $drive = Get-WmiObject -Class win32_volume -Filter "DriveLetter = 'e:'"
    Set-WmiInstance -input $drive -Arguments @{DriveLetter="O:"; Label="Label"}

    We really need to have this syntax : -Filter "DriveLetter = 'e:'" -> 'e:' is the current mounted drive
    And i change it to O: by -Arguments @{DriveLetter="O:"; Label="Label"}

    :p

    Edit : re-uploaded the zip.
     

    Attachments

    • DaemonTools.zip
      3 KB
    Last edited:

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Right now i have done multiple test and ISO always mount and on both PC (where it failed before).
    I will push the change and let MP config if we can found to fix a letter :)
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    So for now, when mount failed (i trigger it manually for purpose) the mounted drive is removed.
    Mounted drive is working for me right now, i will test more :)
    Thanks :)
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Yep needed on my side and no clue why. (I have retry again last night and all was ok but need twice command).
    The unmount is needed if previous mount was done but no letter associate/detected so we need to unmount it.
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Looking the code again and the first unmount is maybe not needed after all. I need to confirm that but I'm at work ;)
     

    Users who are viewing this thread

    Top Bottom