示例#1
0
 private static void InitResNameTable()
 {
     foreach (object[] args in TableLoader.LoadTable("data/resnametable.txt", 2))
     {
         ResNameTable[args[1]] = args[2];
     }
 }
示例#2
0
        public void AllNamedTablesAreRegistered(Type type, string name)
        {
            TableLoader tl = new TableLoader();

            Assert.Contains(type, tl.RegisterdTypes());
            Assert.Equal(name, tl.GetTag(type));
        }
示例#3
0
        protected void Application_Start(object sender, EventArgs e)
        {
            ThreadPool.SetMinThreads(Environment.ProcessorCount * 2, Environment.ProcessorCount * 10);
            ThreadPool.SetMaxThreads(Environment.ProcessorCount * 4, Environment.ProcessorCount * 16);

            // Log
            LogicCore.Utility.ThirdPartyLog.Log4Net.Initialize();

            // Mysql
            Repository.RepositoryStatic.Init_Mysql();

            // Register Singleton
            Singleton.Register <CryptoFacade>();
            Singleton.Register <FootballFixtureDetailConverter>();
            Singleton.Register <FootballStandingsDetailConverter>();
            Singleton.Register <FootballLeagueDetailConverter>();
            Singleton.Register <FootballTeamDetailConverter>();
            Singleton.Register <FootballOddsDetailConverter>();
            Singleton.Register <FootballPredictionDetailConverter>();
            Singleton.Register <FootballVIPFixtureDetailConverter>();

            // Register Comparer
            Singleton.Register <FootballFixtureEqualityComparer>();

            // Load Table
            string tableRootPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data");

            TableLoader.Init(tableRootPath);
        }
        public void Reticle_DrawShot()
        {
            var canvas     = CreateMockCanvas();
            var reticle    = CreateReticle();
            var trajectory = TableLoader.FromResource("g1_wind");

            // How constants calculated:
            //     Reticle: 10x10mil
            //     Canvas: 10000x1000 pixels
            //     Center of Target @ 250ft (see trajectory -> -3.2moa drop (0.95068 mil), 2.6moa windage (0.75828 mil))
            //     Map center to target: mil to pixel y: 950, x: 758 against zero @ 5000x5000
            //     Linear size of the target = atan(8 inches / 250 yards) = 0.905414549 mil => 905 pixels
            //     c1 = center - size / 2, c2 = center + size / 2

            canvas.Setup(canva => canva.Rectangle(
                             It.Is <float>(f => Approximately(f, 5305, 5)),
                             It.Is <float>(f => Approximately(f, 5497, 5)),
                             It.Is <float>(f => Approximately(f, 6210, 5)),
                             It.Is <float>(f => Approximately(f, 6403, 5)),
                             It.Is <float>(f => Approximately(f, 1, 0.1f)),
                             It.Is <bool>(b => !b),
                             It.Is <string>(s => s == "zecolor"))).Verifiable();

            ReticleDrawController controller = new ReticleDrawController(reticle, canvas.Object);

            controller.DrawTarget(trajectory.Trajectory, DistanceUnit.Inch.New(8), DistanceUnit.Yard.New(250), "zecolor");

            canvas.Verify();
        }
        public void GivenATableWithIndex(string tableName, string indexName, int indexRead, int indexWrite)
        {
            var tableDesc = new TableDescription
            {
                TableName             = tableName,
                ProvisionedThroughput = new ProvisionedThroughputDescription
                {
                    ReadCapacityUnits  = indexRead,
                    WriteCapacityUnits = indexWrite
                },
                GlobalSecondaryIndexes = new List <GlobalSecondaryIndexDescription>
                {
                    new GlobalSecondaryIndexDescription
                    {
                        IndexName             = indexName,
                        ProvisionedThroughput = new ProvisionedThroughputDescription
                        {
                            ReadCapacityUnits  = indexRead,
                            WriteCapacityUnits = indexWrite
                        }
                    }
                }
            };

            var resource = new AwsResource <TableDescription>(tableName, tableDesc);

            TableLoader
            .Setup(x => x.GetResourceAsync(tableName))
            .ReturnsAsync(resource);
        }
示例#6
0
    protected override void Awake()
    {
        base.Awake();
        SetPlayComponent(false);

        TableLoader.LoadAllData();
    }
示例#7
0
        public static void Main(string[] args)
        {
            TableLoader.fileLoadPath = @"D:\CSProjects\FlatTable\FlatTable\Test\BinaryFile";
            TableLoader.Load <TestTable>();
            TableLoader.Load <AnotherTestTable>();

            if (AnotherTestTable.ins == null)
            {
                return;
            }
            List <AnotherTestTable.Value> valueList = AnotherTestTable.ins.list;

            for (int i = 0; i < valueList.Count; i++)
            {
                Debug.WriteLine(valueList[i].id);
                Debug.WriteLine(valueList[i].hero_name);
                Debug.WriteLine(valueList[i].speed);
                Debug.WriteLine(valueList[i].damage);
                Debug.WriteLine(valueList[i].is_lock);

                for (int j = 0; j < valueList[i].resource.Length; j++)
                {
                    Debug.WriteLine(valueList[i].resource[j]);
                }
            }
        }
        /// <summary>
        /// Gets the table. If <see cref="Owner" /> is specified, it is used.
        /// </summary>
        /// <param name="tableName">Name of the table. Oracle names can be case sensitive.</param>
        /// <param name="ct">The ct.</param>
        public DatabaseTable Table(string tableName, CancellationToken ct)
        {
            if (string.IsNullOrEmpty(tableName))
            {
                throw new ArgumentNullException("tableName");
            }

            var loader  = new TableLoader(_schemaReader, DatabaseSchema);
            var handler = ReaderProgress;

            if (handler != null)
            {
                loader.ReaderProgress += RaiseReadingProgress;
            }
            var table = loader.Load(tableName, ct);

            if (ct.IsCancellationRequested)
            {
                return(table);
            }

            if (DatabaseSchema.DataTypes.Count > 0)
            {
                DatabaseSchemaFixer.UpdateDataTypes(DatabaseSchema);
            }
            _schemaReader.PostProcessing(DatabaseSchema);

            return(table);
        }
示例#9
0
    private void LoadFromStreamingAssetsFolder()
    {
        TableLoader.loadType     = LoadType.FilePath;
        TableLoader.fileLoadPath = Application.streamingAssetsPath + "/Table";
        TableLoader.Load <AnotherTestTable>();

        if (AnotherTestTable.ins == null)
        {
            return;
        }
        List <AnotherTestTable.Value> valueList = AnotherTestTable.ins.list;

        for (int i = 0; i < valueList.Count; i++)
        {
            Debug.Log(valueList[i].id);
            Debug.Log(valueList[i].hero_name);
            Debug.Log(valueList[i].speed);
            Debug.Log(valueList[i].damage);
            Debug.Log(valueList[i].is_lock);

            for (int j = 0; j < valueList[i].resource.Length; j++)
            {
                Debug.Log(valueList[i].resource[j]);
            }
        }
    }
示例#10
0
        public void NullForUnknownTypes()
        {
            TableLoader loader = new TableLoader();
            string      tag    = loader.GetTag(typeof(TableLoaderTests));

            Assert.Null(tag);
        }
示例#11
0
    private async void Awake()
    {
        var tableLoader = new TableLoader();
        await tableLoader.LoadAllTableAsync();

        TempDI.TableLoader = tableLoader;

        var sceneManager = new SceneManagerAdapter();

        TempDI.SceneManager = sceneManager;

        var uiManager = new UIManager(tableLoader.GetTable <IUIPath>(), sceneManager);

        TempDI.UIManager = uiManager;
        await uiManager.Init();

        var roomManager = new RoomManager();

        TempDI.RoomManager = roomManager;

        var gameFSM = new GameFSM(sceneManager, uiManager, roomManager);

        TempDI.GameFSM = gameFSM;

        await gameFSM.ChangeFSMAsync(eGameFSM.StartUp);
    }
示例#12
0
 private static void InitMsgStringTable()
 {
     foreach (object[] args in TableLoader.LoadTable("data/msgstringtable.txt", 1))
     {
         MsgStringTable[args[0]] = args[1];
     }
 }
示例#13
0
    protected override void Awake()
    {
        base.Awake();
        TableLoader.LoadAllData();
        Debug.Log("이이잉 : " + EnemyData.Get(1).Key);

        SetPlayCompoenent(false);
    }
示例#14
0
    private void Awake()
    {
        Instance  = this;
        tableDict = new Dictionary <string, List <Dictionary <string, string> > >();
#if UNITY_EDITOR
        InitInEdit();
#else
        InitInWindows();
#endif
    }
示例#15
0
        public void TryingToLoadUnregisteredTagReturnsUnknownTable()
        {
            TableLoader loader = new TableLoader();

            string tag    = Guid.NewGuid().ToString();
            Table  result = loader.Load(tag, null);

            UnknownTable table = Assert.IsType <UnknownTable>(result);

            Assert.Equal(tag, table.Name);
        }
        public TrapArchitect()
        {
            tableLoader = new TableLoader();

            trapBaseFactory         = new TrapEffectFactory();
            effectFactory           = new TrapEffectFactory();
            pitContentEffectFactory = new TrapEffectFactory();
            gasTrapContentFactory   = new TrapEffectFactory();
            trapDamagesFactory      = new TrapEffectFactory();
            mechanismFactory        = new TrapEffectFactory();

            LoadTables();
        }
示例#17
0
        private static void InitMp3NameTable()
        {
            foreach (object[] args in TableLoader.LoadTable("data/mp3nametable.txt", 2))
            {
                if (!MapTable.ContainsKey(args[1]))
                {
                    MapTable.Add(args[1], new MapTableStruct());
                }

                MapTableStruct mts = (MapTableStruct)MapTable[args[1]];
                mts.mp3 = Convert.ToString(args[2]);
            }
        }
        private static GameObject ImportVpx(string path, bool applyPatch, string tableName)
        {
            // create root object
            var rootGameObj = new GameObject();
            var importer    = rootGameObj.AddComponent <VpxConverter>();

            // load table
            var table = TableLoader.LoadTable(path);

            Logger.Info("Importing Table\nInfoName={0}\nInfoAuthorName={1}", table.InfoName, table.InfoAuthorName);

            importer.Convert(Path.GetFileName(path), table, applyPatch, tableName);

            return(rootGameObj);
        }
        public void GivenATable(string tableName, int readCapacity, int writeCapacity)
        {
            var tableDesc = new TableDescription
            {
                TableName             = tableName,
                ProvisionedThroughput = new ProvisionedThroughputDescription
                {
                    ReadCapacityUnits  = readCapacity,
                    WriteCapacityUnits = writeCapacity
                }
            };

            TableLoader
            .Setup(x => x.GetResourceAsync(tableName))
            .ReturnsAsync(tableDesc);
        }
示例#20
0
        /// <summary>
        /// 初始化一个<see cref="LoaderContext"/>类型的实例
        /// </summary>
        public LoaderContext()
        {
            KeyLoader             = new KeyLoader();
            ReferenceLoader       = new ReferenceLoader();
            DbmsLoader            = new DbmsLoader();
            GroupLoader           = new GroupLoader();
            PhysicalDiagramLoader = new PhysicalDiagramLoader();
            ViewLoader            = new ViewLoader();
            SchemaLoader          = new SchemaLoader();
            TargetModelLoader     = new TargetModelLoader();

            TableLoader   = new TableLoader(KeyLoader);
            PackageLoader = new PackageLoader(TableLoader, ReferenceLoader);

            PdmLoader = new PdmLoader(this);
        }
示例#21
0
    public static T GetDeploy <T>(int id) where T : BaseDeploy
    {
        Type type = typeof(T);

        object[] attributes = type.GetCustomAttributes(false);
        for (int i = 0; i < attributes.Length; i++)
        {
            if (attributes[i] is Deploy)
            {
                Deploy deploy = (Deploy)attributes[i];
                return(TableLoader.Load <T>(deploy.path, id));
            }
        }

        return(null);
    }
        public bool LoadTable <T>(string file, bool merge, TableSet <T> table = null) where T : TableBase, new()
        {
            lock (mLock)
            {
                int id = TableSet <T> .HashTable(file);

                if (!mTaskQueue.Add(id))
                {
                    return(false);
                }
                TableLoader <T> loader = new TableLoader <T>(id, file, merge, table, mTableFolder, mTableExtension);
                IsLoading = true;
                mLoaders.Enqueue(loader);
                return(true);
            }
        }
示例#23
0
        private List <Character> LFGFetchPage(int Index)
        {
            using (var w = new WebClient())
            {
                string Raw;

                w.Encoding = System.Text.Encoding.UTF8;
                w.Headers.Add(h_UserAgent);

                if (Index == -1)
                {
                    Raw = w.DownloadString(IndexPage);
                    return(TableLoader.ReadTableData(Raw));
                }
                else
                {
                    Raw = w.UploadString(string.Format(NextPage, Index), RQ);
                    return(TableLoader.ReadTableData(Raw));
                }
            }
        }
        public override void OnImportAsset(AssetImportContext ctx)
        {
            Logger.Info("Importing VPX table at {0}...", ctx.assetPath);

            // create root object
            var rootGameObj = new GameObject();
            var importer    = rootGameObj.AddComponent <VpxImporter>();

            // load table
            var table = TableLoader.LoadTable(ctx.assetPath);

            // instantiate asset handler
            var assetHandler = new AssetImportHandler(ctx);

            importer.Import(Path.GetFileName(ctx.assetPath), table, assetHandler);

            ctx.AddObjectToAsset("main obj", rootGameObj);
            ctx.SetMainObject(rootGameObj);

            // select imported object
            Selection.activeObject = rootGameObj;
        }
示例#25
0
        private static List <Character> LFGFetchAll()
        {
            using (var w = new WebClient())
            {
                string           Raw;
                List <Character> lfg = new List <Character>();
                w.Encoding = System.Text.Encoding.UTF8;

                //Download first page
                w.Headers.Add(h_UserAgent);
                Raw = w.DownloadString(IndexPage);
                lfg.AddRange(TableLoader.ReadTableData(Raw));

                //Download all remaining
                bool HasData = true;
                int  Index   = 0;

                w.Headers.Add(h_ContentType);

                Console.WriteLine();
                while (HasData)
                {
                    Console.Write(Index + " ");
                    Raw = w.UploadString(string.Format(NextPage, Index), RQ);
                    if (Raw.Length == 0)
                    {
                        HasData = false;
                        break;
                    }
                    lfg.AddRange(TableLoader.ReadTableData(Raw));
                    Index++;
                }
                Console.WriteLine();
                return(lfg);
            }
        }
        protected virtual void Awake()
        {
            if (_importComplete)
            {
                return;
            }

            var obj = PrefabUtility.GetCorrespondingObjectFromSource(gameObject);

            if (obj == null)
            {
                return;
            }

            var path = AssetDatabase.GetAssetPath(obj);

            GameObject tableRoot = new GameObject(obj.name);
            var        converter = tableRoot.AddComponent <VpxConverter>();
            var        table     = TableLoader.LoadTable(path);

            converter.Convert(Path.GetFileName(path), table);

            _importComplete = true;
        }
 public void GivenAListOfTables(IEnumerable <string> tableNames)
 {
     TableLoader.Setup(x => x.GetResourceNamesAsync())
     .ReturnsAsync(tableNames.ToList());
 }
示例#28
0
        internal FontReader(Stream stream, TableLoader loader)
        {
            this.loader = loader;

            Func <BinaryReader, TableHeader> loadHeader = TableHeader.Read;
            long startOfFilePosition = stream.Position;

            this.stream = stream;
            var reader = new BinaryReader(stream, true);

            // we should immediately read the table header to learn which tables we have and what order they are in
            uint   version    = reader.ReadUInt32();
            ushort tableCount = 0;

            if (version == 0x774F4646)
            {
                // this is a woff file
                // WOFFHeader
                // UInt32 | signature      | 0x774F4646 'wOFF'
                // UInt32 | flavor         | The "sfnt version" of the input font.
                // UInt32 | length         | Total size of the WOFF file.
                // UInt16 | numTables      | Number of entries in directory of font tables.
                // UInt16 | reserved       | Reserved; set to zero.
                // UInt32 | totalSfntSize  | Total size needed for the uncompressed font data, including the sfnt header, directory, and font tables(including padding).
                // UInt16 | majorVersion   | Major version of the WOFF file.
                // UInt16 | minorVersion   | Minor version of the WOFF file.
                // UInt32 | metaOffset     | Offset to metadata block, from beginning of WOFF file.
                // UInt32 | metaLength     | Length of compressed metadata block.
                // UInt32 | metaOrigLength | Uncompressed size of metadata block.
                // UInt32 | privOffset     | Offset to private data block, from beginning of WOFF file.
                // UInt32 | privLength     | Length of private data block.
                uint flavor = reader.ReadUInt32();
                this.OutlineType = (OutlineTypes)flavor;
                uint length = reader.ReadUInt32();
                tableCount = reader.ReadUInt16();
                ushort reserved       = reader.ReadUInt16();
                uint   totalSfntSize  = reader.ReadUInt32();
                ushort majorVersion   = reader.ReadUInt16();
                ushort minorVersion   = reader.ReadUInt16();
                uint   metaOffset     = reader.ReadUInt32();
                uint   metaLength     = reader.ReadUInt32();
                uint   metaOrigLength = reader.ReadUInt32();
                uint   privOffset     = reader.ReadUInt32();
                uint   privLength     = reader.ReadUInt32();
                this.CompressedTableData = true;
                loadHeader = WoffTableHeader.Read;
            }
            else
            {
                // this is a standard *.otf file (this is named the Offset Table).
                this.OutlineType = (OutlineTypes)version;
                tableCount       = reader.ReadUInt16();
                ushort searchRange   = reader.ReadUInt16();
                ushort entrySelector = reader.ReadUInt16();
                ushort rangeShift    = reader.ReadUInt16();
                this.CompressedTableData = false;
            }

            if (this.OutlineType != OutlineTypes.TrueType)
            {
                throw new Exceptions.InvalidFontFileException("Invalid glyph format, only TTF glyph outlines supported.");
            }

            var headers = new Dictionary <string, TableHeader>(tableCount);

            for (int i = 0; i < tableCount; i++)
            {
                TableHeader tbl = loadHeader(reader);
                headers[tbl.Tag] = tbl;
            }

            this.Headers = new ReadOnlyDictionary <string, TableHeader>(headers);
        }
        public static GameObject ImportIntoScene(string path, GameObject parent = null, bool applyPatch = true, string tableName = null, ConvertOptions options = null)
        {
            var sw = Stopwatch.StartNew();

            return(ImportIntoScene(TableLoader.LoadTable(path), Path.GetFileName(path), parent, applyPatch, tableName, sw, options));
        }
        private void LoadTables()
        {
            try
            {
                basePrimaryTableDie = TableLoader.GetTrapBaseTableDie();
                var trapBases = TableLoader.GetTrapBaseContents();

                mechanismTableDie = TableLoader.GetTrapMechanismTableDie();
                var mechanismTypes = TableLoader.GetTrapMechanismContents();


                effectPrimaryTableDie = TableLoader.GetTrapEffectsTableDie();
                var trapEffects = TableLoader.GetTrapEffectsContents();

                pitTrapTableDie = TableLoader.GetPitTrapTableDie();
                var pitContents = TableLoader.GetPitTrapContents();

                gasTrapTableDie = TableLoader.GetGasTrapTableDie();
                var gasTypes = TableLoader.GetGasTrpContents();

                trapDamageTableDie = TableLoader.GetTrapDamageTableDie();
                var trapDamages = TableLoader.GetTrapDamages();

                foreach (var damage in trapDamages)
                {
                    trapDamagesFactory.Add(damage.RollUpperBound, new SimpleFactory(damage.DamageDescription));
                }

                foreach (var mechanism in mechanismTypes)
                {
                    mechanismFactory.Add(mechanism.Key, new SimpleFactory(mechanism.Value));
                }

                foreach (var trapBase in trapBases)
                {
                    if (trapBase.MechanismTypeSpecified)
                    {
                        trapBaseFactory.Add(trapBase.RollUpperBound, new MechanizedBaseFactory(mechanismFactory, mechanismTableDie, trapBase.TrappedObjectOrArea));
                    }
                    else
                    {
                        trapBaseFactory.Add(trapBase.RollUpperBound, new SimpleFactory(trapBase.TrappedObjectOrArea));
                    }
                }

                foreach (var content in pitContents)
                {
                    pitContentEffectFactory.Add(content.RollUpperBound, new SimpleFactory(content.PitContent));
                }

                foreach (var gas in gasTypes)
                {
                    gasTrapContentFactory.Add(gas.RollUpperBound, new SimpleFactory(gas.GasName));
                }

                foreach (var trapEffect in trapEffects)
                {
                    if (trapEffect.RollAgain && trapEffect.NumberOfReRolls == 1)
                    {
                        effectFactory.Add(trapEffect.RollUpperBound, new ComplexTrapEffectFactory(effectFactory, effectPrimaryTableDie, trapEffect.EffectDescription));
                    }
                    else if (trapEffect.RollAgain && trapEffect.NumberOfReRolls > 1)
                    {
                        effectFactory.Add(trapEffect.RollUpperBound, new MultiRollEffectFactory(effectFactory, effectPrimaryTableDie, trapEffect.NumberOfReRolls, trapEffect.EffectDescription));
                    }
                    else if (trapEffect.HasSubtable && trapEffect.SubtableName == "PitContents")
                    {
                        effectFactory.Add(trapEffect.RollUpperBound, new PitTrapEffectFactory(pitContentEffectFactory, pitTrapTableDie, trapEffect.EffectDescription));
                    }
                    else if (trapEffect.HasSubtable && trapEffect.SubtableName == "GasType")
                    {
                        effectFactory.Add(trapEffect.RollUpperBound, new GasTrapEffectFactory(gasTrapContentFactory, gasTrapTableDie, trapEffect.EffectDescription));
                    }
                    else
                    {
                        effectFactory.Add(trapEffect.RollUpperBound, new SimpleFactory(trapEffect.EffectDescription));
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }