Beispiel #1
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            Func <ITagger <T> > taggerProperty = delegate {
                var vsShell = Package.GetGlobalService(typeof(SVsShell)) as IVsShell;
                if (vsShell == null)
                {
                    throw new NullReferenceException("VS Shell failed to Load");
                }
                IVsPackage shellPack;
                var        packToLoad = new Guid("e1baf989-88a6-4acf-8d97-e0dc243476aa");
                if (vsShell.LoadPackage(ref packToLoad, out shellPack) != VSConstants.S_OK)
                {
                    throw new NullReferenceException("Dafny Menu failed to Load");
                }
                var dafnyMenuPack = (DafnyMenuPackage)shellPack;
                dafnyMenuPack.DeadCodeMenuProxy = new DeadCodeMenuProxy();

                DeadAnnotationTag.Type = Ctr.GetClassificationType("Dead Annotation");
                RefactoringUtil.Tdf    = RefactoringUtil.Tdf ?? Tdf;
                var status = (IVsStatusbar)Isp.GetService(typeof(IVsStatusbar));
                var tsn    = Tsn.GetTextStructureNavigator(buffer);
                var agg    = AggregatorFactory.CreateTagAggregator <ProgressGlyphTag>(buffer);
                var elp    = new ErrorListProvider(Isp);

                Func <ITagger <T> > sc = () => new DeadAnnotationTagger(buffer, status, tsn, agg, elp) as ITagger <T>;
                return(buffer.Properties.GetOrCreateSingletonProperty(typeof(DeadAnnotationTagger), sc));
            };

            return(buffer.Properties.GetOrCreateSingletonProperty(typeof(DeadAnnotationTagger), taggerProperty));
        }
Beispiel #2
0
 public MainWindow()
 {
     try
     {
         string[] Creds = new string[2];
         if (File.Exists(@"C:\LocalSwap\EclipseAPI\LocalCred.Txt"))
         {
             using (StreamReader CredFile = new StreamReader(@"C:\LocalSwap\EclipseAPI\LocalCred.Txt"))
             {
                 Creds[0] = CredFile.ReadLine();
                 Creds[1] = CredFile.ReadLine();
             }
             Ctr.Initialize(Creds[0], Creds[1]);
         }
         else
         {
             Ctr.Initialize(null, null);
         }
         InitializeComponent();
     }
     catch (Exception ex)
     {
         var test = ex;
     }
 }
Beispiel #3
0
        private async void ImportProtocol(object sender, RoutedEventArgs e)
        {
            if (Ctr.PatientLoaded || Ctr.NumAssessments > 0)
            {
                System.Windows.Forms.DialogResult DR = System.Windows.Forms.MessageBox.Show("This will close the current protocol and any assessments. Any unsaved changes will be lost. Continue?", "Import from XML", System.Windows.Forms.MessageBoxButtons.YesNo);
                if (DR == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
            }
            Ctr.ClosePatient();
            Ctr.CloseProtocol();
            Cursor = Cursors.Wait;
            System.Windows.Forms.OpenFileDialog d = new System.Windows.Forms.OpenFileDialog();
            d.Title            = "Open Ctr.GetProtocolView() File";
            d.Filter           = "XML files|*.xml";
            d.InitialDirectory = @"\\srvnetapp02\bcca\docs\Physics\CN\Software\Squint\XML Protocol Library\v0.5 Library";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                MessageBox.Show(d.FileName.ToString());
            }
            bool ImportSuccessful = await Task.Run(() => Ctr.ImportProtocolFromXML(d.FileName));

            if (ImportSuccessful)
            {
                Cursor = Cursors.Arrow;
            }
            else
            {
                Cursor = Cursors.Arrow;
                MessageBox.Show("Error in importing protocol, please review XML file");
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            // SBox
            Dictionary <string, string> sbox = new Dictionary <string, string>()
            {
                { "0000", "1110" },
                { "0001", "0100" },
                { "0010", "1101" },
                { "0011", "0001" },
                { "0100", "0010" },
                { "0101", "1111" },
                { "0110", "1011" },
                { "0111", "1000" },
                { "1000", "0011" },
                { "1001", "1010" },
                { "1010", "0110" },
                { "1011", "1100" },
                { "1100", "0101" },
                { "1101", "1001" },
                { "1110", "0000" },
                { "1111", "0111" }
            };

            // Bitpermutations-Tabelle
            Dictionary <int, int> bitPermutation = new Dictionary <int, int>()
            {
                { 0, 0 },
                { 1, 4 },
                { 2, 8 },
                { 3, 12 },
                { 4, 1 },
                { 5, 5 },
                { 6, 9 },
                { 7, 13 },
                { 8, 2 },
                { 9, 6 },
                { 10, 10 },
                { 11, 14 },
                { 12, 3 },
                { 13, 7 },
                { 14, 11 },
                { 15, 15 }
            };

            Spn    mySpn    = new Spn(4, 4, 4, 32, "00111010100101001101011000111111", 4, sbox, bitPermutation);
            Ctr    ctr      = new Ctr("00111010100101001101011000111111", 16, mySpn);
            string klartext = ctr.Decrypt(@"00000100110100100000101110111000000000101000111110001110011111110110000001010001010000111010000000010011011001110010101110110000", false);

            System.Console.WriteLine("-- Klartext als BitString --");
            System.Console.WriteLine(klartext);

            var data = klartext.GetBytesFromBinaryString();
            var text = Encoding.ASCII.GetString(data);

            System.Console.WriteLine("-- Klartext als Text --");
            System.Console.WriteLine(text);

            System.Console.ReadLine();
        }
Beispiel #5
0
        public override string ToString()
        {
            string val = string.Empty;

            val = Val.ToString() + "/" + Ctr.ToString();

            return(val);
        }
Beispiel #6
0
    protected virtual void FixedUpdate()
    {
        ChrSM.Update(this);

        //CSMachine.Update();

        //stats.FixedUpdate();

        UpdateStats();

        UpdatesStatsForCtr();
        Ctr.ManualFixedUpdate();

        currentDamage = null;
        Jump          = false;

        Attack = false;
    }
Beispiel #7
0
        public async Task <bool> AddBolusCheck()
        {
            int numBoluses = 0;

            foreach (Ctr.TxFieldItem.BolusInfo BI in Field.BolusInfos)
            {
                var    Warning       = false;
                string WarningString = "";
                numBoluses++;
                if (Math.Abs(BI.HU - RefBeam.RefBolusHU) > 0.1)
                {
                    Warning       = true;
                    WarningString = @"HU deviation";
                }
                if (RefBeam.BolusParameter == ParameterOptions.None)
                {
                    Warning       = true;
                    WarningString = @"Off-protocol bolus";
                }
                var HU = new TestListItem(string.Format(@"Bolus HU (""{0}"")", BI.Id), string.Format("{0:0} HU", BI.HU), string.Format("{0:0} HU", RefBolusHU), Warning, WarningString);
                BeamTests.Tests.Add(HU);

                //ThickCheck
                if (RefBeam.BolusParameter != ParameterOptions.None)
                {
                    var Thick = await Ctr.GetBolusThickness(Field.CourseId, Field.PlanId, BI.Id);

                    if (Thick < (RefBeam.BolusClinicalMinThickness - 0.1) || Thick > (RefBeam.BolusClinicalMaxThickness + 0.1))
                    {
                        Warning = true;
                    }
                    var ThickCheck = new TestListItem(string.Format(@"Bolus Thickness (""{0}"")", BI.Id), string.Format("{0:0.0#} cm", Thick),
                                                      string.Format("{0:0.#} - {1:0.#} cm", RefBeam.BolusClinicalMinThickness, RefBeam.BolusClinicalMaxThickness), Warning, "");
                    BeamTests.Tests.Add(ThickCheck);
                }
            }
            if (numBoluses == 0 && RefBeam.BolusParameter == ParameterOptions.Required)
            {
                var HU = new TestListItem(string.Format(@"Bolus Check"), string.Format(" - "), string.Format("{0:0} HU", RefBolusHU), true, "Bolus indicated but not found");
                BeamTests.Tests.Add(HU);
            }
            return(true);
        }
Beispiel #8
0
 //Import / Export of protocols
 private async void ImportProtocolDirectory(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.FolderBrowserDialog f = new System.Windows.Forms.FolderBrowserDialog();
     f.Description  = "Please select import folder...";
     f.SelectedPath = @"\\srvnetapp02\bcca\docs\physics\cn\software\squint\xml protocol library\";
     Cursor         = Cursors.Wait;
     if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             string[]    filenames   = System.IO.Directory.GetFiles(f.SelectedPath);
             List <Task> importTasks = new List <Task>();
             int         count       = 0;
             double      total       = filenames.Count();
             foreach (string file in filenames)
             {
                 string ext = System.IO.Path.GetExtension(file);
                 if (ext == ".xml")
                 {
                     try
                     {
                         count++;
                         importTasks.Add(Task.Run(() =>
                         {
                             Ctr.ImportProtocolFromXML(file);
                         }));
                     }
                     catch
                     {
                         MessageBox.Show(string.Format("Error importing {0}", file));
                     }
                 }
             }
             await Task.WhenAll(importTasks);
         }
         catch (Exception ex)
         {
             string debugme = "hi";
         }
     }
     Cursor = Cursors.Arrow;
     MessageBox.Show("Complete!");
 }
Beispiel #9
0
 private void OnClosing(object sender, CancelEventArgs e)
 {
     Ctr.Dispose();
 }