Esempio n. 1
0
        private void UpdateSummaryData(SummaryData summaryData)
        {
            TrimToGraphRange(this.DataPointsHashRate, this.SelectedGraphTimeSpan.Span);

            // add the data point to our series if it will actually result in an additional pixel, this prevents the graph from getting overloaded with too many
            // data points even if the UI stays open for long periods of time (for example, a new point every 10 seconds at 7d time range - that would result
            // in a very high density that would impact performance while not actually showing any additional detail on the screen)
            var dataPoint = new DataPoint()
            {
                TimeLocal = summaryData.TimestampUtc.ToLocalTime(), Value = summaryData.TotalKiloHashesAverage5Sec
            };
            var minimumGap = TimeSpan.FromMilliseconds(this.SelectedGraphTimeSpan.Span.TotalMilliseconds / Math.Max(this.GraphWidth, InitialWindowWidth));

            if (this.DataPointsHashRate.Count == 0 || (dataPoint.TimeLocal - this.DataPointsHashRate.Last().TimeLocal) >= minimumGap)
            {
                PerformFlatLineFix(this.DataPointsHashRate, dataPoint);

                this.DataPointsHashRate.Add(dataPoint);
            }

            // inform the data manager about the new point (regardless of display density logic)
            if (this.summaryDataManager != null)
            {
                this.summaryDataManager.Add(summaryData);
            }

            this.ApplicationTitle = string.Format("Mining Controller ({0:0.#} KH/s)", summaryData.TotalKiloHashesAverage5Sec);
        }
Esempio n. 2
0
        private static SummaryData ExecuteBonus(int level, RequestContext <BonusArgs> requestContext, FortuneKoiSpinResult result)
        {
            var bonus           = module.CreateBonus(result);
            var fortunekoiBonus = bonus.Value as FortuneKoiBonus;
            var summData        = new SummaryData();
            var bonusContext    = new BonusStateContext(level, fortunekoiBonus);

            do
            {
                summData.FSpinCounter++;
                var bonusSpinResult = bonusContext.SetState(fortunekoiBonus.State).Transform(requestContext);
                var spinResult      = bonusSpinResult.SpinResult;
                if (spinResult.HasBonus)
                {
                    summData.FgFHit++;
                }

                summData.FgTotalWin += spinResult.Win;
                if (bonusContext.IsCompleted)
                {
                    break;
                }
                fortunekoiBonus.State = bonusContext.GetState();
            } while (true);

            return(summData);
        }
Esempio n. 3
0
        private static void PrintResult(int level, DateTime sdt, DateTime edt, SummaryData summData, string output)
        {
            var oldOut     = Console.Out;
            var fileStream = new FileStream($@"..\..\..\Results\MonkeySmash\{output}.txt", FileMode.OpenOrCreate, FileAccess.Write);
            var writer     = new StreamWriter(fileStream);

            Console.SetOut(writer);
            Console.WriteLine(String.Format("Test.SpinCount             : {0}", summData.SpinCounter));
            Console.WriteLine(String.Format("Test.Level                 : {0}", level));
            Console.WriteLine(String.Format("Test.TimeStart             : {0} {1}", sdt.ToShortDateString(), sdt.ToLongTimeString()));
            Console.WriteLine(String.Format("Test.TimeEnd               : {0} {1}", edt.ToShortDateString(), edt.ToLongTimeString()));
            Console.WriteLine(String.Format("Test.SpinMode              : {0}", "Random"));
            Console.WriteLine("-----------------------------------------------------------");
            Console.WriteLine(String.Format("Main Game Win              : {0,12:0.00}", summData.TotalWin));
            Console.WriteLine(String.Format("Free Spin Win              : {0,12:0.00}", summData.FSTotalWin));
            Console.WriteLine(String.Format("TotalBet                   : {0,12:0.00}", summData.TotalBet));
            Console.WriteLine("--- RTP ---------------------------------------------------");
            Console.WriteLine(String.Format("Main Game RTP              : {0,12:0.0000000}", 100 * summData.TotalWin / summData.TotalBet));
            Console.WriteLine(String.Format("Free Spin RTP              : {0,12:0.0000000}", 100 * summData.FSTotalWin / summData.TotalBet));
            Console.WriteLine(String.Format("RTP.Total                  : {0,12:0.0000000}", 100 * summData.RTPOverAll));
            Console.SetOut(oldOut);
            writer.Close();
            fileStream.Close();
            Console.WriteLine("Done");
        }
Esempio n. 4
0
        private static SummaryData ExecuteFreeSpin(int level, RequestContext <BonusArgs> bonusRequestcontext, FuDaoLeResult result)
        {
            var bonus         = module.CreateBonus(result);
            var summData      = new SummaryData();
            var freeSpinBonus = bonus.Value as FreeSpinBonus;

            do
            {
                summData.FSpinCounter++;
                var mystery        = ParSheet.GetFreeGameMysteryIndex(RandomNumberEngine.NextDouble());
                var wheel          = ParSheet.CreateWheelForFreeSpin(level, mystery);
                var freeSpinResult = Engine.ClaimBonus(level, freeSpinBonus, bonusRequestcontext, wheel) as FuDaoLeFreeSpinResult;
                summData.FSTotalWin += freeSpinResult.Win;
                if (freeSpinResult.SpinResult.HasBonus)
                {
                    summData.FgFHit++;
                }

                if (freeSpinResult.IsCompleted)
                {
                    break;
                }
            } while (true);
            return(summData);
        }
Esempio n. 5
0
    public static SummaryData GetSummary()
    {
        var result = new SummaryData
        {
            Sluzby = new List <IdName>()
        };

        using (var sqlConnection = new SqlConnection(ConnectionString))
        {
            using (var command = sqlConnection.CreateCommand())
            {
                command.PrepareStoredProcedure(sqlConnection, "GetSummary");

                sqlConnection.Open();
                using (var reader = command.ExecuteReader())
                {
                    if (reader.Read())
                    {
                        result.TotalPeople = reader.GetInt32(0);
                    }
                    reader.NextResult();

                    while (reader.Read())
                    {
                        result.Sluzby.Add(new IdName
                        {
                            Id   = reader.GetInt32(0),
                            Name = reader.GetString(1)
                        });
                    }
                }
            }
        }
        return(result);
    }
Esempio n. 6
0
        private static SummaryData ExecuteMainGameCollapsing(int level, RequestContext <BonusArgs> bonusRequestcontext, WolvesResult result)
        {
            var bonus         = module.CreateBonus(result);
            var summData      = new SummaryData();
            var freeSpinBonus = bonus.Value as WolvesBonus;

            do
            {
                var freeSpinResult = BonusReducer.dispatch(level, freeSpinBonus, bonusRequestcontext) as WolvesSeqFreeSpinResult;
                summData.MgRollingWin += freeSpinResult.Win;
                if (freeSpinResult.SpinResult.HasBonus)
                {
                    if (freeSpinResult.SpinResult.Bonus.ClientId == 4)
                    {
                        summData.MgFHit++;
                        summData += ExecuteFreeSpin(level, bonusRequestcontext, freeSpinResult.SpinResult);
                        break;
                    }
                }

                if (freeSpinResult.IsCompleted)
                {
                    break;
                }
                freeSpinBonus = freeSpinResult.Bonus as WolvesBonus;
            } while (true);
            return(summData);
        }
Esempio n. 7
0
        private static SummaryData ExecuteFreeSpinBonus(int level, RequestContext <BonusArgs> requestContext, BikiniBeachResult result)
        {
            var bonus            = module.CreateBonus(result);
            var bikiniBeachBonus = bonus.Value as BikiniBeachBonus;
            var summData         = new SummaryData();

            IBikiniBeachAction action(BonusState state)
            {
                switch (state)
                {
                default: return(new FreeSpinAction(level, requestContext.Platform, bikiniBeachBonus.SpinBet, () => Config.FreeGameReelStrip));
                }
            }

            do
            {
                var bonusSpinResult = BonusReducer.Dispatch(bikiniBeachBonus, action);
                summData.FSpinCounter++;
                summData.FSTotalWin += bonusSpinResult.Win;

                if (bonusSpinResult.IsCompleted)
                {
                    break;
                }
                bikiniBeachBonus = bonusSpinResult.Bonus as BikiniBeachBonus;
            } while (true);

            return(summData);
        }
Esempio n. 8
0
        public void InitForm()
        {
            try
            {
                dataManager = new DSManager(jmsServer, jmsUser, jmsPassword, cacheUpdateTimerInterval, msgFilter, msgFilter);
                dataManager.IncMessageCounter += new EventHandler(OnIncMessageCounter);

                dataSet = new DataSet();

                SummaryData         summaryDataTemplate = new SummaryData();
                IList <SummaryData> summaryList;
                summaryList = dataManager.DaoManager.CreateObjList <SummaryData>(summaryDataTemplate);
                string filterText = "";  //G
                summaryDataTable            = CollectionHelper.ConvertTo <SummaryData>(summaryList, filterText);
                summaryDataTable.PrimaryKey = new DataColumn[] { summaryDataTable.Columns["Id"] };

                dataSet.Tables.Add(summaryDataTable);

                dataManager.RegisterDataSet(ref dataSet);
                dataManager.RegisterGridControl(ref gridMain);
                dataManager.StartListening();

                gridMain.DataSource = dataSet.Tables["SummaryData"];
                gridMain.ForceInitialize();
            }
            catch (Exception error)
            {
                MessageBox.Show("Error:" + error.Message);
            }
        }
Esempio n. 9
0
        private static SummaryData ExecuteFreeSpin(int level, RequestContext <BonusArgs> bonusRequestcontext, SevenWondersResult result)
        {
            var bonus             = module.CreateBonus(result);
            var summData          = new SummaryData();
            var sevenWondersBonus = bonus.Value as SevenWondersBonus;

            ISevenWondersAction action(BonusState state)
            {
                return(new FreeSpinAction(level, bonusRequestcontext.Platform, sevenWondersBonus.SpinBet));
            }

            do
            {
                summData.FSpinCounter++;
                var freeSpinResult = BonusReducer.Dispatch(sevenWondersBonus, action);
                summData.FSTotalWin += freeSpinResult.Win;
                if (freeSpinResult.SpinResult.HasBonus)
                {
                    summData.FgFHit++;
                }

                if (freeSpinResult.IsCompleted)
                {
                    break;
                }
            } while (true);
            return(summData);
        }
Esempio n. 10
0
        public void OnMessage(IMessage message)
        {
            object data        = CreateDataObject(message);
            bool   isPermKeyOk = false;

            //Israel 11/20/2015 -- Added support for permission keys.
            if (message.NMSType.ToUpper() == "SUMMARY")
            {
                SummaryData summaryData = data as SummaryData;
                isPermKeyOk = (String.IsNullOrEmpty(summaryData.PermissionKey)) ||
                              (v_PermKeyList.IndexOf(summaryData.PermissionKey) > -1);
                if (isPermKeyOk || v_IsSuperUser)
                {
                    callback.Invoke(this, data);
                }
            }
            //Israel 12/16/2015 -- Message publisher was escaping the : character-- this removes it.
            else if (message.NMSType.ToUpper() == "CONFIRM")
            {
                TradeRqmtConfirm confirmData = data as TradeRqmtConfirm;
                if (!String.IsNullOrEmpty(confirmData.XmitAddr))
                {
                    confirmData.XmitAddr = confirmData.XmitAddr.Replace(@"\", "");
                }
                callback.Invoke(this, data);
            }
            else
            {
                callback.Invoke(this, data);
            }

            message.Acknowledge();
            //string testMessage = DateTime.Now.ToShortDateString() + ":" + DateTime.Now.ToLongTimeString() + ": " + message.ToString();
            //File.AppendAllText(@"_MessageDump.txt", testMessage + Environment.NewLine);
        }
Esempio n. 11
0
        public static string GetSummaryPost(string Format, SummaryData Data)
        {
            XDocument xmlData = XDocument.Parse(Data.XmlData);

            string[] games = xmlData.Descendants("Games").First().Value.Split(',');

            string gamesString = string.Empty;
            int    maxCount    = (games.Length > 0 && !games[0].Equals(string.Empty) ? (games.Length > 4 ? 4 : games.Length) : 0);

            for (int i = 0; i < maxCount; i++)
            {
                gamesString += games[i] + (i == 2 ? " & " : ", ");
            }

            if (int.Parse(xmlData.Descendants("AchievementPoints").First().Value) == 0)
            {
                return(string.Empty);
            }
            else
            {
                return(Data.Gamertag.Tag + " earned " + xmlData.Descendants("AchievementPoints").First().Value + " gamerpoints on Xbox 360 in the past [@Timeframe]." +
                       (!gamesString.Equals(string.Empty) ? " Recent games: " + gamesString.Trim(new char[] { ',', ' ' }) + "." : string.Empty));
            }

            //SaintFX82 earned 100 gamerpoints on Xbox 360 in the past week. Recent games: Mass Effect 2, Forza 3, Final Fantasy XIII & Grid.
        }
Esempio n. 12
0
    public static SummaryData GetSummary()
    {
        var result = new SummaryData
        {
            Sluzby = new List<IdName>()
        };

        using (var sqlConnection = new SqlConnection(ConnectionString))
        {
            using (var command = sqlConnection.CreateCommand())
            {
                command.PrepareStoredProcedure(sqlConnection, "GetSummary");

                sqlConnection.Open();
                using (var reader = command.ExecuteReader())
                {
                    if(reader.Read())
                    {
                        result.TotalPeople = reader.GetInt32(0);
                    }
                    reader.NextResult();

                    while (reader.Read())
                    {
                        result.Sluzby.Add(new IdName
                        {
                            Id = reader.GetInt32(0),
                            Name = reader.GetString(1)
                        });
                    }
                }
            }
        }
        return result;
    }
Esempio n. 13
0
 private void ReadSummaryData(string line, List <SummaryData> summaryData, string fileName, ref bool isSummaryRow)
 {
     try
     {
         string[]    splittedRow = line.Split('\t');
         SummaryData sd          = new SummaryData();
         sd.Type      = splittedRow[0];
         sd.Time      = splittedRow[1];
         sd.Value     = decimal.Parse(splittedRow[2]);
         sd.Condition = int.Parse(splittedRow[3]);
         if (sd.Condition == 3)
         {
             sqlModel.ParameterProcessTime = sd.Value;
         }
     }
     catch (IndexOutOfRangeException)
     {
         // Just ignore this exception for data because empty rows can come. Might come handy while debugging
         // Reading is done when this exception occurs
         isSummaryRow = false;
     }
     catch (Exception ex)
     {
         Logger.Log("ReadSummaryData Line no: " + rowNo, fileName, ex.Message);
     }
 }
Esempio n. 14
0
        public void RandomSpin(int gameId, int level, string currencyCode, int numOfUsers, int numItrPerUser, decimal bet)
        {
            const int lines = Game.Lines;

            var timeStart        = DateTime.Now;
            var module           = SimulationHelper.GetModule(gameId);
            var configuration    = new Configuration();
            var targetRtpLevel   = Math.Round(configuration.RtpLevels.FirstOrDefault(rl => rl.Level == level).Rtp, 2);
            var totalSummaryData = new SummaryData();

            var users               = SimulationHelper.GetUsers(gameId, numOfUsers, level);
            var spinBets            = SimulationHelper.GetUserBets(users, bet, lines);
            var spinRequestContext  = SimulationHelper.GetMockSpinRequestContext(gameId);
            var bonusRequestContext = SimulationHelper.GetMockBonusRequestContext(0, gameId);

            Parallel.ForEach(users,
                             () => new SummaryData(),
                             (key, state, summaryData) =>
            {
                var spinBet = spinBets[key.UserId];

                for (var ctr = 0; ctr < numItrPerUser; ctr++)
                {
                    var spinResult = module.ExecuteSpin(level, null, spinRequestContext).Value as SpinResult;

                    summaryData.Update(spinResult);

                    if (spinResult.HasBonus)
                    {
                        var bonus = module.CreateBonus(spinResult).Value;

                        while (!bonus.IsCompleted)
                        {
                            var bonusResult = SimulationHelper.ExecuteBonus(level, bonus, bonusRequestContext, configuration).Value;

                            summaryData.UpdateBonus(bonusResult);

                            bonus = bonusResult.Bonus;
                        }
                    }
                }

                return(summaryData);
            },
                             summaryData =>
            {
                lock (totalSummaryData)
                {
                    totalSummaryData.Sum(summaryData);
                }
            });

            totalSummaryData.DisplayData(level, timeStart, targetRtpLevel);
            totalSummaryData.DisplayPayoutsData(bet, lines);

            var isWithinRtp = totalSummaryData.RtpData.OverallRtp >= targetRtpLevel - 1 && totalSummaryData.RtpData.OverallRtp <= targetRtpLevel + 1;

            Assert.True(isWithinRtp, $"RTP not matching. The result is {totalSummaryData.RtpData.OverallRtp}. Expected is {targetRtpLevel}");
        }
        private void UpdateSummaryData(SummaryData sdata, SpinResult sr)
        {
            var alchemySpinResult = sr as ChessRoyaleSpinResult;

            sdata.SpinCounter++;
            sdata.TotalBet += alchemySpinResult.SpinBet.TotalBet;
            sdata.TotalWin += alchemySpinResult.Win;
        }
Esempio n. 16
0
        private void button1_Click(object sender, EventArgs e)
        {
            dataManager = new DSManager("", "", "", 10, "", "");
            SummaryData summaryDataTemplate = new SummaryData();

            summaryDataTemplate.FinalApprovalFlag = "N";
            IList <SummaryData> summaryList = dataManager.DaoManager.CreateObjList <SummaryData>(summaryDataTemplate);
        }
Esempio n. 17
0
        public SummaryDataViewModel GetSummaryDataForSingleSchool <T>(string seedCode, int month, int year) where T : SummaryData
        {
            SummaryData currentSummary = (SummaryData)this.rpGeneric2nd.Query <T>()
                                         .Where(x => x.type.Equals("School") && x.dataCode.Equals(seedCode) && x.dataMonth == month && x.dataYear == year)
                                         .SingleOrDefault();

            return(new SummaryDataViewModel(currentSummary));
        }
Esempio n. 18
0
        private void UpdateSummaryData(SummaryData sdata, SpinResult sr)
        {
            var alchemySpinResult = sr as AlchemyReelsCollapsingSpinResult;

            sdata.SpinCounter++;
            sdata.TotalBet += alchemySpinResult.SpinBet.TotalBet;
            sdata.TotalWin += alchemySpinResult.Win;
        }
        private void UpdateSummaryData(SummaryData sdata, SpinResult sr)
        {
            var FaFaZhuSpinResult = sr as FaFaZhuSpinResult;

            sdata.SpinCounter++;
            sdata.TotalBet += FaFaZhuSpinResult.SpinBet.TotalBet;
            sdata.TotalWin += FaFaZhuSpinResult.Win;
        }
Esempio n. 20
0
        private void UpdateSummaryData(SummaryData sdata, SpinResult sr)
        {
            var alchemySpinResult = sr as FountainOfFortuneSpinResult;

            sdata.SpinCounter++;
            sdata.TotalBet += alchemySpinResult.SpinBet.TotalBet;
            sdata.TotalWin += alchemySpinResult.Win;
        }
        private void UpdateSummaryData(SummaryData sdata, SpinResult sr)
        {
            var SpaceNeonSpinResult = sr as SpaceNeonSpinResult;

            sdata.SpinCounter++;
            sdata.TotalBet += SpaceNeonSpinResult.SpinBet.TotalBet;
            sdata.TotalWin += SpaceNeonSpinResult.Win;
        }
Esempio n. 22
0
        private static SummaryData ExecuteBonus(int level, RequestContext <BonusArgs> requestContext, GeniesLuckResult result)
        {
            var bonus           = module.CreateBonus(result);
            var geniesLuckBonus = bonus.Value as GeniesLuckBonus;
            var entity          = new BonusEntity
            {
                UserId       = -1,
                GameId       = GameId,
                Guid         = geniesLuckBonus.Guid.ToString("N"),
                Data         = Model.Utility.Extension.ToByteArray(geniesLuckBonus),
                BonusType    = bonus.GetType().Name,
                Version      = 3,
                RoundId      = 1,
                BetReference = ""
            };

            var summData = new SummaryData();

            do
            {
                var freeSpinResult = module.ExecuteBonus(level, entity, requestContext).Value as GeniesLuckBonusSpinResult;
                var spinResult     = freeSpinResult.SpinResult;
                switch (freeSpinResult.GameResultType)
                {
                case Model.GameResultType.FreeSpinResult:
                    summData.FSWin += freeSpinResult.Win;
                    summData.FSpinCounter++;
                    break;

                case Model.GameResultType.CollapsingSpinResult:
                    summData.ReSpinWin += freeSpinResult.Win;
                    break;

                case Model.GameResultType.FreeSpinCollapsingSpinResult:
                    summData.ReSpinFSWin += freeSpinResult.Win;
                    break;
                }

                if (spinResult.HasBonus)
                {
                    if (spinResult.Bonus.ClientId == 3)
                    {
                        summData.FgFHit++;
                    }
                    else
                    {
                        summData.FgReHit++;
                    }
                }

                if (freeSpinResult.IsCompleted)
                {
                    break;
                }
                entity.Data = Model.Utility.Extension.ToByteArray(freeSpinResult.Bonus);
            } while (true);
            return(summData);
        }
Esempio n. 23
0
        public IList <SummaryModel> Get(string startRangeBegin, string startRangeEnd, string endRangeBegin, string endRangeEnd, string locale)
        {
            Resources.Main.Culture = System.Globalization.CultureInfo.CreateSpecificCulture(locale);
            DateTime startRangeBeginDate;
            DateTime startRangeEndDate;
            DateTime endRangeBeginDate;
            DateTime endRangeEndDate;

            bool _continue = true;

            if (!DateTime.TryParse(startRangeBegin, null, System.Globalization.DateTimeStyles.AdjustToUniversal, out startRangeBeginDate))
            {
                _continue = false;
            }
            if (!DateTime.TryParse(startRangeEnd, null, System.Globalization.DateTimeStyles.AdjustToUniversal, out startRangeEndDate))
            {
                _continue = false;
            }
            if (!DateTime.TryParse(endRangeBegin, null, System.Globalization.DateTimeStyles.AdjustToUniversal, out endRangeBeginDate))
            {
                _continue = false;
            }
            if (!DateTime.TryParse(endRangeEnd, null, System.Globalization.DateTimeStyles.AdjustToUniversal, out endRangeEndDate))
            {
                _continue = false;
            }

            IList <SummaryModel> models = new List <SummaryModel>();

            try
            {
                SummaryDataRepository.ValidateRanges(startRangeBeginDate, startRangeEndDate, endRangeBeginDate, endRangeEndDate);
            }
            catch (Exception e)
            {
                throw new WrongDateException(e.Message);
            }

            _continue = SummaryDataRepository.RangesAreEqualSize(startRangeBeginDate, startRangeEndDate, endRangeBeginDate, endRangeEndDate);

            if (_continue)
            {
                SummaryDataRepository repository = new SummaryDataRepository();
                repository.CalculateNumberOfDays(startRangeBeginDate, startRangeEndDate);

                var data = SummaryData.CreateCollection(repository);

                models = SummaryModel.CreateCollection(data);
            }
            else
            {
                throw new WrongDateException(Resources.Main.Error);
            }

            return(models);
        }
        private void UpdateFaFaZhuSummaryData(SummaryData sd, SpinResult sr)
        {
            var FaFaZhuSpinResult = sr as FaFaZhuSpinResult;

            foreach (var wp in FaFaZhuSpinResult.WinPositions)
            {
                var vcounter = sd.WinCounter;
                vcounter[wp.Win] = vcounter.ContainsKey(wp.Win) ? vcounter[wp.Win] + 1 : 1;
            }
        }
Esempio n. 25
0
        private void UpdateAlchemyReelsSummaryData(SummaryData sd, SpinResult sr)
        {
            var alchemySpinResult = sr as AlchemyReelsCollapsingSpinResult;

            foreach (var wp in alchemySpinResult.WinPositions)
            {
                var scatter  = wp.Line == 0;
                var vcounter = scatter ? sd.ScatterCounter : sd.WinCounter;
                vcounter[wp.Win] = vcounter.ContainsKey(wp.Win) ? vcounter[wp.Win] + 1 : 1;
            }
        }
        public override MetricData <T> ToMetricData()
        {
            var summaryData = new SummaryData <T>();

            summaryData.Count     = this.checkPoint.Count;
            summaryData.Sum       = this.checkPoint.Sum;
            summaryData.Min       = this.checkPoint.Min;
            summaryData.Max       = this.checkPoint.Max;
            summaryData.Timestamp = DateTime.UtcNow;
            return(summaryData);
        }
Esempio n. 27
0
        private void AddSummaryItem(List <SummaryData> result, DateTime dateTime, string seriesName, decimal?value)
        {
            var summaryItem = new SummaryData()
            {
                DateTimeStamp = dateTime.ToJavascriptMilliseconds(),
                DateTime      = dateTime,
                SeriesName    = seriesName,
                YValue        = value
            };

            result.Add(summaryItem);
        }
Esempio n. 28
0
    //IEnumerator StepSchedulerEnumerator()
    //{
    //    SchedulerPause = true;
    //    SchedulerDeltaTime = Mathf.Ceil(SchedulerTime) - SchedulerTime;
    //    yield return null;
    //    SchedulerDeltaTime = 1.0f;
    //}
    public void makeSummary(PropertiesData CurrentlyProcessing, float SpeedAdjustment = 0.0f)
    {
        SummaryData summaryData = new SummaryData();

        summaryData.ProcessName    = CurrentlyProcessing.ProcessName;
        summaryData.ArrivalTime    = CurrentlyProcessing.ArrivalTime;
        summaryData.BurstTime      = CurrentlyProcessing.BurstTime;
        summaryData.CompletionTime = (float)System.Math.Round(SchedulerTime - SpeedAdjustment, 2);
        summaryData.TurnAroundTime = summaryData.CompletionTime - summaryData.ArrivalTime;
        summaryData.WaitingTime    = (float)System.Math.Round(summaryData.TurnAroundTime - summaryData.BurstTime, 2);
        summaryManager.summaryDatas.Add(summaryData);
    }
Esempio n. 29
0
        private void DisplayDinoAgeSummaryData(int level, decimal bet, int lines, SummaryData summData, DateTime timeStart, decimal maxWin1, List <int> maxIndexPosition)
        {
            var timeEnd = DateTime.Now;

            Console.WriteLine($"-----------------------------------------------------------");
            Console.WriteLine($"Test.SpinCount      : {summData.SpinCounter}");
            Console.WriteLine($"Test.Level          : {level}");
            Console.WriteLine($"Test.TimeStart      : {timeStart.ToShortDateString()} {timeStart.ToShortTimeString()}");
            Console.WriteLine($"Test.TimeEnd        : {timeEnd.ToShortDateString()} {timeEnd.ToShortTimeString()}");
            Console.WriteLine($"-----------------------------------------------------------");
            Console.WriteLine($"TotalBet            : {summData.TotalBet}");
            Console.WriteLine($"MG TotalWin         : {summData.TotalWin}");
            Console.WriteLine($"FG TotalWin         : {summData.FSTotalWin}");
            Console.WriteLine($"Max Win             : {maxWin1}");

            var payoutHitrate = new SortedDictionary <int, TupleRW <int, decimal, decimal, decimal, decimal> >();

            foreach (var w in summData.WinCounter.OrderByDescending(x => x.Key))
            {
                var hits        = summData.WinCounter.ContainsKey(w.Key) ? summData.WinCounter[w.Key] : 0;
                var probability = summData.WinCounter.ContainsKey(w.Key) ? (decimal)summData.WinCounter[w.Key] / (decimal)summData.SpinCounter : 0;
                var hitrate     = summData.WinCounter.ContainsKey(w.Key) ? (decimal)summData.SpinCounter / (decimal)summData.WinCounter[w.Key] : 0;
                var win         = w.Key * summData.SpinCounter * probability; //Win
                var rtp         = win / summData.TotalBet;
                var payout      = (int)(w.Key / bet);

                if (!payoutHitrate.ContainsKey(payout))
                {
                    payoutHitrate.Add(payout, new TupleRW <int, decimal, decimal, decimal, decimal>(0, 0, 0, 0, 0));
                }

                payoutHitrate[payout].Item1 += hits;
                payoutHitrate[payout].Item2 += win;
                payoutHitrate[payout].Item3 += (rtp * 100);
                payoutHitrate[payout].Item4 += probability;
                payoutHitrate[payout].Item5 += hitrate;
            }

            Console.WriteLine($"-----------------------------------------------------------");
            Console.WriteLine($"MG Spin Count           : {summData.SpinCounter}");
            Console.WriteLine($"-----------------------------------------------------------");

            Console.WriteLine($"--- HIT RATE ----------------------------------------------");
            foreach (var payout in payoutHitrate.OrderByDescending(p => p.Key))
            {
                Console.WriteLine($"{payout.Key,-10} \t{payout.Value.Item2,10:0.00} \t{payout.Value.Item1,10} \t{payout.Value.Item3,10:0.000} \t{payout.Value.Item4,10:0.000} \t{payout.Value.Item5,10:0.000}");
            }

            Console.WriteLine($"-----------------------------------------------------------");
            Console.WriteLine($"MG RTP                  : {summData.RTPSpin,0:P}");
            Console.WriteLine($"-----------------------------------------------------------");
            Console.WriteLine($"Total RTP               : {summData.RTPOverAll,0:P}");
        }
Esempio n. 30
0
        private static SummaryData ExecuteFreeSpin(int level, RequestContext <BonusArgs> bonusRequestcontext, WolvesResult result)
        {
            var bonus         = module.CreateBonus(result);
            var summData      = new SummaryData();
            var freeSpinBonus = bonus.Value as WolvesBonus;
            var totalFreeSpin = 0;
            var fscouter      = 0;

            switch (result.Wheel.Reels.Sum(ele => ele.Count(item => item == 9)))
            {
            case 3:
                totalFreeSpin = 10;
                break;

            case 4:
                totalFreeSpin = 15;
                break;

            case 5:
                totalFreeSpin = 20;
                break;
            }
            do
            {
                var freeSpinResult = BonusReducer.dispatch(level, freeSpinBonus, bonusRequestcontext) as WolvesSeqFreeSpinResult;
                var spinResult     = freeSpinResult.SpinResult;
                if (spinResult.Wheel.Type == 4)
                {
                    summData.FgRollingWin += spinResult.Win;
                }
                else
                {
                    summData.FSpinCounter++;
                    fscouter++;
                    summData.FSTotalWin += spinResult.Win;
                }

                if (spinResult.HasBonus)
                {
                    summData.FgRollingHit++;
                    Assert.True(spinResult.Win > 0);
                }

                if (freeSpinResult.IsCompleted)
                {
                    break;
                }
                freeSpinBonus = freeSpinResult.Bonus as WolvesBonus;
            } while (true);

            Assert.AreEqual(totalFreeSpin, fscouter);
            return(summData);
        }
        private void SumAndPublish(IList <ShoppingList> allLists)
        {
            var done  = allLists.Sum(d => d.NumberOfCompletedItems);
            var total = allLists.Sum(d => d.NumberOfItems);
            var sd    = new SummaryData()
            {
                TotalItems = total,
                DoneItems  = done
            };

            TinyPubSub.Publish <SummaryData>("SummaryData", sd);
        }
Esempio n. 32
0
        public static string GetSummaryPost(string Format, SummaryData Data)
        {
            XDocument xmlData = XDocument.Parse(Data.XmlData);

            string[] games = xmlData.Descendants("Games").First().Value.Split(',');

            string gamesString = string.Empty;
            int maxCount = (games.Length > 0 && !games[0].Equals(string.Empty) ? (games.Length > 4 ? 4 : games.Length) : 0);
            for (int i = 0; i < maxCount; i++)
                gamesString += games[i] + (i == 2 ? " & " : ", ");

            if (int.Parse(xmlData.Descendants("AchievementPoints").First().Value) == 0)
                return string.Empty;
            else
                return Data.Gamertag.Tag + " earned " + xmlData.Descendants("AchievementPoints").First().Value + " gamerpoints on Xbox 360 in the past [@Timeframe]." +
                    (!gamesString.Equals(string.Empty) ? " Recent games: " + gamesString.Trim(new char[]{ ',', ' '}) + "." : string.Empty);

            //SaintFX82 earned 100 gamerpoints on Xbox 360 in the past week. Recent games: Mass Effect 2, Forza 3, Final Fantasy XIII & Grid.
        }
Esempio n. 33
0
 public string GetSummaryPost(GamervineDataContext DataContext, SummaryData Data, string Format)
 {
     return bcXboxData.GetSummaryPost(Format, Data);
 }
Esempio n. 34
0
        public void ProcessSummary(GamervineDataContext DataContext, Gamertag Gamertag)
        {
            var summaryData = from s in DataContext.SummaryData
                              where s.TagId == Gamertag.TagId
                              select s;

            SummaryData sData = null;
            XDocument xdXmlData = null;
            bool isNew = false;
            if (summaryData.Count() == 0)
            {
                isNew = true;
                sData = new SummaryData();
                sData.TagId = Gamertag.TagId;
                sData.LastProcessedDate = DateTime.Parse("01/01/1753");
                xdXmlData = GetSummaryXml();
                sData.XmlData = xdXmlData.ToString();
            }
            else
            {
                sData = summaryData.First();
                xdXmlData = XDocument.Parse(sData.XmlData);
            }

            var dataToProcess = from xd in DataContext.XboxData
                                where xd.TagId == Gamertag.TagId &&
                                    xd.RetrieveDate > sData.LastProcessedDate
                                orderby xd.RetrieveDate ascending
                                select xd;

            if (dataToProcess.Count() == 0)
                return;

            //This handles the first row of data - everything else is then based off of it's successor
            int? lastGamerscore = int.Parse(xdXmlData.Descendants("Gamerscore").First().Value);
            int? achievementPoints = int.Parse(xdXmlData.Descendants("AchievementPoints").First().Value);

            if (lastGamerscore == 0)
                lastGamerscore = dataToProcess.First().Gamerscore;

            DateTime lastProcessedDate = DateTime.MinValue;
            foreach (XboxData currXboxData in dataToProcess)
            {
                if (currXboxData.Gamerscore != lastGamerscore)
                {
                    achievementPoints += currXboxData.Gamerscore - lastGamerscore;

                    lastGamerscore = currXboxData.Gamerscore;
                }

                lastProcessedDate = currXboxData.RetrieveDate;
            }

            XDocument lastXboxData_XmlData = XDocument.Parse(dataToProcess.AsEnumerable().Last().XmlData);

            var lastGames = from xugi in lastXboxData_XmlData.Descendants("XboxUserGameInfo")
                            select new bcGame
                            {
                                Name = xugi.Element("Game").Element("Name").Value,
                                TotalAchievements = int.Parse(xugi.Element("Game").Element("TotalAchievements").Value),
                                TotalGamerScore = int.Parse(xugi.Element("Game").Element("TotalGamerScore").Value),
                                Image32Url = new Uri(xugi.Element("Game").Element("Image32Url").Value),
                                Image64Url = new Uri(xugi.Element("Game").Element("Image64Url").Value)
                            };

            sData.LastProcessedDate = lastProcessedDate;

            xdXmlData.Descendants("Gamerscore").First().SetValue(lastGamerscore);
            xdXmlData.Descendants("AchievementPoints").First().SetValue(achievementPoints);

            StringBuilder sbGames = new StringBuilder();

            int maxVal = (lastGames.Count() >= 5 ? 5 : lastGames.Count());
            for (int i = 0; i < maxVal; i++)
                sbGames.Append(lastGames.AsEnumerable().ElementAt(i).Name + ",");

            xdXmlData.Descendants("Games").First().SetValue(sbGames.ToString().TrimEnd(new char[]{ ',' }));

            sData.XmlData = xdXmlData.ToString();

            if(isNew)
                DataContext.SummaryData.InsertOnSubmit(sData);
        }
Esempio n. 35
0
    public static SummaryData GetSummary()
    {
        var result = new SummaryData
        {
            Tricka = new List<TeeShirtInfo>(),
            Volunteers = new List<UserInfo>(),
            Commenters = new List<UserInfo>(),
            NeedHelp = new List<UserInfo>(),
            Churches = new List<NameCount>()
        };

        using (var sqlConnection = new SqlConnection(ConnectionString))
        {
            using (var command = sqlConnection.CreateCommand())
            {
                command.PrepareStoredProcedure(sqlConnection, "GetSummary3");

                sqlConnection.Open();
                using (var reader = command.ExecuteReader())
                {
                    if(reader.Read())
                    {
                        var i = 0;
                        result.TotalPeople = reader.GetInt32(i++);
                        result.PiatokVecera = reader.GetInt32(i++);
                        result.PiatokVeceraZaplatene = reader.GetInt32(i++);
                        result.PiatokVecera2 = reader.GetInt32(i++);
                        result.PiatokVecera2Zaplatene = reader.GetInt32(i++);
                        result.UbytovaniePiatokSobota = reader.GetInt32(i++);
                        result.TichaTriedaPiatokSobota = reader.GetInt32(i++);
                        result.SobotaRanajky = reader.GetInt32(i++);
                        result.SobotaRanajkyZaplatene = reader.GetInt32(i++);
                        result.SobotaObed = reader.GetInt32(i++);
                        result.SobotaObedZaplatene = reader.GetInt32(i++);
                        result.SobotaVecera = reader.GetInt32(i++);
                        result.SobotaVeceraZaplatene = reader.GetInt32(i++);
                        result.SobotaVecera2 = reader.GetInt32(i++);
                        result.SobotaVecera2Zaplatene = reader.GetInt32(i++);
                        result.UbytovanieSobotaNedela = reader.GetInt32(i++);
                        result.TichaTriedaSobotaNedela = reader.GetInt32(i++);
                        result.NedelaRanajky = reader.GetInt32(i++);
                        result.NedelaRanajkyZaplatene = reader.GetInt32(i++);
                        result.NedelaObed = reader.GetInt32(i++);
                        result.NedelaObedZaplatene = reader.GetInt32(i++);
                        result.Sach = reader.GetInt32(i++);
                        result.PingPong = reader.GetInt32(i++);
                        result.VolunteersTotal = reader.GetInt32(i++);
                        result.Internat1 = reader.GetInt32(i++);
                        result.Internat2 = reader.GetInt32(i++);
                    }
                    reader.NextResult();

                    int totalOrdered = 0;
                    while (reader.Read())
                    {
                        var ordered = reader.GetInt32(1);
                        result.Tricka.Add(new TeeShirtInfo
                        {
                            Name = reader.GetString(0),
                            Ordered = ordered
                        });
                        totalOrdered += ordered;
                    }
                    reader.NextResult();

                    int totalPaid = 0;
                    while (reader.Read())
                    {
                        var name = reader.GetString(0);
                        var paid = reader.GetInt32(1);
                        var tee = result.Tricka.First(x => x.Name == name);
                        if(tee != null) tee.Paid = paid;
                        totalPaid += paid;
                    }
                    reader.NextResult();
                    result.Tricka.Add(new TeeShirtInfo
                        {
                            Name = "Spolu",
                            Ordered = totalOrdered,
                            Paid = totalPaid
                        });

                    if (reader.Read()) result.ExpectingEur = (float)reader.GetDecimal(0);
                    reader.NextResult();

                    if (reader.Read()) result.ExpectingCzk = (float)reader.GetDecimal(0);
                    reader.NextResult();

                    if (reader.Read()) result.MoneyFromPeople = (float)reader.GetDecimal(0);
                    reader.NextResult();

                    if (reader.Read()) result.MoneyFromChurches = (float)reader.GetDouble(0);
                    reader.NextResult();

                    while (reader.Read())
                    {
                        result.Volunteers.Add(new UserInfo
                        {
                            FirstName = reader.GetString(0),
                            LastName = reader.GetString(1),
                            Email = reader.GetString(2),
                            Phone = reader.GetString(3),
                            Note = reader.GetString(4)
                        });
                    }
                    reader.NextResult();

                    while (reader.Read())
                    {
                        result.Commenters.Add(new UserInfo
                        {
                            FirstName = reader.GetString(0),
                            LastName = reader.GetString(1),
                            Email = reader.GetString(2),
                            Phone = reader.GetString(3),
                            Note = reader.GetString(4)
                        });
                    }
                    reader.NextResult();

                    while (reader.Read())
                    {
                        result.NeedHelp.Add(new UserInfo
                        {
                            FirstName = reader.GetString(0),
                            LastName = reader.GetString(1),
                            Email = reader.GetString(2),
                            Phone = reader.GetString(3),
                            Note = reader.GetString(4)
                        });
                    }
                    reader.NextResult();

                    while (reader.Read())
                    {
                        result.Churches.Add(new NameCount
                        {
                            Name = reader.GetString(0),
                            Count = reader.GetInt32(1)
                        });
                    }
                }
            }
        }
        return result;
    }
Esempio n. 36
0
        /// <summary>
        /// Update the (JSON) summary in the Output item.
        /// </summary>
        /// <param name="name">The name of the Template.</param>
        /// <param name="files">The files/binaries created by the Template.</param>
        protected void OutputSummary(string name, IEnumerable<string> files)
        {
            List<SummaryData> summaries = new List<SummaryData>();

            Item outputItem = Package.GetByName(Package.OutputName);
            if (outputItem != null)
            {
                summaries = JsonConvert.DeserializeObject <List<SummaryData>>(outputItem.GetAsString());
                Package.Remove(outputItem);
            }

            SummaryData summary = new SummaryData { Name = name, Status = "Success", Files = files };
            summaries.Add(summary);

            string summariesJson = JsonSerialize(summaries);
            outputItem = Package.CreateStringItem(ContentType.Text, summariesJson);
            Package.PushItem(Package.OutputName, outputItem);
        }