Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: 0.16 Ship Updater | New Version out!

  1. #1

    0.16 Ship Updater | New Version out!

    Hi!

    I wanted to play my old 0.15 Ships on 0.16, so I decided to create a tool which converts the old Ships to 0.16 Ships.

    This tool is propably very buggy, but it works with the most of craft files.

    Screenshot:


    Download Attached


    Code (CAUTION, VERY VERY BAD VB CODE WHICH WAS MADE WITHIN 5 MINUTES )
    Code:
      Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles btn_SelectShip.Click
        OpenFileDialog1.ShowDialog()
        txb_OldShipPath.Text = OpenFileDialog1.FileName
        txb_File.Text = My.Computer.FileSystem.ReadAllText(txb_OldShipPath.Text)
      End Sub
    
      Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles btn_SelectOutput.Click
        SaveFileDialog1.ShowDialog()
        txb_OutputPath.Text = SaveFileDialog1.FileName
      End Sub
      Dim type As String = 'VAB'
      Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles btn_Convert.Click
        txb_OldShipPath.Enabled = False
        txb_OutputPath.Enabled = False
    
        Dim lines() As String = txb_File.Lines
    
        Dim verpos As Integer
        Dim typepos As Integer
    
        For i As Integer = 0 To lines.Length - 1
          If lines(i).Contains('version = ') Then
            verpos = i
          End If
          If lines(i).Contains('type = ') Then
            typepos = i
          End If
        Next
    
    
        If txb_File.Text.Contains('type = ') Then
          txb_File.Text = txb_File.Text.Replace(txb_File.Lines(verpos), 'version = 0.16.0')
    
          txb_File.Text = txb_File.Text.Replace(txb_File.Lines(typepos), 'type = ' & type & vbNewLine & 'PART')
        Else
          txb_File.Text = txb_File.Text.Replace(txb_File.Lines(verpos), 'version = 0.16.0' & vbNewLine & 'type = ' & type & vbNewLine & 'PART')
        End If
    
    
    
    
    
    
    
        txb_File.Text = txb_File.Text.Replace('}' & vbNewLine & '{', '}' & vbNewLine & 'PART' & vbNewLine & '{')
    
        txb_File.Text = txb_File.Text & vbNewLine & '// Converted with deppdepp\'s Ship-Updater'
    
        My.Computer.FileSystem.WriteAllText(txb_OutputPath.Text, txb_File.Text, False)
    
        MsgBox('Ship was updated succesfully!')
    
        txb_File.Clear()
        txb_OldShipPath.Clear()
        txb_OutputPath.Clear()
        txb_OldShipPath.Enabled = True
        txb_OutputPath.Enabled = True
      End Sub
    
      Private Sub TextBox3_TextChanged(sender As System.Object, e As System.EventArgs) Handles txb_OutputPath.TextChanged
        If txb_OutputPath.Text = '' Or txb_OldShipPath.Text = '' Then
          btn_Convert.Enabled = False
        Else
          btn_Convert.Enabled = True
        End If
      End Sub
    
      Private Sub RadioButton1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rdb_VAB.CheckedChanged
        If rdb_VAB.Checked = True Then
          type = 'VAB'
        Else
          type = 'SPH'
        End If
      End Sub

    License:

    Do whatever you want with it.

    Have Fun, you can leave your opinion as a reply


    - deppdepp
    Attached Files Attached Files

  2. #2
    Supreme Addon Commander DYJ's Avatar
    Join Date
    Sep 2011
    Location
    Stockholm, Sweden
    Posts
    573

    Re: 0.16 Ship Updater

    Quote Originally Posted by N3X15 View Post
    The same rules for plugins apply for applications. This means post sourcecode and a license.
    [mod]For tools to be distributed on the KSPforums the sourcecode has to be posted as a safety precaution.[/mod]

  3. #3

    Re: 0.16 Ship Updater

    Code and License posted!

  4. #4
    Supreme Addon Commander DYJ's Avatar
    Join Date
    Sep 2011
    Location
    Stockholm, Sweden
    Posts
    573

    Re: 0.16 Ship Updater

    Good good.
    I reckon this will be much appreciated by lots of people, good job!

  5. #5
    Spacecraft Engineer
    Join Date
    Jun 2012
    Location
    South Korea
    Posts
    126

    Re: 0.16 Ship Updater

    too bad I already manually reconstructed every ship
    NP heavy strut is solution to all problems

  6. #6
    Modder's muse
    Join Date
    May 2012
    Location
    Bangor, N. Ireland
    Posts
    442
    Blog Entries
    1

    Re: 0.16 Ship Updater

    Oh goodie....I have a whole fleet needing conversion...

  7. #7
    Modder's muse
    Join Date
    May 2012
    Location
    Bangor, N. Ireland
    Posts
    442
    Blog Entries
    1

    Re: 0.16 Ship Updater

    It threw an unhandled exception error.

    Code:
    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.
    
    ************** Exception Text **************
    System.ArgumentException: String cannot be of zero length.
    Parameter name: oldValue
      at System.String.ReplaceInternal(String oldValue, String newValue)
      at System.String.Replace(String oldValue, String newValue)
      at KSP_Ship_Converter.Form1.Button3_Click(Object sender, EventArgs e)
      at System.Windows.Forms.Control.OnClick(EventArgs e)
      at System.Windows.Forms.Button.OnClick(EventArgs e)
      at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
      at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
      at System.Windows.Forms.Control.WndProc(Message& m)
      at System.Windows.Forms.ButtonBase.WndProc(Message& m)
      at System.Windows.Forms.Button.WndProc(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
      at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    
    
    ************** Loaded Assemblies **************
    mscorlib
      Assembly Version: 4.0.0.0
      Win32 Version: 4.0.30319.269 (RTMGDR.030319-2600)
      CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
    ----------------------------------------
    KSP Ship Updater
      Assembly Version: 1.0.0.0
      Win32 Version: 1.0.0.0
      CodeBase: file:///Y:/PlayOnLinux\'s%20virtual%20drives/KSP/drive_c/KSP_win/Ships/SPH/KSP%20Ship%20Updater.exe
    ----------------------------------------
    Microsoft.VisualBasic
      Assembly Version: 10.0.0.0
      Win32 Version: 10.0.30319.1 built by: RTMRel
      CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
    ----------------------------------------
    System
      Assembly Version: 4.0.0.0
      Win32 Version: 4.0.30319.269 built by: RTMGDR
      CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Core
      Assembly Version: 4.0.0.0
      Win32 Version: 4.0.30319.1 built by: RTMRel
      CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
    ----------------------------------------
    System.Windows.Forms
      Assembly Version: 4.0.0.0
      Win32 Version: 4.0.30319.278 built by: RTMGDR
      CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System.Drawing
      Assembly Version: 4.0.0.0
      Win32 Version: 4.0.30319.282 built by: RTMGDR
      CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System.Runtime.Remoting
      Assembly Version: 4.0.0.0
      Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
      CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
    ----------------------------------------
    Accessibility
      Assembly Version: 4.0.0.0
      Win32 Version: 4.0.30319.1 built by: RTMRel
      CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
    ----------------------------------------
    
    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.
    
    For example:
    
    <configuration>
      <system.windows.forms jitDebugging='true' />
    </configuration>
    
    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.

  8. #8

    Re: 0.16 Ship Updater

    Could you post the top of your .craft file?


  9. #9
    Modder's muse
    Join Date
    May 2012
    Location
    Bangor, N. Ireland
    Posts
    442
    Blog Entries
    1

    Re: 0.16 Ship Updater

    I\'m away from the PC with the specific file, but I think this is the same (link - http://kerbalspaceprogram.com/forum/...0;attach=24491):

    Code:
    // SFS Craft File
    
    ship = CK VTOL-TwinTurbine MkII
    version = 0.15.2
    type = SPH
    PART
    {

  10. #10

    Re: 0.16 Ship Updater

    Ah, the problem is your file.

    I made that program within 5 minutes, so bugs like that can happen.
    You can fix this if you remove all lines that stand before 'ship' (so that the file begins with 'ship....')


    With regards

    Florian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •