示例#1
0
        public static void Main(string[] args)
        {
            // Directory where Tor files are going to be stored.
            // If the directory does not exist, it will create one.
            var torDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Tor4NET");

            // Use 64-bit Tor with 64-bit process.
            // It's *very* important for the architecture of Tor process match the one used by your app.
            // If no parameter is given Tor constructor will check Environment.Is64BitProcess property (the same one as below).
            var is32Bit = !Environment.Is64BitProcess;

            var tor = new Tor(torDirectory, is32Bit);

            // Check for updates and install latest version.
            if (tor.CheckForUpdates().Result)
            {
                tor.Install().Wait();
            }

            // Disposing the client will exit the Tor process automatically.
            using (var client = tor.InitializeClient())
            {
                var http = new WebClient
                {
                    // And now let's use Tor as a proxy.
                    Proxy = client.Proxy.WebProxy
                };

                var html = http.DownloadString("http://facebookcorewwwi.onion");
                Debugger.Break();
            }

            // Finally, you can remove all previously downloaded Tor files (optional).
            tor.Uninstall();
        }
示例#2
0
        static void Main(string[] args)
        {
            // directory where the tor files are going to be stored
            // if directory doesn't exist, it will create one
            var torDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "tor");

            // support 64 bit tor on 64 bit os (optional)
            var is32Bit = !Environment.Is64BitOperatingSystem;

            var tor = new Tor(torDirectory, is32Bit);

            // install updates if available
            if (tor.CheckForUpdates().Result)
            {
                tor.InstallUpdates().Wait();
            }

            var client = tor.InitializeClient();

            // wait for tor to fully initialize
            while (!client.Proxy.IsRunning)
            {
                Thread.Sleep(100);
            }

            var wc = new WebClient();

            // use the tor proxy !!
            wc.Proxy = client.Proxy.WebProxy;

            var html = wc.DownloadString("http://facebookcorewwwi.onion");

            client.Dispose();
        }
示例#3
0
        public string GetTrueIP()
        {
            string IP = "";
            Task   t  = Task.Run(() =>
            {
                IP = Tor.GetCurrentIP();
            });

            t.Wait();

            return(IP);
        }
示例#4
0
        public async Task EndAsync()
        {
            Console.WriteLine("Gracefully shutting down...");
            if (_walletJob != null)
            {
                _walletJob.StateChanged -= _walletJob_StateChanged;
                _walletJob.Tracker.TrackedTransactions.CollectionChanged -= TrackedTransactions_CollectionChanged;
            }

            _cts.Cancel();
            await Task.WhenAll(_walletJobTask).ConfigureAwait(false);

            Tor.Kill();
        }
示例#5
0
        private void generateCollection_Click(object sender, EventArgs e)
        {
            Random rnd = new Random();
            torCollection.Clear();
            int amountElements = Convert.ToInt32(textBox1.Text);
            for(int i=0;i<amountElements;i++)
            {
                Tor tor = new Tor(i.ToString(),rnd.Next(1,20),rnd.Next(20,100));
                torCollection.Add(tor);
            }
            //foreach (Tor value in torCollection) MessageBox.Show(value.ToString());
            MessageBox.Show("Коллекция сгенерирована");

        }
示例#6
0
        public MSProApp()
        {
            Version = "1.1";

            MainTabs = new Tabs();

            ProxyTips = new TabbedPage();
            ProxyTipsWifiPage wfPage = new ProxyTipsWifiPage();

            wfPage.Title = AppStrings.Wifi;

            ProxyTipsAPNPage apnPage = new ProxyTipsAPNPage();

            apnPage.Title = AppStrings.APN;
            ProxyTips.Children.Add(wfPage);
            ProxyTips.Children.Add(apnPage);

            MainPage = new NavigationPage(MainTabs);

            MessagingCenter.Subscribe <MSProApp, string>(this, "TorOutput", (sender, arg) =>
            {
                if (arg.CompareTo(System.String.Empty) != 0)
                {
                    MSProApp.Locator.TorLogVM.TorLog.Add(arg);
                    MessagingCenter.Send <StatusViewModel, string>(MSProApp.Locator.StatusVM, "NewLoadMessage", arg);
                }
                if (arg.IndexOf("[err]") != -1)
                {
                    //error!
                }
                if (arg.IndexOf("100%") != -1)
                {
                    Task tc = Task.Run(() =>
                    {
                        Tor.Connect();
                    });
                    tc.Wait();
                    MessagingCenter.Send <StatusPage>(MSProApp.Locator.StatusVM.CurrentPage, "BootstrappFinished");
                }
            });
            MessagingCenter.Subscribe <MSProApp>(this, "Start", (sender) =>
            {
                OnStart();
            });
        }
示例#7
0
        public TorModule() : base("/tor")
        {
            Post["/apply"] = x => {
                Tor.Apply();
                return(HttpStatusCode.OK);
            };

            Post["/start"] = x => {
                Tor.Start();
                return(HttpStatusCode.OK);
            };

            Post["/set"] = x => {
                string data    = Request.Form.Data;
                var    objects = JsonConvert.DeserializeObject <TorModel>(data);
                Application.CurrentConfiguration.Services.Tor = objects;
                ConfigRepo.Save();
                return(HttpStatusCode.OK);
            };
        }
示例#8
0
        public async Task EndAsync()
        {
            if (_endCalled)
            {
                return;
            }
            _endCalled = true;
            Console.WriteLine("Gracefully shutting down...");
            if (_walletJob != null)
            {
                _walletJob.StateChanged -= _walletJob_StateChanged;
                (await _walletJob.GetTrackerAsync()).TrackedTransactions.CollectionChanged -= TrackedTransactions_CollectionChangedAsync;
            }

            _cts.Cancel();
            await Task.WhenAll(_walletJobTask);

            Tor.Kill();

            _cts?.Dispose();
            _walletJobTask?.Dispose();
        }
示例#9
0
        public void CancelSelectedCountriesList()
        {
            StringBuilder strConfig = new StringBuilder();
            int           nStart;

            strConfig.Append(Tor.ReadTorrc());
            if (!String.IsNullOrWhiteSpace(strConfig.ToString()))
            {
                nStart = strConfig.ToString().IndexOf("StrictNodes");
                if (nStart != -1)
                {
                    strConfig.Remove(nStart, 13);
                }

                nStart = strConfig.ToString().IndexOf("ExitNodes");
                if (nStart != -1)
                {
                    int nEnd = strConfig.ToString().IndexOf("\r\n", nStart + 1);
                    if (nEnd < 0)
                    {
                        strConfig.Remove(nStart, strConfig.Length - nStart);
                    }
                    else
                    {
                        strConfig.Remove(nStart, nEnd - nStart);
                    }
                }
                string strResult = strConfig.ToString();

                Tor.WriteTorrc(strResult);

                Task t = Task.Run(() =>
                {
                    bool bResult;
                    bResult = Tor.SendSimpleSignal("SIGNAL RELOAD\r\n");
                    bResult = Tor.SendSimpleSignal("SIGNAL NEWNYM\r\n");
                });
            }
            Settings.Remove("Selected countries list");
            Settings.Remove("Selected cities list");
            Settings.Remove("Selected regions list");

            StatusViewModel svm  = MSProApp.Locator.StatusVM;
            CitiesViewModel civm = MSProApp.Locator.CitiesVM;

            Device.BeginInvokeOnMainThread(() =>
            {
                if (SelectedCountriesList.Count > 0)
                {
                    SelectedCountriesList.Clear();
                }
                if (svm.SelectedRegionsList.Count > 0)
                {
                    svm.SelectedRegionsList.Clear();
                }
                if (civm.SelectedCitiesList.Count > 0)
                {
                    civm.SelectedCitiesList.Clear();
                }
            });
        }
示例#10
0
        public bool ApplySelectedCountriesList()
        {
            if (SelectedCountriesList.Count <= 0)
            {
                return(false);
            }


            //удаление серверов предыдущей страны
            StringBuilder strConfig           = new StringBuilder();
            StringBuilder ExcludedCodesResult = new StringBuilder();
            int           nStart;

            strConfig.Append(Tor.ReadTorrc());
            if (!String.IsNullOrWhiteSpace(strConfig.ToString()))
            {
                nStart = strConfig.ToString().IndexOf("StrictNodes");
                if (nStart != -1)
                {
                    strConfig.Remove(nStart, 13);
                }

                nStart = strConfig.ToString().IndexOf("ExitNodes");
                if (nStart != -1)
                {
                    int nEnd = strConfig.ToString().IndexOf("\r\n", nStart + 1);
                    if (nEnd < 0)
                    {
                        strConfig.Remove(nStart, strConfig.Length - nStart);
                    }
                    else
                    {
                        strConfig.Remove(nStart, nEnd - nStart);
                    }
                }
                string strResult = strConfig.ToString();
                strResult += "\r\n";
            }

            StringBuilder strNewExitCountriesEntry = new StringBuilder();

            //if (rbtnListModeInclude.IsChecked == true)
            //{
            for (int i = 0; i < SelectedCountriesList.Count; i++)
            {
                strNewExitCountriesEntry.Append("{");
                strNewExitCountriesEntry.Append(Tor.CountryToCode(SelectedCountriesList.ElementAt(i)));
                strNewExitCountriesEntry.Append("},");
            }
            strNewExitCountriesEntry.Remove(strNewExitCountriesEntry.Length - 1, 1);
            //}

            /*
             * if (rbtnListModeExclude.IsChecked == true)
             * {
             *  strNewExitCountriesEntry.Append(AllCountriesCodes.ToUpper());
             *  strNewExitCountriesEntry.Append(",");
             *  StringBuilder CodeToRemove = new StringBuilder();
             *  for (int i = 0; i < lbSelectedCountries.Items.Count; i++)
             *  {
             *      CodeToRemove.Clear();
             *      CodeToRemove.Append("{");
             *      CodeToRemove.Append(Tor.CountryToCode(lbSelectedCountries.Items.GetItemAt(i).ToString()));
             *      CodeToRemove.Append("},");
             *      strNewExitCountriesEntry.Replace(CodeToRemove.ToString(), "");
             *  }
             *  strNewExitCountriesEntry.Remove(strNewExitCountriesEntry.Length - 1, 1);
             * }
             */

            //write country codes
            if (!String.IsNullOrEmpty(strNewExitCountriesEntry.ToString()))
            {
                strConfig.Append("StrictNodes 1\r\n");
                strConfig.Append("ExitNodes ");
                strConfig.Append(strNewExitCountriesEntry);
                strConfig.Append("\r\n");
                Tor.WriteTorrc(strConfig.ToString());
            }
            else
            {
                return(false);
            }

            //смена цепи и перезагрузка настроек tor
            bool bResult;

            Task t = Task.Run(() =>
            {
                bResult = Tor.SendSimpleSignal("SIGNAL RELOAD\r\n");
                bResult = Tor.SendSimpleSignal("SIGNAL NEWNYM\r\n");
            });

            StatusViewModel svm  = MSProApp.Locator.StatusVM;
            CitiesViewModel civm = MSProApp.Locator.CitiesVM;

            Device.BeginInvokeOnMainThread(() =>
            {
                svm.SelectedRegionsList.ReplaceRange(SelectedCountriesList);
                if (civm.SelectedCitiesList.Count > 0)
                {
                    civm.SelectedCitiesList.Clear();
                }
            });

            Settings.SetStringCollection("Selected countries list", SelectedCountriesList);
            Settings.Remove("Selected cities list");
            Settings.SetStringCollection("Selected regions list", SelectedCountriesList);
            //var test=Settings.GetStringCollection("Selected cities list");

            return(true);
        }
示例#11
0
        public bool ApplySettings()
        {
            StringBuilder strConfig           = new StringBuilder();
            StringBuilder ExcludedCodesResult = new StringBuilder();
            int           nStart;

            strConfig.Append(Tor.ReadTorrc());
            if (!String.IsNullOrWhiteSpace(strConfig.ToString()))
            {
                if (TorPort != 0)
                {
                    nStart = strConfig.ToString().IndexOf("SOCKSPort");
                    if (nStart != -1)
                    {
                        int nEnd = strConfig.ToString().IndexOf(Environment.NewLine, nStart + 1);
                        if (nEnd < 0)
                        {
                            strConfig.Remove(nStart, strConfig.Length - nStart);
                        }
                        else
                        {
                            strConfig.Remove(nStart, nEnd - nStart);
                        }
                    }
                    strConfig.Append("SOCKSPort " + TorPort.ToString() + Environment.NewLine);
                    Settings.SetInt("Tor port", TorPort);
                }
                if (TorControlPort != 0)
                {
                    nStart = strConfig.ToString().IndexOf("ControlPort");
                    if (nStart != -1)
                    {
                        int nEnd = strConfig.ToString().IndexOf(Environment.NewLine, nStart + 1);
                        if (nEnd < 0)
                        {
                            strConfig.Remove(nStart, strConfig.Length - nStart);
                        }
                        else
                        {
                            strConfig.Remove(nStart, nEnd - nStart);
                        }
                    }
                    strConfig.Append("ControlPort " + TorControlPort.ToString() + Environment.NewLine);
                    Settings.SetInt("Tor control port", TorControlPort);
                }
                Tor.WriteTorrc(strConfig.ToString());
            }
            StringBuilder strPolipoConfig = new StringBuilder();

            strPolipoConfig.Append(Tor.ReadPolipoConf());
            if (PolipoPort != 0)
            {
                nStart = strPolipoConfig.ToString().IndexOf("proxyPort=");
                if (nStart != -1)
                {
                    int nEnd = strPolipoConfig.ToString().IndexOf(Environment.NewLine, nStart + 1);
                    if (nEnd < 0)
                    {
                        strPolipoConfig.Remove(nStart, strPolipoConfig.Length - nStart);
                    }
                    else
                    {
                        strPolipoConfig.Remove(nStart, nEnd - nStart);
                    }
                }
                strPolipoConfig.Append("proxyPort=" + PolipoPort.ToString() + Environment.NewLine);

                //socksParentProxy
                nStart = strPolipoConfig.ToString().IndexOf("socksParentProxy=");
                if (nStart != -1)
                {
                    int nEnd = strPolipoConfig.ToString().IndexOf(Environment.NewLine, nStart + 1);
                    if (nEnd < 0)
                    {
                        strPolipoConfig.Remove(nStart, strPolipoConfig.Length - nStart);
                    }
                    else
                    {
                        strPolipoConfig.Remove(nStart, nEnd - nStart);
                    }
                }
                strPolipoConfig.Append("socksParentProxy=\"localhost\\:" + TorPort.ToString() + "\"" + Environment.NewLine);

                Tor.WritePolipoConf(strPolipoConfig.ToString());
                Settings.SetInt("Polipo port", PolipoPort);
            }

            /*
             * if (IsStartOnBoot != Settings.GetBool("Start on boot", false)) //Applys changes
             * {
             *  if (IsStartOnBoot)
             *  {
             *      //
             *  }
             *  else
             *  {
             *      //
             *  }
             * }
             */
            //смена цепи и перезагрузка настроек tor
            bool bResult;

            Task t = Task.Run(() =>
            {
                bResult = Tor.SendSimpleSignal("SIGNAL RELOAD\r\n");
                bResult = Tor.SendSimpleSignal("SIGNAL NEWNYM\r\n");
            });

            return(true);
        }
示例#12
0
        public MSProApp()
        {
            Version = "1.1";

            StatusPage       = (StatusPage)FreshPageModelResolver.ResolvePageModel <StatusViewModel>();
            StatusPage.Title = Translation.GetString("Status");
            StatusVM         = (StatusViewModel)StatusPage.BindingContext;

            CountriesPage       = (CountriesPage)FreshPageModelResolver.ResolvePageModel <CountriesViewModel>();
            CountriesPage.Title = Translation.GetString("Countries");
            CountriesVM         = (CountriesViewModel)CountriesPage.BindingContext;

            CitiesPage       = (CitiesPage)FreshPageModelResolver.ResolvePageModel <CitiesViewModel>();
            CitiesPage.Title = Translation.GetString("Cities");
            CitiesVM         = (CitiesViewModel)CitiesPage.BindingContext;

            TorLogPage       = (TorLogPage)FreshPageModelResolver.ResolvePageModel <TorLogViewModel>();
            TorLogPage.Title = Translation.GetString("Tor log");
            TorLogVM         = (TorLogViewModel)TorLogPage.BindingContext;

            SettingsPage       = (SettingsPage)FreshPageModelResolver.ResolvePageModel <SettingsViewModel>();
            SettingsPage.Title = Translation.GetString("Settings");
            SettingsVM         = (SettingsViewModel)SettingsPage.BindingContext;

            AboutPage       = (AboutPage)FreshPageModelResolver.ResolvePageModel <AboutViewModel>();
            AboutPage.Title = Translation.GetString("About");
            AboutVM         = (AboutViewModel)AboutPage.BindingContext;

            ProxyTips = new TabbedPage();
            ProxyTipsWifiPage wfPage = (ProxyTipsWifiPage)FreshPageModelResolver.ResolvePageModel <ProxyTipsWifiViewModel>();

            wfPage.Title = Translation.GetString("Wi-Fi");
            PTWFVM       = (ProxyTipsWifiViewModel)wfPage.BindingContext;

            ProxyTipsAPNPage apnPage = (ProxyTipsAPNPage)FreshPageModelResolver.ResolvePageModel <ProxyTipsAPNViewModel>();

            apnPage.Title = Translation.GetString("APN");
            PTAPNVM       = (ProxyTipsAPNViewModel)apnPage.BindingContext;
            ProxyTips.Children.Add(wfPage);
            ProxyTips.Children.Add(apnPage);

            MainPage = new NavigationPage(StatusPage);

            MessagingCenter.Subscribe <MSProApp, string>(this, "TorOutput", (sender, arg) =>
            {
                if (arg.CompareTo(System.String.Empty) != 0)
                {
                    TorLogVM.TorLog.Add(arg);
                    MessagingCenter.Send <StatusViewModel, string>(StatusVM, "NewLoadMessage", arg);
                }
                if (arg.IndexOf("[err]") != -1)
                {
                    //error!
                }
                if (arg.IndexOf("100%") != -1)
                {
                    Task tc = Task.Run(() =>
                    {
                        Tor.Connect();
                    });
                    tc.Wait();
                    MessagingCenter.Send <StatusPage>((StatusPage)StatusVM.CurrentPage, "BootstrappFinished");
                }
            });
            MessagingCenter.Subscribe <MSProApp>(this, "Start", (sender) =>
            {
                OnStart();
            });
        }
示例#13
0
        public bool ApplySelectedCitiesList()
        {
            if (SelectedCitiesList.Count <= 0)
            {
                return(false);
            }

            //удаление серверов предыдущей страны
            StringBuilder strConfig           = new StringBuilder();
            StringBuilder ExcludedCodesResult = new StringBuilder();
            int           nStart;

            strConfig.Append(Tor.ReadTorrc());
            if (!String.IsNullOrWhiteSpace(strConfig.ToString()))
            {
                nStart = strConfig.ToString().IndexOf("StrictNodes");
                if (nStart != -1)
                {
                    strConfig.Remove(nStart, 13);
                }

                nStart = strConfig.ToString().IndexOf("ExitNodes");
                if (nStart != -1)
                {
                    int nEnd = strConfig.ToString().IndexOf(Environment.NewLine, nStart + 1);
                    if (nEnd < 0)
                    {
                        strConfig.Remove(nStart, strConfig.Length - nStart);
                    }
                    else
                    {
                        strConfig.Remove(nStart, nEnd - nStart);
                    }
                }
                //string strResult = strConfig.ToString();
                //strResult += "\r\n";
            }
            StringBuilder SelectedRoutersFingerprints = new StringBuilder();

            foreach (string SelectedCity in SelectedCitiesList)
            {
                var SelectedCitiesGroup = from SelectedGroup in AllCitiesList
                                          where SelectedGroup.Name == SelectedCity
                                          select SelectedGroup;

                foreach (City curcity in SelectedCitiesGroup)
                {
                    string reply = "";
                    Task   ts    = Task.Run(() =>
                    {
                        //desc/name/
                        reply = Tor.SendSignal("GETINFO desc/name/" + curcity.RouterName + Environment.NewLine);
                    });
                    ts.Wait();
                    if (String.IsNullOrEmpty(reply))
                    {
                        continue;
                    }
                    int    end         = reply.IndexOf("uptime");
                    int    start       = reply.IndexOf("fingerprint ");
                    string fingerprint = reply.Substring(start + 12, end - start - 12);
                    fingerprint = fingerprint.Replace(" ", String.Empty);
                    SelectedRoutersFingerprints.Append(fingerprint);
                    SelectedRoutersFingerprints.Append(",");
                }
            }
            if (SelectedRoutersFingerprints.Length > 0)
            {
                SelectedRoutersFingerprints.Remove(SelectedRoutersFingerprints.Length - 1, 1);
                SelectedRoutersFingerprints.Append(Environment.NewLine);
            }

            //write country codes

            if (!String.IsNullOrEmpty(SelectedRoutersFingerprints.ToString()))
            {
                nStart = strConfig.ToString().IndexOf("StrictNodes");
                if (nStart != -1)
                {
                    strConfig.Remove(nStart, 13);
                }
                nStart = strConfig.ToString().IndexOf("ExitNodes");
                if (nStart != -1)
                {
                    int nEnd = strConfig.ToString().IndexOf(Environment.NewLine, nStart + 1);
                    if (nEnd < 0)
                    {
                        strConfig.Remove(nStart, strConfig.Length - nStart);
                    }
                    else
                    {
                        strConfig.Remove(nStart, nEnd - nStart);
                    }
                }
                strConfig.Append("StrictNodes 1\r\n");
                strConfig.Append("ExitNodes ");
                strConfig.Append(SelectedRoutersFingerprints.ToString());
                Tor.WriteTorrc(strConfig.ToString());
            }
            else
            {
                return(false);
            }

            //смена цепи и перезагрузка настроек tor
            bool bResult;

            Task t = Task.Run(() =>
            {
                bResult = Tor.SendSimpleSignal("SIGNAL RELOAD\r\n");
                bResult = Tor.SendSimpleSignal("SIGNAL NEWNYM\r\n");
            });

            StatusViewModel    svm = MSProApp.Locator.StatusVM;
            CountriesViewModel cvm = MSProApp.Locator.CountriesVM;

            Device.BeginInvokeOnMainThread(() =>
            {
                svm.SelectedRegionsList.ReplaceRange(SelectedCitiesList);
                if (cvm.SelectedCountriesList.Count > 0)
                {
                    cvm.SelectedCountriesList.Clear();
                }
            });

            Settings.SetStringCollection("Selected cities list", SelectedCitiesList);
            Settings.Remove("Selected countries list");
            Settings.SetStringCollection("Selected regions list", SelectedCitiesList);

            return(true);
        }
示例#14
0
        static void Main(string[] args)
        {
            CollectionType<Tor> collectionType_1 = new CollectionType<Tor>();
            Tor tor1 = new Tor("ator",10, 80);
            Tor tor2 = new Tor("btor",20, 90);
            Tor tor3 = new Tor("btor",30, 70);
            collectionType_1.Add(tor1);
            collectionType_1.Add(tor2);
            collectionType_1.Add(tor3);
            foreach (Tor value in collectionType_1)
                value.printInfo();
            WriteToFile(collectionType_1);

            collectionType_1.SortT();
            foreach (Tor value in collectionType_1)
                value.printInfo();

            CollectionType<Tor> collectionType_2 = new CollectionType<Tor>();
            Tor tor4 = new Tor("dtor",50, 80);
            Tor tor5 = new Tor("etor",20, 100);
            Tor tor6 = new Tor("ftor",30, 70);


            var linkedList = new LinkedList<CollectionType<Tor>>();
            linkedList.AddLast(collectionType_1);
            linkedList.AddFirst(collectionType_2);


            Console.WriteLine("where + OrderBy");
            var selectedTeams = collectionType_1.Where(t => t.Name.ToUpper().StartsWith("B")).OrderBy(t => t);
            foreach (Tor s in selectedTeams)
                s.printInfo();

            Console.WriteLine("Where( || + && + > )");
            var selectedTeams_2 = collectionType_1.Where(t => (t.innerRadius < 100 || t.outerRadius > 70) && t.innerRadius > 20);
            foreach (Tor s in selectedTeams_2)
                s.printInfo();

            Console.WriteLine("Where+Count");
            var selectedTeams_3 = (collectionType_1.Where(s => s.innerRadius < 90)).Count();
            Console.WriteLine(selectedTeams_3);

            Console.WriteLine("Select");
            var selectedTeams_4 = collectionType_1.Select((h, i) => new { Index = i + 1, h.Name });
            foreach (var el in selectedTeams_4)
                Console.WriteLine(el);


            Console.WriteLine("Min");
            var minRes = collectionType_1.Min(h => h.outerRadius);
            Console.WriteLine(minRes);

            Console.WriteLine("Max");
            var maxRes = collectionType_1.Max(h => h.outerRadius);
            Console.WriteLine(maxRes);

            Console.WriteLine("Join");
            var joinRes = collectionType_1.Join(collectionType_2, o => o.innerRadius, i => i.innerRadius, (o, i) => new Tor
            {
                Name = string.Format("{0}&{1}",o.Name,i.Name),
                innerRadius = o.innerRadius + i.innerRadius,
                outerRadius = o.outerRadius + i.outerRadius
            });
            foreach (var tor in joinRes)
                Console.WriteLine(tor);


            LinkedList<string> stringList = new LinkedList<string>();
            stringList.AddFirst("ЯАнтон");
            stringList.AddFirst("Саня");
            stringList.AddLast("Александр");
            WriteToFile(stringList);
            foreach (var value in stringList) Console.WriteLine("Значение: "+value);
            includeWord(stringList, "Саня");
            Console.WriteLine(lenghtString(stringList, 4));


            //var asc = stringList.OrderBy(v => v).ToList();
            var asc = stringList.OrderBy(v=>v);
            foreach (var value in asc) Console.WriteLine("Значение: " + value);
            Console.WriteLine("\n");
            var desc = stringList.OrderByDescending(v=>v);
            foreach (var value in desc) Console.WriteLine("Значение: " + value);

            Console.ReadKey();

        }