예제 #1
0
 public void SetUp()
 {
     _amc = new ArmaModCollection();
     _mod = new ArmaMod
     {
         Author     = "Test",
         IsLocal    = false,
         Name       = "Test",
         Path       = "Test",
         WorkshopId = 1
     };
 }
예제 #2
0
        public async Task AddSteamMod()
        {
            var modID = await DialogCoordinator.ShowInputAsync(this, "Add Steam Mod", "Please enter the mod ID or mod URL");

            if (string.IsNullOrEmpty(modID))
            {
                return;
            }

            Analytics.TrackEvent("Mods - Clicked AddSteamMod", new Dictionary <string, string>
            {
                { "Name", Properties.Settings.Default.steamUserName },
                { "Mod", modID }
            });

            //Cast link to mod ID
            if (modID.Contains("steamcommunity.com") && modID.Contains("id="))
            {
                var uri = new Uri(modID);
                modID = System.Web.HttpUtility.ParseQueryString(uri.Query).Get("id");
            }

            if (!uint.TryParse(modID, out uint modIDOut))
            {
                return;
            }

            var mod = new ArmaMod
            {
                WorkshopId = modIDOut,
                Path       = Path.Combine(Properties.Settings.Default.modStagingDirectory, modID),
                IsLocal    = false
            };

            ModsCollection.AddSteamMod(mod);
        }