Development

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • r71006 - in trunk/mono-basic: . toolstools/extract-source

    0 answers - 10147 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Author: rolf
    Date: 2007-01-15 03:37:41 -0500 (Mon, 15 Jan 2007)
    New Revision: 71006
    Added:
    trunk/mono-basic/tools/
    Log:
    2007-01-15 Rolf Bjarne Kvinge <RKvinge (AT) novell (DOT) com>
    * Added extract-source.
    Added:
    2007-01-15 07:39:50 UTC (rev 71005)
    2007-01-15 08:37:41 UTC (rev 71006)
    @@ -0,0 +1,3 @@
    +2007-01-15 Rolf Bjarne Kvinge <RKvinge (AT) novell (DOT) com>
    +
    +* Added extract-source.
    \ No newline at end of file
    Property changes on:
    Name: svn:ignore
    + bin
    My Project
    obj
    *.exe
    Added:
    2007-01-15 07:39:50 UTC (rev 71005)
    2007-01-15 08:37:41 UTC (rev 71006)
    @@ -0,0 +1,2 @@
    +all:
    +vbnc extract-source.vb -r:System.Xml.dll
    \ No newline at end of file
    Added:
    2007-01-15 07:39:50 UTC (rev 71005)
    2007-01-15 08:37:41 UTC (rev 71006)
    @@ -0,0 +1,20 @@
    +
    +Microsoft Visual Studio Solution File, Format Version 9.00
    +# Visual Studio 2005
    +Project("{}") = "extract-source", "extract-source.vbproj", "{}"
    +EndProject
    +Global
    +GlobalSection(SolutionConfigurationPlatforms) = preSolution
    +Debug|Any CPU = Debug|Any CPU
    +Release|Any CPU = Release|Any CPU
    +EndGlobalSection
    +GlobalSection(ProjectConfigurationPlatforms) = postSolution
    +{}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    +{}.Debug|Any CPU.Build.0 = Debug|Any CPU
    +{}.Release|Any CPU.ActiveCfg = Release|Any CPU
    +{}.Release|Any CPU.Build.0 = Release|Any CPU
    +EndGlobalSection
    +GlobalSection(SolutionProperties) = preSolution
    +HideSolutionNode = FALSE
    +EndGlobalSection
    +EndGlobal
    Added:
    2007-01-15 07:39:50 UTC (rev 71005)
    2007-01-15 08:37:41 UTC (rev 71006)
    @@ -0,0 +1,150 @@
    +' extract-source.vb
    +'
    +' Rolf Bjarne Kvinge (RKvinge (AT) novell (DOT) com)
    +'
    +'
    +' Copyright (C) 2007 Novell, Inc (http://www.novell.com)
    +'
    +' Permission is hereby granted, free of charge, to any person obtaining
    +' a copy of this software and associated documentation files (the
    +' "Software"), to deal in the Software without restriction, including
    +' without limitation the rights to use, copy, modify, merge, publish,
    +' distribute, sublicense, and/or sell copies of the Software, and to
    +' permit persons to whom the Software is furnished to do so, subject to
    +' the following conditions:
    +'
    +' The above copyright notice and this permission notice shall be
    +' included in all copies or substantial portions of the Software.
    +'
    +' THE SFTWARE IS PRVIDED "AS IS", WITHUT WARRANTY F ANY KIND,
    +' EXPRESS R IMPLIED, INCLUDING BUT NT LIMITED T THE WARRANTIES F
    +' MERCHANTABILITY, FITNESS FR A PARTICULAR PURPSE AND
    +' NNINFRINGEMENT. IN N EVENT SHALL THE AUTHRS R CPYRIGHT HLDERS BE
    +' LIABLE FR ANY CLAIM, DAMAGES R THER LIABILITY, WHETHER IN AN ACTIN
    +' F CNTRACT, TRT R THERWISE, ARISING FRM, UT F R IN CNNECTIN
    +' WITH THE SFTWARE R THE USE R THER DEALINGS IN THE SFTWARE.
    +
    +Imports System
    +Imports System.Collections
    +Imports Microsoft.VisualBasic
    +
    +Module extract_source
    +
    + Sub ShowHelp()
    + Console.WriteLine("Extracts sources from a vb project file (.vbproj, VS2005 file format)")
    + Console.WriteLine(vbTab & "-s[ource]:<vbproj file>")
    + Console.WriteLine(vbTab & "-d[estination]:<destination file>")
    + Console.WriteLine(vbTab & "-m[ode]:win|windows|linux")
    + Console.WriteLine(vbTab & "-b[asepath]:<optional base path to append to all paths in project file>")
    + End Sub
    +
    + Function Main(ByVal args As String()) As Integer
    + Dim source As String = Nothing, destination As String = Nothing, mode As String = Nothing, basepath As String = Nothing
    +
    + For Each arg As String In args
    + If arg.StartsWith("-") = False AndAlso arg.StartsWith("/") = False Then
    + ShowHelp()
    + Return 1
    + End If
    + Dim name, value As String
    + Dim idx As Integer
    + arg = arg.Substring(1)
    + idx = arg.IAny(New Char() {":"c, "="c})
    + If idx = -1 Then
    + ShowHelp()
    + Return 1
    + End If
    + name = arg.Substring(0, idx)
    + value = arg.Substring(idx + 1)
    + Select Case name.ToUpperInvariant
    + Case "B", "BASEPATH"
    + basepath = value
    + Case "S", "SURCE"
    + source = value
    + Case "D", "DESTINATIN", "DEST"
    + destination = value
    + Case "M", "MDE"
    + Select Case value.ToUpperInvariant
    + Case "WIN", "W", "WINDWS"
    + mode = "w"
    + Case "L", "LINUX", "LIN"
    + mode = "l"
    + Case Else
    + ShowHelp()
    + Return 1
    + End Select
    + mode = value
    + Case "H", "HELP", "?"
    + ShowHelp()
    + Return 0
    + Case Else
    + ShowHelp()
    + Return 1
    + End Select
    + Next
    +
    + If mode = "" Else source = "" Else destination = "" Then
    + ShowHelp()
    + Return 1
    + End If
    +
    + Try
    + Extract(source, destination, mode, basepath)
    + Catch ex As Exception
    + Console.WriteLine(ex.Message)
    + End Try
    +
    + End Function
    +
    + Sub Extract(ByVal VBProjFileName As String, ByVal DestinationFile As String, ByVal mode As String, ByVal basepath As String)
    + Dim sources As String()
    +
    + sources = GetSources(VBProjFileName, basepath)
    + Select Case mode.ToUpperInvariant
    + Case "W"
    + IFile.WriteAllText(DestinationFile, Join(sources, vbCrLf))
    + Case "L"
    + IFile.WriteAllText(DestinationFile, Join(sources, vbLf).Replace("\"c, "/"c))
    + Case Else
    + Throw New Exception("Invalid mode: " & mode)
    + End Select
    +
    + End Sub
    +
    + Function GetSources(ByVal File As String, ByVal BasePath As String) As String()
    + Dim files As New Generic.List( String)
    +
    + If BasePath Is Nothing Then BasePath = String.Empty
    +
    + Using x As New Xml.XmlTextReader(File)
    + Dim i As Integer
    + While x.Read()
    + Dim filename As String
    + Dim prefix As String
    + prefix = ""
    + filename = ""
    + If x.Name = "Compile" AndAlso x.NodeType = Xml.XmlNodeType.Element Then
    + x.MoveToAttribute("Include")
    + filename = x.Value
    + ElseIf x.Name = "EmbeddedResource" AndAlso x.NodeType = Xml.XmlNodeType.Element Then
    + x.MoveToAttribute("Include")
    + filename = x.Value
    + prefix = "-res:"
    + End If
    + If filename <"" Then
    + filename = BasePath & x.Value
    + filename = filename.Replace("%29", ")")
    + filename = filename.Replace("%28", "(")
    + filename = prefix & filename
    + If filename.Contains(" "c) Then
    + filename = """" & filename & """"
    + End If
    + files.Add(filename)
    + i += 1
    + End If
    + End While
    + End Using
    +
    + Return files.ToArray
    + End Function
    +End Module
    Added:
    2007-01-15 07:39:50 UTC (rev 71005)
    2007-01-15 08:37:41 UTC (rev 71006)
    @@ -0,0 +1,63 @@
    +<?xml version="1.0" encoding="utf-8"?>
    +<Project DefaultTargets="Build" xmlns="">
    + <PropertyGroup>
    + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    + <ProductVersion>8.0.50727</ProductVersion>
    + <SchemaVersion>2.0</SchemaVersion>
    + <ProjectGuid>{}</ProjectGuid>
    + <Type>Exe</Type>
    + <S>extract_source.extract_source</S>
    + <RootNamespace>extract_source</RootNamespace>
    + <AssemblyName>extract-source</AssemblyName>
    + <MyType>Console</MyType>
    + <Strict></Strict>
    + </PropertyGroup>
    + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    + <DebugSymbols>true</DebugSymbols>
    + <DebugType>full</DebugType>
    + <DefineDebug>true</DefineDebug>
    + <DefineTrace>true</DefineTrace>
    + <Path>bin\Debug\</Path>
    + <DocumentationFile>extract-source.xml</DocumentationFile>
    + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42 021,42022</NoWarn>
    + <DefineConstants>_MYTYPE="Empty"</DefineConstants>
    + </PropertyGroup>
    + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    + <DebugType>pdbonly</DebugType>
    + <DefineDebug>false</DefineDebug>
    + <DefineTrace>true</DefineTrace>
    + <>true</>
    + <Path>bin\Release\</Path>
    + <DocumentationFile>extract-source.xml</DocumentationFile>
    + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42 021,42022</NoWarn>
    + </PropertyGroup>
    + <ItemGroup>
    + <Reference Include="System" />
    + <Reference Include="System.Data" />
    + <Reference Include="System.Deployment" />
    + <Reference Include="System.Xml" />
    + </ItemGroup>
    + <ItemGroup>
    + <Import Include="Microsoft.VisualBasic" />
    + <Import Include="System" />
    + <Import Include="System.Collections" />
    + <Import Include="System.Collections.Generic" />
    + <Import Include="System.Data" />
    + <Import Include="System.Diagnostics" />
    + </ItemGroup>
    + <ItemGroup>
    + <Compile Include="extract-source.vb" />
    + </ItemGroup>
    + <ItemGroup>
    + <Folder Include="My Project\" />
    + </ItemGroup>
    + <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
    + <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
    + similar extension points exist, see Microsoft.Common.targets.
    + <Target Name="BeforeBuild">
    + </Target>
    + <Target Name="AfterBuild">
    + </Target>
    +
    +</Project>
    \ No newline at end of file
    Mono-patches maillist - Mono-patches (AT) lists (DOT) ximian.com

Re: r71006 - in trunk/mono-basic: . toolstools/extract-source


max 4000 letters.
Your nickname that display:
In order to stop the spam: 5 + 4 =
QUESTION ON "Development"

EMSDN.COM