Inheritance: MonoBehaviour
Exemple #1
1
 public frmTermoNovo(Usuario user, String terId)
 {
     InitializeComponent();
     ter = new Termo();
     util = new Utils();
     this.user = user;
     lblUserOn.Text = user.Login;
     alu = new Aluno();
     if (terId != "") //atualizar
     {
         lblUltimaAlter.Visible = true;
         lblUltimaAlter1.Visible = true;
         ter.TerId = terId;
         ter = ter.getTermoById();
         userTermo = new Usuario();
         userTermo.Id = Convert.ToInt32(ter.TerQuemCadastrou);
         userTermo = userTermo.getUserById();
         lblUltimaAlter.Text = userTermo.Login;
         btnSelecionar.Visible = false;
         alu.TerId = terId;
         ttbAluno.Text = alu.getAlunoByTermo();
         pictureBox1.ImageLocation = fotoPath + "" + ter.TerId + ".jpg";
     }
     else
     {
         lblUltimaAlter.Visible = false;
         lblUltimaAlter1.Visible = false;
     }
 }
Exemple #2
0
 public void ActionParameters_constants()
 {
     Expression<Action<string>> a = s => s.Replace("a", "b");
     IDictionary d = new Utils().GetActionParameters(a);
     Assert.AreEqual("a", d["oldValue"]);
     Assert.AreEqual("b", d["newValue"]);
 }
Exemple #3
0
 public void ActionParameters_MethodCall()
 {
     Expression<Action<string>> a = s => s.Replace("a", GetString());
     IDictionary d = new Utils().GetActionParameters(a);
     Assert.AreEqual("a", d["oldValue"]);
     Assert.AreEqual("something", d["newValue"]);
 }
Exemple #4
0
 public override void Run(DataAdapters.IDataAdapter adapter, Utils.Logger logger)
 {
     while (adapter.Read() != null)
     {
         // Do not alot
     }
 }
Exemple #5
0
        public double[,] agregar(List<KRankPonderado> listaKRanking)
        {
            Utils utils= new Utils();

            normalizarPesos(listaKRanking);

            int dimension = listaKRanking[1].KRanking.GetLength(0);

            double[,] rankAgregado = new double[dimension, 1];

               // utils.Cerar(rankAgregado, dimension);

            foreach (var kRankPonderado in listaKRanking)
            {

                for (int i = 0; i < dimension; i++)
                {

                        rankAgregado[i, 0] += kRankPonderado.KRanking[i, 0]*kRankPonderado.PesoPonderado;

                }

            }
            return rankAgregado;
        }
        public void SetContent(Utils.PatientNote[] patientNotesArray, int aTotalNrofVisits, int aNrofFreecards, int aNrofPatientPays, int aNrofYouths)
        {
            StringBuilder s = new StringBuilder();
            StringBuilder footer = new StringBuilder();

            footer.Append("\n\nTotalt antal besök: " + aTotalNrofVisits);
            footer.Append("\nAntal frikkortsbesök: " + aNrofFreecards);
            footer.Append("\nAntal besök där patienten betlat själv: " + aNrofPatientPays);
            footer.Append("\nAntal besök barn och ungdom: " + aNrofYouths);

            foreach(Utils.PatientNote patientNote in patientNotesArray)
            {
                Charge tmpCharge = patientNote.charge;
                Note tmpNote = patientNote.note;
                Patient tmpPatient = patientNote.patient;

                s.Append("\n" + tmpNote.VisitDateTime.ToShortDateString());
                s.Append("\t" + tmpPatient.Surname + " " + tmpPatient.Firstname);
                s.Append("\t" + tmpPatient.Personnumber);
                s.Append("\t" + tmpNote.PatientFee + " kr");
                s.Append("\t" + tmpCharge.PrimulaCharachter);

                //TODO: Make sure that if one row is longer than the width of the page, cut some chars from the name
            }

            contentString = s.ToString();
            contentFooter = footer.ToString();
        }
 internal static Hashtable GetTVSeriesName(Utils.Category category)
 {
     var hashtable = new Hashtable();
       try
       {
     var allSeries = DBOnlineSeries.getAllSeries();
     if (allSeries != null)
     {
       foreach (var series in allSeries)
       {
     DBSeries mytv = Helper.getCorrespondingSeries(series[DBOnlineSeries.cID]);
     if (mytv != null)
     {
       var SeriesName = Utils.GetArtist(mytv[DBSeries.cParsedName], category);
       string seriesId = mytv[DBSeries.cID];
       // logger.Debug("*** "+seriesId + " - " + SeriesName + " - " + mytv[DBSeries.cParsedName] + " - " + mytv);
       if (!hashtable.Contains(seriesId))
       {
         // hashtable.Add(seriesId, SeriesName);
         hashtable.Add(seriesId, mytv.ToString());
       }
     }
       }
     }
     if (allSeries != null)
       allSeries.Clear();
       }
       catch (Exception ex)
       {
     logger.Error("GetTVSeriesName: " + ex);
       }
       return hashtable;
 }
Exemple #8
0
 public static string SignRequst(HttpWebRequest request, Utils.RequestHeadType type, string bucket, string key)
 {
     string Authorization = string.Empty;
     string StringToSign = string.Empty;
     switch (type) {
     case Utils.RequestHeadType.HEAD_FIELD_CHECK:
         Authorization += "UCloud ";
         Authorization += Config.UCLOUD_PUBLIC_KEY;
         Authorization += ":";
         StringToSign = request.Method + "\n" + request.Headers.Get ("Content-MD5") + "\n";
         StringToSign += request.ContentType;
         StringToSign += "\n";
         /*
         StringToSign += DateTime.Now.ToString ();
         */
         StringToSign += "\n";
         StringToSign += CanonicalizedUCloudHeaders (request.Headers);
         StringToSign += CanonicalizedResource (bucket, key);
             break;
         default:
             break;
     }
     HMACSHA1 hmac = new HMACSHA1 (Encoding.ASCII.GetBytes (Config.UCLOUD_PRIVATE_KEY));
     Byte[] hashValue = hmac.ComputeHash(Encoding.UTF8.GetBytes(StringToSign));
     string Signature = Convert.ToBase64String (hashValue);
     return Authorization + Signature;
 }
Exemple #9
0
 /// <summary>
 /// Ao clicar no botão ok mando a informação para o form stoploss
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonOk_Click(object sender, EventArgs e)
 {
     Int64 hand = new Utils().stringtoInt64(textBoxStopHand.Text);
     Double loss = new Utils().stringtoDouble(textBoxStopLoss.Text);
     Int32 time = new Utils().stringtoInt32(textBoxStopTime.Text);
     Double win = new Utils().stringtoDouble(textBoxStopWin.Text);
     Double losspeak = new Utils().stringtoDouble(textBoxStopLossPeak.Text);
     Double peakover = new Utils().stringtoDouble(textBoxPeakOver.Text);
     Double wininter = new Utils().stringtoDouble(textBoxStopWinIntermediate.Text);
     Double lossinter = new Utils().stringtoDouble(textBoxStopLossIntermediate.Text);
     Boolean continu = true;
     if (wininter >= win && wininter != 0)
     {
         labelAlertIntermediate.Text = "Stopwin intermediate don't superior at stopwin final";
         continu = false;
     }
     if (lossinter >= loss && lossinter != 0 && continu)
     {
         labelAlertIntermediate.Text = "StopLoss intermediate don't superior at stopLoss final";
         continu = false;
     }
     if(continu)
     {
         sl.setNewValue(hand, loss, time, win, losspeak, peakover, checkBoxHideBbbs.Checked, wininter, lossinter);
         this.Close();
     }
 }
Exemple #10
0
        public void Titles()
        {
            var text = @"grammar Titles
            defs
            Expr : TextOrSubExpr*
            TextOrSubExpr : Text | SubExpr
            SubExpr : openCurly Text closeCurly
            patterns
            openCurly :'{'
            closeCurly : '}'
            colon : ':'
            Text : '^[a-zA-Z1-9_]+$'
            ";
            var utils = new Utils();

            Parsing.Core.GrammarDef.Parser parser = new Parsing.Core.GrammarDef.Parser();

            var root = parser.Parse(text);

            utils.NodeToString(root);

            var builder = new Builder();

            var grammar = builder.BuildGrammar(root);

            File.WriteAllText(@"C:\Temp\Parsing\V2.TitleBuilder\Lexer.cs", builder.BuildLexer(grammar));
            File.WriteAllText(@"C:\Temp\Parsing\V2.TitleBuilder\Parser.cs", builder.BuildParser2(grammar));
            File.WriteAllText(@"C:\Temp\Parsing\V2.TitleBuilder\NodeType.cs", builder.BuildNodeType(grammar));
            File.WriteAllText(@"C:\Temp\Parsing\V2.TitleBuilder\TokenType.cs", builder.BuildTokenType(grammar));

            builder.BuildLexer(grammar);
        }
Exemple #11
0
 public void ActionParameters_DataBind_Nested()
 {
     Expression<Action<SmartTest2Controller>> a =
         c => c.DataBindingNested(new PropertiesNested {Prop = new Properties {SomeValue = 25}});
     IDictionary d = new Utils().GetActionParameters(a);
     Assert.AreEqual(25, d["pre.Prop.SomeValue"]);
 }
Exemple #12
0
        public void BuildGrammar()
        {
            var utils = new Utils();

            var builder = new Builder();

            var text = GetDef<Core.GrammarDef.Parser>();

            Core.GrammarDef.Parser parser = new Core.GrammarDef.Parser();

            Node<Core.GrammarDef.NodeType> root = parser.Parse(text);

            builder.PreProcess(root);

            File.WriteAllText(@"C:\temp\node.txt", utils.NodeToString(root));

            Grammar grammar = builder.BuildGrammar(root);

            var actual = utils.GrammarToDefString(grammar);

            Assert.That(actual, Is.EqualTo(text));

            File.WriteAllText(@"C:\temp\parser.cs", builder.BuildParser2(grammar));

            //var parser2 = builder.CreateParser(grammar);
            //
            //var root2 = parser2.GetType().GetMethod("Parse").Invoke(parser2, new object[] { text });
        }
  public static int    curLine, curCol;     // position of curCh


  public static void BinaryTreeLexMethod(Utils.ModuleAction action, out String moduleName) {
  //-----------------------------------|----------------------------------------
    moduleName = MODULENAME;
    switch (action) {
      case Utils.ModuleAction.getModuleName:
        return;
      case Utils.ModuleAction.initModule:
        caseSensitive = true;
        lt            = new LexicalTable();
        tokenStrArr   = new char[256];
        kwHt          = CreateHashtable();
        nHt           = CreateHashtable();
        nl            = new ArrayList();
        break;
      case Utils.ModuleAction.resetModule:
        kwHt.Clear();
        nHt.Clear();
        nl.Clear();
        break;
      case Utils.ModuleAction.cleanupModule:
        lt            = null;
        tokenStrArr   = null;
        kwHt          = null;
        nHt           = null;
        nl            = null;
        break;
    } // switch
  } // BinaryTreeLexMethod
Exemple #14
0
        public void CommaSeperatedNames()
        {
            var text = @"grammar CommaSeperatedNames
            defs
            Name : Identifier
            Names : Name [comma Name]*
            patterns
            comma : ','
            Identifier : '^[a-zA-Z_][a-zA-Z1-9_]*$'
            ";
            var utils = new Utils();

            Core.GrammarDef.Parser parser = new Core.GrammarDef.Parser();

            var root = parser.Parse(text);

            utils.NodeToString(root);

            var builder = new Builder();

            var grammar = builder.BuildGrammar(root);

            var actual = utils.GrammarToDefString(grammar);

            Assert.That(actual, Is.EqualTo(text));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Utils utils = new Utils();
            InsecureCookieProtocol insecure = new InsecureCookieProtocol();
            FuCookieProtocol fu = new FuCookieProtocol();
            OtherCookieProtocol other = new OtherCookieProtocol();
            OurCookieProtocol our = new OurCookieProtocol();

            Label1.Text = "Fu's cookie creation time = " + utils.calculateAverage("fu_cookie_creation_times").ToString() + "<br/>"
                + "Fu's cookie verification time = " + utils.calculateAverage("fu_cookie_verification_times").ToString() + "<br/>"
                + "Other cookie creation time = " + utils.calculateAverage("other_cookie_creation_times").ToString() + "<br/>"
                + "Other cookie verification time = " + utils.calculateAverage("other_cookie_verification_times").ToString() + "<br/>"
                + "Our cookie creation time = " + utils.calculateAverage("our_cookie_creation_times").ToString() + "<br/>"
                + "Our cookie verification time = " + utils.calculateAverage("our_cookie_verification_times").ToString() + "<br/>"
                + "Insecure cookie creation time = " + utils.calculateAverage("Insecure_cookie_creation_times").ToString() + "<br/>"
                + "Insecure cookie verification time = " + utils.calculateAverage("Insecure_cookie_verification_times").ToString() + "<br/>"
                ;

            /*

            HttpCookie cc = insecure.create();
            HttpCookie fucookie = fu.create();
            HttpCookie othercookie = other.create();
            HttpCookie ourcookie = our.create();

            insecure.verification(Request.Cookies["InsecureCookieProtocol"]);
            fu.verification(Request.Cookies["FuCookieProtocol"]);
            other.verification(Request.Cookies["OtherCookieProtocol"]);
            our.verification(Request.Cookies["OurCookieProtocol"]);
            */
        }
Exemple #16
0
        public static void Game_OnGameLoad()
        {
            if (Player.ChampionName != ChampionName)
                return;

            Spells.Initiate();

            Config = MainMenu.AddMenu(string.Format("xQx | {0}", ChampionName), ChampionName);

            PlayerSpells.Initialize();

            DamageCalc = new DamageCalc();
            Utils = new Utils();
            Menu = new Menu();
            Items = new Items();

            Draws = new Draws();
            Combo = new Combo();
            Harass = new Harass();
            LaneClear = new LaneClear();
            JungleClear = new JungleClear();
            OnUpdate = new OnUpdate();
            LogicW.Initiate();

            Config.Add("GameMode", new ComboBox("Game Mode:", 0, "AP", "AD", "Hybrid", "Tanky"));

            Chat.Print(
                "Mordekasier</font> <font color='#ff3232'> How to Train Your Dragon </font> <font color='#FFFFFF'>Loaded!</font>");
        }
Exemple #17
0
 public MakeXMLSAT(DadosSAT _dtSAT, Utils.ConfigureXml _config)
 {
     config = _config;
     dtSAT = _dtSAT;
     
     processXml();
 }
 public frmErga_Single(long fldProjectID, long fldParentProjectID, Utils.enums.formState inState)
 {
     InitializeComponent();
     _fldProjectID = fldProjectID;
     _fldParentProjectID = fldParentProjectID;
     fState = inState;
 }
	private IEnumerator GetHit(float amount, GameObject attacker) {
		if (attacker != null) {
			RaycastHit hit;
	
			if (playerScript.isBlocking) {	


					Utils utils = new Utils ();
					Utils.DIRECTION dir = utils.getDirection (transform.position, attacker.transform.position, transform.forward, transform.right);
					if (dir == Utils.DIRECTION.FRONT) {
							playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Once;
							yield return StartCoroutine (Utils.WaitForAnimation 
	                             (playerScript.shieldBlookAnimation, .2f, true, playerScript.model)
							);
							Soldier soldierScript = attacker.GetComponent<Soldier> ();
							soldierScript.state = Soldier.STATES.GotBlocked;
					} else {
							if (attacker != null)
									GotHitAnimation (attacker.transform.position);
					}
			} else {
					//health -= amount;
					if (attacker != null)
							GotHitAnimation (attacker.transform.position);
			}
		}
	}
Exemple #20
0
 public static void ErrorsMethod(Utils.ModuleAction action, out String moduleName) {
   //-----------------------------------|----------------------------------------
   moduleName = MODULENAME;
   switch (action) {
     case Utils.ModuleAction.getModuleName:
       return;
     case Utils.ModuleAction.initModule:
       aps = new AbortMethod[MAXABORTPROCS];
       sp = 0;
       PushAbortMethod(DefaultAbort);
       stopParsing = null;
       eowCnt = new int[4];
       curEoW = new ErrorWarn[4];
       break;
     case Utils.ModuleAction.resetModule:
       break;
     case Utils.ModuleAction.cleanupModule:
       eowl = null;
       eowCnt = null;
       curEoW = null;
       return;
   } // switch
   // --- for initModule and resetModule ---
   eowl = null;
   numOfErrs = 0;
   numOfWarns = 0;
   for (int i = 0; i < 4; i++)
     eowCnt[i] = 0;
 } // ErrorsMethod
 void IPersistNode.SetState(object state, Utils.Logger logger)
 {
     if (state is DynamicConfigObject)
     {
         _config = (DynamicConfigObject)state;
     }
 }
Exemple #22
0
    public WebSite.Data.Utils.stcCep ConsultaCep(string cep)
    {
        Utils utls = new Utils();
        WebSite.Data.Utils.stcCep stcRetorno = new Utils.stcCep();
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["CEPConnectionString"].ToString());
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = con;

        cmd.CommandText = @"SELECT TOP 1
                                   LOGRADOURO.cepLogradouro,
                                   ESTADO.siglaEstado,
                                   CIDADE.nomeCidade,
                                   BAIRRO.nomeBairro,
                                   LOGRADOURO.nomeLogradouro
                              FROM LOGRADOURO
                             INNER JOIN BAIRRO
                                ON LOGRADOURO.idBairro = BAIRRO.idBairro
                              LEFT OUTER JOIN CIDADE
                                ON BAIRRO.idCidade = CIDADE.idCidade
                             INNER JOIN ESTADO
                                ON CIDADE.idEstado = ESTADO.idEstado
                             WHERE LOGRADOURO.cepLogradouro = @CepLogradouro;";
        try
        {
            cmd.Parameters.AddWithValue("@CepLogradouro", Convert.ToString(cep));

            cmd.Connection.Open();

            DataSet dts = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dts);

            if (dts.Tables[0].Rows.Count > 0)
            {
                DataRow dr = dts.Tables[0].Rows[0];
                stcRetorno.CepLogradouro = utls.ConvertePara<String>(dr["cepLogradouro"], cep); ;
                stcRetorno.SiglaEstado   = utls.ConvertePara<String>(dr["siglaEstado"], "");
                stcRetorno.NomeCidade    = utls.ConvertePara<String>(dr["nomeCidade"], "");
                if (cep.Substring(5, 3) == "000")
                {
                    stcRetorno.NomeBairro = "";
                    stcRetorno.NomeLogradouro = "";
                }
                else
                {
                    stcRetorno.NomeBairro = utls.ConvertePara<String>(dts.Tables[0].Rows[0]["nomeBairro"], "");
                    stcRetorno.NomeLogradouro = utls.ConvertePara<String>(dts.Tables[0].Rows[0]["nomeLogradouro"], "");
                }
            }

            cmd.Connection.Close();

            return stcRetorno;
        }
        catch (Exception ex)
        {
            throw (new Exception("mensagem do contexto", ex));
        }
    }
Exemple #23
0
        public MakeXMLSAT(CancelNFCE _cancelSAT, Utils.ConfigureXml _config)
        {
            config = _config;



            processCancel(_cancelSAT);
        }
Exemple #24
0
 public static void StartServices(Utils util = null)
 {
     for (int i = 0; i < SERVICES.Length; i++)
     {
         string s = SERVICES[i];
         ServiceUtil.StartService(s, util);
     }
 }
Exemple #25
0
 public void ActionParameters_Array()
 {
     Expression<Action<SmartTest2Controller>> a = c => c.ArrayMethod(new[] {1, 2, 4});
     IDictionary d = new Utils().GetActionParameters(a);
     Assert.AreEqual(1, d["ints[0]"]);
     Assert.AreEqual(2, d["ints[1]"]);
     Assert.AreEqual(4, d["ints[2]"]);
 }
Exemple #26
0
	public Utils () {
		if (instance != null) {
			return;
		}
 
		instance = this;
		init ();
	}
        public ActionResult Avances()
        {
            Utils __u = new Utils();

            ViewData.Model = __u.GetAvances();

            return View();
        }
 public static CameraShakeAction Create(CameraScript cam, float duration, Utils.VoidDelegate callback)
 {
     CameraShakeAction a = Utils.CreateScript<CameraShakeAction>();
     a.cameraScript = cam;
     a.duration = duration;
     a.AddDelegate(callback);
     return a;
 }
        public void LongestSubsequenceOfOneNumber()
        {
            List<int> theNumbers = new List<int> { 1 };
            Utils longestSubsequenceUtils = new Utils();
            List<int> longestSubsequence = longestSubsequenceUtils.FindLongestSubsequence(theNumbers);

            Assert.AreEqual(1, longestSubsequence[0]);
        }
 void _timer_Tick(object sender, EventArgs e)
 {
     try
     {
         GlobalProgress.Instance.Stop();
         if (_ex == null)
         {
             _connections.RemoveAt(0);
             if (!StartInstall(false))
             {
                 _wizard.GoToStep(new InstallComplete());
             }
         }
         else
         {
             Utils.HandleError(_ex);
         }
         _timer.Enabled = false;
     }
     catch (Exception ex)
     {
         Utils.HandleError(ex);
     }
 }
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(XLua.CSObjectWrap.XLuaCSObjectWrapMongoDBSharedCanonicalDisposableClassWrapWrap);
			Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
			
			
			
			
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "__Register", _m___Register_xlua_st_);
            
			
            
			
			
			
			Utils.EndClassRegister(type, L, translator);
        }
Exemple #32
0
        void btnAnimeSearch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SetSelectedAnime(null);

                IsAnimeDisplayed = false;

                this.Cursor = Cursors.Wait;
                Window parentWindow = Window.GetWindow(this);
                btnAnimeSearch.IsEnabled = false;
                btnConfirm.IsEnabled     = false;
                btnCancel.IsEnabled      = false;

                SearchResults.Clear();
                ViewSearchResults.Refresh();

                List <JMMServerBinary.Contract_AnimeSearch> searchResults = JMMServerVM.Instance.clientBinaryHTTP.OnlineAnimeTitleSearch(txtAnimeSearch.Text.Trim());
                foreach (JMMServerBinary.Contract_AnimeSearch res in searchResults)
                {
                    AnimeSearchVM ser = new AnimeSearchVM(res);
                    SearchResults.Add(ser);
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                btnAnimeSearch.IsEnabled = true;
                btnConfirm.IsEnabled     = true;
                btnCancel.IsEnabled      = true;
                this.Cursor = Cursors.Arrow;
            }
        }
Exemple #33
0
        public Formula(Cell cell, FormulaValue formulaValue, bool fAlwaysCalc, CellParsedFormula cellParsedFormula) : base(RecordType.Formula, 0)
        {
            this.val = formulaValue.Bytes;
            this.rw = cell.Rw;
            this.col = cell.Col;
            this.ixfe = cell.IXFe;
            ProcessFormulaValue();

            this.fAlwaysCalc = fAlwaysCalc;
            //TODO add handling for shared formulas
            this.fShrFmla = false;
            this.fClearErrors = true;

            uint flags = 0;
            flags = flags | Utils.BoolToBitmask(fAlwaysCalc, 0x01);
            flags = flags | Utils.BoolToBitmask(fShrFmla, 0x08);
            flags = flags | Utils.BoolToBitmask(fClearErrors, 0x20);
            this.grbit = (ushort) flags;

            this.cce = cellParsedFormula.cce;
            this.ptgStack = cellParsedFormula.PtgStack;

            this._length = CalculateLength();
        }
Exemple #34
0
        public override async ValueTask <Directive> Run(RawSourceFile source)
        {
            if (!_regex.IsMatch(source.Path))
            {
                return(null);
            }

            try
            {
                var lines = File.ReadAllLines(source.AbsolutePath);
                var id    = 0;
                lines.Where(l => l.StartsWith("itemID=")).Do(l => int.TryParse(l.Replace("itemID=", ""), out id));
                if (id == 0)
                {
                    return(null);
                }

                SteamWorkshopItem item = null;
                _game.WorkshopItems.Where(i => i.ItemID == id).Do(i => item = i);
                if (item == null)
                {
                    return(null);
                }

                var fromSteam = source.EvolveTo <SteamMeta>();
                fromSteam.SourceDataID = _compiler.IncludeFile(source.AbsolutePath);
                fromSteam.ItemID       = item.ItemID;
                fromSteam.Size         = item.Size;
                return(fromSteam);
            }
            catch (Exception e)
            {
                Utils.Error(e, $"Exception while trying to evolve source to FromSteam");
                return(null);
            }
        }
Exemple #35
0
        private void CommandBinding_VoteDown(object sender, ExecutedRoutedEventArgs e)
        {
            Window parentWindow = Window.GetWindow(this);

            object obj = e.Parameter;

            if (obj == null)
            {
                return;
            }

            try
            {
                if (obj.GetType() == typeof(RecommendationTile))
                {
                    RecommendationTile rec = obj as RecommendationTile;
                    Utils.AniDBVoteRecommendation(rec.AnimeID, rec.SimilarAnimeID, false);
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
        private static OSD DeserializeLLSDNotationReal(StringReader reader)
        {
            int character;
            StringBuilder s = new StringBuilder();
            if (((character = reader.Peek()) > 0) &&
                ((char)character == '-' && (char)character == '+'))
            {
                s.Append((char)character);
                reader.Read();
            }
            while (((character = reader.Peek()) > 0) &&
                   (Char.IsDigit((char)character) || (char)character == '.' ||
                    (char)character == 'e' || (char)character == 'E' ||
                    (char)character == '+' || (char)character == '-'))
            {
                s.Append((char)character);
                reader.Read();
            }
            double dbl;
            if (!Utils.TryParseDouble(s.ToString(), out dbl))
                throw new OSDException("Notation LLSD parsing: Can't parse real value: " + s.ToString());

            return OSD.FromReal(dbl);
        }
Exemple #37
0
        // Get unneeded size to sub from the struct size
        private int GetUnneededSize()
        {
            int sSub = 0;

            // if it's 32bit game (4byte pointer) sub 4byte for every pointer
            if (!Utils.ProgramIs64() || Utils.MemObj.Is64Bit)
            {
                return(sSub);
            }

            foreach (var(_, value) in Vars)
            {
                if (value.VarType.EndsWith("*"))
                {
                    sSub += 0x4;
                }
                else if (value.IsStruct)
                {
                    sSub += value.Struct.GetUnneededSize();
                }
            }

            return(sSub);
        }
Exemple #38
0
        //private void LoadCategoryParent()
        //{
        //    try
        //    {
        //        var CatList = (
        //                        from t2 in DB.ESHOP_PROPERTies
        //                        select new
        //                        {
        //                            PROP_ID = t2.PROP_NAME == "------- Root -------" ? 0 : t2.PROP_ID,
        //                            PROP_NAME = t2.PROP_NAME,
        //                            PROP_PARENT_ID = t2.PROP_PARENT_ID,
        //                            PROP_RANK = t2.PROP_RANK

        //                        }
        //                    );

        //        if (CatList.ToList().Count > 0)
        //        {
        //            DataRelation relCat;
        //            DataTable tbl = DataUtil.LINQToDataTable(CatList);
        //            DataSet ds = new DataSet();
        //            ds.Tables.Add(tbl);

        //            tbl.PrimaryKey = new DataColumn[] { tbl.Columns["PROP_ID"] };
        //            relCat = new DataRelation("Category_parent", ds.Tables[0].Columns["PROP_ID"], ds.Tables[0].Columns["PROP_PARENT_ID"], false);

        //            ds.Relations.Add(relCat);
        //            DataSet dsCat = ds.Clone();
        //            DataTable CatTable = ds.Tables[0];

        //            CpanelUtils.TransformTableWithSpace(ref CatTable, dsCat.Tables[0], relCat, null);

        //            ddlCategory.DataSource = dsCat.Tables[0];
        //            ddlCategory.DataTextField = "PROP_NAME";
        //            ddlCategory.DataValueField = "PROP_ID";
        //            ddlCategory.DataBind();

        //        }
        //        else
        //        {
        //            DataTable dt = new DataTable("Newtable");

        //            dt.Columns.Add(new DataColumn("PROP_ID"));
        //            dt.Columns.Add(new DataColumn("PROP_NAME"));

        //            DataRow row = dt.NewRow();
        //            row["PROP_ID"] = 0;
        //            row["PROP_NAME"] = "--------Root--------";
        //            dt.Rows.Add(row);

        //            ddlCategory.DataTextField = "PROP_NAME";
        //            ddlCategory.DataValueField = "PROP_ID";
        //            ddlCategory.DataSource = dt;
        //            ddlCategory.DataBind();



        //        }

        //    }
        //    catch (Exception ex)
        //    {
        //        clsVproErrorHandler.HandlerError(ex);
        //    }
        //}

        private void getInfo()
        {
            try
            {
                //LoadCategoryParent();

                var G_info = (from c in DB.ESHOP_COLORs
                              where c.COLOR_ID == m_color_id
                              select c
                              );

                if (G_info.ToList().Count > 0)
                {
                    txtName.Value           = G_info.ToList()[0].COLOR_NAME;
                    txtDesc.Value           = G_info.ToList()[0].COLOR_DESC;
                    rblStatus.SelectedValue = Utils.CStrDef(G_info.ToList()[0].COLOR_ACTIVE);
                    txtOrder.Value          = Utils.CStrDef(G_info.ToList()[0].COLOR_PRIORITY);
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        public void Rebuild()
        {
            const String publishCompleteMessage = "========== Rebuild All: 2 succeeded, 135 failed, 86 skipped ==========\r\n";

            var span = Utils.CreateSpan(publishCompleteMessage);
            BuildResultData data;
            var parser = new BuildResultParser();
            var parsed = parser.TryParse(span, out data);
            Assert.IsTrue(parsed);
            Assert.IsNotNull(data);

            Assert.IsTrue(data.Succeeded.HasValue);
            Assert.IsTrue(data.Failed.HasValue);
            Assert.IsFalse(data.UpToDate.HasValue);
            Assert.IsTrue(data.Skipped.HasValue);

            Assert.AreEqual(2, data.Succeeded);
            Assert.AreEqual(135, data.Failed);
            Assert.AreEqual(86, data.Skipped);

            Assert.AreEqual(new Span(24, 1), data.Succeeded.Span);
            Assert.AreEqual(new Span(37, 3), data.Failed.Span);
            Assert.AreEqual(new Span(49, 2), data.Skipped.Span);
        }
        public void BuildDnx()
        {
            const String publishCompleteMessage = "========== Build: 10 succeeded or up-to-date, 3 failed, 43 skipped ==========\r\n";

            var span = Utils.CreateSpan(publishCompleteMessage);
            BuildResultData data;
            var parser = new BuildResultParser();
            var parsed = parser.TryParse(span, out data);
            Assert.IsTrue(parsed);
            Assert.IsNotNull(data);

            Assert.IsTrue(data.Succeeded.HasValue);
            Assert.IsTrue(data.Failed.HasValue);
            Assert.IsFalse(data.UpToDate.HasValue);
            Assert.IsTrue(data.Skipped.HasValue);

            Assert.AreEqual(10, data.Succeeded);
            Assert.AreEqual(3, data.Failed);
            Assert.AreEqual(43, data.Skipped);

            Assert.AreEqual(new Span(18, 2), data.Succeeded.Span);
            Assert.AreEqual(new Span(46, 1), data.Failed.Span);
            Assert.AreEqual(new Span(56, 2), data.Skipped.Span);
        }
Exemple #41
0
        private void RptBind(string _strWhere, string _orderby)
        {

            // Model.wx_userweixin weixin = GetWeiXinCode();

            //判断是否已经设置了微留言基本信息
            BLL.wx_diancai_dianyuan sbll = new BLL.wx_diancai_dianyuan();


            _strWhere = "shopid=" + shopid + " " + _strWhere;
            this.page = MXRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            DataSet ds = gbll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            // DataSet ds = gbll.GetList( _strWhere);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr;

                int count = ds.Tables[0].Rows.Count;
                for (int i = 0; i < count; i++)
                {
                    dr = ds.Tables[0].Rows[i];

                }
                ds.AcceptChanges();
            }
            this.rptList.DataSource = ds;
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("dianyuan_manage.aspx?shopid=" + shopid + "", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);


        }
Exemple #42
0
        /// <summary>
        /// This method was created in VisualAge.
        /// <summary>
        /// <returns>double[]</returns>
        /// <param name="values">cern.it.hepodbms.primitivearray.DoubleArrayList</param>
        /// <param name="phis">double[]</param>
        public static double ObservedEpsilonAtPhi(double phi, ExactDoubleQuantileFinder exactFinder, IDoubleQuantileFinder approxFinder)
        {
            int N = (int)exactFinder.Size;

            int exactRank = (int)Utils.EpsilonCeiling(phi * N) - 1;
            //Console.WriteLine("exactRank="+exactRank);
            var tmp = exactFinder.QuantileElements(new DoubleArrayList(new double[] { phi }))[0]; // just to ensure exactFinder is sorted
            double approxElement = approxFinder.QuantileElements(new DoubleArrayList(new double[] { phi }))[0];
            //Console.WriteLine("approxElem="+approxElement);
            IntArrayList approxRanks = BinaryMultiSearch(exactFinder.Buffer, approxElement);
            int from = approxRanks[0];
            int to = approxRanks[1];

            int distance;
            if (from <= exactRank && exactRank <= to) distance = 0;
            else
            {
                if (from > exactRank) distance = System.Math.Abs(from - exactRank);
                else distance = System.Math.Abs(exactRank - to);
            }

            double epsilon = (double)distance / (double)N;
            return epsilon;
        }
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(XLua.CSObjectWrap.XLuaCSObjectWrapMongoDBBsonSerializationConventionsReadWriteMemberFinderConventionWrapWrap);
			Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
			
			
			
			
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "__Register", _m___Register_xlua_st_);
            
			
            
			
			
			
			Utils.EndClassRegister(type, L, translator);
        }
Exemple #44
0
    public void CmdRepairAllItems()
    {
        // validate: close enough, npc alive and valid index and valid item?
        // use collider point(s) to also work with big entities
        if (player.state == "IDLE" &&
            player.target != null &&
            player.target.health.current > 0 &&
            player.target is Npc npc &&
            npc.trading != null && // only if Npc offers trading
            npc.trading.offersRepair && // and repairs
            Utils.ClosestDistance(player, player.target) <= player.interactionRange)
        {
            // calculate missing durability from inventory + equipment
            int missing = player.inventory.GetTotalMissingDurability() +
                          player.equipment.GetTotalMissingDurability();

            // calculate costs based on npc repair costs
            int price = missing * npc.trading.repairCostPerDurabilityPoint;

            // don't allow negative price ever. just in case a calculation is
            // wrong, we don't want the player to get money back when repairing.
            if (price > 0)
            {
                // check if player has enough gold
                if (player.gold >= price)
                {
                    // repair all items
                    player.inventory.RepairAllItems();
                    player.equipment.RepairAllItems();

                    // reduce gold
                    player.gold -= price;
                }
            }
        }
    }
Exemple #45
0
        /// <summary>
        /// 设置子系统权限
        /// </summary>
        /// <param name="sysId">子系统编号</param>
        /// <param name="privs">权限信息集合</param>
        /// <returns></returns>
        public int SetSysPrivs(string sysId, IList <EyouSoft.Model.SysStructure.MComMenu2Info> privs)
        {
            if (privs == null || privs.Count < 1)
            {
                return(0);
            }

            DbCommand dc = _db.GetStoredProcCommand("proc_SysMenu_SetMenu2Privs");

            _db.AddInParameter(dc, "Menu2Xml", DbType.String, GetMenu2PrivsSqlXml(privs));
            _db.AddOutParameter(dc, "ReturnValue", DbType.Int32, 4);
            _db.AddInParameter(dc, "SysId", DbType.AnsiStringFixedLength, sysId);

            DbHelper.RunProcedure(dc, _db);

            object obj = _db.GetParameterValue(dc, "ReturnValue");

            if (obj == null || string.IsNullOrEmpty(obj.ToString()))
            {
                return(0);
            }

            return(Utils.GetInt(obj.ToString()));
        }
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(XLua.CSObjectWrap.FairyGUIInputTextFieldWrap);
			Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
			
			
			
			
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "__Register", _m___Register_xlua_st_);
            
			
            
			
			
			
			Utils.EndClassRegister(type, L, translator);
        }
Exemple #47
0
        private static void TreeWindow(int id)
        {
            GUILayout.BeginVertical();
            {
                _folderTreeView.DrawDirectoryTree();

                GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
                {
                    if (Overlord.DrawDefaultCardsToggle())
                        OnFolderChanged();

                    if (GUILayout.Button("Refresh thumbnails"))
                    {
                        _folderTreeView.ResetTreeCache();
                        OnFolderChanged();
                    }

                    if (GUILayout.Button("Open folder in explorer"))
                        Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndVertical();
        }
    public void CorrectInvalidData()
    {
        if (tier < 1)
        {
            tier = 1;
        }

        if (power == null || power.Value == 0)
        {
            power = new Attribute(100);
            Debug.LogWarning("Invalid teleport power");
        }

        if (time == null || time.Value == 0)
        {
            time = new Attribute(60);
            Debug.LogWarning("Invalid teleport time");
        }
        if (gemSlots == null || gemSlots.Count < GemSlotNo)
        {
            Debug.LogWarning("Gem slots not found, initializing...");
            Utils.InitWithNew(ref gemSlots, GemSlotNo);
        }
    }
Exemple #49
0
        public static DbExpression TryGetOrAddNullChecking(DbSqlQueryExpression sqlQuery, DbTable table, DbExpression exp)
        {
            if (exp == null)
            {
                return(null);
            }

            List <DbColumnSegment> columnList = sqlQuery.ColumnSegments;
            DbColumnSegment        columnSeg  = null;

            columnSeg = columnList.Where(a => DbExpressionEqualityComparer.EqualsCompare(a.Body, exp)).FirstOrDefault();

            if (columnSeg == null)
            {
                string alias = Utils.GenerateUniqueColumnAlias(sqlQuery);
                columnSeg = new DbColumnSegment(exp, alias);

                columnList.Add(columnSeg);
            }

            DbColumnAccessExpression cae = new DbColumnAccessExpression(table, DbColumn.MakeColumn(columnSeg.Body, columnSeg.Alias));

            return(cae);
        }
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(XLua.CSObjectWrap.XLuaCSObjectWrapDCETModelResourcesHelperWrapWrap);
			Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
			
			
			
			
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "__Register", _m___Register_xlua_st_);
            
			
            
			
			
			
			Utils.EndClassRegister(type, L, translator);
        }
Exemple #51
0
    public int[] GetV8Version()
    {
        string[] VersionHeader = Utils.ReadAllText(Path.Combine(ThirdPartyPath, "v8", "include", "v8-version.h")).Replace("\r\n", "\n").Replace("\t", " ").Split('\n');
        string   VersionMajor  = "0";
        string   VersionMinor  = "0";
        string   VersionPatch  = "0";

        foreach (string Line in VersionHeader)
        {
            if (Line.StartsWith("#define V8_MAJOR_VERSION"))
            {
                VersionMajor = Line.Split(' ')[2];
            }
            else if (Line.StartsWith("#define V8_MINOR_VERSION "))
            {
                VersionMinor = Line.Split(' ')[2];
            }
            else if (Line.StartsWith("#define V8_PATCH_VERSION "))
            {
                VersionPatch = Line.Split(' ')[2];
            }
        }
        return(new int[] { Int32.Parse(VersionMajor), Int32.Parse(VersionMinor), Int32.Parse(VersionPatch) });
    }
            public SchemaImpl(IExceptionContext ectx, Schema inputSchema, UngroupMode mode, string[] pivotColumns)
            {
                Contracts.AssertValueOrNull(ectx);
                _ectx = ectx;
                _ectx.AssertValue(inputSchema);
                _ectx.AssertNonEmpty(pivotColumns);

                _inputSchema = inputSchema;
                Mode = mode;

                CheckAndBind(_ectx, inputSchema, pivotColumns, out _infos);

                _pivotColMap = new Dictionary<string, int>();
                _pivotIndex = Utils.CreateArray(_inputSchema.ColumnCount, -1);
                for (int i = 0; i < _infos.Length; i++)
                {
                    var info = _infos[i];
                    _pivotColMap[info.Name] = info.Index;
                    _ectx.Assert(_pivotIndex[info.Index] == -1);
                    _pivotIndex[info.Index] = i;
                }

                AsSchema = Schema.Create(this);
            }
        void ProcessFrame(SpatialCoordinateSystem worldCoordinateSystem)
        {
            if (!IsInValidateStateToProcessFrame())
            {
                return;
            }

            // obtain the details of the last frame captured 
            FrameGrabber.Frame frame = frameGrabber.LastFrame;

            if (frame.mediaFrameReference == null)
            {
                return;
            }

            MediaFrameReference mediaFrameReference = frame.mediaFrameReference;

            SpatialCoordinateSystem cameraCoordinateSystem = mediaFrameReference.CoordinateSystem;
            CameraIntrinsics cameraIntrinsics = mediaFrameReference.VideoMediaFrame.CameraIntrinsics;

            Matrix4x4? cameraToWorld = cameraCoordinateSystem.TryGetTransformTo(worldCoordinateSystem);

            if (!cameraToWorld.HasValue)
            {
                return;
            }

            // padding 
            float averageFaceWidthInMeters = 0.15f;

            float pixelsPerMeterAlongX = cameraIntrinsics.FocalLength.X;
            float averagePixelsForFaceAt1Meter = pixelsPerMeterAlongX * averageFaceWidthInMeters;

            // Place the label 25cm above the center of the face.
            Vector3 labelOffsetInWorldSpace = new Vector3(0.0f, 0.25f, 0.0f);            

            frameAnalyzer.AnalyzeFrame(frame.mediaFrameReference, (status, detectedPersons) =>
            {
                if(status > 0 && detectedPersons.Count > 0)
                {
                    FrameAnalyzer.Bounds? bestRect = null;
                    Vector3 bestRectPositionInCameraSpace = Vector3.Zero;
                    float bestDotProduct = -1.0f;
                    FrameAnalyzer.DetectedPerson bestPerson = null; 

                    foreach (var dp in detectedPersons)
                    {
                        Debug.WriteLine($"Detected person: {dp.ToString()}");

                        Point faceRectCenterPoint = new Point(
                            dp.bounds.left + dp.bounds.width /2, 
                            dp.bounds.top + dp.bounds.height / 2
                            );

                        // Calculate the vector towards the face at 1 meter.
                        Vector2 centerOfFace = cameraIntrinsics.UnprojectAtUnitDepth(faceRectCenterPoint);

                        // Add the Z component and normalize.
                        Vector3 vectorTowardsFace = Vector3.Normalize(new Vector3(centerOfFace.X, centerOfFace.Y, -1.0f));

                        // Get the dot product between the vector towards the face and the gaze vector.
                        // The closer the dot product is to 1.0, the closer the face is to the middle of the video image.
                        float dotFaceWithGaze = Vector3.Dot(vectorTowardsFace, -Vector3.UnitZ);                        

                        // Pick the faceRect that best matches the users gaze.
                        if (dotFaceWithGaze > bestDotProduct)
                        {
                            // Estimate depth using the ratio of the current faceRect width with the average faceRect width at 1 meter.
                            float estimatedFaceDepth = averagePixelsForFaceAt1Meter / (float)dp.bounds.width;

                            // Scale the vector towards the face by the depth, and add an offset for the label.
                            Vector3 targetPositionInCameraSpace = vectorTowardsFace * estimatedFaceDepth;

                            bestDotProduct = dotFaceWithGaze;
                            bestRect = dp.bounds;
                            bestRectPositionInCameraSpace = targetPositionInCameraSpace;
                            bestPerson = dp; 
                        }                         
                    }

                    if (bestRect.HasValue)
                    {
                        // Transform the cube from Camera space to World space.
                        Vector3 bestRectPositionInWorldspace = Vector3.Transform(bestRectPositionInCameraSpace, cameraToWorld.Value);
                        Vector3 labelPosition = bestRectPositionInWorldspace + labelOffsetInWorldSpace;                          

                        quadRenderer.TargetPosition = labelPosition;
                        textRenderer.RenderTextOffscreen($"{bestPerson.name}, {bestPerson.gender}, Age: {bestPerson.age}");

                        lastFaceDetectedTimestamp = Utils.GetCurrentUnixTimestampMillis();
                    }               
                }
            }); 
        }
Exemple #54
0
        private AType FloatGT(AType right, AType left)
        {
            int number = (!Utils.ComparisonTolerance(left.asFloat, right.asFloat) && left.asFloat > right.asFloat) ? 1 : 0;

            return(AInteger.Create(number));
        }
        /// <summary>
        /// Updates the application state once per frame.
        /// </summary>
        public HolographicFrame Update()
        {
            // Before doing the timer update, there is some work to do per-frame
            // to maintain holographic rendering. First, we will get information
            // about the current frame.

            // The HolographicFrame has information that the app needs in order
            // to update and render the current frame. The app begins each new
            // frame by calling CreateNextFrame.
            HolographicFrame holographicFrame = holographicSpace.CreateNextFrame();

            // Get a prediction of where holographic cameras will be when this frame
            // is presented.
            HolographicFramePrediction prediction = holographicFrame.CurrentPrediction;

            // Back buffers can change from frame to frame. Validate each buffer, and recreate
            // resource views and depth buffers as needed.
            deviceResources.EnsureCameraResources(holographicFrame, prediction);

            // Next, we get a coordinate system from the attached frame of reference that is
            // associated with the current frame. Later, this coordinate system is used for
            // for creating the stereo view matrices when rendering the sample content.
            SpatialCoordinateSystem currentCoordinateSystem = referenceFrame.CoordinateSystem;

            SpatialPointerPose pose = SpatialPointerPose.TryGetAtTimestamp(currentCoordinateSystem, prediction.Timestamp);            

            ProcessFrame(currentCoordinateSystem);

             if (Utils.GetCurrentUnixTimestampMillis() - lastFaceDetectedTimestamp > faceTimeThreshold)
            {
                if(pose != null)
                {
                    var headPosition = pose.Head.Position;
                    var headForward = pose.Head.ForwardDirection;
                    quadRenderer.TargetPosition = headPosition + (2.0f * headForward);
                }
                                
                textRenderer.RenderTextOffscreen("No faces detected");
            }

            timer.Tick(() => 
            {
            //
            // TODO: Update scene objects.
            //
            // Put time-based updates here. By default this code will run once per frame,
            // but if you change the StepTimer to use a fixed time step this code will
            // run as many times as needed to get to the current step.
            //                

                quadRenderer.Update(pose, timer);
            });

            // We complete the frame update by using information about our content positioning
            // to set the focus point.
            foreach (var cameraPose in prediction.CameraPoses)
            {
                // The HolographicCameraRenderingParameters class provides access to set
                // the image stabilization parameters.
                HolographicCameraRenderingParameters renderingParameters = holographicFrame.GetRenderingParameters(cameraPose);

                // SetFocusPoint informs the system about a specific point in your scene to
                // prioritize for image stabilization. The focus point is set independently
                // for each holographic camera.
                // You should set the focus point near the content that the user is looking at.
                // In this example, we put the focus point at the center of the sample hologram,
                // since that is the only hologram available for the user to focus on.
                // You can also set the relative velocity and facing of that content; the sample
                // hologram is at a fixed point so we only need to indicate its position.

                if(Utils.GetCurrentUnixTimestampMillis() - lastFaceDetectedTimestamp <= faceTimeThreshold)
                {
                    renderingParameters.SetFocusPoint(
                        currentCoordinateSystem,    
                        quadRenderer.Position,
                        quadRenderer.Forward,
                        quadRenderer.Velocity
                    );
                }
            }

            // The holographic frame will be used to get up-to-date view and projection matrices and
            // to present the swap chain.
            return holographicFrame;
        }
        private async Task ReconnectConsumerHandles(StreamSubscriptionHandle <int>[] subscriptionHandles)
#endif
        {
            logger.Info("ReconnectConsumerHandles SubscriptionHandles={0} Grain={1}", Utils.EnumerableToString(subscriptionHandles), this.AsReference <IStreamReliabilityTestGrain>());


            foreach (var subHandle in subscriptionHandles)
            {
#if USE_GENERICS
                // var stream = GetStreamProvider(State.StreamProviderName).GetStream<T>(subHandle.StreamId);
                var stream   = subHandle.Stream;
                var observer = new MyStreamObserver <T>();
#else
                var observer = new MyStreamObserver <int>(logger);
#endif
                var subsHandle = await subHandle.ResumeAsync(observer);

                Observers.Add(subsHandle, observer);
                State.ConsumerSubscriptionHandles.Add(subsHandle);
            }
            await WriteStateAsync();
        }
 /// <summary>
 /// Here when manipulation completes.
 /// </summary>
 private void OnManipulationCompleted(object sender, Manipulation2DCompletedEventArgs e)
 {
     Utils.ResetCompositeTransformCenter(AssociatedObject, _initialCenter);
 }
Exemple #58
0
 public void OnTitleClicked()
 {
     shipLives   = ship.ShipLives;
     shipCanMove = true;
     Utils.EnableAllChildren(transform);
 }
Exemple #59
0
 public void OnGameOver()
 {
     shipCanMove = false;
     Utils.DisableAllChildren(transform);
 }
Exemple #60
-1
 public frmDespesaNova(Usuario user, String despId)
 {
     InitializeComponent();
     this.user = user;
     desp = new Despesa();
     util = new Utils();
     util.moneyMaskFormata(ttbValorPgmto);
     util.moneyMaskFormata(ttbValor);
     if (despId != "")
     {
         this.Text = "Alterar Despesa";
         desp.Id = despId;
         desp = desp.getById();
         ttbDesc.Text = desp.Desc;
         ttbValor.Text = desp.Valor;
         if (desp.DtPgmto != "")
         {
             rbPaga.Checked = true;
             gpbPagamento.Enabled = true;
             ttbValorPgmto.Text = desp.ValorPg;
             dtpPagamento.Value = DateTime.Parse(desp.DtPgmto);
         }
         else
             rbApagar.Checked = true;
         dtpVcmto.Value = DateTime.Parse(desp.DtVcmto);
     }
     else
         rbApagar.Checked = true;
     util.setCamposObrigatorios(Controls);
 }