File System Browser Example Code Problems

Last post 09-26-2007 3:00 PM by BarryR. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-22-2007 3:43 PM

    File System Browser Example Code Problems

    This is the first time I have used the system. So a real newbie.
    First I tried to give feedback via the Management Portal / Customer Support, this page just crashed with vast number of script errors.

    I am playing with the File System Browser.
    In principle I am seeing faults in the MetaData when refreshing.
    1. Transfer a file to Nirvanix and press Refresh on Nirvanix side then an exception is thrown in GetFileToolTipText from

                if (file.MetaData.Xml != null)
                //changed to
                if (file.MetaData != null && file.MetaData.Xml != null) //dw 1st test added

    Then ok for files
    2. Tried folder with sub folders
    and had to alter a section to

                if (folder.MetaData != null)//dw
                {
                  string xmlstring = "<metadata>" + folder.MetaData.Xml + "</metadata>";
                  doc = new XmlDocument();
                  doc.LoadXml(xmlstring);
                }
                // Storage for the tooltip string
                StringBuilder sb = new StringBuilder();

                // Add the file and folder count information
                sb.AppendLine("File Count: " + folder.FileCount);
                sb.AppendLine("Folder Count: " + folder.FolderCount);

                if (folder.MetaData != null)//dw
                {
                  // Get the metdata node
                  XmlNode node = doc.SelectSingleNode("metadata");

                  // Iterate through all of the attribute nodes
                  foreach (XmlNode att in node.ChildNodes)
                  {
                    // Get the metdata type
                    string type = att.Attributes["AttributeType"].Value;

                    // Get the metadata value
                    XmlNode valNode = att.SelectSingleNode("lft");
                    string value = valNode.Attributes["AttributeValue"].Value;

                    // Add the metadata to the tooltip
                    sb.AppendLine(type + ": " + value);
                  }
                }


    This fixed silly exceptions

    but now can see that folders within folders are not being transferred properly with mangling of sub folder names with sub folder files. eg d2/common.h transferred as d2common.h

    Time to talk with some experts and hope some one has fixed it already, before I spend to much time on this.

    Dave

  • 09-24-2007 11:25 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 602

    Re: File System Browser Example Code Problems

    Sorry for the delay on the reply, we had to get the sample updated from the last release.  You can download the File System Manager again and the MetaData rename has been fixed.

    davidweatherall:
    but now can see that folders within folders are not being transferred properly with mangling of sub folder names with sub folder files. eg d2/common.h transferred as d2common.h
     

    I verified this was fixed as well.

    Let me know if you have any issues with the new version.  Here is a quick link to the updated download:

    http://developer.nirvanix.com/files/folders/reference_code__applications/entry14.aspx

    Regards,
        Barry R.
     

     

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
    Filed under: , ,
  • 09-25-2007 1:37 PM In reply to

    Re: File System Browser Example Code Problems

    Can confirm that the exceptions have now gone.


    But 2nd part still is there.

    My statements

    >but now can see that folders within folders are not being transferred properly with mangling of sub folder names with sub folder files. eg d2/common.h transferred as d2common.h

    was not precise enough (in fact completely confusing or just wrong).
    More thoroughly, I have

    PC Side
    Directory structure  d1/d2/d3
    One file in each directory
    d1/d1Edit1.cs
    d1/d2/d2Common.h
    d1/d2/d3/d3jodie.jpg

    transfer d1 to Nirvanix

    directory d1 appears on Nirvanix side (d2 and d3 do not)
    all 3 file above now appear under d1 on Nirvanix side
    d1/d1Edit1.cs
    d1/d2Common.h
    d1/d3jodie.jpg

    Hope the more accurate description helps.

    Dave

  • 09-26-2007 3:00 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 602

    Re: File System Browser Example Code Problems

    The problem is the following code:

     

        string relativePath = uploadPath;
        if (!string.IsNullOrEmpty(relativePath) && uploadPath != "/")
        {
                relativePath += "/";
        }
        relativePath += fInfo.Name;

    It should be appending the full path but instead its just attaching name.  I'll try to get a fix for this posted as soon as possible.  Likely the fix will be to find the common root and build the tree up from there.

     So,

    c:\testroot\testfolder1\file1.txt
    c:\testroot\testfolder2\file1.txt
    c:\testroot\testfolder1\someotherfolder\file1.txt

    would translate to the paths dropping the c:\testroot and changing the \ to /.

     I will keep you posted as soon as the fix is up.
     

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
Page 1 of 1 (4 items)