1'
2' Copyright (C) 2009 Rolf Bjarne Kvinge, RKvinge@novell.com
3'
4' This library is free software; you can redistribute it and/or
5' modify it under the terms of the GNU Lesser General Public
6' License as published by the Free Software Foundation; either
7' version 2.1 of the License, or (at your option) any later version.
8'
9' This library is distributed in the hope that it will be useful,
10' but WITHOUT ANY WARRANTY; without even the implied warranty of
11' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12' Lesser General Public License for more details.
13'
14' You should have received a copy of the GNU Lesser General Public
15' License along with this library; if not, write to the Free Software
16' Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17'
18
19Imports Mono.Cecil
20Imports System
21Imports System.IO
22Imports System.Reflection
23
24Class Tuner
25	Shared Function Main (args () As String) As Integer
26		Dim a As AssemblyDefinition
27		Dim rp As ReaderParameters
28		Dim wp As WriterParameters
29		Dim source As String = args (0)
30		Dim destination As String = args (1)
31
32		source = Path.GetFullPath (source)
33		destination = Path.GetFullPath (destination)
34
35		rp = New ReaderParameters ()
36		rp.ReadSymbols = True
37		a = AssemblyDefinition.ReadAssembly (source, rp)
38
39		Console.WriteLine ("Assembly successfully loaded from {0}", source)
40
41		For i As Integer = a.MainModule.AssemblyReferences.Count - 1 To 0 Step -1
42			Dim ref as AssemblyNameReference = a.MainModule.AssemblyReferences (i)
43
44			Console.Write ("Assembly reference: {0}", ref.FullName)
45			ref.Version = new Version (2, 0, 5, 0)
46			ref.PublicKeyToken = new Byte () {&H7C, &HEC, &H85, &HD7, &HBE, &HA7, &H79, &H8E }
47			Console.WriteLine (" => {0}", ref.FullName)
48		Next
49
50		wp = New WriterParameters ()
51		wp.WriteSymbols = True
52		a.Write (destination, wp)
53
54		Console.WriteLine ("Assembly successfully written to {0}", destination)
55	End Function
56End Class