示例#1
0
	void Awake(){
		
		if(Instance != null && Instance != this)
		{
			Destroy(gameObject);
		}
		
		Instance = this;
		
		DontDestroyOnLoad(gameObject);

		if(deleteProgressAtStart){
			PlayerPrefs.DeleteAll();
			//TODO neue levelSequence
		}//else{
//			load();
//		}

		player = GameObject.FindWithTag("Player");
//		Debug.Log(player.transform.position.x);

		playerDataPerScene = new Dictionary<string, PlayerData>();
		currentScene = "Stadt";
		load();
	}
		private void Update(){
			if (globalVariables == null && !EditorApplication.isCompiling) {
				globalVariables = GlobalVariables.Load();
				if (globalVariables == null) {
					if (!System.IO.Directory.Exists(Application.dataPath + "/ICode/Resources")) {
						AssetDatabase.CreateFolder("Assets/ICode", "Resources");
					}	
					globalVariables= AssetCreator.CreateAsset<GlobalVariables>("Assets/ICode/Resources/"+GlobalVariables.assetName+".asset");
					EditorUtility.DisplayDialog("Created GlobalVariables!",
					                            "Do not delete or rename the Resource folder and the GlobalVariables asset.", "Ok");
				}
				Array.Sort(globalVariables.Variables,(a, b) =>  a.Group.CompareTo(b.Group));
			}
		}
示例#3
0
 public virtual bool GlobalLocked(TDto dto)
 {
     return(!this.genericRepository.VersionValidate(GlobalVariables.ConfigID, GlobalVariables.ConfigVersionID(GlobalVariables.ConfigID)) || dto.EntryDate <= this.genericRepository.GetEditLockedDate(this.LocationID, this.nmvnTaskID));
 }
        public async Task <User> Add(PaymentNotification paymentNotification, IFormFile[] images)
        {
            var user = await _context.Users.Where(x => x.Email == paymentNotification.Email).FirstOrDefaultAsync();

            if (user == null)
            {
                throw new AppException("User is not found");
            }

            if (images != null)
            {
                for (int i = 0; i < images.Length; i++)
                {
                    if (images[i] != null && images[i].Length > 0)
                    {
                        var file = images[i];
                        if (file.Length > 0)
                        {
                            if (!file.ContentType.StartsWith("image"))
                            {
                                var fileLength    = file.Length / 1024;
                                var maxFileLength = 5120;
                                if (fileLength > maxFileLength)
                                {
                                    throw new AppException("Uploaded file must not be more than 5MB!");
                                }
                            }
                        }
                    }
                }
            }

            if (images != null)
            {
                for (int i = 0; i < images.Length; i++)
                {
                    Bitmap originalFile = null;
                    Bitmap resizedFile  = null;
                    int    imgWidth     = 0;
                    int    imgHeigth    = 0;
                    if ((i == 0) && (images[i] != null) && (images[i].Length > 0))
                    {
                        var uploads = Path.GetFullPath(Path.Combine(GlobalVariables.ImagePath, @"images\payment"));
                        var file    = images[i];
                        if (file.Length > 0)
                        {
                            var    fileName              = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim();
                            string uniqueFileName        = paymentNotification.FirstName.Substring(0, 5) + i + DateTime.Now + file.FileName;
                            string uniqueFileNameTrimmed = uniqueFileName.Replace(":", "").Replace("-", "").Replace(" ", "").Replace("/", "");

                            using (var fileStream = new FileStream(Path.Combine(uploads, uniqueFileNameTrimmed), FileMode.Create))
                            {
                                await file.CopyToAsync(fileStream);

                                paymentNotification.ImageNames = uniqueFileNameTrimmed;

                                if (file.ContentType.StartsWith("image"))
                                {
                                    int width  = 200;
                                    int height = 200;
                                    originalFile = new Bitmap(fileStream);
                                    resizedFile  = ResizeImage.GetResizedImage(fileStream, width, height, width, height);
                                }
                            }

                            if (resizedFile != null)
                            {
                                imgWidth  = resizedFile.Width;
                                imgHeigth = resizedFile.Height;
                                using (var fileStreamUp = new FileStream(Path.Combine(uploads, uniqueFileNameTrimmed), FileMode.Create))
                                {
                                    resizedFile.Save(fileStreamUp, ImageFormat.Jpeg);
                                }
                            }
                        }
                    }
                }
            }

            DateTime paymentNotificationLocalDate_Nigeria = new DateTime();
            string   windowsTimeZone = GetWindowsFromOlson.GetWindowsFromOlsonFunc("Africa/Lagos");

            paymentNotificationLocalDate_Nigeria = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(windowsTimeZone));
            paymentNotification.DateAdded        = paymentNotificationLocalDate_Nigeria;

            int length              = GlobalVariables.RandomStringLengthShort();
            var randomKey           = "";
            var keyIsAlreadyPresent = true;

            do
            {
                randomKey           = GlobalVariables.RandomString(length);
                keyIsAlreadyPresent = _context.PaymentNotifications.Any(x => x.Reference == randomKey);
            } while (keyIsAlreadyPresent);
            paymentNotification.Reference = randomKey;

            paymentNotification.Confirmed     = "No";
            paymentNotification.UpdateAllowed = true;
            await _context.PaymentNotifications.AddAsync(paymentNotification);

            if (paymentNotification.TransactionType == "Activation")
            {
                user.ActivationRequested = true;
                _context.Users.Update(user);
            }
            await _context.SaveChangesAsync();

            //ThreadPool.QueueUserWorkItem(o => {
            string body = "Dear " + paymentNotification.FirstName + ",<br/><br/>Thank you for submitting your payment notification.<br/><br/>" +
                          "We will confirm your payment and update your online profile.<br/><br/>" +
                          "You will also receive an email from us as soon as we have confirmed your payment<br/><br/>" +
                          "Thanks,<br/>The RotatePay Team<br/>";
            var message = new Message(new string[] { paymentNotification.Email }, "[RotatePay] Payment Notification Received", body, null);

            _emailSenderService.SendEmail(message);

            string body1    = paymentNotification.FirstName + "(" + paymentNotification.Email + ") has submitted the payment notification form.<br/><br/><br/>";
            var    message1 = new Message(new string[] { GlobalVariables.AdminEmail }, "[RotatePay] Payment receipt by " + paymentNotification.Email, body1, images);

            _emailSenderService.SendEmail(message1);
            //});

            //await _logService.Create(log);
            return(user);
        }
示例#5
0
        public MasterMDI(GlobalEnums.NmvnTaskID nmvnTaskID, Form loadedView)
        {
            InitializeComponent();

            try
            {
                this.nmvnTaskID = nmvnTaskID;
                this.moduleAPIs = new ModuleAPIs(CommonNinject.Kernel.Get <IModuleAPIRepository>());

                switch (this.nmvnTaskID)
                {
                case GlobalEnums.NmvnTaskID.SmartCoding:

                    this.buttonLoading.Visible             = false;
                    this.buttonNew.Visible                 = false;
                    this.buttonEdit.Visible                = false;
                    this.buttonSave.Visible                = false;
                    this.buttonDelete.Visible              = false;
                    this.buttonImport.Visible              = false;
                    this.buttonExport.Visible              = false;
                    this.toolStripSeparatorImport.Visible  = false;
                    this.buttonApprove.Visible             = false;
                    this.buttonVoid.Visible                = false;
                    this.toolStripSeparatorApprove.Visible = false;
                    this.toolStripSeparatorVoid.Visible    = false;
                    this.buttonPrint.Visible               = false;
                    this.buttonPrintPreview.Visible        = false;
                    this.toolStripSeparatorPrint.Visible   = false;
                    this.toolStripTopHead.Visible          = false;
                    break;

                case GlobalEnums.NmvnTaskID.Batch:
                    this.Size            = new Size(1388, 740);
                    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                    this.MinimizeBox     = false; this.MaximizeBox = false; this.WindowState = FormWindowState.Normal;

                    this.panelTopRight.Visible = false;
                    this.panelTopLeft.Dock     = DockStyle.Fill;
                    break;

                case GlobalEnums.NmvnTaskID.BatchMaster:
                    if (GlobalVariables.ConfigID != (int)GlobalVariables.FillingLine.BatchMaster)
                    {
                        this.Size            = new Size(1388, 740);
                        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                        this.MinimizeBox     = false; this.MaximizeBox = false; this.WindowState = FormWindowState.Normal;
                    }

                    //this.panelTopRight.Visible = false;
                    //this.panelTopLeft.Dock = DockStyle.Fill;
                    break;

                case GlobalEnums.NmvnTaskID.Commodity:
                    this.Size            = new Size(1388, 740);
                    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                    this.MinimizeBox     = false; this.MaximizeBox = false; this.WindowState = FormWindowState.Normal;

                    this.panelTopRight.Visible = false;
                    this.panelTopLeft.Dock     = DockStyle.Fill;
                    break;

                default:
                    break;
                }

                this.beginingDateBinding = this.textFillterLowerDate.TextBox.DataBindings.Add("Text", GlobalEnums.GlobalOptionSetting, "LowerFillterDate", true);
                this.endingDateBinding   = this.textFillterUpperDate.TextBox.DataBindings.Add("Text", GlobalEnums.GlobalOptionSetting, "UpperFillterDate", true);

                this.beginingDateBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.endingDateBinding.BindingComplete   += new BindingCompleteEventHandler(CommonControl_BindingComplete);

                this.buttonNaviBarHeaderVisibleBinding         = this.buttonNaviBarHeader.DataBindings.Add("Visible", this.naviBarModuleMaster, "Collapsed", true, DataSourceUpdateMode.OnPropertyChanged);
                this.buttonNaviBarHeaderVisibleBinding.Parse  += new ConvertEventHandler(buttonNaviBarHeaderVisibleBinding_Parse);
                this.buttonNaviBarHeaderVisibleBinding.Format += new ConvertEventHandler(buttonNaviBarHeaderVisibleBinding_Format);

                this.listViewTaskMaster.Dock = DockStyle.Fill;
                this.listViewTaskMaster.Columns.Add(new ColumnHeader()
                {
                    Width = this.listViewTaskMaster.Width
                });

                if (loadedView != null)
                {
                    this.naviBarModuleMaster.Visible = false;
                    this.OpenView(loadedView);
                }
                else
                {
                    this.InitializeModuleMaster();
                    this.buttonNaviBarHeader_Click(this.buttonNaviBarHeader, new EventArgs());
                }

                DateTime buildDate = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
                this.statusVersion.Text = "Version 1.0." + GlobalVariables.ConfigVersionID(GlobalVariables.ConfigID).ToString() + ", Date: " + buildDate.ToString("dd/MM/yyyy HH:mm:ss");

                this.comboSearchBarcode.Text    = this.searchPlaceHolder;
                this.toolUserReferences.Enabled = true; //ContextAttributes.User.IsDatabaseAdmin;
                this.statusUserDescription.Text = ContextAttributes.User.FullyQualifiedUserName;

                this.panelTop.Height = this.nmvnTaskID == GlobalEnums.NmvnTaskID.SmartCoding ? 61 : 39;
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
示例#6
0
 // Use this for initialization
 void Awake()
 {
     variables = this;
 }
示例#7
0
文件: Logon.cs 项目: Proerp/Nuti01
        private bool VersionValidate()
        {
            try
            {
                foreach (GlobalVariables.FillingLine fillingLine in Enum.GetValues(typeof(GlobalVariables.FillingLine)))
                {
                    this.baseRepository.ExecuteStoreCommand("UPDATE Configs SET VersionID = " + GlobalVariables.ConfigVersionID((int)fillingLine) + " WHERE ConfigID = " + (int)fillingLine + " AND VersionID < " + GlobalVariables.ConfigVersionID((int)fillingLine), new ObjectParameter[] { });
                }


                if (this.baseRepository.VersionValidate(GlobalVariables.ConfigID, GlobalVariables.ConfigVersionID(GlobalVariables.ConfigID)))
                {
                    CommonConfigs.AddUpdateAppSetting("VersionID", GlobalVariables.ConfigVersionID(GlobalVariables.ConfigID).ToString());
                }

                return(true);
            }
            catch (Exception exception)
            {
                CommonConfigs.AddUpdateAppSetting("VersionID", "-9");
                throw exception;
            }
        }
    public static void Load(GlobalVariables globalVariables, string version)
    {
        if (globalVariables == null)
        {
            return;
        }
        if (string.IsNullOrEmpty(version))
        {
            BinaryDeserializationDeprecated.Load(globalVariables);
            return;
        }
        globalVariables.Variables = null;
        FieldSerializationData fieldSerializationData;

        if (globalVariables.VariableData == null || (fieldSerializationData = globalVariables.VariableData.fieldSerializationData).byteData == null || fieldSerializationData.byteData.Count == 0)
        {
            return;
        }
        if (fieldSerializationData.typeName.Count > 0)
        {
            BinaryDeserializationDeprecated.Load(globalVariables);
            return;
        }
        VariableSerializationData variableData = globalVariables.VariableData;

        fieldSerializationData.byteDataArray       = fieldSerializationData.byteData.ToArray();
        BinaryDeserialization.updatedSerialization = (globalVariables.Version.CompareTo("1.5.7") >= 0);
        if (BinaryDeserialization.updatedSerialization)
        {
            BinaryDeserialization.shaHashSerialization = (globalVariables.Version.CompareTo("1.5.9") >= 0);
        }
        if (variableData.variableStartIndex != null)
        {
            List <SharedVariable> list       = new List <SharedVariable>();
            Dictionary <int, int> dictionary = ObjectPool.Get <Dictionary <int, int> >();
            for (int i = 0; i < variableData.variableStartIndex.Count; i++)
            {
                int num = variableData.variableStartIndex[i];
                int num2;
                if (i + 1 < variableData.variableStartIndex.Count)
                {
                    num2 = variableData.variableStartIndex[i + 1];
                }
                else
                {
                    num2 = fieldSerializationData.startIndex.Count;
                }
                dictionary.Clear();
                for (int j = num; j < num2; j++)
                {
                    dictionary.Add(fieldSerializationData.fieldNameHash[j], fieldSerializationData.startIndex[j]);
                }
                SharedVariable sharedVariable = BinaryDeserialization.BytesToSharedVariable(fieldSerializationData, dictionary, fieldSerializationData.byteDataArray, variableData.variableStartIndex[i], globalVariables, false, 0);
                if (sharedVariable != null)
                {
                    list.Add(sharedVariable);
                }
            }
            ObjectPool.Return <Dictionary <int, int> >(dictionary);
            globalVariables.Variables = list;
        }
    }
示例#9
0
        public static void TestUserModSelectionInPrunedDB()
        {
            List <(string, string)> listOfModsFixed = new List <(string, string)> {
                ("Common Fixed", "Carbamidomethyl of C"), ("Common Fixed", "Carbamidomethyl of U")
            };
            //Create Search Task
            SearchTask task5 = new SearchTask
            {
                SearchParameters = new SearchParameters
                {
                    WritePrunedDatabase  = true,
                    SearchTarget         = true,
                    MassDiffAcceptorType = MassDiffAcceptorType.Exact,
                },
                CommonParameters = new CommonParameters(listOfModsFixed: listOfModsFixed)
            };

            task5.SearchParameters.ModsToWriteSelection["Mod"]          = 0;
            task5.SearchParameters.ModsToWriteSelection["Common Fixed"] = 1;
            task5.SearchParameters.ModsToWriteSelection["Glycan"]       = 2;
            task5.SearchParameters.ModsToWriteSelection["missing"]      = 3;

            //add task 1 to task list
            List <(string, MetaMorpheusTask)> taskList = new List <(string, MetaMorpheusTask)> {
                ("task5", task5)
            };

            ModificationMotif.TryGetMotif("P", out ModificationMotif motif);
            ModificationMotif.TryGetMotif("E", out ModificationMotif motif2);

            var connorMod  = new Modification(_originalId: "ModToNotAppear", _modificationType: "Mod", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 10);
            var connorMod2 = new Modification(_originalId: "Default(Mod in DB and Observed)", _modificationType: "Common Fixed", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 10);
            var connorMod3 = new Modification(_originalId: "ModToAlwaysAppear", _modificationType: "Glycan", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 10);
            var connorMod4 = new Modification(_originalId: "ModObservedNotinDB", _modificationType: "missing", _target: motif2, _locationRestriction: "Anywhere.", _monoisotopicMass: 5);

            GlobalVariables.AddMods(new List <Modification>
            {
                connorMod,
                connorMod2,
                connorMod3,
                connorMod4
            }, false);

            //create modification lists
            List <Modification> variableModifications = GlobalVariables.AllModsKnown.OfType <Modification>().Where(b => task5.CommonParameters.ListOfModsVariable.Contains
                                                                                                                       ((b.ModificationType, b.IdWithMotif))).ToList();
            List <Modification> fixedModifications = GlobalVariables.AllModsKnown.OfType <Modification>().Where(b => task5.CommonParameters.ListOfModsFixed.Contains
                                                                                                                    ((b.ModificationType, b.IdWithMotif))).ToList();

            //add modification to Protein object
            var          dictHere  = new Dictionary <int, List <Modification> >();
            Modification modToAdd  = connorMod;
            Modification modToAdd2 = connorMod2;
            Modification modToAdd3 = connorMod3;
            Modification modToAdd4 = connorMod4;

            //add Fixed modifcation so can test if mod that is observed and not in DB
            fixedModifications.Add(connorMod4);
            listOfModsFixed.Add((connorMod4.ModificationType, connorMod4.IdWithMotif));

            dictHere.Add(1, new List <Modification> {
                modToAdd
            });
            dictHere.Add(2, new List <Modification> {
                modToAdd2
            });                                                    //default
            dictHere.Add(3, new List <Modification> {
                modToAdd3
            });                                                    //Alway Appear

            var dictHere2 = new Dictionary <int, List <Modification> >
            {
                { 1, new List <Modification> {
                      modToAdd
                  } },
                { 2, new List <Modification> {
                      modToAdd2
                  } },                                       //default
                { 3, new List <Modification> {
                      modToAdd3
                  } },                                       //Alway Appear
                { 4, new List <Modification> {
                      modToAdd4
                  } }                                      //observed
            };

            //protein Creation (One with mod and one without)
            Protein TestProteinWithModForDB    = new Protein("PPPPPPPPPPE", "accession1", "organism", new List <Tuple <string, string> >(), dictHere);
            Protein TestProteinWithModObsevred = new Protein("PPPPPPPPPPE", "accession1", "organism", new List <Tuple <string, string> >(), dictHere2);

            //First Write XML Database
            string xmlName  = "selectedMods.xml";
            string xmlName2 = "selectedModsObvs.xml";

            //Add Mod to list and write XML input database
            Dictionary <string, HashSet <Tuple <int, Modification> > > modList = new Dictionary <string, HashSet <Tuple <int, Modification> > >();
            var Hash = new HashSet <Tuple <int, Modification> >
            {
                new Tuple <int, Modification>(1, modToAdd),
                new Tuple <int, Modification>(2, modToAdd2),
                new Tuple <int, Modification>(3, modToAdd3),
                new Tuple <int, Modification>(4, modToAdd4), //Observed Only
            };

            modList.Add("test", Hash);
            ProteinDbWriter.WriteXmlDatabase(modList, new List <Protein> {
                TestProteinWithModForDB
            }, xmlName);

            //Add Observed Only
            modList.Add("test2", Hash);
            ProteinDbWriter.WriteXmlDatabase(modList, new List <Protein> {
                TestProteinWithModObsevred
            }, xmlName2);

            //now create MZML data
            var protein      = ProteinDbLoader.LoadProteinXML(xmlName2, true, DecoyType.Reverse, new List <Modification>(), false, new List <string>(), out Dictionary <string, Modification> ok);
            var digestedList = protein[0].Digest(task5.CommonParameters.DigestionParams, fixedModifications, variableModifications).ToList();

            //Set Peptide with 1 mod at position 3
            PeptideWithSetModifications pepWithSetMods1 = digestedList[0];
            PeptideWithSetModifications pepWithSetMods2 = digestedList[1];
            PeptideWithSetModifications pepWithSetMods3 = digestedList[2];
            PeptideWithSetModifications pepWithSetMods4 = digestedList[3];
            PeptideWithSetModifications pepWithSetMods5 = digestedList[4];

            //CUSTOM PEP
            MsDataFile myMsDataFile = new TestDataFile(new List <PeptideWithSetModifications>
            {
                pepWithSetMods1, pepWithSetMods2, pepWithSetMods3, pepWithSetMods4, pepWithSetMods5
            });
            string mzmlName = @"newMzml.mzML";

            IO.MzML.MzmlMethods.CreateAndWriteMyMzmlWithCalibratedSpectra(myMsDataFile, mzmlName, false);

            //make sure this runs correctly
            //run!
            string outputFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestUserModSelectionInPrunedDB");
            var    engine       = new EverythingRunnerEngine(taskList, new List <string> {
                mzmlName
            }, new List <DbForTask> {
                new DbForTask(xmlName, false)
            }, outputFolder);

            engine.Run();
            string final    = Path.Combine(MySetUpClass.outputFolder, "task5", "selectedModspruned.xml");
            var    proteins = ProteinDbLoader.LoadProteinXML(final, true, DecoyType.Reverse, new List <Modification>(), false, new List <string>(), out ok);
            var    Dlist    = proteins[0].GetVariantProteins().SelectMany(vp => vp.Digest(task5.CommonParameters.DigestionParams, fixedModifications, variableModifications)).ToList();

            Assert.AreEqual(Dlist[0].NumFixedMods, 1);

            //check length
            Assert.AreEqual(proteins[0].OneBasedPossibleLocalizedModifications.Count, 3);
            List <Modification> listOfLocalMods = new List <Modification>();

            listOfLocalMods.AddRange(proteins[0].OneBasedPossibleLocalizedModifications[2]);
            listOfLocalMods.AddRange(proteins[0].OneBasedPossibleLocalizedModifications[3]);
            listOfLocalMods.AddRange(proteins[0].OneBasedPossibleLocalizedModifications[11]);

            //check Type, count, ID
            Assert.AreEqual(listOfLocalMods[0].ModificationType, "Common Fixed");
            Assert.AreEqual(listOfLocalMods[2].ModificationType, "missing");
            Assert.IsFalse(listOfLocalMods.Contains(connorMod)); //make sure that mod set not to show up is not in mod list

            Assert.AreEqual(listOfLocalMods[0].IdWithMotif, "Default(Mod in DB and Observed) on P");
            Assert.AreEqual(listOfLocalMods[1].IdWithMotif, "ModToAlwaysAppear on P");
            //Makes sure Mod that was not in the DB but was observed is in pruned DB
            Assert.AreEqual(listOfLocalMods[2].IdWithMotif, "ModObservedNotinDB on E");
            Assert.AreEqual(listOfLocalMods.Count, 3);
            Directory.Delete(outputFolder, true);
            File.Delete(mzmlName);
            File.Delete(xmlName);
            File.Delete(xmlName2);
        }
示例#10
0
        public string GenerateTimePeriodCV(string startMonth, int?startYear, string endMonth, int?endYear)
        {
            string timePeriod = GlobalVariables.GenerateTimePeriodFormat(startMonth, startYear, endMonth, endYear);

            return(!string.IsNullOrWhiteSpace(timePeriod) ? timePeriod.Substring(1, timePeriod.Length - 2) : timePeriod);
        }
示例#11
0
 // Update is called once per frame
 void Update()
 {
     GlobalVariables.getGameTime().addSeconds(Time.deltaTime);
 }
示例#12
0
文件: ICP.cs 项目: whigg/PointClouds
        public PointCloud AlignCloudsFromDirectory_StartFromLast(string directory, int numberOfCloudPairs)
        {
            GlobalVariables.ResetTime();

            PointCloud pSource;
            PointCloud pTarget = null;


            string[] files      = System.IO.Directory.GetFiles(directory, "*.obj");
            string   pathResult = directory + "\\result";

            if (!System.IO.Directory.Exists(pathResult))
            {
                System.IO.Directory.CreateDirectory(pathResult);
            }

            int numberOfCloudsCurrent = 0;
            int numberOfCloudsResult  = -1;

            int iteratorFile = -1;

            for (int i = 0; i < 1000; i++)
            {
                numberOfCloudsCurrent++;
                iteratorFile++;

                if (numberOfCloudsCurrent == numberOfCloudPairs)
                {
                    numberOfCloudsCurrent = 1;
                    numberOfCloudsResult++;
                    pTarget.ToObjFile(pathResult + "\\Result" + numberOfCloudsResult.ToString() + ".obj");

                    // iteratorFile--;
                }
                if (pTarget != null && iteratorFile == (files.Length - 2))
                {
                    numberOfCloudsResult++;
                    pTarget.ToObjFile(pathResult + "\\Result" + numberOfCloudsResult.ToString() + ".obj");
                    return(pTarget);
                }
                //first iteration
                if (numberOfCloudsCurrent == 1)
                {
                    //pTarget = PointCloud.FromObjFile(files[iteratorFile]);
                    pTarget = PointCloud.FromObjFile(files[files.Length - iteratorFile - 1]);
                }


                //pSource = PointCloud.FromObjFile(files[iteratorFile + 1]);
                pSource = PointCloud.FromObjFile(files[files.Length - iteratorFile - 2]);



                //------------------
                //ICP

                Reset_RealData();



                pTarget = PerformICP(pSource, pTarget);
                System.Diagnostics.Debug.WriteLine("###### ICP for point cloud: " + pSource.Name + " - points added: " + PointsAdded.ToString());


                //   this.registrationMatrix = icp.Matrix;
                //   registrationMatrix.Save(GLSettings.Path + GLSettings.PathModels, "registrationMatrix.txt");
            }
            GlobalVariables.ShowLastTimeSpan("--> Time for ICP ");

            return(pTarget);
        }
示例#13
0
 public Visit(GlobalVariables.Visit.IVisit iVisit)
 {
     _iVisit = iVisit;
 }
示例#14
0
        private static int Run(CommandLineSettings settings)
        {
            if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
            {
                Console.WriteLine("Welcome to MetaMorpheus");
                Console.WriteLine(GlobalVariables.MetaMorpheusVersion);
            }

            int errorCode = 0;

            try
            {
                settings.ValidateCommandLineSettings();
                CommandLineSettings = settings;
            }
            catch (Exception e)
            {
                if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                {
                    Console.WriteLine("MetaMorpheus encountered the following error:" + Environment.NewLine + e.Message);
                }
                errorCode = 2;

                return(errorCode);
            }

            if (settings.GenerateDefaultTomls)
            {
                if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                {
                    Console.WriteLine("Generating default tomls at location: " + settings.OutputFolder);
                }
                CommandLineSettings.GenerateDefaultTaskTomls(settings.OutputFolder);

                return(errorCode);
            }

            // set up microvignette
            if (settings.RunMicroVignette)
            {
                // set up the spectra file
                settings.Spectra.Clear();
                settings.Spectra.Add(Path.Combine(GlobalVariables.DataDir, @"Data", "SmallCalibratible_Yeast.mzML"));

                // set up the database
                settings.Databases.Clear();
                settings.Databases.Add(Path.Combine(GlobalVariables.DataDir, @"Data", "SmallYeast.fasta"));

                // set up the tasks (calibration, GPTMD, search)
                settings.Tasks.Clear();
                CommandLineSettings.GenerateDefaultTaskTomls(settings.OutputFolder);
                settings.Tasks.Add(Path.Combine(settings.OutputFolder, "CalibrationTask.toml"));
                settings.Tasks.Add(Path.Combine(settings.OutputFolder, "GptmdTask.toml"));
                settings.Tasks.Add(Path.Combine(settings.OutputFolder, "SearchTask.toml"));
            }

            MetaMorpheusEngine.WarnHandler                 += WarnHandler;
            MetaMorpheusEngine.OutProgressHandler          += MyEngine_outProgressHandler;
            MetaMorpheusEngine.StartingSingleEngineHander  += MyEngine_startingSingleEngineHander;
            MetaMorpheusEngine.FinishedSingleEngineHandler += MyEngine_finishedSingleEngineHandler;

            MetaMorpheusTask.WarnHandler += WarnHandler;
            MetaMorpheusTask.LogHandler  += LogHandler;
            MetaMorpheusTask.StartingSingleTaskHander   += MyTaskEngine_startingSingleTaskHander;
            MetaMorpheusTask.FinishedSingleTaskHandler  += MyTaskEngine_finishedSingleTaskHandler;
            MetaMorpheusTask.FinishedWritingFileHandler += MyTaskEngine_finishedWritingFileHandler;

            bool containsRawFiles = settings.Spectra.Select(v => Path.GetExtension(v).ToLowerInvariant()).Any(v => v == ".raw");

            if (containsRawFiles && !GlobalVariables.GlobalSettings.UserHasAgreedToThermoRawFileReaderLicence)
            {
                // write the Thermo RawFileReader licence agreement
                Console.WriteLine(ThermoRawFileReader.ThermoRawFileReaderLicence.ThermoLicenceText);
                Console.WriteLine("\nIn order to search Thermo .raw files, you must agree to the above terms. Do you agree to the above terms? y/n\n");
                string res = Console.ReadLine().ToLowerInvariant();
                if (res == "y")
                {
                    var newGlobalSettings = new GlobalSettings
                    {
                        UserHasAgreedToThermoRawFileReaderLicence = true,
                        WriteExcelCompatibleTSVs = GlobalVariables.GlobalSettings.WriteExcelCompatibleTSVs
                    };

                    Toml.WriteFile <GlobalSettings>(newGlobalSettings, Path.Combine(GlobalVariables.DataDir, @"settings.toml"));
                    GlobalVariables.GlobalSettings = newGlobalSettings;
                }
                else
                {
                    Console.WriteLine("Thermo licence has been declined. Exiting MetaMorpheus. You can still search .mzML and .mgf files without agreeing to the Thermo licence.");
                    errorCode = 3;
                    return(errorCode);
                }
            }

            foreach (var db in settings.Databases)
            {
                if (!Path.GetExtension(db).Equals(".fasta"))
                {
                    GlobalVariables.AddMods(UsefulProteomicsDatabases.ProteinDbLoader.GetPtmListFromProteinXml(db).OfType <Modification>(), true);

                    // print any error messages reading the mods to the console
                    foreach (var error in GlobalVariables.ErrorsReadingMods)
                    {
                        if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                        {
                            Console.WriteLine(error);
                        }
                    }

                    GlobalVariables.ErrorsReadingMods.Clear();
                }
            }

            List <(string, MetaMorpheusTask)> taskList = new List <(string, MetaMorpheusTask)>();

            var tasks = settings.Tasks.ToList();

            for (int i = 0; i < tasks.Count; i++)
            {
                var filePath = tasks[i];

                var toml = Toml.ReadFile(filePath, MetaMorpheusTask.tomlConfig);

                switch (toml.Get <string>("TaskType"))
                {
                case "Search":
                    var searchTask = Toml.ReadFile <SearchTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "SearchTask", searchTask));
                    break;

                case "Calibrate":
                    var calibrationTask = Toml.ReadFile <CalibrationTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "CalibrationTask", calibrationTask));
                    break;

                case "Gptmd":
                    var GptmdTask = Toml.ReadFile <GptmdTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "GptmdTask", GptmdTask));
                    break;

                case "XLSearch":
                    var XlTask = Toml.ReadFile <XLSearchTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "XLSearchTask", XlTask));
                    break;

                case "GlycoSearch":
                    var GlycoTask = Toml.ReadFile <GlycoSearchTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "GlycoSearchTask", GlycoTask));
                    break;

                default:
                    if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                    {
                        Console.WriteLine(toml.Get <string>("TaskType") + " is not a known task type! Skipping.");
                    }
                    break;
                }
            }

            List <string>    startingRawFilenameList   = settings.Spectra.Select(b => Path.GetFullPath(b)).ToList();
            List <DbForTask> startingXmlDbFilenameList = settings.Databases.Select(b => new DbForTask(Path.GetFullPath(b), IsContaminant(b))).ToList();

            EverythingRunnerEngine a = new EverythingRunnerEngine(taskList, startingRawFilenameList, startingXmlDbFilenameList, settings.OutputFolder);

            try
            {
                a.Run();
            }
            catch (Exception e)
            {
                while (e.InnerException != null)
                {
                    e = e.InnerException;
                }

                var message = "Run failed, Exception: " + e.Message;

                if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                {
                    Console.WriteLine(message);
                }
                errorCode = 4;
            }

            return(errorCode);
        }
示例#15
0
        public static void TestPrunedDatabase()
        {
            //Create Search Task
            SearchTask task1 = new SearchTask
            {
                SearchParameters = new SearchParameters
                {
                    WritePrunedDatabase  = true,
                    SearchTarget         = true,
                    MassDiffAcceptorType = MassDiffAcceptorType.Exact,
                    ModsToWriteSelection = new Dictionary <string, int>
                    {
                        { "ConnorModType", 1 }
                    }
                },
                CommonParameters = new CommonParameters(digestionParams: new DigestionParams(minPeptideLength: 5))
            };

            //add task to task list
            List <(string, MetaMorpheusTask)> taskList = new List <(string, MetaMorpheusTask)>
            {
                ("task1", task1)
            };

            ModificationMotif.TryGetMotif("P", out ModificationMotif motif);

            var connorMod = new Modification(_originalId: "ConnorMod on P", _modificationType: "ConnorModType", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 10);

            GlobalVariables.AddMods(new List <Modification>
            {
                connorMod
            }, false);

            //create modification lists
            List <Modification> variableModifications = GlobalVariables.AllModsKnown.OfType <Modification>()
                                                        .Where(b => task1.CommonParameters.ListOfModsVariable.Contains((b.ModificationType, b.IdWithMotif))).ToList();

            //add modification to Protein object
            var          dictHere  = new Dictionary <int, List <Modification> >();
            Modification modToAdd  = connorMod;
            Modification modToAdd2 = connorMod;

            dictHere.Add(1, new List <Modification> {
                modToAdd
            });
            dictHere.Add(3, new List <Modification> {
                modToAdd2
            });

            //protein Creation (One with mod and one without)
            Protein TestProteinWithMod = new Protein("PEPTID", "accession1", "organism", new List <Tuple <string, string> >(), dictHere);

            //First Write XML Database
            string xmlName = "okkk.xml";

            //Add Mod to list and write XML input database
            Dictionary <string, HashSet <Tuple <int, Modification> > > modList = new Dictionary <string, HashSet <Tuple <int, Modification> > >();
            var Hash = new HashSet <Tuple <int, Modification> >
            {
                new Tuple <int, Modification>(3, modToAdd)
            };

            modList.Add("test", Hash);
            ProteinDbWriter.WriteXmlDatabase(modList, new List <Protein> {
                TestProteinWithMod
            }, xmlName);

            //now write MZML file
            var protein = ProteinDbLoader.LoadProteinXML(xmlName, true,
                                                         DecoyType.Reverse, new List <Modification>(), false, new List <string>(), out Dictionary <string, Modification> ok);

            //Dictionary 'ok' contains unknown modifications. There are no unknown modifications in this test.
            Assert.AreEqual(0, ok.Count);
            //One protein is read from the .xml database and one decoy is created. Therefore, the list of proteins contains 2 entries.
            Assert.AreEqual(2, protein.Count);
            //The original database had two localized mods on the protein. Therefore. both protein and decoy should have two mods.
            Assert.AreEqual(2, protein[0].OneBasedPossibleLocalizedModifications.Count);
            List <int> foundResidueIndicies   = protein[0].OneBasedPossibleLocalizedModifications.Select(k => k.Key).ToList();
            List <int> expectedResidueIndices = new List <int>()
            {
                1, 3
            };

            Assert.That(foundResidueIndicies, Is.EquivalentTo(expectedResidueIndices));
            Assert.AreEqual(2, protein[1].OneBasedPossibleLocalizedModifications.Count);
            foundResidueIndicies   = protein[1].OneBasedPossibleLocalizedModifications.Select(k => k.Key).ToList();
            expectedResidueIndices = new List <int>()
            {
                4, 6
            };                                                 //originally modified residues are now at the end in the decoy
            Assert.That(foundResidueIndicies, Is.EquivalentTo(expectedResidueIndices));

            var thisOk = ok;                                                      //for debugging
            var commonParamsAtThisPoint = task1.CommonParameters.DigestionParams; //for debugging

            var digestedList = protein[0].Digest(task1.CommonParameters.DigestionParams, new List <Modification> {
            },
                                                 variableModifications).ToList();

            Assert.AreEqual(4, digestedList.Count);

            //Set Peptide with 1 mod at position 3
            PeptideWithSetModifications pepWithSetMods1 = digestedList[1];

            //Finally Write MZML file
            Assert.AreEqual("PEP[ConnorModType:ConnorMod on P]TID", pepWithSetMods1.FullSequence);//this might be base sequence
            MsDataFile myMsDataFile = new TestDataFile(new List <PeptideWithSetModifications> {
                pepWithSetMods1
            });
            string mzmlName = @"hello.mzML";

            IO.MzML.MzmlMethods.CreateAndWriteMyMzmlWithCalibratedSpectra(myMsDataFile, mzmlName, false);

            //run!
            string outputFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestPrunedDatabase");
            var    engine       = new EverythingRunnerEngine(taskList, new List <string> {
                mzmlName
            },
                                                             new List <DbForTask> {
                new DbForTask(xmlName, false)
            }, outputFolder);

            engine.Run();

            string final = Path.Combine(MySetUpClass.outputFolder, "task1", "okkkpruned.xml");

            var proteins = ProteinDbLoader.LoadProteinXML(final, true, DecoyType.Reverse, new List <Modification>(), false, new List <string>(), out ok);

            //check length
            Assert.AreEqual(1, proteins[0].OneBasedPossibleLocalizedModifications.Count);
            //check location (key)
            Assert.AreEqual(true, proteins[0].OneBasedPossibleLocalizedModifications.ContainsKey(3));
            List <Modification> listOfMods = proteins[0].OneBasedPossibleLocalizedModifications[3];

            //check Type, count, ID
            Assert.AreEqual(listOfMods[0].ModificationType, "ConnorModType");
            Assert.AreEqual(listOfMods[0].IdWithMotif, "ConnorMod on P");
            Assert.AreEqual(listOfMods.Count, 1);
            Directory.Delete(outputFolder, true);
            File.Delete(xmlName);
            File.Delete(mzmlName);
        }
 public GlobalVariablesWrapper(GlobalVariables globalVariables)
 {
     this.globalVariables = globalVariables;
 }
示例#17
0
        private void LicenseTerms_Load(object sender, EventArgs e)
        {
            DateTime buildDate = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;

            this.labelVersion.Text = "Version 1.0." + GlobalVariables.ConfigVersionID(GlobalVariables.ConfigID).ToString() + ", Date: " + buildDate.ToString("dd/MM/yyyy HH:mm:ss");
        }
示例#18
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     CurrentFallingSpeed = RegularFallingSpeed;
 }
        public ActionResult Login(string command, AppUserLoginInfo data)
        {
            if (ModelState.IsValid)
            {
                switch (command)
                {
                case "Log In":
                    try
                    {
                        string MD5_Password = mainDAL.CalculateMD5Hash(data.Password);
                        User   _user        = db.Users.Where(w => w.Username.ToLower() == data.Username.ToLower() && w.Password == MD5_Password && !w.IsDeleted).FirstOrDefault();
                        if (_user != null)
                        {
                            string IsAdmin = _user.UserRole.RoleName == GlobalVariables.AdminRoleName ? "True" : "False";
                            GlobalVariables.StoreInCookie("NYCUser", IPGlobalProperties.GetIPGlobalProperties().DomainName, "Username", _user.Username, DateTime.Now.AddDays(2), false);
                            GlobalVariables.StoreInCookie("NYCUser", IPGlobalProperties.GetIPGlobalProperties().DomainName, "IsLogged", "True", DateTime.Now.AddDays(2), false);
                            GlobalVariables.StoreInCookie("NYCUser", IPGlobalProperties.GetIPGlobalProperties().DomainName, "IsAdmin", IsAdmin, DateTime.Now.AddDays(2), false);

                            if (MD5_Password == mainDAL.CalculateMD5Hash(GlobalVariables.InitPassword))
                            {
                                return(RedirectToAction("ChangePassword"));
                            }
                            else
                            {
                                return(RedirectToAction("Index", "Home"));
                            }
                        }
                        else
                        {
                            TempData["ErrorMessage"] = "Your username or password is not correct";
                            return(View(data));
                        }
                    }
                    catch (Exception ex)
                    {
                        string message = ex.InnerException != null ? "Message: " + ex.Message + Environment.NewLine + "InnerException: " + ex.InnerException.Message : "Message: " + ex.Message;
                        mainDAL.RecordInLogger("ERROR", "Login", message, "", "");
                        return(View(data));
                    }

                case "Sign Up":
                    try
                    {
                        if (db.Users.Any(w => w.Username.ToLower() == data.Username.ToLower()))
                        {
                            TempData["ErrorMessage"] = "This username is taken. Please choose other one";
                            return(View(data));
                        }
                        else
                        {
                            User _user = new User
                            {
                                Username  = data.Username,
                                Password  = mainDAL.CalculateMD5Hash(data.Password),
                                Role_ID   = GlobalVariables.ViewerRoleID,
                                IsDeleted = false
                            };
                            db.Users.Add(_user);
                            db.SaveChanges();
                            TempData["InfoMessage"] = "You are registered successfully";
                            return(RedirectToAction("Login"));
                        }
                    }
                    catch (Exception ex)
                    {
                        string message = ex.InnerException != null ? "Message: " + ex.Message + Environment.NewLine + "InnerException: " + ex.InnerException.Message : "Message: " + ex.Message;
                        mainDAL.RecordInLogger("ERROR", "Sign Up", message, "", "");
                        TempData["ErrorMessage"] = "Some error happens and you are not registered successfully";
                        return(View(data));
                    }
                }
            }

            return(View(data));
        }
 // Start is called before the first frame update
 void Start()
 {
     gameManager = GameObject.Find("GameManager");
     globalV     = gameManager.GetComponent <GlobalVariables>();
 }
示例#21
0
    private void checkInput()
    {
        if (!unitSelected)
        {
            // Check to see if the player made some input that we need to do something with
            for (int i = 0; i < 6; i++)
            {
                if (unitSelected = Input.GetKeyDown(unitKeys[i]))
                {
                    unitType = unitPrefabs[i];
                    if (isLeftSideBox)
                    {
                        GlobalVariables.leftSelectedUnit = i + 1;
                    }
                    else
                    {
                        GlobalVariables.rightSelectedUnit = i + 1;
                    }
                    break;
                }
            }
        }
        else if (unitSelected)
        {
            // Check all the selection keys to see if the player selected something
            for (int i = 0; i < 6; i++)
            {
                if (Input.GetKeyDown(unitKeys[i]))
                {
                    // If any unit is tried to be placed on any tile of the same side,
                    // go back to checking for a unit instead
                    unitSelected = false;

                    // De-highlight the unit summoned
                    if (isLeftSideBox)
                    {
                        GlobalVariables.leftSelectedUnit = -1;
                    }
                    else
                    {
                        GlobalVariables.rightSelectedUnit = -1;
                    }

                    // Only summon the unit corresponding to the key pressed and only if
                    // a unit is not summoned on that spot already
                    if (unitKeys[i] == selectionBoxKey && (currentUnit == null || currentUnit.GetComponent <Unit>().health <= 0))
                    {
                        // Check if we have the currency to buy the unit
                        // Check the left side if we are on it
                        if (isLeftSideBox)
                        {
                            if (!GlobalVariables.payLeftHoneyCount(1 + unitPrefabs.IndexOf(unitType)))
                            {
                                break;
                            }
                        }
                        // Otherwise check the right side
                        else
                        {
                            if (!GlobalVariables.payRightHoneyCount(1 + unitPrefabs.IndexOf(unitType)))
                            {
                                break;
                            }
                        }

                        // Summon the unit of the selected key
                        currentUnit = Instantiate(unitType, rigidbody2d.position, Quaternion.identity);

                        // If the unit is on the right, change it's direction
                        if (!isLeftSideBox)
                        {
                            currentUnit.GetComponent <Unit>().direction = -1;
                        }

                        // Hide the selection box since the unit was just summoned
                        unitAlive = true;
                        gameObject.GetComponent <Renderer>().enabled = false;

                        // Don't summon any more units
                        break;
                    }
                }
            }
        }
    }
示例#22
0
        private void BuildFile()
        {
            this.Enabled = false;
            string uploadKey = tbUploadKey.txtbox.Text;
            string time      = nudInterval.Value.ToString();
            string mutex     = Random();

            if (string.IsNullOrEmpty(uploadKey) || string.IsNullOrEmpty(time))
            {
                this.Enabled = true;
                return;
            }
            tbBuildLog.Text += "> Upload Key: " + uploadKey + Environment.NewLine;
            tbBuildLog.Text += "> Log Interval: " + time + Environment.NewLine;
            tbBuildLog.Text += "> Mutex: " + mutex + Environment.NewLine;


            bool   installFile = cbInstallFile.Checked;
            string processName = tbProcessName.txtbox.Text;
            string folder      = tbFolder.txtbox.Text;
            string directory   = cbDirectory.Text;

            bool   hkcu    = cbHKCU.Checked;
            bool   hklm    = cbHKLM.Checked;
            string hkcuKey = tbHKCU.txtbox.Text;
            string hklmKey = tbHKLM.txtbox.Text;

            bool meltFile        = cbMeltFile.Checked;
            bool antis           = cbAntis.Checked;
            bool sendScreenshots = cbSendScreenshots.Checked;
            bool hideFile        = cbHideFile.Checked;
            bool pinlogger       = cbPinlogger.Checked;

            bool stealers = cbStealers.Checked;

            string title       = tbTitle.txtbox.Text;
            string description = tbDescription.txtbox.Text;
            string product     = tbProduct.txtbox.Text;
            string copyright   = tbCopyright.txtbox.Text;
            string version     = tbVersion.txtbox.Text;
            string guid        = tbGUID.txtbox.Text;

            string iconPath   = tbIconPath.txtbox.Text;
            bool   changeIcon = !string.IsNullOrEmpty(tbIconPath.txtbox.Text);

            byte[] iconFile = null;
            if (changeIcon)
            {
                iconFile = File.ReadAllBytes(iconPath);
            }

            using (PayloadWriter pw = new PayloadWriter())
            {
                pw.WriteByte(0x03);
                pw.WriteString(uploadKey);
                pw.WriteString(time);
                pw.WriteString(mutex);
                pw.WriteBool(installFile);
                if (installFile)
                {
                    pw.WriteString(processName);
                    pw.WriteString(folder);
                    pw.WriteString(directory);
                }
                pw.WriteBool(hkcu);
                if (hkcu)
                {
                    pw.WriteString(hkcuKey);
                }
                pw.WriteBool(hklm);
                if (hklm)
                {
                    pw.WriteString(hklmKey);
                }


                pw.WriteBool(meltFile);
                pw.WriteBool(antis);
                pw.WriteBool(sendScreenshots);
                pw.WriteBool(hideFile);
                pw.WriteBool(pinlogger);

                pw.WriteBool(stealers);


                pw.WriteString(title);
                pw.WriteString(description);
                pw.WriteString(product);
                pw.WriteString(copyright);
                pw.WriteString(version);
                pw.WriteString(guid);

                pw.WriteBool(changeIcon);

                if (changeIcon)
                {
                    pw.WriteInteger(iconFile.Length);
                    pw.WriteBytes(iconFile);
                }

                byte[] packet = pw.ToByteArray();
                tbBuildLog.Text += "> Sending packet size: " + packet.Length + Environment.NewLine;
                GlobalVariables.SendData(packet);
            }
        }
    IEnumerator CUnpause()
    {
        yield return(new WaitForSecondsRealtime(1f));

        GlobalVariables.UnpauseGame(GlobalVariables.PauseSource.UI);
    }
示例#24
0
    private void Update()
    {
        RotateShip();
        if (Input.GetKeyDown(KeyCode.LeftControl))
        {
            cursorVisible = !cursorVisible;
            SetCursor();
        }
        float currentSpeed = shipSpeed;


        if (Input.GetKey(KeyCode.LeftShift))
        {
            currentSpeed *= shipBoostMultiplier;
            boosterEffect.Play();
            rayCam.fieldOfView = Mathf.Lerp(rayCam.fieldOfView, boostFov, Time.deltaTime);
        }
        else
        {
            boosterEffect.Stop();
            rayCam.fieldOfView = Mathf.Lerp(rayCam.fieldOfView, baseFOV, Time.deltaTime);
        }
        Vector3 dir           = transform.TransformDirection(Vector3.forward);
        float   forwardMotion = Input.GetAxisRaw("Vertical");

        //variables set when hyperspeeding
        if (GlobalVariables.isHyperspeed)
        {
            forwardMotion      = 1f;
            currentSpeed       = hyperdriveSpeed;
            rayCam.fieldOfView = Mathf.Lerp(rayCam.fieldOfView, hyperdriveFov, Time.deltaTime);
        }
        currentSpeed *= forwardMotion;
        GlobalVariables.playerSpeed = currentSpeed;
        if (GlobalVariables.CurrentPlanet == null)
        {
            currentSpeed *= Time.deltaTime;
        }
        Vector3d posDelta = new Vector3d(dir) * currentSpeed;

        if (GlobalVariables.CurrentPlanet == null)
        {
            GlobalVariables.AddPlayerWorldPos(posDelta);
        }
        else
        {
            Vector3 gravityUp = (transform.position - GlobalVariables.CurrentPlanet.transform.position).normalized;
            rigidbody.velocity = (Vector3)posDelta;
            if (rotationContrained)
            {
                Quaternion targetRot = Quaternion.FromToRotation(transform.up, gravityUp) * transform.rotation;
                transform.rotation = Quaternion.Slerp(transform.rotation, targetRot, rotationSmoothness * Time.deltaTime);
                float mouseY = Mathf.Abs(Input.GetAxis("Mouse Y"));
                if (mouseY > 0.8f)
                {
                    rotationContrained  = false;
                    constraintThreshold = 0;
                }
            }
            else
            {
                if (Vector3.Dot(transform.up, gravityUp) > 0.95)
                {
                    constraintThreshold += Time.deltaTime;
                }
                else
                {
                    constraintThreshold = 0;
                }
                if (constraintThreshold >= 2)
                {
                    rotationContrained  = true;
                    constraintThreshold = 0;
                }
            }

            GlobalVariables.AddPlayerWorldPos(transform.position);
        }
        if (GlobalVariables.isHyperspeed)
        {
            if (hyperSpeedTarget.transform.position.magnitude < hyperSpeedTarget.AtmosphereLevel)
            {
                StopHyperSpeed();
            }
        }
        cameraRay = new Ray(rayCam.transform.position, rayCam.transform.forward);

        if (Physics.Raycast(cameraRay, out hit, rayDistance, planetLayer))
        {
            Planet planet = hit.transform.parent.GetComponent <Planet>();
            UiHandler.instance.ShowPlanetPanel(planet);
            if (Input.GetKeyDown(KeyCode.F) && GlobalVariables.CurrentPlanet == null)
            {
                if (!GlobalVariables.isHyperspeed)
                {
                    GlobalVariables.isHyperspeed = true;
                    hyperSpeedTarget             = planet;

                    hyperDriveEffect.Play();
                    CameraShake.instance.Shake(x, y, hyperdriveShakeMagnitude, hyperdriveSmoothness);
                }
                else
                {
                    StopHyperSpeed();
                }
            }
        }
        else
        {
            UiHandler.instance.HidePlanetPanel();
        }
    }
示例#25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IVR"/> class.
        /// </summary>
        /// <param name="client"><see cref="SwitchvoxClient"/> methods will use to communicate with the phone server.</param>
        internal IVR(SwitchvoxClient client)
        {
            this.client = client;

            GlobalVariables = new GlobalVariables(client);
        }
示例#26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        /// <param name="ilg"></param>
        /// <param name="scope"></param>
        /// <param name="args"></param>
        /// <exception cref="DynException"></exception>
        public void EmitExpression(DynAstNodeExpression e, ILGenerator ilg, Dictionary <string, LocalBuilder> scope, Dictionary <string, int> args)
        {
            if (e.Operation is null)
            {
                EmitOperand(e.Left, ilg, scope, args);
                return;
            }

            switch (e.Operation.Token)
            {
            case DynToken.SymbolEqual:
            {
                if (e.Left.Lexeme.Token != DynToken.Identifier)
                {
                    throw new DynException($"语法错误,赋值操作只可作用于左值。");
                }
                // Right
                EmitExpression(e.Right, ilg, scope, args);

                if (GlobalVariables.Contains(e.Left.Lexeme.Identifier))
                {
                    ilg.Emit(OpCodes.Stfld, e.Left.Lexeme.Identifier);
                    break;
                }
                if (!scope.ContainsKey(e.Left.Lexeme.Identifier))
                {
                    LocalBuilder lbt = ilg.DeclareLocal(anyType);
                    scope.Add(e.Left.Lexeme.Identifier, lbt);
                }
                LocalBuilder lb = scope[e.Left.Lexeme.Identifier];
                ilg.Emit(OpCodes.Stloc, lb.LocalIndex);
                break;
            }

            case DynToken.SymbolPlus:
            {
                // Left
                EmitOperand(e.Left, ilg, scope, args);

                // Right
                EmitExpression(e.Right, ilg, scope, args);

                //ilg.Emit(OpCodes.Add);
                ilg.Emit(OpCodes.Call, anyType.GetMethod("add_operator"));
                break;
            }

            case DynToken.SymbolMinus:
            {
                // Left
                EmitOperand(e.Left, ilg, scope, args);

                // Right
                EmitExpression(e.Right, ilg, scope, args);

                ilg.Emit(OpCodes.Sub);
                break;
            }

            case DynToken.SymbolStar:
            {
                // Left
                EmitOperand(e.Left, ilg, scope, args);

                // Right
                EmitExpression(e.Right, ilg, scope, args);

                ilg.Emit(OpCodes.Mul);
                break;
            }

            default:
                throw new DynException($"语法错误,未知的表达式 {e.Operation}");
            }
        }
示例#27
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            SaveUsers();

            GlobalVariables.Log("Użytkownik dodał nowego użytkownika");
        }
示例#28
0
 public void Quit()
 {
     GlobalVariables.SoundButton();
     Application.Quit();
 }
示例#29
0
        private static int Run(CommandLineSettings settings)
        {
            int errorCode = 0;

            if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
            {
                Console.WriteLine("Welcome to MetaMorpheus");
            }

            if (settings.CustomDataDirectory != null)
            {
                GlobalVariables.UserSpecifiedDataDir = settings.CustomDataDirectory;
            }

            GlobalVariables.SetUpGlobalVariables();

            if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
            {
                Console.WriteLine(GlobalVariables.MetaMorpheusVersion);
            }

            try
            {
                settings.ValidateCommandLineSettings();
                CommandLineSettings = settings;
            }
            catch (Exception e)
            {
                if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                {
                    Console.WriteLine("MetaMorpheus encountered the following error:" + Environment.NewLine + e.Message);
                }
                errorCode = 2;

                return(errorCode);
            }

            if (settings.GenerateDefaultTomls)
            {
                if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                {
                    Console.WriteLine("Generating default tomls at location: " + settings.OutputFolder);
                }
                CommandLineSettings.GenerateDefaultTaskTomls(settings.OutputFolder);

                return(errorCode);
            }

            // set up microvignette
            if (settings.RunMicroVignette)
            {
                // set up the spectra file
                settings.Spectra.Clear();
                settings.Spectra.Add(Path.Combine(GlobalVariables.DataDir, @"Data", "SmallCalibratible_Yeast.mzML"));

                // set up the database
                settings.Databases.Clear();
                settings.Databases.Add(Path.Combine(GlobalVariables.DataDir, @"Data", "SmallYeast.fasta"));

                // set up the tasks (calibration, GPTMD, search)
                settings.Tasks.Clear();
                CommandLineSettings.GenerateDefaultTaskTomls(settings.OutputFolder);
                settings.Tasks.Add(Path.Combine(settings.OutputFolder, "CalibrationTask.toml"));
                settings.Tasks.Add(Path.Combine(settings.OutputFolder, "GptmdTask.toml"));
                settings.Tasks.Add(Path.Combine(settings.OutputFolder, "SearchTask.toml"));
            }

            MetaMorpheusEngine.WarnHandler                 += WarnHandler;
            MetaMorpheusEngine.OutProgressHandler          += MyEngine_outProgressHandler;
            MetaMorpheusEngine.StartingSingleEngineHander  += MyEngine_startingSingleEngineHander;
            MetaMorpheusEngine.FinishedSingleEngineHandler += MyEngine_finishedSingleEngineHandler;

            MetaMorpheusTask.WarnHandler += WarnHandler;
            MetaMorpheusTask.LogHandler  += LogHandler;
            MetaMorpheusTask.StartingSingleTaskHander   += MyTaskEngine_startingSingleTaskHander;
            MetaMorpheusTask.FinishedSingleTaskHandler  += MyTaskEngine_finishedSingleTaskHandler;
            MetaMorpheusTask.FinishedWritingFileHandler += MyTaskEngine_finishedWritingFileHandler;

            bool containsRawFiles = settings.Spectra.Select(v => Path.GetExtension(v).ToLowerInvariant()).Any(v => v == ".raw");

            if (containsRawFiles && !GlobalVariables.GlobalSettings.UserHasAgreedToThermoRawFileReaderLicence)
            {
                // write the Thermo RawFileReader licence agreement
                Console.WriteLine(ThermoRawFileReaderLicence.ThermoLicenceText);
                Console.WriteLine("\nIn order to search Thermo .raw files, you must agree to the above terms. Do you agree to the above terms? y/n\n");
                string res = Console.ReadLine().ToLowerInvariant();
                if (res == "y")
                {
                    var newGlobalSettings = new GlobalSettings
                    {
                        UserHasAgreedToThermoRawFileReaderLicence = true,
                        WriteExcelCompatibleTSVs = GlobalVariables.GlobalSettings.WriteExcelCompatibleTSVs
                    };

                    Toml.WriteFile <GlobalSettings>(newGlobalSettings, Path.Combine(GlobalVariables.DataDir, @"settings.toml"));
                    GlobalVariables.GlobalSettings = newGlobalSettings;
                }
                else
                {
                    Console.WriteLine("Thermo licence has been declined. Exiting MetaMorpheus. You can still search .mzML and .mgf files without agreeing to the Thermo licence.");
                    errorCode = 3;
                    return(errorCode);
                }
            }

            foreach (var db in settings.Databases)
            {
                if (!Path.GetExtension(db).Equals(".fasta"))
                {
                    GlobalVariables.AddMods(UsefulProteomicsDatabases.ProteinDbLoader.GetPtmListFromProteinXml(db).OfType <Modification>(), true);

                    // print any error messages reading the mods to the console
                    foreach (var error in GlobalVariables.ErrorsReadingMods)
                    {
                        if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                        {
                            Console.WriteLine(error);
                        }
                    }

                    GlobalVariables.ErrorsReadingMods.Clear();
                }
            }

            List <(string, MetaMorpheusTask)> taskList = new List <(string, MetaMorpheusTask)>();

            var tasks = settings.Tasks.ToList();

            for (int i = 0; i < tasks.Count; i++)
            {
                var filePath = tasks[i];

                var toml = Toml.ReadFile(filePath, MetaMorpheusTask.tomlConfig);

                switch (toml.Get <string>("TaskType"))
                {
                case "Search":
                    var searchTask = Toml.ReadFile <SearchTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "SearchTask", searchTask));
                    break;

                case "Calibrate":
                    var calibrationTask = Toml.ReadFile <CalibrationTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "CalibrationTask", calibrationTask));
                    break;

                case "Gptmd":
                    var GptmdTask = Toml.ReadFile <GptmdTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "GptmdTask", GptmdTask));
                    break;

                case "XLSearch":
                    var XlTask = Toml.ReadFile <XLSearchTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "XLSearchTask", XlTask));
                    break;

                case "GlycoSearch":
                    var GlycoTask = Toml.ReadFile <GlycoSearchTask>(filePath, MetaMorpheusTask.tomlConfig);
                    taskList.Add(("Task" + (i + 1) + "GlycoSearchTask", GlycoTask));
                    break;

                default:
                    if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                    {
                        Console.WriteLine(toml.Get <string>("TaskType") + " is not a known task type! Skipping.");
                    }
                    break;
                }
            }

            List <string>    startingRawFilenameList   = settings.Spectra.Select(b => Path.GetFullPath(b)).ToList();
            List <DbForTask> startingXmlDbFilenameList = settings.Databases.Select(b => new DbForTask(Path.GetFullPath(b), IsContaminant(b))).ToList();

            // check that experimental design is defined if normalization is enabled
            var searchTasks = taskList
                              .Where(p => p.Item2.TaskType == MyTask.Search)
                              .Select(p => (SearchTask)p.Item2);

            string pathToExperDesign = Directory.GetParent(startingRawFilenameList.First()).FullName;

            pathToExperDesign = Path.Combine(pathToExperDesign, GlobalVariables.ExperimentalDesignFileName);

            if (!File.Exists(pathToExperDesign))
            {
                if (searchTasks.Any(p => p.SearchParameters.Normalize))
                {
                    if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                    {
                        Console.WriteLine("Experimental design file was missing! This must be defined to do normalization. Download a template from https://github.com/smith-chem-wisc/MetaMorpheus/wiki/Experimental-Design");
                    }
                    return(5);
                }
            }
            else
            {
                ExperimentalDesign.ReadExperimentalDesign(pathToExperDesign, startingRawFilenameList, out var errors);

                if (errors.Any())
                {
                    if (searchTasks.Any(p => p.SearchParameters.Normalize))
                    {
                        if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                        {
                            foreach (var error in errors)
                            {
                                Console.WriteLine(error);
                            }
                        }
                        return(5);
                    }
                    else
                    {
                        if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                        {
                            Console.WriteLine("An experimental design file was found, but an error " +
                                              "occurred reading it. Do you wish to continue with an empty experimental design? (This will delete your experimental design file) y/n" +
                                              "\nThe error was: " + errors.First());

                            var result = Console.ReadLine();

                            if (result.ToLowerInvariant() == "y" || result.ToLowerInvariant() == "yes")
                            {
                                File.Delete(pathToExperDesign);
                            }
                            else
                            {
                                return(5);
                            }
                        }
                        else
                        {
                            // just continue on if verbosity is on "none"
                            File.Delete(pathToExperDesign);
                        }
                    }
                }
                else
                {
                    if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                    {
                        Console.WriteLine("Read ExperimentalDesign.tsv successfully");
                    }
                }
            }

            EverythingRunnerEngine a = new EverythingRunnerEngine(taskList, startingRawFilenameList, startingXmlDbFilenameList, settings.OutputFolder, settings.OrfCallingTables);

            try
            {
                a.Run();
            }
            catch (Exception e)
            {
                while (e.InnerException != null)
                {
                    e = e.InnerException;
                }

                var message = "Run failed, Exception: " + e.Message;

                if (settings.Verbosity == CommandLineSettings.VerbosityType.minimal || settings.Verbosity == CommandLineSettings.VerbosityType.normal)
                {
                    Console.WriteLine(message);
                }
                errorCode = 4;
            }

            return(errorCode);
        }
示例#30
0
 private void Awake()
 {
     GV  = GameObject.FindGameObjectWithTag("GameController").GetComponent <GlobalVariables>();
     buy = GameObject.FindGameObjectWithTag("GameController").GetComponent <PurchaseHandler>();
     btn = this.GetComponent <Button>();
 }
示例#31
0
 public HealthSystem(Game1 myGame)
 {
     EntityManager   = myGame.EntityManager;
     GlobalVariables = myGame.globalVariables;
     Subscribtions   = new List <int>();
 }
示例#32
0
 public void DeleteCareer(string id)
 {
     GlobalVariables.XmlData.Descendants("careers").Elements("career").Where(i => i.Element("id").Value.Equals(id)).Remove();
     GlobalVariables.XmlData.Save(HttpContext.Current.Server.MapPath(GlobalVariables.XmlPath));
     GlobalVariables.Update();
 }
示例#33
0
 public int GenerateUserID()
 {
     return(GlobalVariables.GetMaxUserID() + 1);
     // return Random.Range(0, 100);
 }
示例#34
0
        public ActionResult ServiceChargeExpenditure(int PropID = 0, string PropName = "")
        {
            if (Session["CustomerID"] != null || (int)Session["CustomerID"] != 0)
            {
                Models.ServiceChargeBudgetViewModel mv = new Models.ServiceChargeBudgetViewModel();

                if (PropID > 0)
                {
                    Session["SelectedPropertyID"] = PropID;
                    Session["SelectedProperty"]   = PropName;
                    Session["IsDirector"]         = EstateDirectors.EstateDirectorMethods.IsCustomerDirector(GlobalVariables.GetConnection(), PropID).ToString();
                }

                if (Session["SelectedPropertyID"] == null || (int)Session["SelectedPropertyID"] == 0)
                {
                    //Get Property List

                    mv.PropertyList   = Models.PropertyMethods.GetAllOwnedProperties((int)Session["CustomerID"]);
                    mv.ViewName       = "ServiceChargeExpenditure";
                    mv.ControllerName = "ServiceCharges";
                }
                else
                {
                    mv.Estate = Models.EstateMethods.GetEstatedByUnitID((int)Session["SelectedPropertyID"]);
                    mv.Estate = Models.EstateMethods.GetServiceChargeExpenditure(mv.Estate);
                }

                return(View("ServiceChargeExpenditure", mv));
            }
            else
            {
                return(View("../Home/NotLoggedIn"));
            }
        }
示例#35
0
 public void Awake()
 {
     inst = this;
     DontDestroyOnLoad(gameObject);
 }