Exemplo n.º 1
0
 protected override void DoNotify(Processes.BaseProcess process)
 {
     var url = ParseTemplateText(Settings["url"], process, value => HttpUtility.UrlEncode(value));
     WebRequest webRequest = WebRequest.Create(url);
     webRequest.Method = Settings.ContainsKey("method") ? Settings["method"] : "POST";
     webRequest.GetResponse();
 }
Exemplo n.º 2
0
 protected override void DoNotify(Processes.BaseProcess process)
 {
     var from = ParseTemplateText(Settings["from"], process);
     var to = ParseTemplateText(Settings["to"], process);
     var subject = ParseTemplateText(Settings["subject"], process);
     var body = ParseTemplateText((Settings["body"] ?? "").Replace("\\n", Environment.NewLine), process);
     var client = new SmtpClient();
     client.Send(new MailMessage(from, to, subject, body));
 }
Exemplo n.º 3
0
 protected override void DoNotify(Processes.BaseProcess process)
 {
     var url = ParseTemplateText(Settings["url"], process, HttpUtility.UrlEncode);
     var webRequest = WebRequest.Create(url);
     webRequest.Method = Settings.ContainsKey("method") ? Settings["method"] : "POST";
     var body = Settings.ContainsKey("body") ? Settings["body"] : "";
     if (!string.IsNullOrEmpty(body))
     {
         webRequest.ContentType = "application/json";
         var dataStream = webRequest.GetRequestStream();
         using (var writer = new StreamWriter(dataStream))
         {
             var parsedBody = ParseTemplateText(body, process, HttpUtility.JavaScriptStringEncode);
             writer.Write(parsedBody);
         }
         dataStream.Close();
     }
     webRequest.GetResponse();
 }
Exemplo n.º 4
0
 private void BtnDownloadGadgets_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://gallery-live.com/sidebar-gadgets/");
 }
Exemplo n.º 5
0
        //Buttons which open links

        #region LINKS

        private void BtnDownloadAddon_OnClick(object sender, RoutedEventArgs e)
        {
            Processes.OpenLink("http://www.wincert.net/forum/index.php?/forum/180-windows-7-toolkit-addons/");
        }
Exemplo n.º 6
0
 private void BtnLocalizion_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://lang.wintoolkit.co.uk");
 }
Exemplo n.º 7
0
 private void BtnReportBug_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink(
         "http://www.wincert.net/forum/index.php?app=forums&module=post&section=post&do=new_post&f=209");
 }
Exemplo n.º 8
0
 void RemoveProcess(ProcessInfo info)
 {
     Processes.Remove(info);
     animationElements.Remove(info.PID);
 }
Exemplo n.º 9
0
 private void BtnDownloadVirtualBox_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("https://www.virtualbox.org/wiki/Downloads");
 }
Exemplo n.º 10
0
 public static void sleep(this object _object, int miliseconds, bool verbose)
 {
     Processes.Sleep(miliseconds, verbose);
 }
Exemplo n.º 11
0
 public static void sleep(this object _object, int miliseconds)
 {
     Processes.Sleep(miliseconds);
 }
Exemplo n.º 12
0
 public static Transaction Create(Processes.Base process)
 {
     return new Transaction(process);
 }
Exemplo n.º 13
0
 public Transaction(Processes.Base process)
 {
     _process = process;
 }
 public ProcessCollectionNodeFactory(Processes processes, string name)
 {
     _processes = processes;
     _name = name;
 }
Exemplo n.º 15
0
 private void BtnDownloadThemes_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://windows.microsoft.com/en-US/windows/downloads/personalize/themes");
 }
Exemplo n.º 16
0
 private void BtnDownloadWallpapers3_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://wallpaperswide.com/");
 }
Exemplo n.º 17
0
 public bool IsProcessRunning(int pid)
 {
     return(Processes.ContainsKey(pid));
 }
Exemplo n.º 18
0
        internal MIKESHE_FLOWMODEL(PFSSection Section)
        {
            _pfsHandle = Section;

              for (int i = 1; i <= Section.GetSectionsNo(); i++)
              {
            PFSSection sub = Section.GetSection(i);
            switch (sub.Name)
            {
            case "FlowModelDocVersion":
              _flowModelDocVersion = new FlowModelDocVersion(sub);
              break;
            case "ViewSettings":
              _viewSettings = new ViewSettings(sub);
              break;
            case "Overlays":
              _overlays = new Overlays(sub);
              break;
            case "SimSpec":
              _simSpec = new SimSpec(sub);
              break;
            case "ModelCompWQ":
              _modelCompWQ = new ModelCompWQ(sub);
              break;
            case "Species":
              _species = new Species(sub);
              break;
            case "Processes":
              _processes = new Processes(sub);
              break;
            case "Catchment":
              _catchment = new Catchment(sub);
              break;
            case "Subcatchments":
              _subcatchments = new Subcatchments(sub);
              break;
            case "Topography":
              _topography = new Topography(sub);
              break;
            case "Climate":
              _climate = new Climate(sub);
              break;
            case "LandUse":
              _landUse = new LandUse(sub);
              break;
            case "River":
              _river = new River(sub);
              break;
            case "RiverMF":
              _riverMF = new RiverMF(sub);
              break;
            case "Overland":
              _overland = new Overland(sub);
              break;
            case "OverlandSubcatchment":
              _overlandSubcatchment = new Subcatchments(sub);
              break;
            case "Unsatzone":
              _unsatzone = new Unsatzone(sub);
              break;
            case "SaturatedZone":
              _saturatedZone = new SaturatedZone(sub);
              break;
            case "SaturatedZoneSubCatchment":
              _saturatedZoneSubCatchment = new SaturatedZoneSubCatchment(sub);
              break;
            case "GroundwaterTable":
              _groundwaterTable = new Bathymetry(sub);
              break;
            case "Sources":
              _sources = new Sources1(sub);
              break;
            case "StoringOfResults":
              _storingOfResults = new StoringOfResults(sub);
              break;
            case "OutputModflow":
              _outputModflow = new OutputModflow(sub);
              break;
            case "ExtraParams":
              _extraParams = new ExtraParams(sub);
              break;
            case "ExecuteEngineFlagsPfs":
              _executeEngineFlagsPfs = new ExecuteEngineFlagsPfs(sub);
              break;
            case "Result":
              _result = new Result(sub);
              break;
            case "Overview":
              _overview = new STRESSPERIOD_PROPPAGE(sub);
              break;
            case "GeoScene3D":
              _geoScene3D = new GeoScene3D(sub);
              break;
              default:
            _unMappedSections.Add(sub.Name);
              break;
            }
              }
        }
Exemplo n.º 19
0
        private void UpdateProcesses()
        {
            if (!AutoHandleFavorites)
            {
                if (_form != null)
                {
                    if (_form.WindowState == FormWindowState.Minimized || !_form.Visible)
                    {
                        return;
                    }
                }
            }
            foreach (var process in Processes.ToList())
            {
                var index          = Processes.FindIndex(x => x.WindowHandle == process.WindowHandle);
                var shouldBePruned = process.ProcessHasExited;
                if (!shouldBePruned)
                {
                    var currentTitle = "";

                    if (!process.NoAccess)
                    {
                        TaskUtilities.StartTaskAndWait(() => { currentTitle = Native.GetWindowTitle(process.WindowHandle); },
                                                       Config.Instance.AppSettings.SlowWindowDetection ? 10 : 2); shouldBePruned = process.WindowTitle != currentTitle;
                    }
                }
                if (shouldBePruned)
                {
                    if (process.MadeBorderless)
                    {
                        HandlePrunedProcess(process);
                    }
                    Processes.RemoveAt(index);
                    _callback(process, true);
                }
            }
            Native.QueryProcessesWithWindows(pd =>
            {
                try
                {
                    if (!string.IsNullOrWhiteSpace(pd?.Proc?.ProcessName))
                    {
                        if (Config.Instance.IsHidden(pd?.Proc?.ProcessName))
                        {
                            return;
                        }
                        if (Processes.Select(p => p.Proc.Id).Contains(pd.Proc.Id) &&
                            Processes.Select(p => p.WindowTitle).Contains(pd.WindowTitle))
                        {
                            return;
                        }
                        Processes.Add(pd);
                        _callback(pd, false);
                    }
                }
                catch (Exception)
                {
                    _callback(null, false);
                }
            }, Processes.Where(p => p.WindowHandle != IntPtr.Zero).Select(p => p.WindowHandle).ToList());
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            // Needed so when we show a message box it doesn't look like Windows 98
            Application.EnableVisualStyles();

            #region System Health Checks and Log Setup
            try
            {
                // creates the datapath to make sure it exists
                Directory.CreateDirectory(DataPath);
            }
            catch (Exception ex)
            {
                Logger.Error($"Couldn't create {DataPath} directory.");

                // No Logger call since we can't even create the directory
                ShowMessageAndExit($"Failed to create data directory in '{DataPath}'.\n{ex.ToString()}",
                                   "Write Access");
            }

            // Marks the begining of a new log cycle
            Logger.Information($"Starting {VersionInfo.FileDescription} v{VersionInfo.ProductVersion}");


            // check if WMI service is running, if it's not we wont be able to get any process information
            if (!IsWMIServiceRunning())
            {
                Logger.Error("WMI service not running");

                ShowMessageAndExit("The \"Windows Management Instrumentation\" service is not running.\n" +
                                   "This service is required for bnetlauncher to function properly, please make sure it's enabled, before trying again.",
                                   "WMI service not running");
            }

            // Logs generic System information for debugging purposes.
            LogSystemInfo();
            #endregion

            LoadGameList();

            #region Argument Parsing
            // Parse the given arguments
            if (args.Length <= 0)
            {
                // No parameters so just Show instructions
                var message = "No Game Id has been given.\n" +
                              "To launch a game please add one of the following Ids to the launch options:\n";

                foreach (var g in games)
                {
                    message += $"{g.Id}\t= {g.Name}\n";
                }

                message += "\nSee 'instructions.txt' on how to add more games.";

                Logger.Warning("No parameter given.");
                ShowMessageAndExit(message, "How to Use", MessageType.Info);
            }

            // Check if the param_timeout is passed as a second parameter
            for (var i = 1; i < args.Length; i++)
            {
                var arg = args[i].ToLowerInvariant().Trim();

                // parse options
                if (arg.StartsWith("-", StringComparison.OrdinalIgnoreCase) || arg.StartsWith("/", StringComparison.OrdinalIgnoreCase))
                {
                    // remove starting character
                    arg = arg.Substring(1);

                    switch (arg)
                    {
                    case "t":
                    case "timeout":
                    case "-timeout":
                        try
                        {
                            param_timeout = Convert.ToInt32(args[++i], CultureInfo.InvariantCulture);
                            Logger.Information($"Changing timeout to '{param_timeout}'.");
                        }
                        catch (Exception ex)
                        {
                            Logger.Warning($"Couldn't convert timeout:'{args[i]}' into integer, ignoring and continuing.", ex);
                        }
                        break;

                    case "l":
                    case "leaveopen":
                    case "-leaveopen":
                        Logger.Information($"Leaving the client open on exit.");
                        param_leaveopen = true;
                        break;

                    case "n":
                    case "notask":
                    case "-notask":
                        Logger.Information($"Disabling task launching");
                        param_notask = true;
                        break;

                    default:
                        Logger.Warning($"Ignoring unknown option: '{arg}'");
                        break;
                    }
                }
                else
                {
                    // unknown parameter
                    Logger.Warning($"Ignoring unknown parameter: '{arg}'");
                }
            }

            // Retrieves the first parameter that should be the game id and checks it against the games list
            // In an attempt to avoid user mistakes we clean the input by forcing lowercase and strip - and /
            // before comparing it to know ids.
            var param_game = args[0].Trim().Replace("-", "").Replace("/", "").ToLowerInvariant();
            Logger.Information($"Given parameter '{args[0]}'.");
            selected_game = games.Find(g => g.Id == param_game);

            // If the id isn't know give a warning about invalid game.
            if (selected_game == null)
            {
                Logger.Error($"Unknown game '{param_game}'.");

                var message = $"Unknown game id '{param_game}' given.\n";
                message += "\nPlease use one of the known game ids:\n";
                foreach (var g in games)
                {
                    message += $"{g.Id}\t= {g.Name}\n";
                }
                message += $"\nPlease check if the Id exists.\n\n" +
                           "bnetlauncher will now Close.\n";

                ShowMessageAndExit(message, "Unknown Game Id");
            }
            #endregion

            // Checks if the game client exists
            selected_client = clients.Find(c => c.Id == selected_game.Client);
            if (selected_client == null)
            {
                var message = $"Unknown client '{selected_game.Client}'\n" +
                              "bnetlauncher only supports the following values:\n\n";

                foreach (var c in clients)
                {
                    message += $"  {c.Id} ({c.Name})\n";
                }
                message += "\nbnetlauncher will now exit.\n";
                ShowMessageAndExit(message, "Error: Unknown client");
            }

            Logger.Information($"Using '{selected_client.Id}' client.");

            // Checks if the client is actually Installed installLocation property is not returning an empty path
            if (!selected_client.IsInstalled)
            {
                ShowMessageAndExit($"The {selected_client.Name} client doesn't seem to be Installed.\n\n" +
                                   "Please reinstall the Battle.net Client to fix the issue\n");
            }

            #region Mutex Setup to enforce single bnetlancher instance
            // We use a Local named Mutex to keep two instances of bnetlauncher from working at the same time.
            // So we check if the mutex already exists and if so we wait until the existing instance releases it
            // otherwise we simply create it and continue.
            // This tries to avoid two instances of bnetlauncher from swapping the games they're launching.
            try
            {
                Logger.Information("Checking for other bnetlauncher processes using same client");
                mutex_name += selected_client.Id;

                launcher_mutex = Mutex.OpenExisting(mutex_name);
            }
            catch (WaitHandleCannotBeOpenedException)
            {
                // Named Mutex doesn't exist yet, so we'll create it
                Logger.Information("No other bnetlauncher detected");
                launcher_mutex = new Mutex(false, mutex_name);
            }
            catch (Exception ex)
            {
                // Unknown problem
                Logger.Error("Unknown error opening mutex.", ex);
                ShowMessageAndExit("A mutex exception has occurred:\n" + ex.ToString(),
                                   "Mutex Exception");
            }

            // Waits for the mutex to be released before continuing, writes a message every second for debug purposes
            // we check for time
            var start = DateTime.Now;
            while (!launcher_mutex.WaitOne(1000))
            {
                Logger.Information("Waiting for another bnetlauncher instance to finish.");

                // If we don't get released for over a minute it's likely something went very wrong so we quit.
                if (DateTime.Now.Subtract(start).TotalMinutes > 1)
                {
                    Logger.Error("Waiting for over 1 minute, assuming something is wrong and exiting");
                    ShowMessageAndExit("A previous bnetlauncher instance seems to have not properly exited.\n" +
                                       "Try using Windows Task Manager to Close it and try again, if the problem persists " +
                                       "report the issue to bnetlauncher author.",
                                       "Stuck Instance");
                }
            }
            #endregion

            // Make sure the client is running
            if (!selected_client.IsRunning)
            {
                // Start the client
                if (!selected_client.Start(!param_leaveopen, (param_notask || selected_game.Options.Contains("notask"))))
                {
                    Logger.Information($"Client '{selected_client.Name}' not running and/or failed to start it.");
                    ShowMessageAndExit($"Couldn't find the {selected_client.Name} running and failed to start it.\nExiting application",
                                       "Client not found");
                }
            }
            else
            {
                Logger.Information($"Client already running with pid:'{selected_client.GetProcessId()}'.");
            }

            #region Launch Game
            // Fire up game trough battle.net using the built in URI handler, we take the date to make sure we
            // don't mess with games that might already be running.
            DateTime launch_request_date = DateTime.Now;


            // Attempts to force the application to run without admin
            if (selected_game.Options.Contains("noadmin"))
            {
                Logger.Information($"Setting compatibility flag to disable UAC prompt.");
                Environment.SetEnvironmentVariable("__COMPAT_LAYER", "RUNASINVOKER");
            }

            // If nolaunch is selected don't actually launch the game but instead shows the client window and adds 1 minute to param_timeout
            if (!selected_game.Options.Contains("nolaunch"))
            {
                Logger.Information($"Issuing game launch command '{selected_game.Cmd}' at '{launch_request_date.ToString("hh:mm:ss.ffff", CultureInfo.InvariantCulture)}'");
                selected_client.Launch(selected_game.Cmd);
            }
            else
            {
                selected_client.ShowWindow();
                param_timeout += 60;
            }

            var game_process_id = 0;
            do
            {
                // Searches for a game started trough the client for 15s
                game_process_id = Processes.GetProcessByNameAfterDate(selected_game.Exe, launch_request_date, param_timeout);

                // did we find it?
                if (game_process_id == 0)
                {
                    // didn't find the game process within timeout
                    Logger.Error($"Game '{selected_game.Id}' not found within timeout.");

                    // Game might be updating
                    var msg = $"Couldn't find {selected_game.Name} running, do you wish to keep trying?\n\n" +
                              "Canceling will exit bnetlauncher but leave the client open.\n\n" +

                              "This message is usually caused by the game being slow to start or an update being required. " +
                              "For slow starting games the launch option '-t' can also be used to increase the timeout limit.\n\n" +
                              "If you keep getting this message make sure the client is working properly and try rebooting your system.\n";

                    var answer = MessageBox.Show(msg, "Game not Found. Retry?",
                                                 MessageBoxButtons.RetryCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                    switch (answer)
                    {
                    case DialogResult.Retry:
                        Logger.Information("User chose to retry searching for game.");
                        continue;     // back to the begining and try again

                    case DialogResult.Cancel:
                        try
                        {
                            Logger.Information("User chose to cancel.");

                            // Make it so we leave the client open
                            selected_client.WasStarted = false;

                            // Cleans up the mutex
                            if (launcher_mutex != null)
                            {
                                launcher_mutex.Close();
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.Error("Error releasing the mutex.", ex);
                        }

                        return;
                    }
                }
            }while (game_process_id == 0); // keep's retrying until user cancels or game found

            // Copies the game process arguments to launch a second copy of the game under this program and kills
            // the current game process that's under the battle.net client.
            var process = new Process()
            {
                StartInfo = Processes.GetProcessStartInfoById(game_process_id)
            };

            // Make sure our StartInfo is actually filled and not blank
            if (String.IsNullOrEmpty(process.StartInfo.FileName) || (String.IsNullOrEmpty(process.StartInfo.Arguments) && !selected_game.Options.Contains("noargs")))
            {
                Logger.Error("Failed to obtain game parameters.");

                // Exit Application in error
                ShowMessageAndExit("Failed to retrieve game parameters.\nGame might start but steam overlay won't be attached to it.\n" +
                                   "This can happen if the game is no longer running (Starcraft Remastered can only have one running instance) " +
                                   "or when bnetlauncher does not have enough permissions, try running bnetlauncher and steam as administrator.",
                                   "Game Parameters");
            }

            try
            {
                Logger.Information("Closing game process and starting it under bnetlauncher");
                Processes.KillProcessAndChildsById(game_process_id);
                process.Start();
            }
            catch (Exception ex)
            {
                Logger.Error("Failed to relaunch game under bnetliancher.", ex);
                ShowMessageAndExit("Failed to relaunch game under bnetlauncher/steam.\nOverlay will not work.",
                                   "Failed to Launch");
            }
            #endregion // Launch game

            // HACK: Add checks for uplay games that close and relaunch themselfs
            if (selected_game.Options.Contains("relaunches"))
            {
                var relaunches_timeout = 60 * 1000;
                Logger.Information("relaunches option is set, looking for new processes.");

                // the old process Id
                var old_pid = process.Id;

                Logger.Information($"{selected_game.Id} current process id is {old_pid}");

                stopwatch.Restart();
                while (stopwatch.ElapsedMilliseconds < relaunches_timeout)
                {
                    foreach (var p in Process.GetProcessesByName(selected_game.Exe))
                    {
                        if (p.Id != old_pid)
                        {
                            process = p;
                            Logger.Information($"{selected_game.Id} new process id is {process.Id}");
                            old_pid = process.Id;
                        }
                    }

                    Thread.Sleep(1000); // wait for 1s before retrying to find it
                }
                stopwatch.Stop();

                if (stopwatch.ElapsedMilliseconds < relaunches_timeout)
                {
                    Logger.Warning($"Couldn't find any new process for {selected_game.Id}");
                }

                Logger.Information($"Stopped looking for {selected_game.Id} processes.");
            }

            // Release the mutex to allow another instance of bnetlauncher to grab it and do work
            launcher_mutex.ReleaseMutex();

            // If we launched the client and it's not needed we can close it early
            if (!selected_client.MustBeRunning)
            {
                CloseClientIfLast();
            }

            // For games that require the client or bnetlauncher to stick around we wait
            if (selected_game.Options.Contains("waitforexit") || selected_client.MustBeRunning)
            {
                Logger.Information($"Waiting for {selected_game.Id} process {process.Id} to exit");
                process.WaitForExit();

                //// Get the process again because sometimes what we start isn't what's still running
                //int extra = 1;
                //while (extra > 0)
                //{
                //    extra = Process.GetProcessesByName(selected_game.Exe).Length;
                //    if (extra > 0)
                //    {
                //        var p2 = Process.GetProcessesByName(selected_game.Exe)[0];
                //        p2.WaitForExit();
                //    }
                //}
            }

            // Finally we close the client when we're done
            process.Dispose();
            CloseClientIfLast();

            Logger.Information("All operations successful, exiting");
            launcher_mutex.Close();
        }
Exemplo n.º 21
0
 public ProcessDetails FromHandle(IntPtr hCurrentActiveWindow)
 {
     return(Processes.FirstOrDefault(pd => pd.WindowHandle == hCurrentActiveWindow));
 }
Exemplo n.º 22
0
 private void BtnHelp_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://www.wincert.net/forum/topic/8822-tools-manager/");
 }
Exemplo n.º 23
0
 public Task Refresh()
 {
     Processes.Clear();
     return(Task.Factory.StartNew(UpdateProcesses));
 }
Exemplo n.º 24
0
 private void BtnVisitGuides_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://www.wincert.net/forum/forum/192-win-toolkit-guides/");
 }
Exemplo n.º 25
0
        protected unsafe override LResult WindowProcedure(WindowHandle window, MessageType message, WParam wParam, LParam lParam)
        {
            switch (message)
            {
            case MessageType.Create:
                Size      baseUnits = Windows.GetDialogBaseUnits();
                Rectangle bounds    = window.GetClientRectangle();

                // Create listbox and static text windows.
                hwndList = Windows.CreateWindow(
                    className: "listbox",
                    style: WindowStyles.Child | WindowStyles.Visible | (WindowStyles)ListBoxStyles.Standard,
                    bounds: new Rectangle(
                        baseUnits.Width,
                        baseUnits.Height * 3,
                        bounds.Width - baseUnits.Width - Windows.GetSystemMetrics(SystemMetric.VerticalScrollWidth),
                        bounds.Height - baseUnits.Height * 4),
                    parentWindow: window,
                    menuHandle: (MenuHandle)ID_LIST,
                    instance: ModuleInstance);

                hwndText = Windows.CreateWindow(
                    className: "static",
                    style: WindowStyles.Child | WindowStyles.Visible | (WindowStyles)StaticStyles.Left,
                    bounds: new Rectangle(
                        baseUnits.Width,
                        baseUnits.Height,
                        bounds.Width - baseUnits.Width - Windows.GetSystemMetrics(SystemMetric.VerticalScrollWidth),
                        baseUnits.Height),
                    parentWindow: window,
                    menuHandle: (MenuHandle)ID_TEXT,
                    instance: ModuleInstance);

                FillListBox(hwndList);
                return(0);

            case MessageType.SetFocus:
                hwndList.SetFocus();
                return(0);

            case MessageType.Command:
                if (wParam.LowWord == ID_LIST &&
                    (wParam.HighWord == (ushort)ListBoxNotification.SelectionChange))
                {
                    // Get current selection.
                    uint  iIndex     = hwndList.SendMessage(ListBoxMessage.GetCurrentSelection, 0, 0);
                    int   iLength    = hwndList.SendMessage(ListBoxMessage.GetTextLength, iIndex, 0) + 1;
                    char *nameBuffer = stackalloc char[iLength];
                    int   result     = hwndList.SendMessage(ListBoxMessage.GetText, iIndex, nameBuffer);

                    // Get environment string.
                    string value = Processes.GetEnvironmentVariable(new string(nameBuffer, 0, result));

                    // Show it in window.
                    hwndText.SetWindowText(value);
                }
                return(0);
            }

            return(base.WindowProcedure(window, message, wParam, lParam));
        }
Exemplo n.º 26
0
 private void BtnWin10ISO_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://windows.microsoft.com/en-us/windows/preview-iso");
 }
Exemplo n.º 27
0
        public void GetEnvironmentVariable_GetNullStringThrows()
        {
            Action action = () => Processes.GetEnvironmentVariable(null);

            action.Should().Throw <ArgumentNullException>();
        }
Exemplo n.º 28
0
 private void BtnDownloadDriver_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://driverpacks.net/driverpacks/latest");
 }
Exemplo n.º 29
0
        public void SetEnvironmentVariable_SetNullStringThrows()
        {
            Action action = () => Processes.SetEnvironmentVariable(null, "invalid");

            action.Should().Throw <ArgumentNullException>();
        }
Exemplo n.º 30
0
 private void BtnDownloadInstallers_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://www.wincert.net/forum/index.php?/forum/129-switchless-installers/");
 }
Exemplo n.º 31
0
        public void SetEnvironmentVariable_SetEmptyStringNotValid()
        {
            Action action = () => Processes.SetEnvironmentVariable("", "invalid");

            action.Should().Throw <ArgumentException>();
        }
Exemplo n.º 32
0
 private void BtnDownloadWallpapers1_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink(
         "http://windows.microsoft.com/en-US/windows/downloads/personalize/wallpaper-desktop-background");
 }
Exemplo n.º 33
0
 public static RibbonGroup add_RibbonButton_StartProcess(this RibbonGroup ribbonGroup, string label, string process, string arguments)
 {
     return(ribbonGroup.add_RibbonButton(label, () => Processes.startProcess(process, arguments)));
 }
Exemplo n.º 34
0
 private void BtnDownloadVirtualPC_OnClick(object sender, RoutedEventArgs e)
 {
     Processes.OpenLink("http://www.microsoft.com/en-us/download/details.aspx?id=3702");
 }
Exemplo n.º 35
0
 public IProcess ToProcess()
 {
     return(Processes.Fork(Flows.Select(f => f.ToProcess()).ToArray()));
 }
Exemplo n.º 36
0
 /// <summary>
 /// Adds a process to this queue.
 /// </summary>
 /// <param name="p">Process to add.</param>
 public void AddProcess(Processes.Process p)
 {
     p.Parent = this;
     if (p.State == ProcessState.READY) this._readyprocs.Add(p);
     else if (p.State == ProcessState.IO) this._ioprocs.Add(p);
     else this._ioprocs.Add(p);
 }
Exemplo n.º 37
0
        /// <summary>
        ///     Either installs or integrate the update to the live OS or image.
        /// </summary>
        /// <param name="LDR">Install LDR or GDR.</param>
        /// <returns></returns>
        private Status DoWork(Task task, string mountPath, bool LDR)
        {
            if (_progressBar == null)
            {
                _progressBar = new ProgressBar();
            }

            _progressBar.Value = 0;

            Status = Status.Working;

            if (CheckIntegration(mountPath, LDR))
            {
                return(Status.Success);
            }

            if (task == Task.Install)
            {
                Processes.Run("wusa.exe", "\"" + Location + "\" /quiet /norestart");
            }
            else
            {
                Processes.Run(DISM.Default.Location,
                              "/Image:\"" + mountPath + "\" /Add-Package /Packagepath:\"" + Location + "\"");
            }

            if (LDR && (_updateType == UpdateType.Unknown || _updateType == UpdateType.LDR))
            {
                if (CheckIntegration(mountPath))
                {
                    return(Status.Failed);
                }
                Extraction.Expand(Location, "*.cab", _tempLocation);

                var cabFile = Directory.GetFiles(_tempLocation, "*.cab", SearchOption.TopDirectoryOnly).First();
                Extraction.Expand(cabFile, _tempLocation);

                _updateType = UpdateType.GDR;
                if (File.Exists(_tempLocation + "\\update-bf.mum"))
                {
                    _updateType = UpdateType.LDR;

                    if (task == Task.Install)
                    {
                        Processes.Run("pkgmgr.exe",
                                      "/ip /m:\"" + _tempLocation + "\\update-bf.mum" + "\" /quiet /norestart");
                    }
                    else
                    {
                        var s = Processes.Run("DISM",
                                              "/Image:\"" + mountPath + "\" /Add-Package /Packagepath:\"" + _tempLocation +
                                              "\\update-bf.mum" + "\"");
                        MessageBox.Show(s);
                    }
                }

                FileHandling.DeleteDirectory(_tempLocation);
            }

            UpdateCache.Add(this);

            if (_updateType != UpdateType.LDR)
            {
                LDR = false;
            }

            if (CheckIntegration(mountPath, LDR))
            {
                return(Status.Success);
            }
            return(Status.Failed);
        }
Exemplo n.º 38
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Account           = new Account(this);
     FoldersNavigation = new FoldersNavigation(this);
     GenericTasks      = new GenericTasks(this);
     Licensing         = new Licensing(this);
     Logs                   = new Logs(this);
     Maintenance            = new Maintenance(this);
     RobotsService          = new RobotsService(this);
     Stats                  = new Stats(this);
     Status                 = new Status(this);
     TaskForms              = new TaskForms(this);
     TestAutomation         = new TestAutomation(this);
     Token                  = new Token(this);
     Translations           = new Translations(this);
     Alerts                 = new Alerts(this);
     Assets                 = new Assets(this);
     AuditLogs              = new AuditLogs(this);
     Buckets                = new Buckets(this);
     Calendars              = new Calendars(this);
     CredentialStores       = new CredentialStores(this);
     Environments           = new Environments(this);
     ExecutionMedia         = new ExecutionMedia(this);
     Folders                = new Folders(this);
     HostLicenses           = new HostLicenses(this);
     Jobs                   = new Jobs(this);
     JobTriggers            = new JobTriggers(this);
     Libraries              = new Libraries(this);
     LicensesNamedUser      = new LicensesNamedUser(this);
     LicensesRuntime        = new LicensesRuntime(this);
     Machines               = new Machines(this);
     MessageTemplates       = new MessageTemplates(this);
     OrganizationUnits      = new OrganizationUnits(this);
     Permissions            = new Permissions(this);
     Processes              = new Processes(this);
     ProcessSchedules       = new ProcessSchedules(this);
     QueueDefinitions       = new QueueDefinitions(this);
     QueueItemComments      = new QueueItemComments(this);
     QueueItemEvents        = new QueueItemEvents(this);
     QueueItems             = new QueueItems(this);
     QueueProcessingRecords = new QueueProcessingRecords(this);
     Queues                 = new Queues(this);
     Releases               = new Releases(this);
     RobotLogs              = new RobotLogs(this);
     Robots                 = new Robots(this);
     Roles                  = new Roles(this);
     Sessions               = new Sessions(this);
     Settings               = new Settings(this);
     TaskCatalogs           = new TaskCatalogs(this);
     Tasks                  = new Tasks(this);
     Tenants                = new Tenants(this);
     TestCaseDefinitions    = new TestCaseDefinitions(this);
     TestCaseExecutions     = new TestCaseExecutions(this);
     TestSetExecutions      = new TestSetExecutions(this);
     TestSets               = new TestSets(this);
     TestSetSchedules       = new TestSetSchedules(this);
     UserLoginAttempts      = new UserLoginAttempts(this);
     Users                  = new Users(this);
     Webhooks               = new Webhooks(this);
     BaseUri                = new System.Uri("http://localhost:6234");
     SerializationSettings  = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
Exemplo n.º 39
0
 /// <summary>
 /// Adds a process to this queue.
 /// </summary>
 /// <param name="p">Process to add.</param>
 public void AddProcess(Processes.Process p)
 {
     this._readyprocs.Add(p);
 }