コード例 #1
0
ファイル: ExtensionTests.cs プロジェクト: hochladen/Hacknet
        public static string TestExtensionCustomStartSong(ScreenManager screenMan, out int errorsAdded)
        {
            int    num  = 0;
            string str1 = "";

            ExtensionLoader.ActiveExtensionInfo = ExtensionInfo.ReadExtensionInfo("Content/Tests/TestExtension");
            ExtensionInfo activeExtensionInfo = ExtensionLoader.ActiveExtensionInfo;

            if (activeExtensionInfo.IntroStartupSong != null)
            {
                string str2 = "Content/Music/" + activeExtensionInfo.IntroStartupSong;
                if (File.Exists(str2))
                {
                    MusicManager.loadAsCurrentSong(str2);
                }
            }
            errorsAdded = num;
            return(str1);
        }
コード例 #2
0
 private void AddExtensionSafe(string folderpath)
 {
     if (!ExtensionInfo.ExtensionExists(folderpath))
     {
         return;
     }
     try
     {
         this.Extensions.Add(ExtensionInfo.ReadExtensionInfo(folderpath));
     }
     catch (Exception ex)
     {
         Console.WriteLine(Utils.GenerateReportFromException(ex));
         ExtensionsMenuScreen extensionsMenuScreen = this;
         string str = extensionsMenuScreen.LoadErrors + LocaleTerms.Loc("Error loading ExtensionInfo for") + " " + folderpath + "\n" + LocaleTerms.Loc("Error details written to") + " " + folderpath.Replace("\\", "/") + "/error_report.txt\n\n";
         extensionsMenuScreen.LoadErrors = str;
         Utils.writeToFile("Error loading ExtensionInfo for extension in folder:\n" + folderpath + "\nError details: \n" + Utils.GenerateReportFromException(ex), folderpath + "/error_report.txt");
     }
 }
コード例 #3
0
ファイル: Game1.cs プロジェクト: hochladen/Hacknet
 protected void LoadInitialScreens()
 {
     if (Settings.ForceEnglish)
     {
         LocaleActivator.ActivateLocale(Settings.ActiveLocale, this.Content);
     }
     if (Game1.AutoLoadExtensionPath != null)
     {
         ExtensionLoader.ActiveExtensionInfo = ExtensionInfo.ReadExtensionInfo(Game1.AutoLoadExtensionPath);
         SaveFileManager.Init(true);
         SaveFileManager.DeleteUser("test");
         MainMenu.CreateNewAccountForExtensionAndStart("test", "test", this.sman, (GameScreen)null, (ExtensionsMenuScreen)null);
     }
     else if (Settings.MenuStartup)
     {
         this.sman.AddScreen((GameScreen) new MainMenu(), new PlayerIndex?(this.sman.controllingPlayer));
     }
     else
     {
         this.sman.AddScreen((GameScreen) new OS(), new PlayerIndex?(this.sman.controllingPlayer));
     }
 }