diff --git a/README.md b/README.md index d57d6d8..eeb7b8e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,39 @@ -# jewDCC - Custom Connection for Discord! +# jewDCC + +jewDCC - A program I made to add custom connections to Discord, Google-ish material GUI and very good UX, trust me. + +## [Download](https://github.com/jewdev/jewDCC/releases/latest) + +## [LICENSE](https://github.com/jewdev/jewDCC/blob/master/LICENSE) + +## Author + +**jewDCC** © [jewdev](https://github.com/jewdev) Authored and maintained by jewdev. + +## Screenshot +![screenshot](https://i.imgur.com/8IZezp3.png) + +## Special Thanks +> Special thanks for my beta testers! +> > [Ryan Montgomery](https://github.com/ryanrohypnol) - I "improved" his own Discord Custom Connections repository in Python and I wanted to re-make in C#, and, here we are! + +## FAQ +1. Q: What the heck does DCC means? + + A: DCC stands for "Discord Custom Connections" in this context. + +2. Q: How can I report bugs? + + A: Open new issue [here](https://github.com/jewdev/jewDCC/issues). + +3. Q: How can I contribute? + + A: If you know how to code, feel free to improve the program and open a pull request [here](https://github.com/jewdev/jewDCC/pulls), if you don't know how to code so just fork and star this repository! + +4. Q: Can you help me with the program? + + A: No. + +5. Q: Are you really a jew? + + A: Yes, I'm a *real* jew. diff --git a/jewDCC.sln b/jewDCC.sln new file mode 100644 index 0000000..a4bac64 --- /dev/null +++ b/jewDCC.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29905.134 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jewDCC", "jewDCC\jewDCC.csproj", "{AD162585-DD8A-4096-B4BF-D0B13D0271D4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AD162585-DD8A-4096-B4BF-D0B13D0271D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD162585-DD8A-4096-B4BF-D0B13D0271D4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD162585-DD8A-4096-B4BF-D0B13D0271D4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD162585-DD8A-4096-B4BF-D0B13D0271D4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7751B888-B027-4129-B311-5CF04E20EA3C} + EndGlobalSection +EndGlobal diff --git a/jewDCC/App.config b/jewDCC/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/jewDCC/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/jewDCC/App.xaml b/jewDCC/App.xaml new file mode 100644 index 0000000..c4a3b21 --- /dev/null +++ b/jewDCC/App.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/jewDCC/App.xaml.cs b/jewDCC/App.xaml.cs new file mode 100644 index 0000000..1bf6e5f --- /dev/null +++ b/jewDCC/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace jewDCC +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/jewDCC/FodyWeavers.xml b/jewDCC/FodyWeavers.xml new file mode 100644 index 0000000..5029e70 --- /dev/null +++ b/jewDCC/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/jewDCC/FodyWeavers.xsd b/jewDCC/FodyWeavers.xsd new file mode 100644 index 0000000..44a5374 --- /dev/null +++ b/jewDCC/FodyWeavers.xsd @@ -0,0 +1,111 @@ + + + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with line breaks. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of unmanaged 32 bit assembly names to include, delimited with |. + + + + + A list of unmanaged 64 bit assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/jewDCC/MainWindow.xaml b/jewDCC/MainWindow.xaml new file mode 100644 index 0000000..548014c --- /dev/null +++ b/jewDCC/MainWindow.xaml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + Skype + + + Battle.Net + + + League Of Legends + + + + + + + + + + + + \ No newline at end of file diff --git a/jewDCC/MainWindow.xaml.cs b/jewDCC/MainWindow.xaml.cs new file mode 100644 index 0000000..b946644 --- /dev/null +++ b/jewDCC/MainWindow.xaml.cs @@ -0,0 +1,184 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using WindowsInput; +using WindowsInput.Native; +using MouseButton = System.Windows.Input.MouseButton; + +namespace jewDCC +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + + if (File.Exists("token.txt")) + TokenField.Text = File.ReadAllText("token.txt"); + else + TokenField.Text = ""; + } + + private void Window_MouseDown(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + this.DragMove(); + } + + private void ExitButton(object sender, RoutedEventArgs e) + { + Environment.Exit(1); + } + + private void MinimizeButton(object sender, RoutedEventArgs e) + { + this.WindowState = WindowState.Minimized; + } + + private void AboutButton(object sender, RoutedEventArgs e) + { + MessageBox.Show("This program is made by jewdev#1337\nI hope you like it~!\n(ノ◕ヮ◕)ノ*:・゚✧", + "About", + MessageBoxButton.OK, + MessageBoxImage.Information); + } + + private void AddButton(object sender, RoutedEventArgs e) + { + if (string.IsNullOrEmpty(TypeComboBox.Text) || string.IsNullOrEmpty(NameField.Text) || string.IsNullOrEmpty(TokenField.Text)) + { + MessageBox.Show("Please fill the fields!", + "Error!", + MessageBoxButton.OK, + MessageBoxImage.Error); + } + else + { + string game; + if (TypeComboBox.Text.StartsWith("L")) + game = "leagueoflegends"; + else if (TypeComboBox.Text.StartsWith("S")) + game = "skype"; + else + game = "battlenet"; + + string url = $"https://discordapp.com/api/v6/users/@me/connections/{game}/{new Random().Next(100000, 1000000)}"; + string data = "{\"name\": \"" + NameField.Text + "\",\n\"visibility\": 1\n}"; + + try + { + var request = (HttpWebRequest) WebRequest.Create(url); + request.Method = "PUT"; + request.Headers.Add("authorization", TokenField.Text); + request.ContentType = "application/json"; + byte[] byteArray = Encoding.UTF8.GetBytes(data); + request.ContentLength = byteArray.Length; + Stream dataStream = request.GetRequestStream(); + dataStream.Write(byteArray, 0, byteArray.Length); + dataStream.Close(); + + if (request.GetResponse().ToString() + .Contains( + "\"revoked\": false, \"visibility\": 1, \"friend_sync\": false, \"show_activity\": true")) + { + MessageBox.Show( + $"Successfully added a connection!\nName: {NameField.Text}\nType: {TypeComboBox.Text}\n(P.S: If you want to remove it go to Settings > Connections and just remove it)", + "Success!", + MessageBoxButton.OK, + MessageBoxImage.Information); + + if ((bool)SaveTokenCheckBox.IsChecked) + File.WriteAllText("token.txt", TokenField.Text); + } + else + { + MessageBox.Show( + "Beep boop... Error!\nSomething is wrong but I can't figure what is it!", + "Error!", + MessageBoxButton.OK, + MessageBoxImage.Information); + } + } + catch (Exception exception) + { + MessageBox.Show($"Beep boop... Error!\n{exception}", + "Error!", + MessageBoxButton.OK, + MessageBoxImage.Error); + throw; + } + } + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + NameField.Focus(); + new InputSimulator().Keyboard.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.OEM_PERIOD); + } + + private void TokenField_TextChanged(object sender, TextChangedEventArgs e) + { + if (TokenField.Text.Contains("\"")) + TokenField.Text = TokenField.Text.Replace("\"", ""); + + if (string.IsNullOrEmpty(TypeComboBox.Text) || string.IsNullOrEmpty(NameField.Text) || + string.IsNullOrEmpty(TokenField.Text)) + { + SaveTokenCheckBox.IsEnabled = false; + AddConnectionButton.IsEnabled = false; + } + else + { + SaveTokenCheckBox.IsEnabled = true; + AddConnectionButton.IsEnabled = true; + } + } + + + private void NameField_TextChanged(object sender, TextChangedEventArgs e) + { + if (string.IsNullOrEmpty(TypeComboBox.Text) || string.IsNullOrEmpty(NameField.Text) || + string.IsNullOrEmpty(TokenField.Text)) + { + SaveTokenCheckBox.IsEnabled = false; + AddConnectionButton.IsEnabled = false; + } + else + { + SaveTokenCheckBox.IsEnabled = true; + AddConnectionButton.IsEnabled = true; + } + } + + private void TypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (string.IsNullOrEmpty(TypeComboBox.Text) || string.IsNullOrEmpty(NameField.Text) || + string.IsNullOrEmpty(TokenField.Text)) + { + SaveTokenCheckBox.IsEnabled = false; + AddConnectionButton.IsEnabled = false; + } + else + { + SaveTokenCheckBox.IsEnabled = true; + AddConnectionButton.IsEnabled = true; + } + } + } +} diff --git a/jewDCC/Properties/AssemblyInfo.cs b/jewDCC/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3ccc393 --- /dev/null +++ b/jewDCC/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("jewDCC")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("jewDCC")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/jewDCC/Properties/Resources.Designer.cs b/jewDCC/Properties/Resources.Designer.cs new file mode 100644 index 0000000..1d0e79c --- /dev/null +++ b/jewDCC/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace jewDCC.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("jewDCC.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/jewDCC/Properties/Resources.resx b/jewDCC/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/jewDCC/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/jewDCC/Properties/Settings.Designer.cs b/jewDCC/Properties/Settings.Designer.cs new file mode 100644 index 0000000..0fd1711 --- /dev/null +++ b/jewDCC/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace jewDCC.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/jewDCC/Properties/Settings.settings b/jewDCC/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/jewDCC/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/jewDCC/favicon.ico b/jewDCC/favicon.ico new file mode 100644 index 0000000..1c90595 Binary files /dev/null and b/jewDCC/favicon.ico differ diff --git a/jewDCC/jewDCC.csproj b/jewDCC/jewDCC.csproj new file mode 100644 index 0000000..04d17a7 --- /dev/null +++ b/jewDCC/jewDCC.csproj @@ -0,0 +1,130 @@ + + + + + + Debug + AnyCPU + {AD162585-DD8A-4096-B4BF-D0B13D0271D4} + WinExe + jewDCC + jewDCC + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + favicon.ico + + + + ..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll + + + ..\packages\MaterialDesignColors.1.2.3\lib\net45\MaterialDesignColors.dll + + + ..\packages\MaterialDesignThemes.3.1.0\lib\net45\MaterialDesignThemes.Wpf.dll + + + + + + + + + + + 4.0 + + + + + + ..\packages\InputSimulator.1.0.4.0\lib\net20\WindowsInput.dll + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + \ No newline at end of file diff --git a/jewDCC/packages.config b/jewDCC/packages.config new file mode 100644 index 0000000..bb1e1e8 --- /dev/null +++ b/jewDCC/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file