예제 #1
0
        private void CleanUpPackages(Version latestVersion)
        {
            var packagesDirectory = InstallDirectory.GetDirectories("packages", SearchOption.TopDirectoryOnly).FirstOrDefault();

            if (packagesDirectory == null)
            {
                return;
            }

            var packages = packagesDirectory.GetFiles("*.nupkg", SearchOption.TopDirectoryOnly);
        }
예제 #2
0
        public void SetInstallDirectory(string installDirectory)
        {
            InstallDirectory = PathUtility.Combine(installDirectory, "Master");

            #if UNITY_IOS
            if (InstallDirectory.StartsWith(Application.persistentDataPath))
            {
                UnityEngine.iOS.Device.SetNoBackupFlag(InstallDirectory);
            }
            #endif
        }
예제 #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (InstallDirectory != null ? InstallDirectory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ApplicationConfigDirectory != null ? ApplicationConfigDirectory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ModConfigDirectory != null ? ModConfigDirectory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PluginConfigDirectory != null ? PluginConfigDirectory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (EnabledPlugins != null ? EnabledPlugins.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ModSupportMatrix != null ? ModSupportMatrix.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #4
0
        /// <summary> 保存先ディレクトリ設定. </summary>
        public void SetInstallDirectory(string directory)
        {
            InstallDirectory = PathUtility.Combine(directory, "ExternalResources");

            #if UNITY_IOS
            if (InstallDirectory.StartsWith(Application.persistentDataPath))
            {
                UnityEngine.iOS.Device.SetNoBackupFlag(InstallDirectory);
            }
            #endif

            assetBundleManager.SetInstallDirectory(InstallDirectory);

            #if ENABLE_CRIWARE_ADX || ENABLE_CRIWARE_SOFDEC
            criAssetManager.SetInstallDirectory(InstallDirectory);
            #endif
        }
예제 #5
0
        public void StartClient()
        {
            // Find the latest client executable
            var directories = new SortedDictionary <Version, string>();

            InstallDirectory.GetDirectories(SquirrelAppDirectoriesSearchPattern)
            .ToList()
            .ForEach(d => { directories.Add(GetVersionFromAppFolder(d), d.FullName); });
            string latestClient = Directory.GetFiles(directories.Last().Value, ClientExeName).FirstOrDefault();

            // Clean up application directories as needed.
            CleanUpAppDirectory(directories.Values.ToArray());

            // Clean up the packages folder as needed.
            CleanUpPackages(directories.Last().Key);

            // Start the client in a new process and kill the bootstrap process.
            Process.Start(latestClient, JsonConvert.SerializeObject(""));
            Process.GetCurrentProcess().Kill();
        }
예제 #6
0
        public WurmClientMock([NotNull] DirectoryHandle dir, bool createBasicDirs, Platform targetPlatform)
        {
            if (dir == null)
            {
                throw new ArgumentNullException(nameof(dir));
            }
            this.dir            = dir;
            this.targetPlatform = targetPlatform;

            var dirinfo = new DirectoryInfo(dir.AbsolutePath);

            WurmDir = dirinfo.CreateSubdirectory("wurm");

            if (createBasicDirs)
            {
                CreateBasicDirectories();
            }

            InstallDirectory = Mock.Create <IWurmClientInstallDirectory>();
            InstallDirectory.Arrange(directory => directory.FullPath).Returns(Path.Combine(dir.AbsolutePath, "wurm"));
        }
예제 #7
0
파일: Config.cs 프로젝트: AllenBP/anope
        static int Main(string[] args)
        {
            bool IgnoreCache = false, NoIntro = false, DoQuick = false;

            if (args.Length > 0)
            {
                if (args[0] == "--help")
                {
                    Console.WriteLine("Config utility for Anope");
                    Console.WriteLine("------------------------");
                    Console.WriteLine("Syntax: .\\Config.exe [options]");
                    Console.WriteLine("-nocache     Ignore settings saved in config.cache");
                    Console.WriteLine("-nointro     Skip intro (disclaimer, etc)");
                    Console.WriteLine("-quick or -q Skip questions, go straight to cmake");
                    return(0);
                }
                else if (args[0] == "-nocache")
                {
                    IgnoreCache = true;
                }
                else if (args[0] == "-nointro")
                {
                    NoIntro = true;
                }
                else if (args[0] == "-quick" || args[0] == "-q")
                {
                    DoQuick = true;
                }
            }

            ExecutablePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            string AnopeVersion = FindAnopeVersion();

            if (!NoIntro && File.Exists(string.Format(@"{0}\.BANNER", ExecutablePath)))
            {
                Console.WriteLine(File.ReadAllText(string.Format(@"{0}\.BANNER", ExecutablePath)).Replace("CURVER", AnopeVersion).Replace("For more options type SOURCE_DIR/Config --help", ""));
            }

            Console.WriteLine("Press Enter to begin");
            Console.WriteLine();
            Console.ReadKey();

            bool UseCache = false;

            if (DoQuick || !IgnoreCache)
            {
                UseCache = LoadCache();
                if (DoQuick && !UseCache)
                {
                    Console.WriteLine("Can't find cache file (config.cache), aborting...");
                    return(1);
                }
            }

            if (!DoQuick)
            {
                List <string> InstallerQuestions = new List <string>()
                {
                    "Where do you want Anope to be installed?",
                    "Would you like to build using NMake instead of using Visual Studio?\r\nNOTE: If you decide to use NMake, you must be in an environment where\r\nNMake can function, such as the Visual Studio command line. If you say\r\nyes to this while not in an environment that can run NMake, it can\r\ncause the CMake configuration to enter an endless loop. [y/n]",
                    "Are you using Visual Studio 2008, 2010, or 2012? You can leave this blank\nand have CMake try and auto detect it, but this usually doesn't\nwork correctly. [2008/2010/2012]",
                    "Would you like to build a debug version of Anope? [y/n]",
                    "Are there any extra include directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra include directories, enter NONE in all caps.",
                    "Are there any extra library directories you wish to use?\nYou may only need to do this if CMake is unable to locate missing dependencies without hints.\nSeparate directories with semicolons and use slashes (aka /) instead of backslashes (aka \\).\nIf you need no extra library directories, enter NONE in all caps.",
                    "Are there any extra arguments you wish to pass to CMake?\nIf you need no extra arguments to CMake, enter NONE in all caps."
                };

                for (int i = 0; i < InstallerQuestions.Count; ++i)
                {
                    Console.WriteLine(InstallerQuestions[i]);
                    string CacheResponse = null;
                    if (UseCache)
                    {
                        CacheResponse = HandleCache(i);
                    }
                    string InstallerResponse = Console.ReadLine();
                    Console.WriteLine();

                    if (!string.IsNullOrWhiteSpace(CacheResponse) && string.IsNullOrWhiteSpace(InstallerResponse))
                    {
                        InstallerResponse = CacheResponse;
                    }

                    // Question 5-7 are optional
                    if (i < 4 && string.IsNullOrWhiteSpace(InstallerResponse))
                    {
                        Console.WriteLine("Invalid option");
                        --i;
                        continue;
                    }

                    switch (i)
                    {
                    case 0:
                        if (!Directory.Exists(InstallerResponse))
                        {
                            Console.WriteLine("Directory does not exist! Creating directory.");
                            Console.WriteLine();
                            try
                            {
                                Directory.CreateDirectory(InstallerResponse);
                                InstallDirectory = InstallerResponse;
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("Unable to create directory: " + e.Message);
                                --i;
                            }
                        }
                        else if (File.Exists(InstallerResponse + @"\include\services.h"))
                        {
                            Console.WriteLine("You cannot use the Anope source directory as the target directory!");
                            --i;
                        }
                        else
                        {
                            InstallDirectory = InstallerResponse;
                        }
                        break;

                    case 1:
                        UseNMake = CheckResponse(InstallerResponse);
                        if (UseNMake)
                        {
                            ++i;
                        }
                        break;

                    case 2:
                        if (InstallerResponse == "2012")
                        {
                            VSVersion  = "-G\"Visual Studio 11\" ";
                            VSShortVer = "2012";
                        }
                        else if (InstallerResponse == "2010")
                        {
                            VSVersion  = "-G\"Visual Studio 10\" ";
                            VSShortVer = "2010";
                        }
                        else if (InstallerResponse == "2008")
                        {
                            VSVersion  = "-G\"Visual Studio 9 2008\" ";
                            VSShortVer = "2008";
                        }
                        break;

                    case 3:
                        BuildDebug = CheckResponse(InstallerResponse);
                        break;

                    case 4:
                        if (InstallerResponse == "NONE")
                        {
                            ExtraIncludeDirs = null;
                        }
                        else
                        {
                            ExtraIncludeDirs = InstallerResponse;
                        }
                        break;

                    case 5:
                        if (InstallerResponse == "NONE")
                        {
                            ExtraLibDirs = null;
                        }
                        else
                        {
                            ExtraLibDirs = InstallerResponse;
                        }
                        break;

                    case 6:
                        if (InstallerResponse == "NONE")
                        {
                            ExtraArguments = null;
                        }
                        else
                        {
                            ExtraArguments = InstallerResponse;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }

            Console.WriteLine("Anope will be compiled with the following options:");
            Console.WriteLine("Install directory: {0}", InstallDirectory);
            Console.WriteLine("Use NMake: {0}", UseNMake ? "Yes" : "No");
            if (!string.IsNullOrWhiteSpace(VSShortVer))
            {
                Console.WriteLine("Using Visual Studio: {0}", VSShortVer);
            }
            else
            {
                Console.WriteLine("Using Visual Studio: No");
            }
            Console.WriteLine("Build debug: {0}", BuildDebug ? "Yes" : "No");
            Console.WriteLine("Anope Version: {0}", AnopeVersion);
            Console.WriteLine("Extra Include Directories: {0}", ExtraIncludeDirs);
            Console.WriteLine("Extra Library Directories: {0}", ExtraLibDirs);
            Console.WriteLine("Extra Arguments: {0}", ExtraArguments);
            Console.WriteLine("Press Enter to continue...");
            Console.ReadKey();

            SaveCache();

            if (!string.IsNullOrWhiteSpace(ExtraIncludeDirs))
            {
                ExtraIncludeDirs = string.Format("-DEXTRA_INCLUDE:STRING={0} ", ExtraIncludeDirs);
            }
            else
            {
                ExtraIncludeDirs = "";
            }
            if (!string.IsNullOrWhiteSpace(ExtraLibDirs))
            {
                ExtraLibDirs = string.Format("-DEXTRA_LIBS:STRING={0} ", ExtraLibDirs);
            }
            else
            {
                ExtraLibDirs = "";
            }
            if (!string.IsNullOrWhiteSpace(ExtraArguments))
            {
                ExtraArguments += " ";
            }
            else
            {
                ExtraArguments = "";
            }

            InstallDirectory = "-DINSTDIR:STRING=\"" + InstallDirectory.Replace('\\', '/') + "\" ";
            string NMake = UseNMake ? "-G\"NMake Makefiles\" " : "";
            string Debug = BuildDebug ? "-DCMAKE_BUILD_TYPE:STRING=DEBUG " : "-DCMAKE_BUILD_TYPE:STRING=RELEASE ";
            string cMake = InstallDirectory + NMake + Debug + VSVersion + ExtraIncludeDirs + ExtraLibDirs + ExtraArguments + "\"" + ExecutablePath.Replace('\\', '/') + "\"";

            RunCMake(cMake);

            return(0);
        }