• 0

    posted a message on Question about Custom Script Compile

    I've been trying to find a galaxy environment template for visual studio all morning, sort of for this purpose.
    It seems a lot of people on this site claim to be using .NET to generate code, when all they do though is have it create their data.
    Perhaps look into T4 Text Templates. I think for your example, you can even skip making runtime, but one could actually make an app that fills in the code as the user enters it. If you google T4 templates there is tons of info.
    I will probably be working on a generic template, as everything seems to be copy-paste or a separate editor.
    an example from your file: lib.SC2lib
    this one is done using visualBasic, and won't run out of box or anything. Plus i'm just recently learning of templates.

    <#@ template language="VB" #>
    <#@ assembly name="System.Core" #>
    <#@ import namespace="System.Linq" #>
    <#@ import namespace="System.Text" #>
    <#@ import namespace="System.Collections.Generic" #>
    <#
            GalaxyHeader

        Dim number As Integer
        For number = 1 to 20
        
        #>
                    DataTableSetString(true, "A<#= number #>", "<#wordData(number-1)#>);
             <#
                    Next
               #>

    that would be entire file, if not less, before you put data into it.
    then just a template.transform() from your app once you get variables set, like GalaxyHeader, and your words into list.
    After transform you end up with same output you had, but this is cleaner beforehand, and can easily be setup for you to
    edit data beforehand (and no copy pasting). The biggest deal is you just use same template over and over, if done correctly (replace 20 with variable),
    A few more tweaks, and you have a 20line file or so that can chug out galaxy libs that declare any number of variables of the type of your choosing, filling them with any data that visual studio has access to.

    I'm just now learning this stuff though, but I'm very suprised it hasn't been done.
    I think a well done template can basically turn any Visual Studio app solution into a custom made editor,
    and I believe same is true for python (i believe they use templates as well).

    Posted in: Galaxy Scripting
  • To post a comment, please or register a new account.