├── .gitignore
├── .gitattributes
├── OmegleSpyWPF.png
├── OmegleSpyWPF
├── OmegleAPI.dll
├── Newtonsoft.Json.dll
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── App.xaml
├── App.xaml.cs
├── OmegleSpyWPF.csproj
├── WindowMain.xaml
└── WindowMain.xaml.cs
├── OmegleSpyWPF.sln
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | /OmegleSpyWPF/bin
2 | /OmegleSpyWPF/obj
3 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/OmegleSpyWPF.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeanluc162/OmegleSpyWPF/HEAD/OmegleSpyWPF.png
--------------------------------------------------------------------------------
/OmegleSpyWPF/OmegleAPI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeanluc162/OmegleSpyWPF/HEAD/OmegleSpyWPF/OmegleAPI.dll
--------------------------------------------------------------------------------
/OmegleSpyWPF/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeanluc162/OmegleSpyWPF/HEAD/OmegleSpyWPF/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/OmegleSpyWPF/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/OmegleSpyWPF/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OmegleSpyWPF/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace OmegleSpyWPF
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OmegleSpyWPF.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 10.00
3 | # Visual Studio 2008
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OmegleSpyWPF", "OmegleSpyWPF\OmegleSpyWPF.csproj", "{5874AAA0-7E77-47FE-99E8-E06039C54CD6}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {5874AAA0-7E77-47FE-99E8-E06039C54CD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {5874AAA0-7E77-47FE-99E8-E06039C54CD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {5874AAA0-7E77-47FE-99E8-E06039C54CD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {5874AAA0-7E77-47FE-99E8-E06039C54CD6}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Jean-Luc Trojahn
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/OmegleSpyWPF/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:2.0.50727.3655
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace OmegleSpyWPF.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OmegleSpyWPF
2 | 
3 | # What can you do with it?
4 | - Watch two strangers chatting without their knowledge
5 | - Send a message as one of them that will only be seen by the other
6 | - Save logs/configure an autosave for all chats that were longer than x messages
7 | - Activate spam protection to manually accept the forwarding of messages containing bad words. This should reduce the likelyhood of getting banned.
8 | # Is this hacking?
9 | No. This program works by connecting two clients to omegle at the same time using [Omegle-.NET](https://github.com/jeanluc162/Omegle-.NET) and forwarding all messages the first client receives to the second client and the other way around.
10 | # Is this illegal?
11 | Frankly, I don't know. Please refrain from doing evil with it. An important note: From omegles perspective, all messages going through this program are being sent by you at one point. Therefore, **you can get your IP banned because of a message written by one of the strangers**.
12 | # Where does this Software run?
13 | Windows XP with .NET 3.5 and up. You might get a warning on Windows 10 because I haven't signed the executeable. If you want to compile it yourself: I used Visual Studio 2008, but newer versions should work just fine.
14 | # Why is this archived?
15 | I consider this program to be complete, therefore this repository has been archived.
16 |
--------------------------------------------------------------------------------
/OmegleSpyWPF/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("OmegleSpyWPF")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("OmegleSpyWPF")]
15 | [assembly: AssemblyCopyright("Copyright © 2020")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/OmegleSpyWPF/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:2.0.50727.3655
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace OmegleSpyWPF.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OmegleSpyWPF.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/OmegleSpyWPF/OmegleSpyWPF.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 9.0.21022
7 | 2.0
8 | {5874AAA0-7E77-47FE-99E8-E06039C54CD6}
9 | WinExe
10 | Properties
11 | OmegleSpyWPF
12 | OmegleSpyWPF
13 | v3.5
14 | 512
15 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
16 | 4
17 |
18 |
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 | False
38 | .\OmegleAPI.dll
39 |
40 |
41 |
42 | 3.5
43 |
44 |
45 | 3.5
46 |
47 |
48 | 3.5
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | MSBuild:Compile
59 | Designer
60 |
61 |
62 | MSBuild:Compile
63 | Designer
64 |
65 |
66 | App.xaml
67 | Code
68 |
69 |
70 | WindowMain.xaml
71 | Code
72 |
73 |
74 |
75 |
76 | Code
77 |
78 |
79 | True
80 | True
81 | Resources.resx
82 |
83 |
84 | True
85 | Settings.settings
86 | True
87 |
88 |
89 | ResXFileCodeGenerator
90 | Resources.Designer.cs
91 |
92 |
93 | SettingsSingleFileGenerator
94 | Settings.Designer.cs
95 |
96 |
97 |
98 |
99 |
106 |
--------------------------------------------------------------------------------
/OmegleSpyWPF/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/OmegleSpyWPF/WindowMain.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/OmegleSpyWPF/WindowMain.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using OmegleAPI;
3 | using System.Collections.Generic;
4 | using System.Windows.Media;
5 |
6 | namespace OmegleSpyWPF
7 | {
8 | ///
9 | /// Interaction logic for WindowMain.xaml
10 | ///
11 | public partial class WindowMain : Window
12 | {
13 | private enum MessageIssuer{Stranger1, Stranger2}
14 |
15 | private readonly System.Boolean[] Connected = new System.Boolean[] { false, false };
16 |
17 | ///
18 | /// The two Clients this Software connects to spy on.
19 | ///
20 | private readonly Client[] OmegleStrangers = new Client[] { new Client(), new Client() };
21 |
22 | ///
23 | /// Keeps any messages that were sent before the recepient connected
24 | ///
25 | private readonly List[] Buffer = new List[] { new List(), new List() };
26 |
27 | public WindowMain()
28 | {
29 | //Hooking up the Event Handlers
30 | foreach (Client c in OmegleStrangers)
31 | {
32 | c.Error += new System.EventHandler(c_Error);
33 | c.StrangerConnected += new System.EventHandler(c_StrangerConnected);
34 | c.StrangerDisconnected += new System.EventHandler(c_StrangerDisconnected);
35 | c.StrangerSentMessage += new Client.StrangerSentMessageHandler(c_StrangerSentMessage);
36 | c.StrangerTypingStarted += new System.EventHandler(c_StrangerTypingStarted);
37 | c.StrangerTypingStopped += new System.EventHandler(c_StrangerTypingStopped);
38 | }
39 |
40 | InitializeComponent();
41 | }
42 |
43 | void c_StrangerTypingStopped(object sender, System.EventArgs e)
44 | {
45 | if (sender == OmegleStrangers[0])
46 | {
47 | this.Dispatcher.Invoke(new System.Action(() => { ChkbxS1Writing.IsChecked = false; }));
48 | OmegleStrangers[1].StopTyping();
49 | }
50 | if (sender == OmegleStrangers[1])
51 | {
52 | this.Dispatcher.Invoke(new System.Action(() => { ChkbxS2Writing.IsChecked = false; }));
53 | OmegleStrangers[0].StopTyping();
54 | }
55 | }
56 |
57 | void c_StrangerTypingStarted(object sender, System.EventArgs e)
58 | {
59 | if (sender == OmegleStrangers[0])
60 | {
61 | this.Dispatcher.Invoke(new System.Action(() => { ChkbxS1Writing.IsChecked = true; }));
62 | OmegleStrangers[1].StartTyping();
63 | }
64 | if (sender == OmegleStrangers[1])
65 | {
66 | this.Dispatcher.Invoke(new System.Action(() => { ChkbxS2Writing.IsChecked = true; }));
67 | OmegleStrangers[0].StartTyping();
68 | }
69 | }
70 |
71 | void c_StrangerSentMessage(object sender, string Message)
72 | {
73 | System.Boolean FoundBadWord = false;
74 | this.Dispatcher.Invoke(new System.Action(() => {
75 | if (ChkbxAskBeforeSpam.IsChecked == true)
76 | {
77 | string[] badwords = TxtbxBadWords.Text.Split(new string[] { ";" }, System.StringSplitOptions.RemoveEmptyEntries);
78 | foreach (string badword in badwords)
79 | {
80 | if (Message.Contains(badword))
81 | {
82 | FoundBadWord = true;
83 | break;
84 | }
85 | }
86 | }
87 | }));
88 |
89 | if (FoundBadWord)
90 | {
91 | if (MessageBox.Show(Message, "Forward Message?", MessageBoxButton.YesNo) != MessageBoxResult.Yes) return;
92 | }
93 |
94 | if (sender == OmegleStrangers[0])
95 | {
96 | if (Connected[1]) SendMessage(Message, MessageIssuer.Stranger1, false);
97 | else Buffer[1].Add(Message);
98 | }
99 | if (sender == OmegleStrangers[1])
100 | {
101 | if (Connected[0]) SendMessage(Message, MessageIssuer.Stranger2, false);
102 | else Buffer[0].Add(Message);
103 | }
104 | }
105 |
106 | void c_StrangerDisconnected(object sender, System.EventArgs e)
107 | {
108 | this.Dispatcher.Invoke(new System.Action(() => { Disconnect(); }));
109 | }
110 |
111 | void c_StrangerConnected(object sender, System.EventArgs e)
112 | {
113 | if (sender == OmegleStrangers[0])
114 | {
115 | this.Dispatcher.Invoke(new System.Action(() => { ChkbxS1Connected.IsChecked = true; }));
116 | Connected[0] = true;
117 | foreach (System.String Message in Buffer[0]) SendMessage(Message, MessageIssuer.Stranger2, false);
118 | Buffer[0].Clear();
119 | }
120 | if (sender == OmegleStrangers[1])
121 | {
122 | this.Dispatcher.Invoke(new System.Action(() => { ChkbxS2Connected.IsChecked = true; }));
123 | Connected[1] = true;
124 | foreach (System.String Message in Buffer[1]) SendMessage(Message, MessageIssuer.Stranger1, false);
125 | Buffer[1].Clear();
126 | }
127 | }
128 |
129 | void c_Error(object sender, System.EventArgs e)
130 | {
131 | MessageBox.Show("An Error occured. Try reconnecting and check if you are banned (by visting Omegles Website). If you are banned, try rebooting your Router or use a VPN.", "Error", MessageBoxButton.OK);
132 | }
133 |
134 | private void SendMessage(System.String Message, MessageIssuer Issuer, System.Boolean IsIntervention)
135 | {
136 | //Very unlikely that all of this has to run on the UI Thread, but it works for now
137 | this.Dispatcher.Invoke(new System.Action(() => {
138 | System.Boolean Success = false;
139 | System.Windows.Documents.Run ToScreen = new System.Windows.Documents.Run();
140 | if (IsIntervention) ToScreen.Text += "YOU as ";
141 | if (Issuer == MessageIssuer.Stranger1)
142 | {
143 | Success = OmegleStrangers[1].SendMessage(Message);
144 | ToScreen.Text += "Stranger 1: ";
145 | if (IsIntervention) ToScreen.Foreground = new SolidColorBrush(Colors.Orange);
146 | else ToScreen.Foreground = new SolidColorBrush(Colors.Red);
147 | }
148 | else if (Issuer == MessageIssuer.Stranger2)
149 | {
150 | Success = OmegleStrangers[0].SendMessage(Message);
151 | ToScreen.Text += "Stranger 2: ";
152 | if (IsIntervention) ToScreen.Foreground = new SolidColorBrush(Colors.Purple);
153 | else ToScreen.Foreground = new SolidColorBrush(Colors.Blue);
154 | }
155 |
156 | if (Success)
157 | {
158 | ToScreen.Text += Message;
159 | System.Windows.Documents.Paragraph p = new System.Windows.Documents.Paragraph(ToScreen);
160 | TxtbxChat.Document.Blocks.Add(p);
161 | }
162 | }));
163 | }
164 |
165 | ///
166 | /// Ensures only Numbers get entered
167 | ///
168 | ///
169 | ///
170 | private void NumericalPreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
171 | {
172 | System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
173 | e.Handled = regex.IsMatch(e.Text);
174 | }
175 |
176 | private void Disconnect()
177 | {
178 | foreach (Client c in OmegleStrangers) c.Disconnect();
179 |
180 | Connected[0] = false;
181 | Connected[1] = false;
182 | ChkbxS1Connected.IsChecked = false;
183 | ChkbxS1Writing.IsChecked = false;
184 | ChkbxS2Connected.IsChecked = false;
185 | ChkbxS2Writing.IsChecked = false;
186 |
187 | if (ChkbxActivateAutosave.IsChecked == true)
188 | {
189 | if (TxtbxAutosaveMinLength.Text.Length == 0) TxtbxAutosaveMinLength.Text = "0";
190 | if (TxtbxChat.Document.Blocks.Count >= System.Convert.ToInt32(TxtbxAutosaveMinLength.Text))
191 | {
192 | SaveLog();
193 | }
194 | }
195 | if (ChkbxActivateAutoReconnect.IsChecked == true)
196 | {
197 | Connect();
198 | }
199 | }
200 |
201 | private void Connect()
202 | {
203 | foreach (Client c in OmegleStrangers) c.ConnectChat(null, false);
204 | TxtbxChat.Document.Blocks.Clear(); ;
205 | }
206 |
207 | private void BtnReconnect_Click(object sender, RoutedEventArgs e)
208 | {
209 | Disconnect();
210 | if(ChkbxActivateAutoReconnect.IsChecked == false) Connect();
211 | }
212 |
213 | private void BtnSaveLog_Click(object sender, RoutedEventArgs e)
214 | {
215 | SaveLog();
216 | }
217 |
218 | private void BtnSendMessage_Click(object sender, RoutedEventArgs e)
219 | {
220 | InterveneText();
221 | }
222 |
223 | private void TxtbxInterveneText_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
224 | {
225 | if (e.Key == System.Windows.Input.Key.Return)
226 | {
227 | InterveneText();
228 | }
229 | }
230 |
231 | ///
232 | /// Sends Text as Intervention
233 | ///
234 | private void InterveneText()
235 | {
236 | if (TxtbxInterveneText.Text.Trim().Length > 0)
237 | {
238 | if (CmbbxInterveneAs.SelectedIndex == 0) SendMessage(TxtbxInterveneText.Text.Trim(), MessageIssuer.Stranger1, true);
239 | else if (CmbbxInterveneAs.SelectedIndex == 1) SendMessage(TxtbxInterveneText.Text.Trim(), MessageIssuer.Stranger2, true);
240 | TxtbxInterveneText.Text = "";
241 | }
242 | }
243 |
244 | ///
245 | /// Saves the Chat Window Log
246 | ///
247 | private void SaveLog()
248 | {
249 | TxtbxChat.SelectAll();
250 | TxtbxChat.Selection.Save(new System.IO.FileStream(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss.fff") + ".rtf"), System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write), DataFormats.Rtf);
251 | }
252 |
253 | private void TxtbxChat_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
254 | {
255 | TxtbxChat.ScrollToEnd();
256 | }
257 | }
258 | }
259 |
--------------------------------------------------------------------------------