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

Annotation of /trunk/MSBuild_CurrentVersion/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 846 - (hide annotations) (download)
Tue Sep 16 02:00:25 2014 UTC (6 years, 5 months ago) by william
File size: 4862 byte(s)

1 william 117 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 william 192 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 william 117 {
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 william 181 string version = fvi.FileVersion;
46     #if DEBUG
47 william 186 version = string.Format("{0}", version);
48    
49 william 181 #endif
50     #if RELEASE
51 william 186 version = version.Replace("-debug", "-release");
52 william 181 #endif
53    
54 william 186 Console.WriteLine(string.Format(" {0} v{1}-{2}", pair.Key, version, GetAssemblyArchitecture(asm)));
55 william 183 sw.WriteLine(string.Format(" {0} v{1}-{2}", pair.Key, version, GetAssemblyArchitecture(asm)));
56 william 117 }
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 william 118 return arch.Architecture;
68 william 117 }
69 william 118 return ProcessorAssemblyArchitecture.GetProcessorArchitecture(t);
70 william 117 }
71    
72     static Dictionary<string, Type> CreateAssemblyDictonary()
73     {
74     Dictionary<string, Type> dict = new Dictionary<string, Type>();
75    
76     #region assemblies
77 william 119 dict.Add("RomCheater.Core.dll", typeof(RomCheater.Core.dummy));
78     dict.Add("RomCheater.exe", typeof(RomCheater.Main));
79 william 812 dict.Add("RomCheater.Logging.dll", typeof(RomCheater.Logging.LoggingConstants));
80 william 117 dict.Add("RomCheater.PluginFramework.dll", typeof(RomCheater.PluginFramework.dummy));
81     dict.Add("RomCheater.UserSettingsSupport.dll", typeof(RomCheater.UserSettingsSupport.SettingSubscriber));
82     dict.Add("RomCheater.CorePlugins.dll", typeof(RomCheater.CorePlugins.Config.GenericConfig));
83    
84     dict.Add("libWin32.dll", typeof(libWin32.dummy));
85     dict.Add("Sojaner.MemoryScanner.dll", typeof(Sojaner.MemoryScanner.dummy));
86    
87    
88    
89     #region deps
90     dict.Add("Be.Windows.Forms.HexBox.dll", typeof(Be.Windows.Forms.HexBox));
91     dict.Add("Utilities.TransparentControls.dll", typeof(Utilities.TransparentControls.Win32));
92 william 124 dict.Add("ManagedWinapi.dll", typeof(ManagedWinapi.ClipboardNotifier));
93 william 143 dict.Add("WeifenLuo.WinFormsUI.Docking.dll", typeof(WeifenLuo.WinFormsUI.Docking.DockPanel));
94 william 823 dict.Add("Enterprise.Logging.dll", typeof(Enterprise.Logging.gLog));
95 william 117 #endregion
96    
97 william 846 #region extra plugins
98     dict.Add("RomCheater.CheatPlugin.dlll", typeof(RomCheater.CheatPlugin.CheatCodePlugin));
99     dict.Add("RomCheater.EmuMMAPPlugin.dlll", typeof(RomCheater.EmuMMAPPlugin.EmuMMAPPlugin));
100     dict.Add("RomCheater.RVACalculator.dlll", typeof(RomCheater.RVACalculator.RVACalculatorPlugin));
101     dict.Add("RomCheater.ScratchPad.dlll", typeof(RomCheater.ScratchPad.ScratchPadPlugin));
102 william 117 #endregion
103 william 846 #endregion
104 william 117
105     return dict;
106     }
107     }
108     }

  ViewVC Help
Powered by ViewVC 1.1.22