ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/MSBuild_CurrentVersion/Program.cs
Revision: 124
Committed: Fri May 11 10:58:42 2012 UTC (11 years ago) by william
File size: 3864 byte(s)
Log Message:

File Contents

# Content
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Reflection;
6 using System.Diagnostics;
7
8 using RomCheater;
9 using RomCheater.CorePlugins;
10 using RomCheater.Logging;
11 using RomCheater.PluginFramework;
12 using RomCheater.UserSettingsSupport;
13 using System.IO;
14
15 namespace MSBuild_CurrentVersion
16 {
17 class Program
18 {
19
20 static void Main(string[] args)
21 {
22 Assembly this_asm = typeof(Program).Assembly;
23
24 string asm_path = this_asm.Location.Replace(@"\MSBuild_CurrentVersion.exe", "");
25
26 string version_file = "current-version.txt";
27 string full_path = string.Format(@"{0}\{1}", asm_path,version_file);
28 using (FileStream fs = new FileStream(full_path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
29 {
30 StreamWriter sw = new StreamWriter(fs);
31 sw.AutoFlush = true;
32 Dictionary<string, Type> dict = CreateAssemblyDictonary();
33 Console.WriteLine("Current Version:");
34 sw.WriteLine("Current Version:");
35 foreach (KeyValuePair<string, Type> pair in dict)
36 {
37 Type t = pair.Value;
38 Assembly asm = t.Assembly;
39 //string ns = string.Format("{0}", t.Namespace);
40 //if (ns.Contains("CorePlugins")) { ns = string.Format("{0}.{1}", t.Namespace, t.Name); }
41 //if (ns.Contains("Be.Windows.Forms")) { ns = pair.Key; }
42 FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location);
43 Console.WriteLine(string.Format(" {0} v{1}-{2}", pair.Key, fvi.FileVersion, GetAssemblyArchitecture(asm)));
44 sw.WriteLine(string.Format(" {0} v{1}-{2}", pair.Key, fvi.FileVersion, GetAssemblyArchitecture(asm)));
45 }
46 sw.Close();
47 }
48 }
49
50 static string GetAssemblyArchitecture(Assembly t)
51 {
52 IEnumerable<ProcessorAssemblyArchitecture> attributes = t.GetCustomAttributes(typeof(ProcessorAssemblyArchitecture), false).ToList().Cast<ProcessorAssemblyArchitecture>();
53
54 foreach (ProcessorAssemblyArchitecture arch in attributes)
55 {
56 return arch.Architecture;
57 }
58 return ProcessorAssemblyArchitecture.GetProcessorArchitecture(t);
59 }
60
61 static Dictionary<string, Type> CreateAssemblyDictonary()
62 {
63 Dictionary<string, Type> dict = new Dictionary<string, Type>();
64
65 #region assemblies
66 dict.Add("RomCheater.Core.dll", typeof(RomCheater.Core.dummy));
67 dict.Add("RomCheater.exe", typeof(RomCheater.Main));
68 dict.Add("RomCheater.Logging.dll", typeof(RomCheater.Logging.logger));
69 dict.Add("RomCheater.PluginFramework.dll", typeof(RomCheater.PluginFramework.dummy));
70 dict.Add("RomCheater.UserSettingsSupport.dll", typeof(RomCheater.UserSettingsSupport.SettingSubscriber));
71 dict.Add("RomCheater.CorePlugins.dll", typeof(RomCheater.CorePlugins.Config.GenericConfig));
72
73 dict.Add("libWin32.dll", typeof(libWin32.dummy));
74 dict.Add("Sojaner.MemoryScanner.dll", typeof(Sojaner.MemoryScanner.dummy));
75
76
77
78 #region deps
79 dict.Add("Be.Windows.Forms.HexBox.dll", typeof(Be.Windows.Forms.HexBox));
80 dict.Add("Utilities.TransparentControls.dll", typeof(Utilities.TransparentControls.Win32));
81 dict.Add("ManagedWinapi.dll", typeof(ManagedWinapi.ClipboardNotifier));
82 #endregion
83
84 #endregion
85
86 return dict;
87 }
88 }
89 }