Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ver:20111127

  • Loading branch information...
commit 7207bd4100a6659c7be866646779e6368e7d17ed 1 parent 09df6b6
Henry Yang authored
View
43 MadCow/Class/Compile.cs
@@ -26,8 +26,9 @@ namespace MadCow
class Compile
{
public static String currentMooegeExePath = Program.programPath + @"\mooege-mooege-" + Program.lastRevision + @"\src\Mooege\bin\Debug\Mooege.exe";
- public static String currentMooegeDebudFolderPath = Program.programPath + @"\mooege-mooege-" + Program.lastRevision + @"\src\Mooege\bin\Debug\";
+ public static String currentMooegeDebugFolderPath = Program.programPath + @"\mooege-mooege-" + Program.lastRevision + @"\src\Mooege\bin\Debug\";
public static String mooegeINI = Program.programPath + @"\mooege-mooege-" + Program.lastRevision + @"\src\Mooege\bin\Debug\config.ini";
+ public static String madcowINI = Program.programPath + @"\Tools\\Settings.ini";
public static String compileArgs = Program.programPath + @"\mooege-mooege-" + Program.lastRevision + @"\build\Mooege-VS2010.sln";
public static String msbuildPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.System) + @"\..\Microsoft.NET\Framework\v4.0.30319\msbuild.exe";
@@ -50,9 +51,19 @@ public static void ExecuteCommandSync(String command)
Console.WriteLine("编译最新Mooege的源代码完成");
Console.ForegroundColor = ConsoleColor.White;
}
- catch (Exception objException)
+ catch (Exception e)
{
- Console.WriteLine(objException);
+ Console.WriteLine(e);
+ Console.ForegroundColor = ConsoleColor.Red;
+ //The problem is, while passing args to ExecuteCommandSync(String command)
+ //If the argument its too long due to the current mooege folder path (Program.programPath)
+ //msbuild.exe won't be able to recieve the complete arguments and compiling will fail.
+ Console.WriteLine("\n长路径错误:不能编译Mooege来源,"
+ + "\n请使用较短的文件夹的路径移动MadCow文件到(例如: C:/MadCow/)");
+ Console.ForegroundColor = ConsoleColor.White;
+ Console.WriteLine("\n按任意键退出......");
+ Console.ReadKey();
+ Environment.Exit(0);
}
}
@@ -66,25 +77,27 @@ public static void ModifyMooegeINI()
{
Console.WriteLine("修改Mooege MPQ存储文件夹......");
IConfig config = source.Configs["Storage"];
- config.Set("MPQRoot", Program.programPath + @"\MPQ");
+ config.Set("MPQRoot", Program.programPath + "\\MPQ");
source.Save();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("修改Mooege MPQ存储文件夹完成");
Console.ForegroundColor = ConsoleColor.White;
}
+ //Then we create the MPQ folder in MadCow Root Folder.
+ if (Directory.Exists(Program.programPath + "\\MPQ"))
+ {
+ Directory.Delete(Program.programPath + "\\MPQ", true);
+ Console.WriteLine("删除当前MPQ MadCow文件夹成功");
+ Directory.CreateDirectory(Program.programPath + "\\MPQ");
+ Console.WriteLine("创建新MPQ MadCow文件夹成功");
+ }
}
- catch (Exception)
+ catch (Exception e)
{
Console.ForegroundColor = ConsoleColor.Red;
- //The problem is, while passing args to ExecuteCommandSync(String command)
- //If the argument its too long due to the current mooege folder path (Program.programPath)
- //msbuild.exe won't be able to recieve the complete arguments and compiling will fail.
- Console.WriteLine("\n长路径错误:不能编译Mooege来源,"
- + "\n请使用较短的文件夹的路径移动MadCow文件到(例如: C:/MadCow/)");
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("\n按任意键退出......");
- Console.ReadKey();
- Environment.Exit(0);
+ Console.WriteLine("不能修改Mooege INI文件");
+ Console.WriteLine(e);
+ Console.ForegroundColor = ConsoleColor.White;
}
}
@@ -96,7 +109,7 @@ static public void WriteVbsPath()
reader.Close();
content = Regex.Replace(content, "MODIFY", Compile.currentMooegeExePath);
- content = Regex.Replace(content, "WESKO", Compile.currentMooegeDebudFolderPath);
+ content = Regex.Replace(content, "WESKO", Compile.currentMooegeDebugFolderPath);
StreamWriter writer = new StreamWriter(vbsPath);
writer.Write(content);
writer.Close();
View
3  MadCow/Class/Diablo3.cs
@@ -33,7 +33,8 @@ public static void FindDiablo3()
RegistryKey d3Path = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\");
if (d3Path == null) //D3未发现
- {
+ {
+ Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("暗黑3未安装" + "\n请安装Diablo III Beta再运行MadCow程序");
Console.ReadKey();
Environment.Exit(0);
View
2  MadCow/Class/MPQprocedure.cs
@@ -96,8 +96,6 @@ public static void MpqTransfer()
//当所有的文件已经复制即可
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("复制MPQ过程已经完成");
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("检查你电脑桌面的Mooege快捷键");
Console.ForegroundColor = ConsoleColor.White;
}
}
View
62 MadCow/Class/MadCowRunProcedure.cs
@@ -0,0 +1,62 @@
+/*********************************************************************
+ * Copyright (C) 2011 Iker Ruiz Arnauda (Wesko)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MadCow
+{
+ class MadCowRunProcedure
+ {
+ public static void RunMadCow(int runType) //0 - 没有D3客户端 //1 - 客户端已安装
+ {
+ if (runType == 1)
+ {
+ PreRequeriments.CheckPrerequeriments();
+ Diablo3.FindDiablo3();
+ Diablo3.VerifyVersion();
+ DownloadRevision.DownloadLatest();
+ Uncompress.UncompressFiles();
+ Compile.ExecuteCommandSync(Compile.msbuildPath + " " + Compile.compileArgs);
+ Compile.ModifyMooegeINI();
+ Compile.WriteVbsPath();
+ MPQprocedure.ValidateMD5();
+ MPQprocedure.MpqTransfer();
+ Console.ForegroundColor = ConsoleColor.Green;
+ Console.WriteLine("\n程序已经编译成功,请检查桌面Mooege快捷键");
+ Console.ForegroundColor = ConsoleColor.White;
+ }
+ else
+ {
+ PreRequeriments.CheckPrerequeriments();
+ DownloadRevision.DownloadLatest();
+ Uncompress.UncompressFiles();
+ Compile.ExecuteCommandSync(Compile.msbuildPath + " " + Compile.compileArgs);
+ Compile.ModifyMooegeINI();
+ Compile.WriteVbsPath();
+ Console.ForegroundColor = ConsoleColor.Yellow;
+ Console.WriteLine("\n 如果不能自动复制MPQ请手动复制MPQ到..//MadCow/MPQ");
+ Console.ForegroundColor = ConsoleColor.Green;
+ Console.WriteLine("\n程序已经编译成功,请检查桌面Mooege快捷键");
+ Console.ForegroundColor = ConsoleColor.White;
+ }
+ }
+ }
+}
View
43 MadCow/Class/PreRequeriments.cs
@@ -17,11 +17,54 @@
*********************************************************************/
using System;
using System.Runtime.InteropServices;
+using Nini.Config;
namespace MadCow
{
class PreRequeriments
{
+ public static void FirstRunConfiguration()
+ {
+ IConfigSource iniSource = new IniConfigSource(Compile.madcowINI);
+ string getValues = iniSource.Configs["Settings"].Get("firstrun");
+ IConfig config = iniSource.Configs["Settings"];
+
+ if (getValues.Contains("0"))
+ {
+ Console.WriteLine("你有暗黑3安装在这台电脑吗? (yes/no)");
+ string input = Console.ReadLine();
+ switch (input.ToLower())
+ {
+ case "yes":
+ config.Set("d3installed", 1);
+ config.Set("firstrun", 1);
+ iniSource.Save();
+ Console.ForegroundColor = ConsoleColor.Green;
+ Console.WriteLine("保持第一次运行配置文件完成");
+ Console.ForegroundColor = ConsoleColor.White;
+ MadCowRunProcedure.RunMadCow(1); //运行D3安装模式
+ break;
+ case "no":
+ config.Set("firstrun", 1);
+ iniSource.Save();
+ Console.ForegroundColor = ConsoleColor.Green;
+ Console.WriteLine("保持第一次运行配置文件完成");
+ Console.ForegroundColor = ConsoleColor.White;
+ MadCowRunProcedure.RunMadCow(0); //没有D3运行安装模式
+ break;
+ default:
+ Console.WriteLine("选择 yes 或 no");
+ break;
+ }
+ }
+ else
+ {
+ string D3InstallStatus = iniSource.Configs["Settings"].Get("firstrun");
+ int StatusValue = Convert.ToInt32(D3InstallStatus);
+ MadCowRunProcedure.RunMadCow(StatusValue);
+ }
+ }
+
public static void CheckPrerequeriments()
{
//Boolean checkSqlite = LoadSQLLiteAssembly();
View
2  MadCow/MadCow.csproj
@@ -54,6 +54,7 @@
<Compile Include="Class\Compile.cs" />
<Compile Include="Class\DownloadRevision.cs" />
<Compile Include="Class\Diablo3.cs" />
+ <Compile Include="Class\MadCowRunProcedure.cs" />
<Compile Include="Class\MPQprocedure.cs" />
<Compile Include="Class\ParseRevision.cs" />
<Compile Include="Class\PreRequeriments.cs" />
@@ -71,6 +72,7 @@
<ItemGroup>
<None Include="App.config" />
<None Include="dep\nini\Nini.Licence" />
+ <None Include="Tools\Settings.ini" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
12 MadCow/Program.cs
@@ -39,17 +39,7 @@ static void Main(string[] args)
}
else
{
- PreRequeriments.CheckPrerequeriments();
- Diablo3.FindDiablo3();
- Diablo3.VerifyVersion();
- DownloadRevision.DownloadLatest();
- Uncompress.UncompressFiles();
- Compile.ExecuteCommandSync(Compile.msbuildPath + " " + Compile.compileArgs);
- Compile.ModifyMooegeINI();
- Compile.WriteVbsPath();
-
- MPQprocedure.ValidateMD5();
- MPQprocedure.MpqTransfer();
+ PreRequeriments.FirstRunConfiguration();
}
Commands.CommandReader();
View
3  MadCow/Tools/Settings.ini
@@ -0,0 +1,3 @@
+[Settings]
+d3installed=0
+firstrun=0
View
2  README.md
@@ -11,4 +11,4 @@
3. 打开MadCow程序文件MadCowzh.sln
4. 运行、编译
5. MadCow将放置在<MadCow文件夹>\bin\Debug
-6. 享受...
+6. 享受吧...
Please sign in to comment.
Something went wrong with that request. Please try again.