Exemplo n.º 1
0
        public static void analyse(DataGridView dataGridView1, Label label1)
        {
            log.WriteLog("Maintainer Registry Cleaner analysis start");
            dataGridView1.Rows.Clear();
            PCS.process("lrc\\lrc.exe", " /analyse", true);

            if (File.Exists("settings\\regcleanresult.txt"))
            {
                System.Threading.Thread.Sleep(1000);
                string  json = File.ReadAllText("settings\\regcleanresult.txt");
                JObject o    = JObject.Parse(json);

                int count = (int)o["problems"];
                Global.registryerrors = count;
                label1.Text           = "Registry Errors Found: " + count.ToString();
                if (count > 0)
                {
                    for (int i = 1; i <= count; i++)
                    {
                        JArray bdky = (JArray)o[i.ToString()];
                        if ((int)bdky[0] == 1)
                        {
                            problem   = (string)bdky[1];
                            regKey    = (string)bdky[4];
                            valueName = (string)bdky[5];
                            dataGridView1.Rows.Add(problem, regKey, valueName);
                        }
                    }
                }
                log.WriteLog("Maintainer Registry Cleaner End");
            }
        }
Exemplo n.º 2
0
 public static void save_Cleaners(TreeView treeView1, string settingsfile)
 {
     for (int x = 0; x < treeView1.Nodes.Count; x++)
     {
         if (treeView1.Nodes[x].Checked)
         {
             PCS.IniWriteValue(settingsfile, "tree", treeView1.Nodes[x].Name.ToString(), "True");
         }
         else
         {
             PCS.IniWriteValue(settingsfile, "tree", treeView1.Nodes[x].Name.ToString(), "False");
         }
         for (int y = 0; y < treeView1.Nodes[x].Nodes.Count; y++)
         {
             if (treeView1.Nodes[x].Nodes[y].Checked)
             {
                 PCS.IniWriteValue(settingsfile, "tree", treeView1.Nodes[x].Nodes[y].Tag.ToString(), "1");
             }
             else
             {
                 PCS.IniWriteValue(settingsfile, "tree", treeView1.Nodes[x].Nodes[y].Tag.ToString(), "0");
             }
         }
     }
 }
        private void StartScopeTask()
        {
            ts_scope = new CancellationTokenSource();
            CancellationToken ct = ts_scope.Token;

            Task.Factory.StartNew(async() =>
            {
                while (true)
                {
                    if (ct.IsCancellationRequested)
                    {
                        break;
                    }
                    PCS device = Devices[MW.SelectedDevice] as PCS;

                    if (device.scopeControl.ScopeRunning)
                    {
                        ReadScopeObjects();
                    }
                    else
                    {
                        await Task.Delay(10);
                    }
                }
            }, ct);
        }
Exemplo n.º 4
0
        public static void listdrives(DataGridView dataGridView1, CheckBox optimize, CheckBox optimizemft, CheckBox uncompress, string settingsfile)
        {
            DriveInfo[]   driveInfo = DriveInfo.GetDrives().Where(x => x.IsReady).ToArray();
            List <string> drives    = new List <string>();

            foreach (DriveInfo drive in driveInfo)
            {
                DriveType driveType = Native.GetDriveType(drive.Name);
                if (
                    driveType != DriveType.Fixed
                    &&
                    driveType != DriveType.Removable
                    &&
                    driveType != DriveType.RAMDisk
                    )
                {
                    continue;
                }
                if (!is_virtual(drive.Name[0]))
                {
                    drives.Add(drive.Name);
                }
                double driveSizeGB      = Math.Round((double)drive.TotalSize / (1024 * 1024 * 1024), 2);
                double driveFreeSpaceGB = Math.Round((double)drive.AvailableFreeSpace / (1024 * 1024 * 1024), 2);
                double drivefreeSpacep  = Math.Round((driveFreeSpaceGB / driveSizeGB) * 100, 2);
                if (drive.Name == "C:\\" && drivefreeSpacep < 35)
                {
                    uncompress.CheckState = CheckState.Unchecked;
                    uncompress.Enabled    = false;
                    PCS.IniWriteValue(settingsfile, "main", "uncompress", "False");
                }
                dataGridView1.Rows.Add(true, drive.Name, driveFreeSpaceGB + " GB", drivefreeSpacep);
            }
            DiskDefragger.read_defragsettings(dataGridView1, optimize, optimizemft, uncompress, settingsfile, true);
        }
Exemplo n.º 5
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            string notify = PCS.IniReadValue(Global.system + "settings\\downloadsettings.ini", "schedule", "notification");

            if (notify == "true")
            {
                this.notifyIcon1.ShowBalloonTip(6000, "Performance Maintainer", "Maintenance Complete! \n\n Files Defragmented:" + Global.defragmented + "\n Disk Space Recovered: " + Global.cleanupsize + "\n Registry Problems Cleared: " + Global.registry, ToolTipIcon.Info);
            }
            notifyIcon1.Text = "Maintenance Complete!";

            FormCollection fc          = Application.OpenForms;
            bool           closesignal = true;

            foreach (Form frm in fc)
            {
                if (frm.Name == "Options")
                {
                    closesignal = false;
                    break;
                }
            }
            if (closesignal)
            {
                Application.DoEvents();
                System.Threading.Thread.Sleep(10000);
                this.Close();
            }
            else
            {
                button2.Text = "Close";
            }
        }
        public static async Task Execute(ConnectionManager connectionManager, List <string> serverLines, string servers, string partitions)
        {
            List <AsyncUnaryCall <Empty> > asyncUnaryCalls = new List <AsyncUnaryCall <Empty> >();

            foreach (string line in serverLines)
            {
                string[] serverLineSplit = line.Split(" ");

                PCS           pcs           = connectionManager.GetPCS(connectionManager.GetPCSUrlFromAnUrl(serverLineSplit[1]));
                ServerRequest serverRequest = new ServerRequest()
                {
                    ServerId             = serverLineSplit[0],
                    Url                  = serverLineSplit[1],
                    MinDelay             = int.Parse(serverLineSplit[2]),
                    MaxDelay             = int.Parse(serverLineSplit[3]),
                    NetworkConfiguration = servers + partitions
                };

                asyncUnaryCalls.Add(pcs.Stub.ServerAsync(serverRequest));
            }

            List <Empty> statusReplies = new List <Empty>();

            foreach (AsyncUnaryCall <Empty> request in asyncUnaryCalls)
            {
                statusReplies.Add(await request.ResponseAsync);
            }
        }
Exemplo n.º 7
0
 public void save_Cleaners()
 {
     for (int x = 0; x < treeView1.Nodes.Count; x++)
     {
         if (treeView1.Nodes[x].Checked)
         {
             PCS.IniWriteValue(Global.system + "blb\\Bleachbit.ini", "tree", treeView1.Nodes[x].Name.ToString(), "True");
         }
         else
         {
             PCS.IniWriteValue(Global.system + "blb\\Bleachbit.ini", "tree", treeView1.Nodes[x].Name.ToString(), "False");
         }
         for (int y = 0; y < treeView1.Nodes[x].Nodes.Count; y++)
         {
             if (treeView1.Nodes[x].Nodes[y].Checked)
             {
                 PCS.IniWriteValue(Global.system + "blb\\Bleachbit.ini", "tree", treeView1.Nodes[x].Nodes[y].Tag.ToString(), "1");
             }
             else
             {
                 PCS.IniWriteValue(Global.system + "blb\\Bleachbit.ini", "tree", treeView1.Nodes[x].Nodes[y].Tag.ToString(), "0");
             }
         }
     }
 }
        public IHttpActionResult PostPCS(PCS pCS)
        {
            db.PCS.Add(pCS);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = pCS.PcID }, pCS));
        }
        public IHttpActionResult PutPCS(int id, PCS pCS)
        {
            if (id != pCS.PcID)
            {
                return(BadRequest());
            }

            db.Entry(pCS).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PCSExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 10
0
        private void StartClient(string pid, string pcs_url, string client_url, int msec_per_round, int num_players)
        {
            System.Console.WriteLine("Starting client pid -> " + pid);
            PCS pcs = AddPCS(pcs_url);

            pid_pcs_Dict.Add(pid, pcs);

            pcs.StartClient(pid, client_url, msec_per_round, num_players);
        }
Exemplo n.º 11
0
        private void InsertPdoWriteTargetMode()
        {
            PCS device = Devices[0] as PCS;

            byte[] buf = new byte[4];

            BitConverter.GetBytes(device.TargetMode).CopyTo(buf, 0);

            FillServiceBuffer(CMD.pdo_W, 0x6060, 0, buf);
        }
Exemplo n.º 12
0
        private void Unfreeze(string pid)
        {
            PCS pcs = null;

            pid_pcs_Dict.TryGetValue(pid, out pcs);
            if (pcs != null)
            {
                Console.WriteLine(pcs.Unfreeze(pid));
            }
        }
Exemplo n.º 13
0
        private void InsertPdoWriteControlword()
        {
            PCS device = Devices[0] as PCS;

            byte[] buf = new byte[4];

            BitConverter.GetBytes(device.Controlword).CopyTo(buf, 0);

            FillServiceBuffer(CMD.pdo_W, 0x6040, 0, buf);
        }
Exemplo n.º 14
0
        private void InjectDelay(string pid_src, string pid_dst)
        {
            PCS pcs = null;

            pid_pcs_Dict.TryGetValue(pid_src, out pcs);
            if (pcs != null)
            {
                Console.WriteLine(pcs.InjectDelay(pid_src, pid_dst));
            }
        }
Exemplo n.º 15
0
        public IHttpActionResult GetPCS(int id)
        {
            PCS pCS = db.PCS.Find(id);

            if (pCS == null)
            {
                return(NotFound());
            }

            return(Ok(pCS));
        }
Exemplo n.º 16
0
        internal void InjectElement(Pointstamp time, Int64 update)
        {
            // by directly modifying the PCS, we don't risk sending anything from the centralizer. Used only for initializing inputs.
            Tracing.Trace("(PCSLock");
            Monitor.Enter(this.PCS);

            var frontierChanged = PCS.UpdatePointstampCount(time, update);

            Monitor.Exit(this.PCS);
            Tracing.Trace(")PCSLock");
        }
Exemplo n.º 17
0
        public static void repair()
        {
            PCS pcs = new PCS();

            log.WriteLog("Maintainer Registry Cleaner repair start");
            PCS.process("lrc\\lrc.exe", " /repair", true);
            if (File.Exists("settings\\reglog.txt"))
            {
                Global.registry = pcs.findword("settings\\reglog.txt", "Total problems found", 21);
            }
            log.WriteLog("Maintainer Registry Cleaner repair end");
        }
        internal void InjectElement(Pointstamp time, Int64 update)
        {
            // by directly modifying the PCS, we don't risk sending anything from centralizer. Used only for initializing inputs.
            NaiadTracing.Trace.LockAcquire(this.PCS);
            Monitor.Enter(this.PCS);
            NaiadTracing.Trace.LockHeld(this.PCS);

            var progressChanged = PCS.UpdatePointstampCount(time, update);

            Monitor.Exit(this.PCS);
            NaiadTracing.Trace.LockRelease(this.PCS);
        }
Exemplo n.º 19
0
        private void Crash(string pid)
        {
            PCS pcs = null;

            pid_pcs_Dict.TryGetValue(pid, out pcs);
            if (pcs != null)
            {
                Console.WriteLine(pcs.Crash(pid));
            }
            //process crashed -> remove pid from list
            pid_pcs_Dict.Remove(pid);
        }
 public static async Task Execute(ConnectionManager connectionManager, string username, string clientURL, string scriptFile, string servers, string partitions)
 {
     PCS           pcs = connectionManager.GetPCS(connectionManager.GetPCSUrlFromAnUrl(clientURL));
     ClientRequest createClientRequest = new ClientRequest()
     {
         Username             = username,
         ClientUrl            = clientURL,
         ScriptFile           = scriptFile,
         NetworkConfiguration = servers + partitions
     };
     await pcs.Stub.ClientAsync(createClientRequest);
 }
Exemplo n.º 21
0
        public bool selection(string cleanername)
        {
            string readselection = PCS.IniReadValue(Global.system + "blb\\Bleachbit.ini", "tree", cleanername);

            if (readselection == "0")
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 22
0
        private void InsertScopeObjects()
        {
            PCS             device      = Devices[0] as PCS;
            List <DictItem> PlotObjects = device.scopeControl.plotScope.PlotObjects;

            for (int i = 0; i < device.scopeControl.plotScope.PlotModel.Series.Count; i++)
            {
                if (device.scopeControl.ScopeRunning && PlotObjects[i].Index != 0)
                {
                    FillServiceBuffer(CMD.sdo_R, PlotObjects[i].Index, PlotObjects[i].Subindex, new byte[4]);
                }
            }
        }
Exemplo n.º 23
0
 /// <summary>
 /// Calculates a hash code of these values:
 /// <para> - <see cref="Class"/></para>
 /// <para> - <see cref="DataColorspace"/></para>
 /// <para> - <see cref="PCS"/></para>
 /// <para> - <see cref="PCSIlluminant"/></para>
 /// <para> - <see cref="Data"/></para>
 /// </summary>
 /// <returns>The hash code of the listed values</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = (int)2166136261;
         hash *= 16777619 ^ Class.GetHashCode();
         hash *= 16777619 ^ DataColorspace.GetHashCode();
         hash *= 16777619 ^ PCS.GetHashCode();
         hash *= 16777619 ^ PCSIlluminant.GetHashCode();
         hash *= CMP.GetHashCode(Data);
         return(hash);
     }
 }
Exemplo n.º 24
0
        public static bool secselection(string cleanername, string settingsfile)
        {
            string readselection = PCS.IniReadValue(settingsfile, "tree", cleanername);

            if (readselection == "False")
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 25
0
        public IHttpActionResult DeletePCS(int id)
        {
            PCS pCS = db.PCS.Find(id);

            if (pCS == null)
            {
                return(NotFound());
            }

            db.PCS.Remove(pCS);
            db.SaveChanges();

            return(Ok(pCS));
        }
Exemplo n.º 26
0
        public void save_defragsettings()
        {
            PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", "main", "optimize", checkBox1.Checked.ToString());

            PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", "main", "optimizemft", checkBox2.Checked.ToString());

            PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", "main", "fixeddrives", dataGridView1.Rows.Count.ToString());

            for (int j = 0; j < dataGridView1.Rows.Count; j++)
            {
                PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", j.ToString(), "drivename", this.dataGridView1.Rows[j].Cells[1].Value.ToString().Substring(0, 2));
                PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", j.ToString(), "checked", this.dataGridView1.Rows[j].Cells[0].Value.ToString());
            }
        }
Exemplo n.º 27
0
        private void LocalState(string pid, int round_id)
        {
            string gameState = "";
            PCS    pcs       = null;

            pid_pcs_Dict.TryGetValue(pid, out pcs);
            if (pcs != null)
            {
                gameState = pcs.LocalState(pid, round_id);
            }

            String filename = "LocalState-" + pid + "-" + round_id + ".txt";

            File.WriteAllText(@"..\\..\\AdditionalFiles\\" + filename, gameState);
        }
        /// <summary>
        /// Called to request SDOs for the scope if the scope is running and an scope object is selected
        /// </summary>
        private void ReadScopeObjects()
        {
            PCS             device      = Devices[MW.SelectedDevice] as PCS;
            List <DictItem> PlotObjects = device.scopeControl.plotScope.PlotObjects;

            for (int i = 0; i < device.scopeControl.plotScope.PlotModel.Series.Count; i++)
            {
                if (device.scopeControl.ScopeRunning &&
                    PlotObjects[i].Index != 0)
                //&& (device.plotScope.PlotModel.Series[i] as LineSeries).IsVisible )
                {
                    AsyncRead(device.SlaveNumber, PlotObjects[i].Index, PlotObjects[i].Subindex);
                }
            }
        }
Exemplo n.º 29
0
        public static void save_regsections(TreeView treeView1)
        {
            for (int i = 0; i < treeView1.Nodes.Count; i++)
            {
                String value = treeView1.Nodes[i].Name;

                if (treeView1.Nodes[i].Checked)
                {
                    PCS.IniWriteValue("settings\\regsections.ini", "sections", value, "1");
                }
                else
                {
                    PCS.IniWriteValue("settings\\regsections.ini", "sections", value, "0");
                }
            }
        }
Exemplo n.º 30
0
        public static void save_defragsettings(DataGridView dataGridView1, CheckBox optimize, CheckBox optimizemft, CheckBox uncompress, string settingsfile)
        {
            PCS.IniWriteValue(settingsfile, "main", "optimize", optimize.Checked.ToString());

            PCS.IniWriteValue(settingsfile, "main", "optimizemft", optimizemft.Checked.ToString());

            PCS.IniWriteValue(settingsfile, "main", "uncompress", uncompress.Checked.ToString());

            PCS.IniWriteValue(settingsfile, "main", "fixeddrives", dataGridView1.Rows.Count.ToString());

            for (int j = 0; j < dataGridView1.Rows.Count; j++)
            {
                PCS.IniWriteValue(settingsfile, j.ToString(), "drivename", dataGridView1.Rows[j].Cells[1].Value.ToString().Substring(0, 2));
                PCS.IniWriteValue(settingsfile, j.ToString(), "checked", dataGridView1.Rows[j].Cells[0].Value.ToString());
            }
        }