├── .gitignore ├── Changes.txt ├── Credits.txt ├── Extra-Tools ├── Compare │ ├── Compare-Classes.py │ └── Unchanged-Classes.py ├── Deduplicate │ └── Deduplicate-Classes.py ├── Invert │ └── Invert-Classes.py ├── Merge │ └── Merge-Classes.py └── Split │ └── Split-Classes.py ├── README.md └── Update-Classes.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.bat 3 | *.ico 4 | *.css 5 | build_env/* 6 | Classes_Source/* 7 | Extra-Tools/Compare/*.txt 8 | Extra-Tools/Compare/*.js 9 | Extra-Tools/Deduplicate/*.txt 10 | Extra-Tools/Invert/*.txt 11 | Extra-Tools/Merge/*.txt 12 | Extra-Tools/Split/*.txt -------------------------------------------------------------------------------- /Credits.txt: -------------------------------------------------------------------------------- 1 | Sarah's Class Changes Repo for the Discord Class Change History -------------------------------------------------------------------------------- /Extra-Tools/Compare/Compare-Classes.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | # Delete Output File if it already Exists 4 | if os.path.exists('Output.txt') == 1: 5 | os.remove('Output.txt') 6 | 7 | # Open, Read, then Close Files 8 | oldFile = open('stable.js', 'r') 9 | newFile = open('canary.js', 'r') 10 | 11 | oldFileLines = oldFile.readlines() 12 | newFileLines = newFile.readlines() 13 | 14 | oldFile.close() 15 | newFile.close() 16 | 17 | # Define Empty Lists 18 | oldFileGroups = [] 19 | newFileGroups = [] 20 | 21 | # Create List of the Functions in the Old File 22 | oldFileLines = '\n'.join([line.strip() for line in oldFileLines]) 23 | for x in range(0, len(oldFileLines.split('e.exports = {')) - 1): 24 | oldFileGroups.append(oldFileLines.split('e.exports = {')[x + 1].split('}')[0].split('\n')) 25 | 26 | # Create List of the Functions in the New File 27 | newFileLines = '\n'.join([line.strip() for line in newFileLines]) 28 | for x in range(0, len(newFileLines.split('e.exports = {')) - 1): 29 | newFileGroups.append(newFileLines.split('e.exports = {')[x + 1].split('}')[0].split('\n')) 30 | 31 | # Create Output File 32 | outputFile = open('Output.txt', 'a+') 33 | 34 | print("Diff:") 35 | 36 | # Check if the Function Groups are the Same Length 37 | for z in range(0, 3): 38 | for x in range(0, len(oldFileGroups)): 39 | if len(newFileGroups) > x + z: 40 | if len(oldFileGroups[x]) == len(newFileGroups[x + z]): 41 | for y in range(0, len(oldFileGroups[x])): 42 | oldFileLine = oldFileGroups[x][y] 43 | newFileLine = newFileGroups[x + z][y] 44 | 45 | # Ensure Lines aren't Empty 46 | if oldFileLine != '' and newFileLine != '': 47 | 48 | # Check if the Key Names are the same 49 | if oldFileLine.split(': "')[0] == newFileLine.split(': "')[0]: 50 | 51 | # Compare the Current Line 52 | if oldFileLine != newFileLine: 53 | 54 | # Output the Removed Line 55 | if oldFileLine != '': 56 | if len(oldFileLine.split(': "')) > 1: 57 | print("- " + oldFileLine.split(': "')[1].split('"')[0].split(' ')[0]) 58 | outputFile.write(oldFileLine.split(': "')[1].split('"')[0].split(' ')[0] + '\n') 59 | 60 | # Output the Added Line 61 | if newFileLine != '': 62 | if len(newFileLine.split(': "')) > 1: 63 | print("+ " + newFileLine.split(': "')[1].split('"')[0].split(' ')[0]) 64 | outputFile.write(newFileLine.split(': "')[1].split('"')[0].split(' ')[0] + '\n') -------------------------------------------------------------------------------- /Extra-Tools/Compare/Unchanged-Classes.py: -------------------------------------------------------------------------------- 1 | 2 | # Open File in Read Mode 3 | file_1 = open('stable.txt', 'r') 4 | file_2 = open('canary.txt', 'r') 5 | 6 | file_1_line = file_1.readline() 7 | file_2_line = file_2.readline() 8 | 9 | # Use as a COunter 10 | line_no = 1 11 | 12 | print() 13 | 14 | with open('stable.txt') as file1: 15 | with open('canary.txt') as file2: 16 | same = set(file1).intersection(file2) 17 | 18 | print("Common Lines in Both Files") 19 | 20 | for line in same: 21 | print(line, end='') 22 | 23 | print('\n') 24 | print("Difference Lines in Both Files") 25 | while file_1_line != '' or file_2_line != '': 26 | 27 | # Removing whitespaces 28 | file_1_line = file_1_line.rstrip() 29 | file_2_line = file_2_line.rstrip() 30 | 31 | # Compare the lines from both file 32 | if file_1_line != file_2_line: 33 | 34 | # otherwise output the line on file1 and use @ sign 35 | if file_1_line == '': 36 | print("", "Line-%d" % line_no, file_1_line) 37 | else: 38 | print("-", "Line-%d" % line_no, file_1_line) 39 | 40 | # otherwise output the line on file2 and use # sign 41 | if file_2_line == '': 42 | print("", "Line-%d" % line_no, file_2_line) 43 | else: 44 | print("+", "Line-%d" % line_no, file_2_line) 45 | 46 | # Print a empty line 47 | print() 48 | 49 | # Read the next line from the file 50 | file_1_line = file_1.readline() 51 | file_2_line = file_2.readline() 52 | 53 | line_no += 1 54 | 55 | file_1.close() 56 | file_2.close() -------------------------------------------------------------------------------- /Extra-Tools/Deduplicate/Deduplicate-Classes.py: -------------------------------------------------------------------------------- 1 | from collections import OrderedDict 2 | import os 3 | 4 | inputFileDir = 'Changes.txt' 5 | mergedFileDir = 'Merged.txt' 6 | outputFileDir = 'Output.txt' 7 | 8 | with open(inputFileDir, 'r') as inputFile: 9 | inputText = "\n".join(line.rstrip() for line in inputFile).split('\n') 10 | 11 | i = 0 12 | classNum = len(inputText) - 1 13 | 14 | mergedText = '' 15 | 16 | print('Merging Classes...') 17 | 18 | while i < classNum: 19 | class1 = inputText[i] 20 | class2 = inputText[i + 1] 21 | 22 | if mergedText != '': 23 | mergedText = mergedText + '\n' + class1 + ', ' + class2 24 | else: 25 | mergedText = class1 + ', ' + class2 26 | 27 | i = i + 2 28 | 29 | with open(mergedFileDir, "w") as mergedFile: 30 | mergedFile.write(mergedText) 31 | 32 | print('Removing Duplicates...') 33 | 34 | with open(mergedFileDir, 'r') as mergedFile: 35 | lines = (line.rstrip() for line in mergedFile) 36 | unique_lines = OrderedDict.fromkeys( (line for line in lines if line) ) 37 | 38 | splitList = list(unique_lines.keys()) 39 | 40 | i = 0 41 | classNum = len(splitList) - 1 42 | 43 | outputText = '' 44 | 45 | print('Splitting Classes...') 46 | 47 | while i < classNum: 48 | class1 = splitList[i].split(', ')[0] 49 | class2 = splitList[i].split(', ')[1] 50 | 51 | if outputText != '': 52 | outputText = outputText + '\n' + class1 + '\n' + class2 53 | else: 54 | outputText = class1 + '\n' + class2 55 | 56 | i = i + 1 57 | 58 | os.remove(mergedFileDir) 59 | 60 | with open(outputFileDir, "w") as outputFile: 61 | outputFile.write(outputText) -------------------------------------------------------------------------------- /Extra-Tools/Invert/Invert-Classes.py: -------------------------------------------------------------------------------- 1 | inputFileDir = 'Changes.txt' 2 | outputFileDir = 'Output.txt' 3 | 4 | outputText = '' 5 | 6 | with open(inputFileDir, 'r') as inputFile: 7 | inputText = "\n".join(line.rstrip() for line in inputFile).split('\n') 8 | 9 | i = 0 10 | classNum = len(inputText) - 1 11 | 12 | while i < classNum: 13 | class1 = inputText[i] 14 | class2 = inputText[i + 1] 15 | 16 | outputText = outputText + '\n' + class2 + '\n' + class1 17 | 18 | i = i + 2 19 | 20 | with open(outputFileDir, "w") as outputFile: 21 | outputFile.write(outputText) -------------------------------------------------------------------------------- /Extra-Tools/Merge/Merge-Classes.py: -------------------------------------------------------------------------------- 1 | from itertools import zip_longest 2 | 3 | filename1 = 'Old_Classes.txt' 4 | filename2 = 'New_Classes.txt' 5 | outfilename = 'Output.txt' 6 | 7 | with open(filename1) as f1, open(filename2) as f2, open(outfilename, 'w') as of: 8 | for lines in zip_longest(f1, f2): 9 | for line in lines: 10 | if line is not None: print(line.rstrip(), file=of) 11 | -------------------------------------------------------------------------------- /Extra-Tools/Split/Split-Classes.py: -------------------------------------------------------------------------------- 1 | inputFileDir = 'Changes.txt' 2 | outputFileDir1 = 'Old_Classes.txt' 3 | outputFileDir2 = 'New_Classes.txt' 4 | 5 | outputText1 = '' 6 | outputText2 = '' 7 | 8 | with open(inputFileDir, 'r') as inputFile: 9 | inputText = "\n".join(line.rstrip() for line in inputFile).split('\n') 10 | 11 | i = 0 12 | classNum = len(inputText) - 1 13 | 14 | while i < classNum: 15 | class1 = inputText[i] 16 | class2 = inputText[i + 1] 17 | 18 | outputText1 = outputText1 + '\n' + class1 19 | outputText2 = outputText2 + '\n' + class2 20 | 21 | i = i + 2 22 | 23 | with open(outputFileDir1, "w") as outputFile1: 24 | outputFile1.write(outputText1) 25 | 26 | with open(outputFileDir2, "w") as outputFile2: 27 | outputFile2.write(outputText2) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Update-Classes 2 | Updates the Classes in a Theme File using a [Change List](https://github.com/SyndiShanX/Update-Classes/blob/main/Changes.txt) 3 | 4 | Place the Old Class one Line above the New Class (Don't leave Blank Lines) 5 | 6 | ## Website 7 | I have also added this script to my Website: https://syndishanx.github.io/Website/Update_Classes.html 8 | 9 | ## To Run Script: 10 | 11 | #### Requirements: Python 12 | 13 | 1. Download the [Script File](https://github.com/SyndiShanX/Update-Classes/blob/main/Update-Classes.py) 14 | 15 | 2. Download the [Change List](https://raw.githubusercontent.com/SyndiShanX/Update-Classes/main/Changes.txt) 16 | 17 | 3. Run `python Update-Classes.py` in Terminal 18 | 19 | 4. Enter the Directory for your Changes File 20 | 21 | 5. Enter the Directory for your Theme File 22 | 23 | 6. The Updated File will be Output to the Current Directory Opened in Terminal as Output.css 24 | 25 | ## To use Executable: 26 | 27 | 1. Download `Update-Classes.exe` from the [Releases](https://github.com/SyndiShanX/Update-Classes/releases) Page 28 | 29 | 2. Download the [Change List](https://raw.githubusercontent.com/SyndiShanX/Update-Classes/main/Changes.txt) 30 | 31 | 3. Run `Update-Classes.exe` 32 | 33 | 4. Enter the Directory for your Changes File 34 | 35 | 5. Enter the Directory for your Theme File 36 | 37 | 6. The Updated File will be Output to the Current Directory as Output.css -------------------------------------------------------------------------------- /Update-Classes.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | fileDir = os.getcwd() 4 | fileDir = fileDir.replace('\\', '/') 5 | fileDir = fileDir + '/' 6 | 7 | changesDir = input('Enter the Directory of your Diff File (Leave Blank to use Changes.txt): ') 8 | if changesDir == '': 9 | changesDir = 'Changes.txt' 10 | 11 | with open(changesDir, 'r') as rawFile: 12 | rawText = "\n".join(line.rstrip() for line in rawFile).split('\n') 13 | 14 | themeDir = input('Enter the Directory of your Theme File (Leave Blank to use Input.css): ') 15 | if themeDir == '': 16 | themeDir = 'Input.css' 17 | 18 | themeFile = open(themeDir, 'r') 19 | themeText = themeFile.read() 20 | 21 | i = 0 22 | classNum = len(rawText) - 1 23 | 24 | while i < classNum: 25 | class1 = rawText[i] 26 | class2 = rawText[i + 1] 27 | 28 | themeText = themeText.replace(class1, class2) 29 | 30 | i = i + 2 31 | 32 | with open(fileDir + 'Output.css', "w") as outputFile: 33 | outputFile.write(themeText) 34 | --------------------------------------------------------------------------------