コード例 #1
0
        public static RegisterInfo GetRegisterInfo(string amiiboId)
        {
            VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);

            UtilityImpl utilityImpl = new UtilityImpl();
            CharInfo    charInfo    = new CharInfo();

            charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0));

            // TODO: Maybe change the "no name" by the player name when user profile will be implemented.
            // charInfo.Nickname = Nickname.FromString("Nickname");

            RegisterInfo registerInfo = new RegisterInfo()
            {
                MiiCharInfo     = charInfo,
                FirstWriteYear  = (ushort)amiiboFile.FirstWriteDate.Year,
                FirstWriteMonth = (byte)amiiboFile.FirstWriteDate.Month,
                FirstWriteDay   = (byte)amiiboFile.FirstWriteDate.Day,
                FontRegion      = 0,
                Reserved1       = new Array64 <byte>(),
                Reserved2       = new Array58 <byte>()
            };

            Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.ToSpan());

            return(registerInfo);
        }
コード例 #2
0
ファイル: VirtualAmiibo.cs プロジェクト: YR1044/Ryujinx
        public static RegisterInfo GetRegisterInfo(string amiiboId, string nickname)
        {
            VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);

            UtilityImpl utilityImpl = new UtilityImpl();
            CharInfo    charInfo    = new CharInfo();

            charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0));

            charInfo.Nickname = Nickname.FromString(nickname);

            RegisterInfo registerInfo = new RegisterInfo()
            {
                MiiCharInfo     = charInfo,
                FirstWriteYear  = (ushort)amiiboFile.FirstWriteDate.Year,
                FirstWriteMonth = (byte)amiiboFile.FirstWriteDate.Month,
                FirstWriteDay   = (byte)amiiboFile.FirstWriteDate.Day,
                FontRegion      = 0,
                Reserved1       = new Array64 <byte>(),
                Reserved2       = new Array58 <byte>()
            };

            Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.ToSpan());

            return(registerInfo);
        }
コード例 #3
0
        /// <summary>
        /// This will demonstrate Use case of:
        /// 1. Fetching forecast configuration list
        /// 2. Fetching forecast configuration using the name
        /// 3. Fecthing forecast Periods for the forecast configuration
        /// 4. Fetching all the forecast Instances for the given forecast configuration and forecast period
        /// 5. Updating their column value using update simple column API by forecast Instance Id
        /// 6. Validating the updates are successful.
        /// </summary>
        /// <param name="da">Forecast Data Access Object</param>
        private void PerformUsecase(ForecastDataAccess da)
        {
            // Fetching full Forecast Configuration List
            var fcs = da.GetFCList();

            LogWriter.GetLogWriter().LogWrite($"Num FCs:{fcs.Count}");
            LogWriter.GetLogWriter().LogWrite($"FCs Names: {string.Join(",", (fcs.Select(c => c.Name).ToList().ToArray()))}");

            // fetching forecast configuration by name

            var fcsByName = da.GetFCListByName(Constants.forecastConfigurationName);

            if (fcsByName.Count == 0)
            {
                LogWriter.GetLogWriter().LogWrite("Please provide a valid fc Name");
                return;
            }
            LogWriter.GetLogWriter().LogWrite($"FCs Found:{fcs.Count > 0}");
            LogWriter.GetLogWriter().LogWrite($"FCs Id: {string.Join(",", (fcs.Select(c => c.ForecastConfigurationId).ToList().ToArray()))}");

            // fetching forecast periods for the forecast configuration
            var fps = da.GetForecastPeriodsList(fcsByName[0].ForecastConfigurationId);

            LogWriter.GetLogWriter().LogWrite("FPs Names: " + string.Join(",", (fps.Select(c => c.Name).ToList().ToArray())));

            var fpResults = fps.Where(o => o.Name == Constants.forecastperiodName).ToList();

            if (fpResults.Count == 0)
            {
                LogWriter.GetLogWriter().LogWrite("Please provide a valid forecast period Name");
                return;
            }

            var fis = da.FetchFullFIList(fcsByName[0].ForecastConfigurationId, fpResults[0].Id);

            Dictionary <Guid, double> dataSet = UtilityImpl.prepareDataSet(fis);

            LogWriter.GetLogWriter().LogWrite("FIs fetched: " + fis.Count);

            LogWriter.GetLogWriter().LogWrite("FIs Guids: " + string.Join(",", (fis.Select(c => c.ForecastInstanceId).ToList().ToArray())));

            LogWriter.GetLogWriter().LogWrite("DataSet Size: " + dataSet.Count());

            LogWriter.GetLogWriter().LogWrite("DataSet build: " + UtilityImpl.DictToDebugString(dataSet));

            var res = da.UpdateSimpleColumnByFIId(fcsByName[0].ForecastConfigurationId,
                                                  fpResults[0].Id,
                                                  fis,
                                                  dataSet);

            fis = da.FetchFullFIList(fcsByName[0].ForecastConfigurationId, fpResults[0].Id);

            UtilityImpl.VerifyDataSet(fis, dataSet);

            Console.WriteLine("Completed");
            Console.ReadKey();
        }
コード例 #4
0
ファイル: StoreData.cs プロジェクト: scese250/Ryujinx
        public static StoreData BuildFromCoreData(UtilityImpl utilImpl, CoreData coreData)
        {
            StoreData result = new StoreData
            {
                CoreData  = coreData,
                _createId = utilImpl.MakeCreateId()
            };

            result.UpdateCrc();

            return(result);
        }
コード例 #5
0
ファイル: StoreData.cs プロジェクト: scese250/Ryujinx
        public static StoreData BuildDefault(UtilityImpl utilImpl, uint index)
        {
            StoreData result = new StoreData
            {
                _createId = utilImpl.MakeCreateId()
            };

            CoreData coreData = new CoreData();

            DefaultMii template = DefaultMii.GetDefaultMii(index);

            coreData.SetDefault();

            coreData.Nickname        = template.Nickname;
            coreData.FontRegion      = (FontRegion)template.FontRegion;
            coreData.FavoriteColor   = (byte)template.FavoriteColor;
            coreData.Gender          = (Gender)template.Gender;
            coreData.Height          = (byte)template.Height;
            coreData.Build           = (byte)template.Build;
            coreData.Type            = (byte)template.Type;
            coreData.RegionMove      = (byte)template.RegionMove;
            coreData.FacelineType    = (FacelineType)template.FacelineType;
            coreData.FacelineColor   = (FacelineColor)Helper.Ver3FacelineColorTable[template.FacelineColorVer3];
            coreData.FacelineWrinkle = (FacelineWrinkle)template.FacelineWrinkle;
            coreData.FacelineMake    = (FacelineMake)template.FacelineMake;
            coreData.HairType        = (HairType)template.HairType;
            coreData.HairColor       = (CommonColor)Helper.Ver3HairColorTable[template.HairColorVer3];
            coreData.HairFlip        = (HairFlip)template.HairFlip;
            coreData.EyeType         = (EyeType)template.EyeType;
            coreData.EyeColor        = (CommonColor)Helper.Ver3EyeColorTable[template.EyeColorVer3];
            coreData.EyeScale        = (byte)template.EyeScale;
            coreData.EyeAspect       = (byte)template.EyeAspect;
            coreData.EyeRotate       = (byte)template.EyeRotate;
            coreData.EyeX            = (byte)template.EyeX;
            coreData.EyeY            = (byte)template.EyeY;
            coreData.EyebrowType     = (EyebrowType)template.EyebrowType;
            coreData.EyebrowColor    = (CommonColor)Helper.Ver3HairColorTable[template.EyebrowColorVer3];
            coreData.EyebrowScale    = (byte)template.EyebrowScale;
            coreData.EyebrowAspect   = (byte)template.EyebrowAspect;
            coreData.EyebrowRotate   = (byte)template.EyebrowRotate;
            coreData.EyebrowX        = (byte)template.EyebrowX;
            coreData.EyebrowY        = (byte)template.EyebrowY;
            coreData.NoseType        = (NoseType)template.NoseType;
            coreData.NoseScale       = (byte)template.NoseScale;
            coreData.NoseY           = (byte)template.NoseY;
            coreData.MouthType       = (MouthType)template.MouthType;
            coreData.MouthColor      = (CommonColor)Helper.Ver3MouthColorTable[template.MouthColorVer3];
            coreData.MouthScale      = (byte)template.MouthScale;
            coreData.MouthAspect     = (byte)template.MouthAspect;
            coreData.MouthY          = (byte)template.MouthY;
            coreData.BeardColor      = (CommonColor)Helper.Ver3HairColorTable[template.BeardColorVer3];
            coreData.BeardType       = (BeardType)template.BeardType;
            coreData.MustacheType    = (MustacheType)template.MustacheType;
            coreData.MustacheScale   = (byte)template.MustacheScale;
            coreData.MustacheY       = (byte)template.MustacheY;
            coreData.GlassType       = (GlassType)template.GlassType;
            coreData.GlassColor      = (CommonColor)Helper.Ver3GlassColorTable[template.GlassColorVer3];
            coreData.GlassScale      = (byte)template.GlassScale;
            coreData.GlassY          = (byte)template.GlassY;
            coreData.MoleType        = (MoleType)template.MoleType;
            coreData.MoleScale       = (byte)template.MoleScale;
            coreData.MoleX           = (byte)template.MoleX;
            coreData.MoleY           = (byte)template.MoleY;

            result.CoreData = coreData;

            result.UpdateCrc();

            return(result);
        }
コード例 #6
0
ファイル: StoreData.cs プロジェクト: scese250/Ryujinx
 public static StoreData BuildRandom(UtilityImpl utilImpl, Age age, Gender gender, Race race)
 {
     return(BuildFromCoreData(utilImpl, CoreData.BuildRandom(utilImpl, age, gender, race)));
 }