Example #1
0
        private void InitializeProgram()
        {
            try
            {
                // File .exe.config
                Process tempsProcess = Process.GetCurrentProcess();
                if (!Others.ExistFile(Application.StartupPath + "\\" + tempsProcess.ProcessName + ".exe.config"))
                {
                    var sw = new StreamWriter(Application.StartupPath + "\\" + tempsProcess.ProcessName + ".exe.config");
                    sw.WriteLine("<?xml version=\"1.0\"?>");
                    sw.WriteLine("<configuration>");
                    sw.WriteLine("<startup>");
                    sw.WriteLine("<supportedRuntime version=\"v4.0\"/>");
                    sw.WriteLine("</startup>");
                    sw.WriteLine("<runtime>");
                    sw.WriteLine("<loadFromRemoteSources enabled=\"true\"/>");
                    sw.WriteLine("</runtime>");
                    sw.WriteLine("</configuration>");
                    sw.Close();

                    Process.Start(Application.StartupPath + "\\" + tempsProcess.ProcessName + ".exe");
                    tempsProcess.Kill();
                }

                LangSelection.DropDownStyle = ComboBoxStyle.DropDownList;
                Others.GetVisualStudioRedistribuable2013();
            }
            catch (Exception ex)
            {
                Logging.WriteError("Login > InitializeProgram(): " + ex);
            }
        }
Example #2
0
        private void InitializeProgram()
        {
            try
            {
                // File .exe.config
                Process tempsProcess = Process.GetCurrentProcess();
                bool    restartBot   = !Others.ExistFile(Application.StartupPath + "\\" + tempsProcess.ProcessName + ".exe.config");
                var     sw           = new StreamWriter(Application.StartupPath + "\\" + tempsProcess.ProcessName + ".exe.config");
                sw.WriteLine("<?xml version=\"1.0\"?>");
                sw.WriteLine("<configuration>");
                sw.WriteLine("  <startup>");
                sw.WriteLine("    <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5\"/>");
                sw.WriteLine("  </startup>");
                sw.WriteLine("  <runtime>");
                sw.WriteLine("    <loadFromRemoteSources enabled=\"true\"/>");
                sw.WriteLine("    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">");
                sw.WriteLine("    <probing privatePath=\"products\"/>");
                sw.WriteLine("  </assemblyBinding>");
                sw.WriteLine("  </runtime>");
                sw.WriteLine("</configuration>");
                sw.Close();
                if (restartBot)
                {
                    Process.Start(Application.StartupPath + "\\" + tempsProcess.ProcessName + ".exe");
                    tempsProcess.Kill();
                }

                LangSelection.DropDownStyle = ComboBoxStyle.DropDownList;
                Others.GetVisualStudioRedistribuable2013();
            }
            catch (Exception ex)
            {
                Logging.WriteError("Login > InitializeProgram(): " + ex);
            }
        }