Beispiel #1
0
        static public bool Start(Debugger.CpuType cpu = Debugger.CpuType.Any)
        {
            if (!initialized)
            {
                Init();
            }

            if (debuggerProcessId != 0)
            {
                return(false);
            }

            MessageQueue.Clear();

            string debuggerApp = PluginEnv.Locate("mdbg.exe", "MDbg");

            if (cpu == Debugger.CpuType.x86)
            {
                debuggerApp = PluginEnv.Locate("mdbghost_32.exe", "MDbg");
            }
            else if (cpu == Debugger.CpuType.x64)
            {
                debuggerApp = PluginEnv.Locate("mdbghost_64.exe", "MDbg");
            }

            var debugger = Process.Start(new ProcessStartInfo
            {
                FileName  = debuggerApp,
                Arguments = "!load npp.dll",
                // #if !DEBUG
                CreateNoWindow  = true,
                UseShellExecute = false
                                  // #endif
            });

            MessageQueue.AddNotification(NppCategory.Diagnostics + debugger.Id + ":STARTED");
            debuggerProcessId = debugger.Id;

            if (CSScriptHelper.IsUsingCSScriptCore)
            {
                OnDebuggeeProcessNotification?.Invoke("======= Debugging .NET 5/Core is not supported =======");
            }

            Task.Factory.StartNew(() => WaitForExit(debugger));

            channel        = new RemoteChannelServer(debuggerProcessId);
            channel.Notify = message => Console.WriteLine(message);
            channel.Start();

            return(true);
        }
Beispiel #2
0
        public void Execute(IServiceProvider serviceProvider)
        {
            Env = new PluginEnv(serviceProvider);
            if (Env.IsValidReq())
            {
                var entity = Env.Svc.Retrieve(Contact.EntityName, Env.TargetEntity.Id, new ColumnSet(true));
                try
                {
                    // set pre image entity
                    Env.SetPreImageEntity("PreImage");

                    // get current contact score
                    ContactScore = Env.Context.MessageName == "Create" ? 70.00M : entity.GetAttr <decimal>(Contact.ContactScore);

                    foreach (string fd in StringFDList)
                    {
                        CalculateString_ContactScoreField(fd, entity);
                    }

                    if (ContactScore > 100.00M)
                    {
                        ContactScore = 100.00M;
                    }
                    else if (ContactScore < 0.00M)
                    {
                        ContactScore = 0.00M;
                    }

                    Entity change = new Entity(Contact.EntityName, entity.Id);
                    change[Contact.ContactScore] = ContactScore;
                    Env.Update(change);
                }
                catch (Exception ex)
                {
                    Env.Trace(ex.Message.ToString());
                }
            }
        }