/[RomCheater]/trunk/MSBuild_CurrentVersion/Program.cs
ViewVC logotype

Contents of /trunk/MSBuild_CurrentVersion/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 889 - (show annotations) (download)
Wed Sep 17 04:55:52 2014 UTC (5 years, 4 months ago) by william
File size: 4974 byte(s)


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.InterfacesPlugins;
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 FileInfo fi = new FileInfo(full_path);
29 if (fi.Exists) fi.Delete();
30 using (FileStream fs = new FileStream(full_path, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite))
31 {
32 StreamWriter sw = new StreamWriter(fs);
33 sw.AutoFlush = true;
34 Dictionary<string, Type> dict = CreateAssemblyDictonary();
35 Console.WriteLine("Current Version:");
36 sw.WriteLine("Current Version:");
37 foreach (KeyValuePair<string, Type> pair in dict)
38 {
39 Type t = pair.Value;
40 Assembly asm = t.Assembly;
41 //string ns = string.Format("{0}", t.Namespace);
42 //if (ns.Contains("CorePlugins")) { ns = string.Format("{0}.{1}", t.Namespace, t.Name); }
43 //if (ns.Contains("Be.Windows.Forms")) { ns = pair.Key; }
44 FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location);
45 string version = fvi.FileVersion;
46 #if DEBUG
47 version = string.Format("{0}", version);
48
49 #endif
50 #if RELEASE
51 version = version.Replace("-debug", "-release");
52 #endif
53
54 Console.WriteLine(string.Format(" {0} v{1}-{2}", pair.Key, version, GetAssemblyArchitecture(asm)));
55 sw.WriteLine(string.Format(" {0} v{1}-{2}", pair.Key, version, GetAssemblyArchitecture(asm)));
56 }
57 sw.Close();
58 }
59 }
60
61 static string GetAssemblyArchitecture(Assembly t)
62 {
63 IEnumerable<ProcessorAssemblyArchitecture> attributes = t.GetCustomAttributes(typeof(ProcessorAssemblyArchitecture), false).ToList().Cast<ProcessorAssemblyArchitecture>();
64
65 foreach (ProcessorAssemblyArchitecture arch in attributes)
66 {
67 return arch.Architecture;
68 }
69 return ProcessorAssemblyArchitecture.GetProcessorArchitecture(t);
70 }
71
72 static Dictionary<string, Type> CreateAssemblyDictonary()
73 {
74 Dictionary<string, Type> dict = new Dictionary<string, Type>();
75
76 #region assemblies
77 dict.Add("RomCheater.Interfaces.dll", typeof(RomCheater.Interfaces.BaseEventArgs));
78 dict.Add("RomCheater.Core.dll", typeof(RomCheater.Core.dummy));
79 dict.Add("RomCheater.exe", typeof(RomCheater.Main));
80 dict.Add("RomCheater.Logging.dll", typeof(RomCheater.Logging.LoggingConstants));
81 dict.Add("RomCheater.PluginFramework.dll", typeof(RomCheater.PluginFramework.dummy));
82 dict.Add("RomCheater.UserSettingsSupport.dll", typeof(RomCheater.UserSettingsSupport.SettingSubscriber));
83 dict.Add("RomCheater.InterfacesPlugins.dll", typeof(RomCheater.InterfacesPlugins.Config.GenericConfig));
84
85 dict.Add("libWin32.dll", typeof(libWin32.dummy));
86 dict.Add("Sojaner.MemoryScanner.dll", typeof(Sojaner.MemoryScanner.dummy));
87
88
89
90 #region deps
91 dict.Add("Be.Windows.Forms.HexBox.dll", typeof(Be.Windows.Forms.HexBox));
92 dict.Add("Utilities.TransparentControls.dll", typeof(Utilities.TransparentControls.Win32));
93 dict.Add("ManagedWinapi.dll", typeof(ManagedWinapi.ClipboardNotifier));
94 dict.Add("WeifenLuo.WinFormsUI.Docking.dll", typeof(WeifenLuo.WinFormsUI.Docking.DockPanel));
95 dict.Add("Enterprise.Logging.dll", typeof(Enterprise.Logging.gLog));
96 #endregion
97
98 #region extra plugins
99 dict.Add("RomCheater.CheatPlugin.dlll", typeof(RomCheater.CheatPlugin.CheatCodePlugin));
100 dict.Add("RomCheater.EmuMMAPPlugin.dlll", typeof(RomCheater.EmuMMAPPlugin.EmuMMAPPlugin));
101 dict.Add("RomCheater.RVACheatList.dlll", typeof(RomCheater.RVACheatList.RVACheatListPlugin));
102 dict.Add("RomCheater.ScratchPad.dlll", typeof(RomCheater.ScratchPad.ScratchPadPlugin));
103 #endregion
104 #endregion
105
106 return dict;
107 }
108 }
109 }

  ViewVC Help
Powered by ViewVC 1.1.22