Пример #1
0
        public static void Run()
        {
            try
            {
                if (ProgramRoutines.IsParameterSet(CommandLineParameters.WINDOWLESS))
                {
                    Cliver.Bot.Program.Run();
                    return;
                }

                LogMessage.Output2Console = false;
                Cliver.Bot.Program.Initialize();

                if (Bot.Properties.App.Default.SingleProcessOnly)
                {
                    ProcessRoutines.RunSingleProcessOnly();
                }

                Application.Run(MainForm.This);
            }
            catch (Exception e)
            {
                LogMessage.Exit(e);
            }
        }
Пример #2
0
        public static void Run()
        {
            try
            {
                LogMessage.DisableStumblingDialogs = ProgramRoutines.IsParameterSet(CommandLineParameters.AUTOMATIC);
                Log.MODE = Log.Mode.ONLY_LOG;
                LogMessage.Output2Console = true;
                ProcessRoutines.RunSingleProcessOnly();

                LogMessage.Inform(MessageMark.STARTED + " \r\nCommand line: " + string.Join("|", Environment.GetCommandLineArgs()) + " \r\nRunning as:" + System.Security.Principal.WindowsIdentity.GetCurrent().Name);

                Assembly    service_assembly = Assembly.GetEntryAssembly();
                List <Type> service_types    = (from t in service_assembly.GetExportedTypes() where t.IsSubclassOf(typeof(Service)) select t).ToList();
                if (service_types.Count < 1)
                {
                    LogMessage.Exit("Could not find Service implementation in the entry assembly: " + service_assembly.FullName);
                }
                if (service_types.Count > 1)
                {
                    LogMessage.Exit("Found more than one Service implementations in the entry assembly: " + service_assembly.FullName);
                }

                Service service = (Service)Activator.CreateInstance(service_types[0]);
                service.Do();
                service.complete();
            }
            catch (Exception e)
            {
                LogMessage.Exit(e);
            }
        }
Пример #3
0
        public static void Main(string[] args)
        {
            try
            {
                //Wpf.Message.ResourceDictionaryPath = "assembly=" + System.Reflection.Assembly.GetEntryAssembly().EscapedCodeBase + ";resources/style.xaml";

                //Uri u = new System.Uri("/" + PathRoutines.GetFileNameFromPath(System.Reflection.Assembly.GetEntryAssembly().EscapedCodeBase) + ";component/resources/style.xaml", System.UriKind.Relative);
                //System.Windows.ResourceDictionary rd = new System.Windows.ResourceDictionary();
                //System.Windows.Application.LoadComponent(rd, u);
                //Wpf.Message.ResourceDictionary = rd;
                //System.Windows.Resources.StreamResourceInfo info = System.Windows.Application.GetContentStream(u);
                //System.Windows.Markup.XamlReader reader = new System.Windows.Markup.XamlReader();
                //Wpf.Message.ResourceDictionary = (System.Windows.ResourceDictionary)reader.LoadAsync(info.Stream);

                Log.Main.Inform("Version: " + AssemblyRoutines.GetAppVersion());
                string user = ProcessRoutines.GetProcessUserName();
                string m    = "User: "******" (as administrator)";
                }
                Log.Main.Inform(m);

                ProcessRoutines.RunSingleProcessOnly();

                if (ProgramRoutines.IsParameterSet <CommandLineParameters>(CommandLineParameters.INITIAL_CONFIGURATION))
                {
                    Message.Inform("Please configure service in the next window.");
                    SettingsWindow.OpenDialog();
                    return;
                }

#if !test
                Application.Run(SysTray.This);
#else
                UiApiClient.testCreateInstanceContext();
                SettingsWindow.Open();
                Application.Run(SysTray.This);
                //UiApiClient.testSubscribe();
                //UiApiClient.testSubscribe();
                //Thread.Sleep(1000);
                //UiApiClient.testCloseInstanceContext();
                //UiApiClient.testCreateInstanceContext();
                //UiApiClient.testSubscribe();
                //UiApiClient.testSubscribe();
                //for (; ; )
                //{
                //    System.Threading.Thread.Sleep(10000);
                //}
#endif
            }
            catch (Exception e)
            {
                LogMessage.Error(e);
            }
            finally
            {
                Exit();
            }
        }
Пример #4
0
 public static void Main()
 {
     try
     {
         ProcessRoutines.RunSingleProcessOnly();
         SysTrayForm.This.Hide();
         Cliver.Bot.ThreadLog.MaxFileSize = Properties.Settings.Default.LogFileChunkSizeInBytes;
         Application.Run();
     }
     catch (Exception e)
     {
         LogMessage.Error(e);
     }
 }
Пример #5
0
        public static void Main(string[] args)
        {
            try
            {
                ProcessRoutines.RunSingleProcessOnly();

                Application.Run(new MainForm());
            }
            catch (Exception e)
            {
                Message.Error(e);
            }
            finally
            {
                Environment.Exit(0);
            }
        }
Пример #6
0
        public static void Main(string[] args)
        {
            try
            {
                uint dwSessionId = WinApi.Wts.WTSGetActiveConsoleSessionId();
                MpegStream.Start(dwSessionId, "-f gdigrab -framerate 10 -f rtp_mpegts -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params aMg7BqN047lFN72szkezmPyN1qSMilYCXbqP/sCt srtp://127.0.0.1:5920");
                //Process mpeg_stream_process;
                //var processId = Win32Process.CreateProcessInConsoleSession("cmd");
                //mpeg_stream_process = Process.GetProcessById((int)processId);
                //ProcessRoutines.AntiZombieTracker.Track(mpeg_stream_process);

                //    try
                //    {
                //        var p = new Process();
                //        p.StartInfo.UseShellExecute = false;
                //        //const string file = "cmd.exe";
                //        const string file = @"psexec.exe";
                //        p.StartInfo.WorkingDirectory = Path.GetDirectoryName(file);
                //        p.StartInfo.FileName = Path.GetFileName(file);
                //        //proc.StartInfo.Domain = "WIN08";
                //        p.StartInfo.Arguments = "-i -d -s cmd";
                //        //p.StartInfo.UserName = "******";
                //        //var password = new System.Security.SecureString();
                //        //foreach (var c in "123")
                //        //    password.AppendChar(c);
                //        //p.StartInfo.Password = password;
                //        p.StartInfo.LoadUserProfile = false;
                //        p.Start();
                //    }
                //    catch (Exception e)
                //    {
                //        Console.WriteLine(e);
                //    }

                //MpegStream.Start("-f gdigrab -framerate 10 -f rtp_mpegts -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params aMg7BqN047lFN72szkezmPyN1qSMilYCXbqP/sCt srtp://127.0.0.1:5920");
                //Thread.Sleep(2000);
                //MpegStream.Stop();

                Log.Main.Inform("Version: " + AssemblyRoutines.GetAppVersion());
                string m = "User: "******"(";
                if (WindowsUserRoutines.CurrentUserIsAdministrator())
                {
                    m += "administrator";
                    if (WindowsUserRoutines.CurrentUserHasElevatedPrivileges())
                    {
                        m += ", elevated privileges";
                    }
                    else
                    {
                        m += ", not elevated privileges";
                    }
                }
                else
                {
                    m += "not administrator";
                }
                Log.Main.Inform(m + ")");

                ProcessRoutines.RunSingleProcessOnly();

                Service.Running = true;

                Application.Run(SysTray.This);
            }
            catch (Exception e)
            {
                Message.Error(e);
            }
            finally
            {
                Environment.Exit(0);
            }
        }