Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

fixed XIDE plugin - or different behavior of .NET methods 25 Jul 2017 09:12 #2209

  • wriedmann
  • wriedmann's Avatar
  • Topic Author


  • Posts: 3198
  • Hi,

    I had to fix my XIDE plugin as in the last version the "Open BIN folder" don't worked anymore.

    I had replaced:
    Project:BaseOutputFolder + Config:cSubFolder
    by
    Path.Combine( Project:BaseOutputFolder, Config:cSubFolder )
    and since cSubFolder had a leading "\" the Path.Combine method returned the cSubFolder alone.

    Therefore I added now the following static function
    static method CombinePath( cPath1 as string, cPath2 as string ) as string
    local cReturn as string
    	
    if cPath2:Length > 0 .and. cPath2[0] == Path.DirectorySeparatorChar
        cReturn := Path.Combine( cPath1, cPath2:Substring( 1 ) )
    else
        cReturn := Path.Combine( cPath1, cPath2 )
    endif
    	
    return cReturn

    The updated plugin with sources is here: www.riedmann.it/download/XIDE_WR_Plugin.zip

    Wolfgang

    P.S. I had to write also my own SubStr() extension method because I would not check the length every time.
    static method SubStr( self cString as string, nStart as int, nLen as int ) as string
    // 0-based!!!
    local nStringLen as int
    local cReturn as string
    	
    nStringLen := cString:Length	
    if nStart < 0
      if ( nStart * -1 ) >= nStringLen
        nStart := 0
      else
        nStart := nStringLen + nStart
      endif
    endif
    if nLen >= ( nStart + nStringLen )
      cReturn := cString
    else
      cReturn := cString:Substring( nStart, nLen )
    endif
    	
    return cReturn
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    fixed XIDE plugin - or different behavior of .NET methods 25 Jul 2017 17:23 #2210

    • Chris
    • Chris's Avatar


  • Posts: 3667
  • Hi Wolfgang,

    Thanks you! Especially the command "Open BIN folder" I am using it many times every day! Also the "Administrator command prompt in BIN folder" is very handy at times and I am glad that you have done this in your plugin, so I did not have to research myself how to implement this in XIDE itself :-)

    Chris
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    fixed XIDE plugin - or different behavior of .NET methods 25 Jul 2017 17:29 #2211

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3198
  • Hi Chris,

    I'm happy if my plugin serves you well! So at least I can contribute a bit also.

    Initially, I tried to use the pure .NET methods whenever possible because I was thinking they are perfect, but slowly I'm discovering that some of them don't work as I would expect. So I'm more and more replacing the string.Substring() method by my own string.Substr() method that is more robust - I don't like to check the string length every time I need to call string.SubString() and to risk an exception otherwise.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    fixed XIDE plugin - or different behavior of .NET methods 25 Jul 2017 17:46 #2212

    • Chris
    • Chris's Avatar


  • Posts: 3667
  • Hi Wolfgang,

    Absolutely agreed, the system string methods are designed for maximum performance and are less "forgiving" that the runtime functions of VO. So I also often use my own function wrappers, or call the already defined SubStr(), Left() etc runtime functions, which are also fast enough (the strongly typed versions).

    Chris
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1