コード例 #1
0
        private static string GetFolderLocationToEdit(ProfileInfo profileInfo)
        {
            int idx = 1;
            int?folderNum;
            var folders = pe.FindProfileFolderActions(profileInfo);

            if (folders == null || folders.Count == 0)
            {
                Console.WriteLine("Profile does not have any top-level folders");
                return(null);
            }

            SDUtil.DisplayKeyLayout(SDUtil.GetStreamDeckTypeFromProfile(profileInfo));

            Console.WriteLine("\r\nFolders in profile:");
            foreach (var location in folders)
            {
                Console.WriteLine($"[{idx}]   Location: {location}");
                idx++;
            }

            Console.WriteLine("The key location is the physical location of the folder on the Stream Deck.\r\nSo 0,0 is the top left key and 4,2 is the bottom right key. Only actual folders are shown above.");
            Console.Write("Enter the number (NUMBER in the square brackets NOT the location) of the folder to edit: ");

            folderNum = SanitizeNumericInput(idx - 1);
            if (folderNum == null || !folderNum.HasValue)
            {
                return(null);
            }

            return(folders[folderNum.Value - 1]);
        }
コード例 #2
0
        public void OverwriteColumn(ProfileInfo originalProfile, ProfileInfo overwriteProfile, int column)
        {
            int maxRows = SDUtil.GetRowsForStreamDeckType(SDUtil.GetStreamDeckTypeFromProfile(originalProfile));
            Dictionary <string, List <string> > dicImageCopy = new Dictionary <string, List <string> >();

            for (int idx = 0; idx < maxRows; idx++)
            {
                string strKey = $"{column},{idx}";
                if (originalProfile.Actions.ContainsKey(strKey))
                {
                    overwriteProfile.Actions[strKey] = originalProfile.Actions[strKey];

                    foreach (var state in originalProfile.Actions[strKey].States)
                    {
                        if (!(String.IsNullOrWhiteSpace(state.Image)))
                        {
                            if (!dicImageCopy.ContainsKey(strKey) || dicImageCopy[strKey] == null)
                            {
                                dicImageCopy[strKey] = new List <string>();
                            }
                            dicImageCopy[strKey].Add(state.Image);
                        }
                    }
                }
            }

            File.WriteAllText(Path.Combine(overwriteProfile.FullPath, MANINFEST_FILE), JObject.FromObject(overwriteProfile).ToString());
            CopyImageFiles(originalProfile, overwriteProfile, dicImageCopy);
        }
コード例 #3
0
        private static void HandleProfilesOverwrite(ProfileInfo originalProfile, List <ProfileInfo> overwriteProfiles)
        {
            var streamDeckType = SDUtil.GetStreamDeckTypeFromProfile(originalProfile);
            int maxCols        = SDUtil.GetColumnsForStreamDeckType(streamDeckType);

            SDUtil.DisplayKeyLayout(streamDeckType);
            while (true)
            {
                Console.WriteLine($"Enter the COLUMN to overwrite (or press 'Q' to quit) [0-{maxCols - 1}]:");
                int?col = SanitizeNumericInput(maxCols);
                if (!col.HasValue)
                {
                    Console.WriteLine("Invalid column, exiting");
                    return;
                }
                foreach (var profile in overwriteProfiles)
                {
                    Console.WriteLine($"Updating column on profile: {profile.Name}...");
                    pe.OverwriteColumn(originalProfile, profile, col.Value);
                }
            }
        }
コード例 #4
0
        private static void ReAssignFolderBack(ProfileInfo profileInfo, String folderLocation)
        {
            SDUtil.DisplayKeyLayout(SDUtil.GetStreamDeckTypeFromProfile(profileInfo));
            Console.WriteLine($"Moving the back location for the folder in location: {folderLocation}");
            Console.WriteLine("Choose where you would like the Back button to move to. If that position is already used, it will be moved to the Top-Left (0,0) position\r\n");
            Console.Write("Enter the Column to put the back folder on [0-4]:");
            int?col = SanitizeNumericInput(4);

            if (col == null || !col.HasValue)
            {
                return;
            }

            Console.Write("Enter the Row to put the back folder on [0-2]:");
            int?row = SanitizeNumericInput(2);

            if (row == null || !row.HasValue)
            {
                return;
            }
            pe.MoveFolderBackLocation(profileInfo, folderLocation, $"{col.Value},{row.Value}");
        }