├── WlanNetworksModel.txt
├── Wlan10
├── Resources
│ └── GongSolutions.Wpf.DragDrop.dll
├── packages.config
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml.cs
├── MainWindow.xaml
├── Controller
│ └── Netshell.cs
├── Wlan10.csproj
└── Model
│ └── WlanNetwork.cs
├── Wlan10.sln
├── README.md
├── .gitignore
└── LICENSE
/WlanNetworksModel.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Wlan10/Resources/GongSolutions.Wpf.DragDrop.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Bertware/wlan10/HEAD/Wlan10/Resources/GongSolutions.Wpf.DragDrop.dll
--------------------------------------------------------------------------------
/Wlan10/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Wlan10/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Wlan10/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Wlan10/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Wlan10.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.31101.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wlan10", "Wlan10\Wlan10.csproj", "{B2213BF4-E988-475F-9B63-5238FA0ADF36}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {B2213BF4-E988-475F-9B63-5238FA0ADF36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {B2213BF4-E988-475F-9B63-5238FA0ADF36}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {B2213BF4-E988-475F-9B63-5238FA0ADF36}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {B2213BF4-E988-475F-9B63-5238FA0ADF36}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/Wlan10/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
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 Net.Bertware.Wlan10.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Wlan10/App.xaml.cs:
--------------------------------------------------------------------------------
1 | // App.xaml.cs in Wlan10/Wlan10
2 | // Created 2016/07/27
3 | // ©Bertware, visit http://bertware.net
4 | //
5 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
6 | // If a copy of the MPL was not distributed with this file,
7 | // you can obtain one at http://mozilla.org/MPL/2.0/.
8 |
9 | using System;
10 | using System.IO;
11 | using System.Reflection;
12 | using System.Windows;
13 |
14 | namespace Net.Bertware.Wlan10
15 | {
16 | ///
17 | /// Interaction logic for App.xaml
18 | ///
19 | public partial class App : Application
20 | {
21 | public App()
22 | {
23 | try
24 | {
25 | AppDomain.CurrentDomain.AssemblyResolve += LoadDll;
26 | MainWindow w = new MainWindow();
27 | w.ShowDialog();
28 | }
29 | catch (Exception e)
30 | {
31 | MessageBox.Show("The application encountered an unexpected error and needs to exit. Please report this error to the developer (\"http://github.com/Bertware/Wlan10/Issues\")\r\n" +
32 | "Error details:\r\n" +
33 | e.Message + "\r\n"
34 | + e.StackTrace,"Unexpected error",MessageBoxButton.OK,MessageBoxImage.Error);
35 | }
36 | }
37 |
38 | public static Assembly LoadDll(object sender, ResolveEventArgs args)
39 | {
40 | //Load embedded DLLs
41 |
42 | String resourceName = "Net.Bertware.Wlan10.Resources." + new AssemblyName(args.Name).Name + ".dll";
43 | using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
44 | {
45 | if (stream == null || stream.Length < 1)
46 | {
47 | return null;
48 | }
49 | Byte[] assemblyData = new Byte[stream.Length];
50 | stream.Read(assemblyData, 0, assemblyData.Length);
51 |
52 | return Assembly.Load(assemblyData);
53 | }
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/Wlan10/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // AssemblyInfo.cs in Wlan10/Wlan10
2 | // Created 2016/07/27
3 | // ©Bertware, visit http://bertware.net
4 | //
5 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
6 | // If a copy of the MPL was not distributed with this file,
7 | // you can obtain one at http://mozilla.org/MPL/2.0/.
8 |
9 | using System.Reflection;
10 | using System.Resources;
11 | using System.Runtime.InteropServices;
12 | using System.Windows;
13 |
14 | // General Information about an assembly is controlled through the following
15 | // set of attributes. Change these attribute values to modify the information
16 | // associated with an assembly.
17 |
18 | [assembly: AssemblyTitle("Wlan10")]
19 | [assembly: AssemblyDescription("Wireless network configuration tool for windows 10")]
20 | [assembly: AssemblyConfiguration("")]
21 | [assembly: AssemblyCompany("Bertware")]
22 | [assembly: AssemblyProduct("Wlan10")]
23 | [assembly: AssemblyCopyright("Copyright ©Bertware 2016")]
24 | [assembly: AssemblyTrademark("")]
25 | [assembly: AssemblyCulture("")]
26 |
27 | // Setting ComVisible to false makes the types in this assembly not visible
28 | // to COM components. If you need to access a type in this assembly from
29 | // COM, set the ComVisible attribute to true on that type.
30 |
31 | [assembly: ComVisible(false)]
32 |
33 | //In order to begin building localizable applications, set
34 | //CultureYouAreCodingWith in your .csproj file
35 | //inside a . For example, if you are using US english
36 | //in your source files, set the to en-US. Then uncomment
37 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
38 | //the line below to match the UICulture setting in the project file.
39 |
40 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
41 |
42 |
43 | [assembly: ThemeInfo(
44 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
45 | //(used if a resource is not found in the page,
46 | // or application resource dictionaries)
47 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
48 | //(used if a resource is not found in the page,
49 | // app, or any theme specific resource dictionaries)
50 | )]
51 |
52 |
53 | // Version information for an assembly consists of the following four values:
54 | //
55 | // Major Version
56 | // Minor Version
57 | // Build Number
58 | // Revision
59 | //
60 | // You can specify all the values or you can default the Build and Revision Numbers
61 | // by using the '*' as shown below:
62 | // [assembly: AssemblyVersion("1.0.*")]
63 |
64 | [assembly: AssemblyVersion("1.1.2.0")]
65 | [assembly: AssemblyFileVersion("1.1.2.0")]
66 | [assembly: NeutralResourcesLanguage("en")]
--------------------------------------------------------------------------------
/Wlan10/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | // MainWindow.xaml.cs in Wlan10/Wlan10
2 | // Created 2016/07/27
3 | // ©Bertware, visit http://bertware.net
4 | //
5 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
6 | // If a copy of the MPL was not distributed with this file,
7 | // you can obtain one at http://mozilla.org/MPL/2.0/.
8 |
9 | using System.Collections.ObjectModel;
10 | using System.Diagnostics;
11 | using System.Windows;
12 | using System.Windows.Controls;
13 | using Net.Bertware.Wlan10.Controller;
14 | using Net.Bertware.Wlan10.Model;
15 |
16 | namespace Net.Bertware.Wlan10
17 | {
18 | ///
19 | /// Interaction logic for MainWindow.xaml
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | private ObservableCollection networks = Netshell.GetNetworks();
24 |
25 | public MainWindow()
26 | {
27 | InitializeComponent();
28 | // bind
29 | lvNetworks.ItemsSource = networks;
30 | }
31 |
32 | private void btnSaveOrder_Click(object sender, RoutedEventArgs e)
33 | {
34 | // Drag and drop will reorder the list (binding with observablelist). So just loop through the list and set the current position.
35 | for (int i = 0; i < networks.Count; i++)
36 | {
37 | networks[i].SetPriority(i + 1);
38 | }
39 | // confirm this to the user, to make sure there is no doubt
40 | MessageBox.Show("The new network order was applied succesfully!");
41 | }
42 |
43 | private void btnForget_click(object sender, RoutedEventArgs e)
44 | {
45 | WlanNetwork net = (WlanNetwork) ((Button) sender).DataContext;
46 | // Ask politely
47 | if (
48 | MessageBox.Show("Are you sure you want to forget " + net.Name + "? This cannot be undone.",
49 | "Forget network",
50 | MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
51 | {
52 | // make windows forget
53 | net.ForgetNetwork();
54 | // also remove from the list
55 | networks.Remove(net);
56 | }
57 | }
58 |
59 | private void btnDonate_Click(object sender, RoutedEventArgs e)
60 | {
61 | MessageBox.Show("You will now be redirected to the donate page");
62 | Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K4856LBVQZ25L");
63 | }
64 |
65 | private void btnCredits_Click(object sender, RoutedEventArgs e)
66 | {
67 | MessageBox.Show(
68 | "Idea and creation by Bertware.\r\n" +
69 | "www.bertware.net www.bertmarcelis.be\r\n\r\n" +
70 | "This program uses the GongSolutions.Wpf.DragDrop library made by Punker79\r\n" +
71 | "Copyright (c) 2015, Jan Karger (Steven Kirk)\r\n" +
72 | "https://github.com/punker76/gong-wpf-dragdrop");
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/Wlan10/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
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 Net.Bertware.Wlan10.Properties {
12 | using System;
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", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Net.Bertware.Wlan10.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Byte[].
65 | ///
66 | internal static byte[] GongSolutions_Wpf_DragDrop {
67 | get {
68 | object obj = ResourceManager.GetObject("GongSolutions_Wpf_DragDrop", resourceCulture);
69 | return ((byte[])(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Wlan10/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Wlan10/Controller/Netshell.cs:
--------------------------------------------------------------------------------
1 | // Netshell.cs in Wlan10/Wlan10
2 | // Created 2016/08/27
3 | // Copyright ©2016 Bertware (bertware.net)
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
13 | // all 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
21 | // THE SOFTWARE.
22 |
23 | using System.Collections.ObjectModel;
24 | using System.Diagnostics;
25 | using System.Text;
26 | using System.Text.RegularExpressions;
27 | using Net.Bertware.Wlan10.Model;
28 |
29 | namespace Net.Bertware.Wlan10.Controller
30 | {
31 | ///
32 | /// Netshell interactions
33 | ///
34 | internal static class Netshell
35 | {
36 | private const string CmdList = "wlan sh profiles";
37 |
38 | public static ObservableCollection GetNetworks()
39 | {
40 | string output = NetshellCmd(CmdList);
41 | MatchCollection m = Regex.Matches(output, "User Profile\\s+:\\s*(.*?)$", RegexOptions.Multiline);
42 | ObservableCollection results = new ObservableCollection();
43 |
44 | for (int i = 0; i < m.Count; i++)
45 | {
46 | string name = m[i].Groups[1].Value.Trim('\r');
47 | if (!string.IsNullOrWhiteSpace(name))
48 | {
49 | results.Add(new WlanNetwork(name));
50 | }
51 | }
52 | return results;
53 | }
54 |
55 | public static string NetshellCmd(string cmd)
56 | {
57 | // Start the child process.
58 | Process p = new Process();
59 | // Redirect the output stream of the child process.
60 | p.StartInfo.UseShellExecute = false;
61 | p.StartInfo.RedirectStandardOutput = true;
62 | // The default codepage (and console output) in your Windows is almost certainly not Unicode.
63 | // If you're alive in 2017 you likely see network SSIDs with lovely international characters,
64 | // emoji and other good stuff. So we need to do something. Alas, you can't set console output
65 | // encoding of a Windows app in debug mode according to Jon Skeet:
66 | // https://stackoverflow.com/a/18580114/83089
67 | // Ideally we'd use the following, but if you try to run it in VisualStudio, it'll throw:
68 | // System.Console.OutputEncoding = System.Text.Encoding.UTF8;
69 | // If we use the PowerShell chcp command to set the console's output with our process object,
70 | // the codepage will reset before our next command. The solution? Chain commands with cmd.exe.
71 | // Nasty, but it works.
72 | p.StartInfo.FileName = "cmd.exe";
73 | p.StartInfo.Arguments = "/C chcp 65001 && netsh " + cmd;
74 | p.StartInfo.StandardOutputEncoding = Encoding.UTF8;
75 | p.StartInfo.CreateNoWindow = true;
76 | p.Start();
77 | // Do not wait for the child process to exit before
78 | // reading to the end of its redirected stream.
79 | // p.WaitForExit();
80 | // Read the output stream first and then wait.
81 | string output = p.StandardOutput.ReadToEnd();
82 | p.WaitForExit();
83 | return output;
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # I am no longer maintaining this project, and gladly hand over the project to [Aidan](https://github.com/afit/wlan10/).
2 | I created this as a quick tool to make managing wi-fi networks easier, but I don't have time to properly develop or maintain this project.
3 | Please see Afit's fork for a maintained version that is actively being developed: https://github.com/afit/wlan10/
4 |
5 | ---
6 |
7 | # wlan10
8 |
9 | Wi-fi network manager for Windows 10. Bringing back the functionality Microsoft removed, and more.
10 |
11 | ## Requirements
12 |
13 | * Windows 10 or 8.1 (may also work on 8, 7)
14 | * .NET 4 or higher
15 | * Wireless networks
16 |
17 | ## Usage
18 |
19 | Open the app. Some wifi networks should show up in the list.
20 |
21 | > **If no wifi networks show up, you need to connect to some wireless networks first!**
22 | > Setting up a wireless network through the >app is not supported.
23 |
24 | Drag and drop the networks to change the order to your liking. Hit the save button to store this new order. Windows should now prefer the networks which you put on top, selecting the highest positioned available network. Setting autoconnect and autoswitching (read more about autoswitching below) doesn't require saving.
25 |
26 | The tool is only required for setup, and can be removed once everything is configured. See [the blog for more](http://blog.bertware.net/2016/07/set-windows-network-priority-wlan10/).
27 |
28 | > **Note:** What is autoswitching?
29 | >
30 | > The `autoSwitch` (`WLANProfile`) element determines the roaming behavior of an auto-connected network when a more preferred network is in range. This element is optional.
31 | >
32 | > If `autoSwitch` is `true` and `connectionMode` is set to `auto`, a connection to a more preferred network must be attempted whenever a more preferred network comes into range. A more preferred network is one that is ordered higher in the list of preferred wireless networks. This connection attempt occurs when connected to another network.
33 | >
34 | > An `autoSwitch` value set to `true` results in a higher frequency of periodic scanning for new networks. This may result in increased radio frequency pollution from these periodic scans and increased power consumption used by the wireless network adapter.
35 |
36 | ## Support
37 |
38 | Create a [GitHub issue](https://github.com/Bertware/wlan10/issues) if you have suggestions or problems.
39 |
40 | ## Say thanks
41 |
42 | Say thanks! Star this project so I can see the impact, or leave me a message!
43 |
44 | ## Credits
45 |
46 | Idea conceived by Bertware, coded by [Bertware](http://www.bertware.net).
47 |
48 | This project is subject to the Mozilla Public License Version 2.0. A copy of the license is included in this repository.
49 |
50 | ### Libraries used in this project
51 | #### GongSolutions.WPF.DragDrop
52 |
53 | The [`GongSolutions.WPF.DragDrop`](https://github.com/punker76/gong-wpf-dragdrop) library is used as an NuGet package, and is included in the exe in executable form.
54 |
55 | `GongSolutions.WPF.DragDrop` code is public under the BSD 3-Clause License.
56 |
57 | Copyright © 2015, Jan Karger (Steven Kirk). All rights reserved.
58 |
59 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
60 |
61 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
62 |
63 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
64 |
65 | Neither the name of gong-wpf-dragdrop nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
66 |
67 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68 |
--------------------------------------------------------------------------------
/Wlan10/Wlan10.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {B2213BF4-E988-475F-9B63-5238FA0ADF36}
8 | WinExe
9 | Properties
10 | Net.Bertware.Wlan10
11 | Wlan10
12 | v4.0
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 | Net.Bertware.Wlan10.App
39 |
40 |
41 |
42 | ..\packages\gong-wpf-dragdrop.0.1.4.3\lib\net40\GongSolutions.Wpf.DragDrop.dll
43 | False
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | 4.0
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | MSBuild:Compile
62 | Designer
63 |
64 |
65 |
66 | MSBuild:Compile
67 | Designer
68 |
69 |
70 | App.xaml
71 | Code
72 |
73 |
74 | MainWindow.xaml
75 | Code
76 |
77 |
78 |
79 |
80 |
81 | Code
82 |
83 |
84 | True
85 | True
86 | Resources.resx
87 |
88 |
89 | True
90 | Settings.settings
91 | True
92 |
93 |
94 | ResXFileCodeGenerator
95 | Resources.Designer.cs
96 |
97 |
98 |
99 | SettingsSingleFileGenerator
100 | Settings.Designer.cs
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
118 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 | *.VC.VC.opendb
85 |
86 | # Visual Studio profiler
87 | *.psess
88 | *.vsp
89 | *.vspx
90 | *.sap
91 |
92 | # TFS 2012 Local Workspace
93 | $tf/
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 | *.DotSettings.user
102 |
103 | # JustCode is a .NET coding add-in
104 | .JustCode
105 |
106 | # TeamCity is a build add-in
107 | _TeamCity*
108 |
109 | # DotCover is a Code Coverage Tool
110 | *.dotCover
111 |
112 | # NCrunch
113 | _NCrunch_*
114 | .*crunch*.local.xml
115 | nCrunchTemp_*
116 |
117 | # MightyMoose
118 | *.mm.*
119 | AutoTest.Net/
120 |
121 | # Web workbench (sass)
122 | .sass-cache/
123 |
124 | # Installshield output folder
125 | [Ee]xpress/
126 |
127 | # DocProject is a documentation generator add-in
128 | DocProject/buildhelp/
129 | DocProject/Help/*.HxT
130 | DocProject/Help/*.HxC
131 | DocProject/Help/*.hhc
132 | DocProject/Help/*.hhk
133 | DocProject/Help/*.hhp
134 | DocProject/Help/Html2
135 | DocProject/Help/html
136 |
137 | # Click-Once directory
138 | publish/
139 |
140 | # Publish Web Output
141 | *.[Pp]ublish.xml
142 | *.azurePubxml
143 | # TODO: Comment the next line if you want to checkin your web deploy settings
144 | # but database connection strings (with potential passwords) will be unencrypted
145 | *.pubxml
146 | *.publishproj
147 |
148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
149 | # checkin your Azure Web App publish settings, but sensitive information contained
150 | # in these scripts will be unencrypted
151 | PublishScripts/
152 |
153 | # NuGet Packages
154 | *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
253 |
--------------------------------------------------------------------------------
/Wlan10/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 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\resources\gongsolutions.wpf.dragdrop.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
123 |
124 |
--------------------------------------------------------------------------------
/Wlan10/Model/WlanNetwork.cs:
--------------------------------------------------------------------------------
1 | // WlanNetwork.cs in Wlan10/Wlan10
2 | // Created 2016/08/27
3 | // Copyright ©2016 Bertware (bertware.net)
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
13 | // all 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
21 | // THE SOFTWARE.
22 |
23 | using System;
24 | using System.Text.RegularExpressions;
25 | using System.Windows;
26 | using Net.Bertware.Wlan10.Controller;
27 |
28 | namespace Net.Bertware.Wlan10.Model
29 | {
30 | ///
31 | /// A network obtained from netshell output.
32 | ///
33 | internal class WlanNetwork
34 | {
35 | private const string CmdDetail = "wlan sh profiles \"\"";
36 |
37 | ///
38 | /// Set network priority
39 | ///
40 | private const string CmdUpdate =
41 | "wlan set profileorder name=\"\" interface=\"\" priority=";
42 |
43 | ///
44 | /// autoswitch can be yes or no
45 | ///
46 | private const string CmdSetAutoswitch =
47 | "wlan set profileparameter name=\"\" SSIDname=\"\" autoSwitch=";
48 |
49 | ///
50 | /// Connectionmode can be auto or manual
51 | ///
52 | private const string CmdSetAutoConnect =
53 | "wlan set profileparameter name=\"\" SSIDname=\"\" ConnectionMode=";
54 |
55 | ///
56 | /// nonbroadcast can be yes or no
57 | ///
58 | private const string CmdSetNonBroadcast =
59 | "wlan set profileparameter name=\"\" SSIDname=\"\" nonBroadcast=";
60 |
61 | ///
62 | /// Set the pre-shared key or passphrase
63 | ///
64 | private const string CmdSetKey =
65 | "wlan set profileparameter name=\"\" SSIDname=\"\" keyMaterial= ";
66 |
67 | ///
68 | /// Delete this profile
69 | ///
70 | private const string CmdDelete = "wlan delete profile \"\"";
71 |
72 | private readonly bool _allUsers;
73 |
74 | public bool AllUsers
75 | {
76 | get { return _allUsers; }
77 | }
78 |
79 | private readonly string _interface;
80 | private readonly int _version;
81 | private readonly string _profileType;
82 | private readonly string _name;
83 | private bool _autoconnect;
84 | private bool _connectWithoutBroadcast;
85 | private bool _autoswitch;
86 | private readonly bool _macRandomization;
87 | private readonly int _ssidCount;
88 | private readonly string _ssidName;
89 | private readonly string _networkType;
90 | private readonly string _radioType;
91 | private readonly string _authentication;
92 | private readonly string _cipher;
93 | private readonly bool _securityKey;
94 | private readonly string _cost;
95 | private readonly bool _congested;
96 | private readonly bool _approachingLimit;
97 | private readonly bool _overLimit;
98 | private readonly bool _roaming;
99 | private readonly string _costSource;
100 |
101 | public int Version
102 | {
103 | get { return _version; }
104 | }
105 |
106 | public string ProfileType
107 | {
108 | get { return _profileType; }
109 | }
110 |
111 | public string Name
112 | {
113 | get { return _name; }
114 | }
115 |
116 | public bool Autoconnect
117 | {
118 | get { return _autoconnect; }
119 | set
120 | {
121 | _autoconnect = value;
122 | string param = value ? "auto" : "manual";
123 | Netshell.NetshellCmd(PrepareCommand(CmdSetAutoConnect.Replace("", param)));
124 | }
125 | }
126 |
127 | public bool ConnectWithoutBroadcast
128 | {
129 | get { return _connectWithoutBroadcast; }
130 | set
131 | {
132 | _connectWithoutBroadcast = value;
133 | string param = value ? "yes" : "no";
134 | Netshell.NetshellCmd(PrepareCommand(CmdSetNonBroadcast.Replace("", param)));
135 | }
136 | }
137 |
138 | public bool Autoswitch
139 | {
140 | get { return _autoswitch; }
141 | set
142 | {
143 | _autoswitch = value;
144 | string param = value ? "yes" : "no";
145 | Netshell.NetshellCmd(PrepareCommand(CmdSetAutoswitch.Replace("", param)));
146 | }
147 | }
148 |
149 | public bool MacRandomization
150 | {
151 | get { return _macRandomization; }
152 | }
153 |
154 | public int SsidCount
155 | {
156 | get { return _ssidCount; }
157 | }
158 |
159 | public string SsidName
160 | {
161 | get { return _ssidName; }
162 | }
163 |
164 | public string NetworkType
165 | {
166 | get { return _networkType; }
167 | }
168 |
169 | public string RadioType
170 | {
171 | get { return _radioType; }
172 | }
173 |
174 | public string Authentication
175 | {
176 | get { return _authentication; }
177 | }
178 |
179 | public string Cipher
180 | {
181 | get { return _cipher; }
182 | }
183 |
184 | public bool SecurityKey
185 | {
186 | get { return _securityKey; }
187 | }
188 |
189 | public string Cost
190 | {
191 | get { return _cost; }
192 | }
193 |
194 | public bool Congested
195 | {
196 | get { return _congested; }
197 | }
198 |
199 | public bool ApproachingLimit
200 | {
201 | get { return _approachingLimit; }
202 | }
203 |
204 | public bool OverLimit
205 | {
206 | get { return _overLimit; }
207 | }
208 |
209 | public bool Roaming
210 | {
211 | get { return _roaming; }
212 | }
213 |
214 | public string CostSource
215 | {
216 | get { return _costSource; }
217 | }
218 |
219 | ///
220 | /// Get a full network based on the network name. Requires netshell access.
221 | ///
222 | ///
223 | public WlanNetwork(string name)
224 | {
225 | if (String.IsNullOrWhiteSpace(name))
226 | {
227 | throw new ArgumentException("Name cannot be empty");
228 | }
229 |
230 | _name = name;
231 | string output = Netshell.NetshellCmd(PrepareCommand(CmdDetail));
232 | try
233 | {
234 | _interface = parseInterface(output);
235 |
236 | _allUsers = (String.Equals(getFieldFromOutput(output, "Applied"), "All User Profile",
237 | StringComparison.Ordinal));
238 | _version = Int32.Parse(getFieldFromOutput(output, "Version"));
239 | _profileType = getFieldFromOutput(output, "Type");
240 | _name = getFieldFromOutput(output, "Name");
241 | _connectWithoutBroadcast = (!String.Equals(getFieldFromOutput(output, "Network broadcast"),
242 | "Connect only if this network is broadcasting", StringComparison.Ordinal));
243 | _autoconnect = (String.Equals(getFieldFromOutput(output, "Connection mode"), "Connect automatically",
244 | StringComparison.Ordinal));
245 | _autoswitch = (String.Equals(getFieldFromOutput(output, "AutoSwitch"),
246 | "Switch to more preferred network if possible", StringComparison.Ordinal));
247 | _macRandomization = (String.Equals(getFieldFromOutput(output, "MAC Randomization"), "Enabled",
248 | StringComparison.Ordinal));
249 | _ssidCount = Int32.Parse(getFieldFromOutput(output, "Number of SSIDs"));
250 | _ssidName = getFieldFromOutput(output, "SSID name");
251 | _networkType = getFieldFromOutput(output, "Network type");
252 | _radioType = getFieldFromOutput(output, "Radio type");
253 |
254 | _authentication = getFieldFromOutput(output, "Authentication");
255 | _cipher = getFieldFromOutput(output, "Cipher");
256 | _securityKey = (String.Equals(getFieldFromOutput(output, "Security key"), "Present",
257 | StringComparison.Ordinal));
258 |
259 | _cost = getFieldFromOutput(output, "Cost");
260 |
261 | _congested = (getFieldFromOutput(output, "Congested") == "Yes");
262 | _approachingLimit = (getFieldFromOutput(output, "Approaching Data Limit") == "Yes");
263 | _overLimit = (getFieldFromOutput(output, "Over Data Limit") == "Yes");
264 | _roaming = (getFieldFromOutput(output, "Roaming") == "Yes");
265 | _costSource = getFieldFromOutput(output, "Cost Source");
266 | }
267 | catch (Exception e)
268 | {
269 | MessageBox.Show(
270 | "The application encountered an unexpected error while parsing a network. You can continue using the app, but some profiles may be missing. Please report this error to the developer (\"http://github.com/Bertware/Wlan10/Issues\")\r\n" +
271 | "Error details:\r\n" +
272 | e.Message + "\r\n"
273 | + e.StackTrace + "\r\n\r\n" +
274 | output, "Unexpected error", MessageBoxButton.OK, MessageBoxImage.Error);
275 | }
276 | }
277 |
278 | ///
279 | /// Parse the network interface
280 | ///
281 | ///
282 | ///
283 | private string parseInterface(string output)
284 | {
285 | return Regex.Match(output, "on interface (.*?):").Groups[1].Value;
286 | }
287 |
288 | ///
289 | /// Parse a field with information
290 | ///
291 | ///
292 | ///
293 | ///
294 | private string getFieldFromOutput(string output, string field)
295 | {
296 | Match m = Regex.Match(output, field + "\\s*:\\s*(.+?)\\s*$",
297 | RegexOptions.Multiline | RegexOptions.IgnoreCase);
298 | return m.Groups[1].Value.Trim(' ', '"');
299 | }
300 |
301 | public override string ToString()
302 | {
303 | return Name + "(" + Authentication + " " + NetworkType + ")";
304 | }
305 |
306 | ///
307 | /// Prepare a command, replacing the name, ssid and interface fields with actual values from the current network
308 | ///
309 | ///
310 | ///
311 | private string PrepareCommand(string command)
312 | {
313 | return command.Replace("", Name)
314 | .Replace("", SsidName)
315 | .Replace("", _interface);
316 | }
317 |
318 | ///
319 | /// Set the network key (WEP/WPA/WPA2) for this network
320 | ///
321 | ///
322 | public void SetKey(string key)
323 | {
324 | Netshell.NetshellCmd(PrepareCommand(CmdSetKey).Replace("", key));
325 | }
326 |
327 | ///
328 | /// Set the priority for this network
329 | ///
330 | ///
331 | public void SetPriority(int priority)
332 | {
333 | Netshell.NetshellCmd(PrepareCommand(CmdUpdate).Replace("", priority.ToString()));
334 | }
335 |
336 | ///
337 | /// Forget this network
338 | ///
339 | public void ForgetNetwork()
340 | {
341 | Netshell.NetshellCmd(PrepareCommand(CmdDelete));
342 | }
343 | }
344 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Mozilla Public License Version 2.0
2 | ==================================
3 |
4 | 1. Definitions
5 | --------------
6 |
7 | 1.1. "Contributor"
8 | means each individual or legal entity that creates, contributes to
9 | the creation of, or owns Covered Software.
10 |
11 | 1.2. "Contributor Version"
12 | means the combination of the Contributions of others (if any) used
13 | by a Contributor and that particular Contributor's Contribution.
14 |
15 | 1.3. "Contribution"
16 | means Covered Software of a particular Contributor.
17 |
18 | 1.4. "Covered Software"
19 | means Source Code Form to which the initial Contributor has attached
20 | the notice in Exhibit A, the Executable Form of such Source Code
21 | Form, and Modifications of such Source Code Form, in each case
22 | including portions thereof.
23 |
24 | 1.5. "Incompatible With Secondary Licenses"
25 | means
26 |
27 | (a) that the initial Contributor has attached the notice described
28 | in Exhibit B to the Covered Software; or
29 |
30 | (b) that the Covered Software was made available under the terms of
31 | version 1.1 or earlier of the License, but not also under the
32 | terms of a Secondary License.
33 |
34 | 1.6. "Executable Form"
35 | means any form of the work other than Source Code Form.
36 |
37 | 1.7. "Larger Work"
38 | means a work that combines Covered Software with other material, in
39 | a separate file or files, that is not Covered Software.
40 |
41 | 1.8. "License"
42 | means this document.
43 |
44 | 1.9. "Licensable"
45 | means having the right to grant, to the maximum extent possible,
46 | whether at the time of the initial grant or subsequently, any and
47 | all of the rights conveyed by this License.
48 |
49 | 1.10. "Modifications"
50 | means any of the following:
51 |
52 | (a) any file in Source Code Form that results from an addition to,
53 | deletion from, or modification of the contents of Covered
54 | Software; or
55 |
56 | (b) any new file in Source Code Form that contains any Covered
57 | Software.
58 |
59 | 1.11. "Patent Claims" of a Contributor
60 | means any patent claim(s), including without limitation, method,
61 | process, and apparatus claims, in any patent Licensable by such
62 | Contributor that would be infringed, but for the grant of the
63 | License, by the making, using, selling, offering for sale, having
64 | made, import, or transfer of either its Contributions or its
65 | Contributor Version.
66 |
67 | 1.12. "Secondary License"
68 | means either the GNU General Public License, Version 2.0, the GNU
69 | Lesser General Public License, Version 2.1, the GNU Affero General
70 | Public License, Version 3.0, or any later versions of those
71 | licenses.
72 |
73 | 1.13. "Source Code Form"
74 | means the form of the work preferred for making modifications.
75 |
76 | 1.14. "You" (or "Your")
77 | means an individual or a legal entity exercising rights under this
78 | License. For legal entities, "You" includes any entity that
79 | controls, is controlled by, or is under common control with You. For
80 | purposes of this definition, "control" means (a) the power, direct
81 | or indirect, to cause the direction or management of such entity,
82 | whether by contract or otherwise, or (b) ownership of more than
83 | fifty percent (50%) of the outstanding shares or beneficial
84 | ownership of such entity.
85 |
86 | 2. License Grants and Conditions
87 | --------------------------------
88 |
89 | 2.1. Grants
90 |
91 | Each Contributor hereby grants You a world-wide, royalty-free,
92 | non-exclusive license:
93 |
94 | (a) under intellectual property rights (other than patent or trademark)
95 | Licensable by such Contributor to use, reproduce, make available,
96 | modify, display, perform, distribute, and otherwise exploit its
97 | Contributions, either on an unmodified basis, with Modifications, or
98 | as part of a Larger Work; and
99 |
100 | (b) under Patent Claims of such Contributor to make, use, sell, offer
101 | for sale, have made, import, and otherwise transfer either its
102 | Contributions or its Contributor Version.
103 |
104 | 2.2. Effective Date
105 |
106 | The licenses granted in Section 2.1 with respect to any Contribution
107 | become effective for each Contribution on the date the Contributor first
108 | distributes such Contribution.
109 |
110 | 2.3. Limitations on Grant Scope
111 |
112 | The licenses granted in this Section 2 are the only rights granted under
113 | this License. No additional rights or licenses will be implied from the
114 | distribution or licensing of Covered Software under this License.
115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a
116 | Contributor:
117 |
118 | (a) for any code that a Contributor has removed from Covered Software;
119 | or
120 |
121 | (b) for infringements caused by: (i) Your and any other third party's
122 | modifications of Covered Software, or (ii) the combination of its
123 | Contributions with other software (except as part of its Contributor
124 | Version); or
125 |
126 | (c) under Patent Claims infringed by Covered Software in the absence of
127 | its Contributions.
128 |
129 | This License does not grant any rights in the trademarks, service marks,
130 | or logos of any Contributor (except as may be necessary to comply with
131 | the notice requirements in Section 3.4).
132 |
133 | 2.4. Subsequent Licenses
134 |
135 | No Contributor makes additional grants as a result of Your choice to
136 | distribute the Covered Software under a subsequent version of this
137 | License (see Section 10.2) or under the terms of a Secondary License (if
138 | permitted under the terms of Section 3.3).
139 |
140 | 2.5. Representation
141 |
142 | Each Contributor represents that the Contributor believes its
143 | Contributions are its original creation(s) or it has sufficient rights
144 | to grant the rights to its Contributions conveyed by this License.
145 |
146 | 2.6. Fair Use
147 |
148 | This License is not intended to limit any rights You have under
149 | applicable copyright doctrines of fair use, fair dealing, or other
150 | equivalents.
151 |
152 | 2.7. Conditions
153 |
154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155 | in Section 2.1.
156 |
157 | 3. Responsibilities
158 | -------------------
159 |
160 | 3.1. Distribution of Source Form
161 |
162 | All distribution of Covered Software in Source Code Form, including any
163 | Modifications that You create or to which You contribute, must be under
164 | the terms of this License. You must inform recipients that the Source
165 | Code Form of the Covered Software is governed by the terms of this
166 | License, and how they can obtain a copy of this License. You may not
167 | attempt to alter or restrict the recipients' rights in the Source Code
168 | Form.
169 |
170 | 3.2. Distribution of Executable Form
171 |
172 | If You distribute Covered Software in Executable Form then:
173 |
174 | (a) such Covered Software must also be made available in Source Code
175 | Form, as described in Section 3.1, and You must inform recipients of
176 | the Executable Form how they can obtain a copy of such Source Code
177 | Form by reasonable means in a timely manner, at a charge no more
178 | than the cost of distribution to the recipient; and
179 |
180 | (b) You may distribute such Executable Form under the terms of this
181 | License, or sublicense it under different terms, provided that the
182 | license for the Executable Form does not attempt to limit or alter
183 | the recipients' rights in the Source Code Form under this License.
184 |
185 | 3.3. Distribution of a Larger Work
186 |
187 | You may create and distribute a Larger Work under terms of Your choice,
188 | provided that You also comply with the requirements of this License for
189 | the Covered Software. If the Larger Work is a combination of Covered
190 | Software with a work governed by one or more Secondary Licenses, and the
191 | Covered Software is not Incompatible With Secondary Licenses, this
192 | License permits You to additionally distribute such Covered Software
193 | under the terms of such Secondary License(s), so that the recipient of
194 | the Larger Work may, at their option, further distribute the Covered
195 | Software under the terms of either this License or such Secondary
196 | License(s).
197 |
198 | 3.4. Notices
199 |
200 | You may not remove or alter the substance of any license notices
201 | (including copyright notices, patent notices, disclaimers of warranty,
202 | or limitations of liability) contained within the Source Code Form of
203 | the Covered Software, except that You may alter any license notices to
204 | the extent required to remedy known factual inaccuracies.
205 |
206 | 3.5. Application of Additional Terms
207 |
208 | You may choose to offer, and to charge a fee for, warranty, support,
209 | indemnity or liability obligations to one or more recipients of Covered
210 | Software. However, You may do so only on Your own behalf, and not on
211 | behalf of any Contributor. You must make it absolutely clear that any
212 | such warranty, support, indemnity, or liability obligation is offered by
213 | You alone, and You hereby agree to indemnify every Contributor for any
214 | liability incurred by such Contributor as a result of warranty, support,
215 | indemnity or liability terms You offer. You may include additional
216 | disclaimers of warranty and limitations of liability specific to any
217 | jurisdiction.
218 |
219 | 4. Inability to Comply Due to Statute or Regulation
220 | ---------------------------------------------------
221 |
222 | If it is impossible for You to comply with any of the terms of this
223 | License with respect to some or all of the Covered Software due to
224 | statute, judicial order, or regulation then You must: (a) comply with
225 | the terms of this License to the maximum extent possible; and (b)
226 | describe the limitations and the code they affect. Such description must
227 | be placed in a text file included with all distributions of the Covered
228 | Software under this License. Except to the extent prohibited by statute
229 | or regulation, such description must be sufficiently detailed for a
230 | recipient of ordinary skill to be able to understand it.
231 |
232 | 5. Termination
233 | --------------
234 |
235 | 5.1. The rights granted under this License will terminate automatically
236 | if You fail to comply with any of its terms. However, if You become
237 | compliant, then the rights granted under this License from a particular
238 | Contributor are reinstated (a) provisionally, unless and until such
239 | Contributor explicitly and finally terminates Your grants, and (b) on an
240 | ongoing basis, if such Contributor fails to notify You of the
241 | non-compliance by some reasonable means prior to 60 days after You have
242 | come back into compliance. Moreover, Your grants from a particular
243 | Contributor are reinstated on an ongoing basis if such Contributor
244 | notifies You of the non-compliance by some reasonable means, this is the
245 | first time You have received notice of non-compliance with this License
246 | from such Contributor, and You become compliant prior to 30 days after
247 | Your receipt of the notice.
248 |
249 | 5.2. If You initiate litigation against any entity by asserting a patent
250 | infringement claim (excluding declaratory judgment actions,
251 | counter-claims, and cross-claims) alleging that a Contributor Version
252 | directly or indirectly infringes any patent, then the rights granted to
253 | You by any and all Contributors for the Covered Software under Section
254 | 2.1 of this License shall terminate.
255 |
256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257 | end user license agreements (excluding distributors and resellers) which
258 | have been validly granted by You or Your distributors under this License
259 | prior to termination shall survive termination.
260 |
261 | ************************************************************************
262 | * *
263 | * 6. Disclaimer of Warranty *
264 | * ------------------------- *
265 | * *
266 | * Covered Software is provided under this License on an "as is" *
267 | * basis, without warranty of any kind, either expressed, implied, or *
268 | * statutory, including, without limitation, warranties that the *
269 | * Covered Software is free of defects, merchantable, fit for a *
270 | * particular purpose or non-infringing. The entire risk as to the *
271 | * quality and performance of the Covered Software is with You. *
272 | * Should any Covered Software prove defective in any respect, You *
273 | * (not any Contributor) assume the cost of any necessary servicing, *
274 | * repair, or correction. This disclaimer of warranty constitutes an *
275 | * essential part of this License. No use of any Covered Software is *
276 | * authorized under this License except under this disclaimer. *
277 | * *
278 | ************************************************************************
279 |
280 | ************************************************************************
281 | * *
282 | * 7. Limitation of Liability *
283 | * -------------------------- *
284 | * *
285 | * Under no circumstances and under no legal theory, whether tort *
286 | * (including negligence), contract, or otherwise, shall any *
287 | * Contributor, or anyone who distributes Covered Software as *
288 | * permitted above, be liable to You for any direct, indirect, *
289 | * special, incidental, or consequential damages of any character *
290 | * including, without limitation, damages for lost profits, loss of *
291 | * goodwill, work stoppage, computer failure or malfunction, or any *
292 | * and all other commercial damages or losses, even if such party *
293 | * shall have been informed of the possibility of such damages. This *
294 | * limitation of liability shall not apply to liability for death or *
295 | * personal injury resulting from such party's negligence to the *
296 | * extent applicable law prohibits such limitation. Some *
297 | * jurisdictions do not allow the exclusion or limitation of *
298 | * incidental or consequential damages, so this exclusion and *
299 | * limitation may not apply to You. *
300 | * *
301 | ************************************************************************
302 |
303 | 8. Litigation
304 | -------------
305 |
306 | Any litigation relating to this License may be brought only in the
307 | courts of a jurisdiction where the defendant maintains its principal
308 | place of business and such litigation shall be governed by laws of that
309 | jurisdiction, without reference to its conflict-of-law provisions.
310 | Nothing in this Section shall prevent a party's ability to bring
311 | cross-claims or counter-claims.
312 |
313 | 9. Miscellaneous
314 | ----------------
315 |
316 | This License represents the complete agreement concerning the subject
317 | matter hereof. If any provision of this License is held to be
318 | unenforceable, such provision shall be reformed only to the extent
319 | necessary to make it enforceable. Any law or regulation which provides
320 | that the language of a contract shall be construed against the drafter
321 | shall not be used to construe this License against a Contributor.
322 |
323 | 10. Versions of the License
324 | ---------------------------
325 |
326 | 10.1. New Versions
327 |
328 | Mozilla Foundation is the license steward. Except as provided in Section
329 | 10.3, no one other than the license steward has the right to modify or
330 | publish new versions of this License. Each version will be given a
331 | distinguishing version number.
332 |
333 | 10.2. Effect of New Versions
334 |
335 | You may distribute the Covered Software under the terms of the version
336 | of the License under which You originally received the Covered Software,
337 | or under the terms of any subsequent version published by the license
338 | steward.
339 |
340 | 10.3. Modified Versions
341 |
342 | If you create software not governed by this License, and you want to
343 | create a new license for such software, you may create and use a
344 | modified version of this License if you rename the license and remove
345 | any references to the name of the license steward (except to note that
346 | such modified license differs from this License).
347 |
348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary
349 | Licenses
350 |
351 | If You choose to distribute Source Code Form that is Incompatible With
352 | Secondary Licenses under the terms of this version of the License, the
353 | notice described in Exhibit B of this License must be attached.
354 |
355 | Exhibit A - Source Code Form License Notice
356 | -------------------------------------------
357 |
358 | This Source Code Form is subject to the terms of the Mozilla Public
359 | License, v. 2.0. If a copy of the MPL was not distributed with this
360 | file, You can obtain one at http://mozilla.org/MPL/2.0/.
361 |
362 | If it is not possible or desirable to put the notice in a particular
363 | file, then You may include the notice in a location (such as a LICENSE
364 | file in a relevant directory) where a recipient would be likely to look
365 | for such a notice.
366 |
367 | You may add additional accurate notices of copyright ownership.
368 |
369 | Exhibit B - "Incompatible With Secondary Licenses" Notice
370 | ---------------------------------------------------------
371 |
372 | This Source Code Form is "Incompatible With Secondary Licenses", as
373 | defined by the Mozilla Public License, v. 2.0.
374 |
--------------------------------------------------------------------------------