コード例 #1
0
ファイル: pscript.cs プロジェクト: x0x029a/PoshSecFramework
 private void InitializeSessionVars()
 {
     if (rspace.RunspaceAvailability == RunspaceAvailability.Available)
     {
         PSAlert = new psmethods.PSAlert(frm);
         PSRoot = new psvariables.PSRoot("PSRoot");
         PSStatus = new psmethods.PSStatus(frm, scriptlvw);
         PSModRoot = new psvariables.PSModRoot("PSModRoot");
         PSFramework = new psvariables.PSFramework("PSFramework");
         PSExec = new psvariables.PSExec("PSExec");
         PSMessageBox = new psmethods.PSMessageBox();
         PSTab = new psmethods.PSTab(frm);
         PSHosts = new psmethods.PSHosts(frm);
         rspace.SessionStateProxy.PSVariable.Set(PSRoot);
         rspace.SessionStateProxy.PSVariable.Set(PSModRoot);
         rspace.SessionStateProxy.PSVariable.Set(PSFramework);
         rspace.SessionStateProxy.PSVariable.Set(PSExec);
         rspace.SessionStateProxy.SetVariable("PSMessageBox", PSMessageBox);
         rspace.SessionStateProxy.SetVariable("PSAlert", PSAlert);
         rspace.SessionStateProxy.SetVariable("PSStatus", PSStatus);
         rspace.SessionStateProxy.SetVariable("PSHosts", PSHosts);
         rspace.SessionStateProxy.SetVariable("PSTab", PSTab);
     }
 }
コード例 #2
0
 private void InitializeSessionVars()
 {
     if (rspace.RunspaceAvailability == RunspaceAvailability.Available)
     {
         PSAlert      = new psmethods.PSAlert(frm);
         PSRoot       = new psvariables.PSRoot("PSRoot");
         PSStatus     = new psmethods.PSStatus(frm, scriptlvw);
         PSModRoot    = new psvariables.PSModRoot("PSModRoot");
         PSFramework  = new psvariables.PSFramework("PSFramework");
         PSExec       = new psvariables.PSExec("PSExec");
         PSMessageBox = new psmethods.PSMessageBox();
         PSTab        = new psmethods.PSTab(frm);
         PSHosts      = new psmethods.PSHosts(frm);
         rspace.SessionStateProxy.PSVariable.Set(PSRoot);
         rspace.SessionStateProxy.PSVariable.Set(PSModRoot);
         rspace.SessionStateProxy.PSVariable.Set(PSFramework);
         rspace.SessionStateProxy.PSVariable.Set(PSExec);
         rspace.SessionStateProxy.SetVariable("PSMessageBox", PSMessageBox);
         rspace.SessionStateProxy.SetVariable("PSAlert", PSAlert);
         rspace.SessionStateProxy.SetVariable("PSStatus", PSStatus);
         rspace.SessionStateProxy.SetVariable("PSHosts", PSHosts);
         rspace.SessionStateProxy.SetVariable("PSTab", PSTab);
     }
 }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: x0x029a/PoshSecFramework
 private void GetAlerts()
 {
     if (Properties.Settings.Default.Alerts != null && Properties.Settings.Default.Alerts.Count > 0)
     {
         foreach (String system in Properties.Settings.Default.Alerts)
         {
             String[] alertparts = system.Split('|');
             if (alertparts.Length == lvwAlerts.Columns.Count)
             {
                 ListViewItem lvwItm = new ListViewItem();
                 lvwItm.Text = alertparts[0];
                 for (int idx = 1; idx < alertparts.Length; idx++)
                 {
                     lvwItm.SubItems.Add(alertparts[idx]);
                 }
                 PShell.psmethods.PSAlert alert = new PShell.psmethods.PSAlert(this);
                 lvwItm.ImageIndex = (int)alert.GetAlertTypeFromString(alertparts[0]);
                 alert = null;
                 lvwAlerts.Items.Add(lvwItm);
                 alerts.Add(lvwItm);
             }
         }
         lvwAlerts_Update();
         Properties.Settings.Default["Alerts"] = new System.Collections.Specialized.StringCollection();
         ((System.Collections.Specialized.StringCollection)Properties.Settings.Default["Alerts"]).Clear();
         Properties.Settings.Default.Save();
         Properties.Settings.Default.Reload();
     }
 }