private static bool Prefix(ref LoadThemePanel __instance, ref UIListBox ___m_SaveList, ref UIButton ___m_LoadButton, string ___m_LastSaveName) { using (AutoProfile.Start("LoadMapPanel.Refresh()")) { ClearListing.Invoke(__instance, null); bool snowfallOwned = SteamHelper.IsDLCOwned(SteamHelper.DLC.SnowFallDLC); foreach (Package.Asset asset in PackageManager.FilterAssets(UserAssetType.MapThemeMetaData)) { if (asset == null || !asset.isEnabled) { continue; } try { var mmd = asset.Instantiate <MapThemeMetaData>(); mmd.SetSelfRef(asset); if (mmd.environment == "Winter" && !snowfallOwned) { continue; } var forbid = false; foreach (string s in Forbidden) { if (asset.fullName.Contains(s)) { forbid = true; } } if (forbid) { continue; } var parameters = _addToListingParamCount == 5 ? new object[] { asset.name, mmd.timeStamp, asset, mmd, true } : new object[] { asset.name, mmd.timeStamp, asset, mmd, true, false }; AddToListing.Invoke(__instance, parameters); } catch (Exception ex) { CODebug.Error(LogChannel.Serialization, "'" + asset.name + "' failed to load.\n" + ex.ToString()); } } ___m_SaveList.items = GetListingItems.Invoke(__instance, null) as string[]; var listingCount = (int)GetListingCount.Invoke(__instance, null); if (listingCount > 0) { var idx = (int)FindIndexOf.Invoke(__instance, new object[] { ___m_LastSaveName }); ___m_SaveList.selectedIndex = (idx != -1) ? idx : 0; ___m_LoadButton.isEnabled = true; } else { ___m_LoadButton.isEnabled = false; } } return(false); }
public void OnEnabled() { Util.DebugPrint(this.Name + " enabled"); if (!SteamHelper.IsDLCOwned(SteamHelper.DLC.SnowFallDLC)) //ist das benötigte DLC vorhanden? { // Falls NEIN eine Meldung im Debugfenster / Debuglog ausgeben und... Util.DebugPrint("Snowfall is not installed, aborting."); //... ein PopUp Fenster (Modal) über die Loadingmanager IntroLoaded Klasse aufrufen Singleton <LoadingManager> .instance.m_introLoaded += DisplayError; } }
public override void Handle(SyncModsCommand command) { var mask = SteamHelper.GetOwnedDLCMask(); foreach (var dlc in mask.DLCs()) { // Checks availability on the server? if (SteamHelper.IsDLCAvailable(dlc)) { //TODO: GET DLC } } }
void update(bool raiseEvent = true) { SetPaths(); TryReadSteamConfig(); SteamHelper = new SteamHelper(SteamConfig, GetSteamPath()); if (raiseEvent) { CalculatedGameSettings.RaiseEvent(new LocalMachineInfoChanged()); } }
public static void setEvacBussesMayIgnoreRules(bool value) { if (!SteamHelper.IsDLCOwned(SteamHelper.DLC.NaturalDisastersDLC)) { value = false; } evacBussesMayIgnoreRules = value; if (evacBussesMayIgnoreRulesToggle != null) { evacBussesMayIgnoreRulesToggle.isChecked = value; } }
private static void addPurchaseButton(int left, int top, Purchase purchaseId, int count) { if (GUI.Button(new Rect(GuiBase.Width((float)left), GuiBase.Height((float)top), GuiBase.Width(180f), GuiBase.Height(32f)), new GUIContent(string.Concat(new object[] { "Buy ", count, " for ", //Purchases.GetPriceText(purchaseId) })))) { SteamHelper.TimerSinceStarted = UpdateStats.CurrentTimeMillis(); SteamHelper.PurchaseItem(purchaseId); } }
public static void SetStrongerRoadConditionEffects(bool newStrongerRoadConditionEffects) { if (!SteamHelper.IsDLCOwned(SteamHelper.DLC.SnowFallDLC)) { newStrongerRoadConditionEffects = false; } Options.strongerRoadConditionEffects = newStrongerRoadConditionEffects; if (_strongerRoadConditionEffectsToggle != null) { _strongerRoadConditionEffectsToggle.isChecked = newStrongerRoadConditionEffects; } }
public void Dispose() { if (SteamHelper != null) { try { SteamHelper.Dispose(); } catch (Exception ex) { Trace.TraceError(ex.ToString()); } } }
private static string GetGamePath() { string gamePath = SteamHelper.FindHollowKnightPath(); if (gamePath == "" || !Directory.Exists(gamePath)) { EditorUtility.DisplayDialog("HKEdit", "Could not find Steam path. If you've moved your Steam directory this could be why. Contact nes.", "OK"); return(null); } string gameDataPath = Path.Combine(gamePath, "hollow_knight_Data"); return(gameDataPath); }
public override void Load() { // loads the mod's configuration file. ConfigModel.Load(); SteamHelper.Initialize(); //Loot.EMMLoader.RegisterMod(this); //Loot.EMMLoader.SetupContent(this); tremorLoaded = ModLoader.GetMod("Tremor") != null; thoriumLoaded = ModLoader.GetMod("ThoriumMod") != null; enigmaLoaded = ModLoader.GetMod("Laugicality") != null; battlerodsLoaded = ModLoader.GetMod("UnuBattleRods") != null; expandedSentriesLoaded = ModLoader.GetMod("ExpandedSentries") != null; MyPlayer.kaiokenKey = RegisterHotKey("Kaioken", "J"); MyPlayer.energyCharge = RegisterHotKey("Energy Charge", "C"); MyPlayer.transform = RegisterHotKey("Transform", "X"); MyPlayer.powerDown = RegisterHotKey("Power Down", "V"); MyPlayer.speedToggle = RegisterHotKey("Speed Toggle", "Z"); MyPlayer.quickKi = RegisterHotKey("Quick Ki", "N"); MyPlayer.transMenu = RegisterHotKey("Transformation Menu", "K"); MyPlayer.instantTransmission = RegisterHotKey("Instant Transmission", "I"); //MyPlayer.ProgressionMenuKey = RegisterHotKey("Progression Menu", "P"); MyPlayer.flyToggle = RegisterHotKey("Flight Toggle", "Q"); MyPlayer.armorBonus = RegisterHotKey("Armor Bonus", "Y"); if (!Main.dedServ) { GFX.LoadGFX(this); KiBar.visible = true; ActivateTransMenu(); ActivateWishmenu(); ActivateProgressionMenu(); ActivateKiBar(); ActivateOverloadBar(); ActivateHairMenu(); _instantTransmissionMapTeleporter = new InstantTransmissionMapHelper(); circle = new CircleShader(new Ref <Effect>(GetEffect("Effects/CircleShader")), "Pass1"); Filters.Scene["DBZMOD:GodSky"] = new Filter(new ScreenShaderData("FilterMiniTower").UseColor(0.9f, 0.1f, 0.1f).UseOpacity(0.7f), EffectPriority.VeryHigh); SkyManager.Instance["DBZMOD:GodSky"] = new GodSky(); Filters.Scene["DBZMOD:WishSky"] = new Filter(new ScreenShaderData("FilterMiniTower").UseColor(0.1f, 0.1f, 0.1f).UseOpacity(0.7f), EffectPriority.VeryHigh); SkyManager.Instance["DBZMOD:WishSky"] = new WishSky(); } }
private static TransferManager.TransferReason[] CreateExportResourcesArray() { var resources = VanillaExportResources; if (SteamHelper.IsDLCOwned(SteamHelper.DLC.IndustryDLC)) { resources = ConcatArrays(resources, DLCIndustriesExportResources); } if (SteamHelper.IsDLCOwned(SteamHelper.DLC.UrbanDLC)) { resources = ConcatArrays(resources, DLCSunsetHarbourExportResources); } return(resources); }
private bool Respond(SteamID roomID, string message) { string[] query = StripCommand(message, Options.ChatCommand.Command); if (query != null) { var msg = new ClientMsg <MsgClientChatAction>(); msg.Body.SteamIdChat = SteamHelper.ToChatID(roomID); msg.Body.SteamIdUserToActOn = SteamHelper.ToChatID(roomID); msg.Body.ChatAction = EChatAction.UnlockChat; Bot.steamClient.Send(msg); return(true); } return(false); }
protected override bool CustomRefreshPanel() { bool flag1 = SteamHelper.IsDLCOwned(SteamHelper.DLC.AfterDarkDLC); bool flag2 = SteamHelper.IsDLCOwned(SteamHelper.DLC.GreenCitiesDLC); this.CreateGroupItem(new GeneratedGroupPanel.GroupInfo("DistrictSpecializationPaint", this.GetCategoryOrder("DistrictSpecializationPaint"), "District"), "DISTRICT_CATEGORY"); this.CreateGroupItem((GeneratedGroupPanel.GroupInfo) new DistrictGroupPanel.PTGroupInfo("DistrictSpecializationIndustrial", this.GetCategoryOrder("DistrictSpecializationIndustrial"), UnlockManager.Feature.IndustrySpecializations, "District"), "DISTRICT_CATEGORY"); if (flag2) { this.CreateGroupItem((GeneratedGroupPanel.GroupInfo) new DistrictGroupPanel.PTGroupInfo("DistrictSpecializationCommercial", this.GetCategoryOrder("DistrictSpecializationCommercial"), UnlockManager.Feature.CommercialSpecializationGC, "District"), "DISTRICT_CATEGORY"); } else if (flag1) { this.CreateGroupItem((GeneratedGroupPanel.GroupInfo) new DistrictGroupPanel.PTGroupInfo("DistrictSpecializationCommercial", this.GetCategoryOrder("DistrictSpecializationCommercial"), UnlockManager.Feature.CommercialSpecialization, "District"), "DISTRICT_CATEGORY"); } if (flag2) { this.CreateGroupItem((GeneratedGroupPanel.GroupInfo) new DistrictGroupPanel.PTGroupInfo("DistrictSpecializationOffice", this.GetCategoryOrder("DistrictSpecializationOffice"), UnlockManager.Feature.OfficeSpecializations, "District"), "DISTRICT_CATEGORY"); this.CreateGroupItem((GeneratedGroupPanel.GroupInfo) new DistrictGroupPanel.PTGroupInfo("DistrictSpecializationResidential", this.GetCategoryOrder("DistrictSpecializationResidential"), UnlockManager.Feature.ResidentialSpecializations, "District"), "DISTRICT_CATEGORY"); } //begin mod SetupEvents("Paint", DistrictPolicies.Policies.None); SetupEvents("Erase", DistrictPolicies.Policies.None); SetupEvents("SpecializationForest", DistrictPolicies.Policies.Forest); SetupEvents("SpecializationFarming", DistrictPolicies.Policies.Farming); SetupEvents("SpecializationOil", DistrictPolicies.Policies.Oil); SetupEvents("SpecializationOre", DistrictPolicies.Policies.Ore); SetupEvents("SpecializationNone", DistrictPolicies.Policies.None); if (flag1) { SetupEvents("SpecializationTourist", DistrictPolicies.Policies.Tourist); SetupEvents("SpecializationLeisure", DistrictPolicies.Policies.Leisure); } if (flag1 || flag2) { SetupEvents("SpecializationCommercialNone", DistrictPolicies.Policies.None); } if (flag2) { SetupEvents("SpecializationOrganic", DistrictPolicies.Policies.Organic); SetupEvents("SpecializationSelfsufficient", DistrictPolicies.Policies.Selfsufficient); SetupEvents("SpecializationResidentialNone", DistrictPolicies.Policies.None); SetupEvents("SpecializationHightech", DistrictPolicies.Policies.Hightech); SetupEvents("SpecializationOfficeNone", DistrictPolicies.Policies.None); } //end mod return(true); }
// Token: 0x06000066 RID: 102 RVA: 0x000091FC File Offset: 0x000073FC public static void Steam(string path) { try { string text = Path.Combine(path, "config"); string path2 = Path.Combine(SteamHelper.GetLocationSteam("InstallPath", "SourceModInstallPath"), "config"); bool flag = Directory.Exists(SteamHelper.GetLocationSteam("InstallPath", "SourceModInstallPath")); if (flag) { Directory.CreateDirectory(path); foreach (string text2 in Directory.GetFiles(SteamHelper.GetLocationSteam("InstallPath", "SourceModInstallPath"), "*.")) { try { File.Copy(text2, Path.Combine(path, Path.GetFileName(text2))); } catch { } } bool flag2 = !Directory.Exists(text); if (flag2) { Directory.CreateDirectory(text); File.AppendAllText(path + "\\Accounts.txt", SteamHelper.GetSteamID()); foreach (string text3 in Directory.GetFiles(path2, "*.vdf")) { try { File.Copy(text3, Path.Combine(text, Path.GetFileName(text3))); } catch { } } } } } catch (UnauthorizedAccessException) { } catch (IOException) { } catch (ArgumentException) { } }
/// <summary> /// 删除游戏进程信息 /// </summary> private void DoDelGameProcessInfoBtnClick() { if (string.IsNullOrEmpty(GameProcessInfoText)) { ShowToolTip("删除失败!游戏进程必填!"); return; } // 删除游戏进程 var saveInfo = SteamHelper.GetSaveInfo(); saveInfo.GameProcessList = saveInfo.GameProcessList.Where(r => r.Name != GameProcessInfoText).ToList(); SteamHelper.SaveSaveInfo(saveInfo); ReLoad(); ShowToolTip("删除成功!"); }
void OnLoggedToBothSteamAndTas() { if (tas.MyUser.SteamID == null) { string token = SteamHelper.GetClientAuthTokenHex(); // removed if (!string.IsNullOrEmpty(token)) tas.LinkSteam(token); } foreach (User u in tas.ExistingUsers.Values.ToList().Where(x => x.SteamID != null && friends.Contains(ulong.Parse(x.SteamID)))) { AddFriend(u.Name); } if (Program.Conf.EnableVoiceChat && Environment.OSVersion.Platform != PlatformID.Unix) { Voice.Init(SteamID); } }
/// <summary> /// 删除steam账号信息 /// </summary> private void DoDelSteamAccoutInfoBtnClick() { if (SelectedSteamAccoutInfo == null) { ShowToolTip("删除失败!请选择要修改的账号!"); return; } // 删除账号 var saveInfo = SteamHelper.GetSaveInfo(); saveInfo.SteamAccoutInfoList = saveInfo.SteamAccoutInfoList.Where(r => r.Account != SelectedSteamAccoutInfo.Account).ToList(); SteamHelper.SaveSaveInfo(saveInfo); ReLoad(); ShowToolTip("删除成功!"); }
public async Task CreateSteamShortcutsAsync() { if (CheckModelValidity() && CheckCanDoWork()) { await LoadRomsAndEmulatorsAsync(); await Task.Run(() => { IsLoading = true; LoadingText = "Writing Steam shortcuts..."; SteamHelper.WriteSteamShortcuts(RomModels, EmulatorModels); LoadingText = string.Empty; IsLoading = false; }); } }
private static void StartMatchHistoryRequester() { _matchHistoryRequester = new Timer((x) => { try { if (_lobbyMembers != null && _currentHistoryRequest == 0 || (_lastHistoryRequest.HasValue && DateTime.UtcNow > _lastHistoryRequest.Value.AddSeconds(5))) { var player = _lobbyMembers.Skip(1).Where(m => m.Active && m.PlayerMatches == null).FirstOrDefault(); if (player != null) { _currentHistoryRequest = ulong.Parse(player.AccountId); _lastHistoryRequest = DateTime.UtcNow; _dotaClient.GetPlayerMatchHistory(SteamHelper.ConvertIDToUint32(_currentHistoryRequest)); } } } catch (Exception e) { _logger.Error("Error while requesting a match", e); } }, null, 0, 100); }
/// <summary> /// Runs Factorio. /// </summary> /// <param name="args">Optional. Command line args.</param> public override void Run(string args = null) { string steamPath; if (!SteamHelper.TryGetSteamInstallPath(out steamPath)) { return; } var startInfo = new ProcessStartInfo(Path.Combine(steamPath, "Steam.exe")); startInfo.Arguments = $"-applaunch {AppId}"; if (!string.IsNullOrWhiteSpace(args)) { startInfo.Arguments += $" {args}"; } Process.Start(startInfo); }
public static IEnumerable <T> WhereMeetRequirements <T>(this IEnumerable <T> enumerable) { return(enumerable .Where(element => { if (element is IDLCRequired) { var requiredDLC = ((IDLCRequired)element).RequiredDLC; if (requiredDLC == SteamHelper.DLC.None) { return true; } return SteamHelper.IsDLCOwned(requiredDLC); } return true; })); }
void OnLoggedToBothSteamAndTas() { if (tas.MyUser.SteamID == null) { string token = SteamHelper.GetClientAuthTokenHex(); if (!string.IsNullOrEmpty(token)) { tas.Say(SayPlace.User, GlobalConst.NightwatchName, string.Format("!linksteam {0}", token), false); } } foreach (User u in tas.ExistingUsers.Values.ToList().Where(x => x.SteamID != null && friends.Contains(x.SteamID.Value))) { AddFriend(u.Name); } if (Program.Conf.EnableVoiceChat && Environment.OSVersion.Platform != PlatformID.Unix) { Voice.Init(SteamID); } }
public async Task <JObject> GetUserInfo(string userIdParam) { string userId = User.Identity.Name; if (!String.IsNullOrEmpty(userIdParam)) { userId = userIdParam; } // if user not found then some trouble in auth controller // when user is logining his data saved in db var user = _context.User.FirstOrDefault(u => u.UserId == userId); if (user == null) { return(null); } JObject result = null; using (var client = new HttpClient()) { try { var response = await client.GetAsync(SteamHelper.UserInfoLink(user.UserId)); response.EnsureSuccessStatusCode(); var responseResult = await response.Content.ReadAsStringAsync(); JObject json = JObject.Parse(responseResult); result = (JObject)json["response"]["players"][0]; } catch (HttpRequestException httpRequestException) { Console.WriteLine($"Error getting user info from: {httpRequestException.Message}"); return(null); } catch { Console.WriteLine($"Error getting user info"); return(null); } } return(result); }
public async Task CreateSteamShortcutsAsync() { if (EmulatorModels != null && EmulatorModels.Length > 0 && RomModels != null && RomModels.Length > 0) { await LoadRomsAndEmulatorsAsync(); } if (EmulatorModels != null && EmulatorModels.Length > 0 && RomModels != null && RomModels.Length > 0) { await Task.Run(() => { IsLoading = true; LoadingText = "Writing Steam Shortcuts"; SteamHelper.WriteSteamShortcuts(RomModels, EmulatorModels); LoadingText = string.Empty; IsLoading = false; }); } }
public void OnSettingsUI(UIHelperBase helper) { var modFullTitle = new ModFullTitle(this.Name, this.Version); IUiBuilder uiBuilder; if (this.onCreatedInvoked) { this.onCreatedInvoked = false; var coverageManager = Singleton <CoverageManager> .instance; var netManager = Singleton <NetManager> .instance; var simulationManager = Singleton <SimulationManager> .instance; var gameEngineService = new GameEngineService(coverageManager, netManager, simulationManager); var netInfoGroupsMOM = new NetInfoGroupInitializer_MOM(); //TODO improve MOM support var afterDarkDlcInstalled = SteamHelper.IsDLCOwned(SteamHelper.DLC.AfterDarkDLC); var inMotionDlcInstalled = SteamHelper.IsDLCOwned(SteamHelper.DLC.InMotionDLC); var netInfoGroupsNeExt2 = new NetInfoGroupInitializer_NeExt2(afterDarkDlcInstalled, inMotionDlcInstalled); var netInfoGroupsRoadsForNeExt2 = new NetInfoGroupInitializer_RoadsForNeExt2(); //TODO one-way train tracks //TODO Ronyx Highway var netInfoGroups = netInfoGroupsMOM.Create() .Concat(netInfoGroupsNeExt2.Create()) .Concat(netInfoGroupsRoadsForNeExt2.Create()); var netInfoGroupViewReadModelFactory = new NetInfoGroupViewReadModelFactory(); var netInfoGroupViewReadModels = netInfoGroups .Select(x => netInfoGroupViewReadModelFactory.Create(x)) .ToList(); uiBuilder = new UiBuilderInGame(helper, modFullTitle, gameEngineService, netInfoGroupViewReadModels); } else { uiBuilder = new UiBuilderOutOfGame(helper, modFullTitle); } uiBuilder.BuildUi(); }
private void OnChatMessage(ClientGCMsgProtobuf <CMsgDOTAChatMessage> response) { if (!string.IsNullOrEmpty(response.Body.persona_name)) { _logger.Info("Incoming chat message - Person: " + response.Body.persona_name + " - Message: " + response.Body.text); var accountId = SteamHelper.ConvertIDToUint64(response.Body.account_id); switch (response.Body.text.Trim().ToLower().Split(' ')[0]) { case "!shutdown": if (_config.Admins.Contains(accountId)) { _logger.Info("Shutdown requested"); DotaClient.Disconnect(true); OnShutdown?.Invoke(); } else { _logger.Warn("Shutdown not allowed for Steam ID: " + accountId); } break; case "!host": ProcessLobbyCommand(response.Body.channel_id, accountId, response.Body.persona_name, response.Body.text); break; case "!lobbies": ProcessLobbiesCommand(response.Body.channel_id, response.Body.persona_name); break; case "!me": ProcessMeCommand(response.Body.channel_id, accountId, response.Body.persona_name); break; case "!help": DotaClient.QueueChatMessage(response.Body.channel_id, String.Format(_config.HelpMessage, response.Body.persona_name), false); break; } } }
public async Task <IActionResult> Index(string t) { var state = _service.GetStateByToken(t); if (state != null) { return(RedirectToAction(nameof(Map), new { t = state.Token })); } var vm = await CreateHomeVmAsync(); if (!string.IsNullOrEmpty(t)) { vm.Error = SharedResource.InvalidQrCode; } var steamId = SteamHelper.GetSteamId(User); if (!string.IsNullOrEmpty(steamId)) { vm.CurrentState = _service.GetUserAuthenticatedStates(steamId).OrderByDescending(e => e.LastActivityUtc).FirstOrDefault(); } return(View(vm)); }
public async Task <IActionResult> EnterKey([FromForm] string key) { var steamId = SteamHelper.GetSteamId(User); if (string.IsNullOrEmpty(steamId)) { return(Denied()); } await Task.Delay(250); var result = _service.GetTokenBySteamIdAndKey(steamId, key); if (result.State == KeyLoginState.Ok) { return(RedirectToAction(nameof(Map), new { t = result.Token })); } var vm = await CreateHomeVmAsync(); vm.Error = result.State == KeyLoginState.UnknownPlayer ? SharedResource.ArmaNotYetConnected : SharedResource.InvalidKey; return(View(nameof(Index), vm)); }
private static void Main() { Control.CheckForIllegalCrossThreadCalls = false; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var detection = SteamHelper.TryInitSteam(); if (detection.IsSuccessful) { using (var form2 = new Form2()) { Application.Run(form2); } } else { using (var form1 = new Form1()) { form1.DetectionResult = detection; Application.Run(form1); } } }
private Dictionary <string, MapThemeMetaData> CacheThemes() { if (_themes == null) { _themes = new Dictionary <string, MapThemeMetaData>(); } _themes.Clear(); foreach (Package.Asset asset in PackageManager.FilterAssets(UserAssetType.MapThemeMetaData)) { if (asset == null || asset.package == null) { continue; } if (asset.fullName.Contains("CO-Winter-Theme") && !SteamHelper.IsDLCOwned(SteamHelper.DLC.SnowFallDLC)) { continue; } _themes[asset.fullName] = asset.Instantiate <MapThemeMetaData>(); _themes[asset.fullName].assetRef = asset; } return(_themes); }