/// <summary> /// 预解析CSV /// </summary> private void SpeculativeParseCSV(string path) { //string path = DEFAULT_CSV_PATH + "guide"; string csvpath = DEFAULT_CSV_PATH + GetFilePath(path); CSVTable csvTable = CSVLoader.LoadCSV(csvpath); data.Clear(); if (csvTable != null) { for (int i = 0; i < csvTable.Headers.Count; i++) { if (!string.IsNullOrEmpty(csvTable.Headers[i])) { try { data.Add(new CsvData() { header = csvTable.Headers[i], dataType = (DataType)Enum.Parse(typeof(DataType), csvTable.DataTypes[i]) }); } catch (Exception e) { Debug.LogError("检查第二行的数据类型是否书写正确,参见:枚举DataType"); } } } } }
//public static CSVLoader csvLoader; public static void Init() { CSVLoader csvLoader = new CSVLoader(); csvLoader.LoadCSV(); localised_English = csvLoader.GetDictionaryValues("English"); localised_French = csvLoader.GetDictionaryValues("French"); localised_Russian = csvLoader.GetDictionaryValues("Russian"); localised_Japanese = csvLoader.GetDictionaryValues("Japanese"); localised_Italian = csvLoader.GetDictionaryValues("Italian"); localised_Spanish = csvLoader.GetDictionaryValues("Spanish"); localised_Arab = csvLoader.GetDictionaryValues("Arab"); localised_Vietnamese = csvLoader.GetDictionaryValues("Vietnamese"); localised_Danish = csvLoader.GetDictionaryValues("Danish"); localised_Chinese_trad = csvLoader.GetDictionaryValues("Chinese_trad"); localised_Korean = csvLoader.GetDictionaryValues("Korean"); localised_Norwegian = csvLoader.GetDictionaryValues("Norwegian"); localised_Portuguese = csvLoader.GetDictionaryValues("Portuguese"); localised_Turkish = csvLoader.GetDictionaryValues("Turkish"); localised_Finnish = csvLoader.GetDictionaryValues("Finnish"); localised_Swedish = csvLoader.GetDictionaryValues("Swedish"); localised_German = csvLoader.GetDictionaryValues("German"); localised_Bulgarian = csvLoader.GetDictionaryValues("Bulgarian"); localised_Hungarian = csvLoader.GetDictionaryValues("Hungarian"); localised_Greek = csvLoader.GetDictionaryValues("Greek"); localised_Chinese_simpl = csvLoader.GetDictionaryValues("Chinese_simpl"); localised_Dutch = csvLoader.GetDictionaryValues("Dutch"); localised_Polish = csvLoader.GetDictionaryValues("Polish"); localised_Romanian = csvLoader.GetDictionaryValues("Romanian"); localised_Thai = csvLoader.GetDictionaryValues("Thai"); localised_Ukrainian = csvLoader.GetDictionaryValues("Ukrainian"); localised_Czech = csvLoader.GetDictionaryValues("Czech"); isInit = true; }
private bool LoadAccessoryFromLocalFileSystem() { string text = Path.Combine(Application.dataPath, "Resources"); if (!Directory.Exists(text)) { Debug.LogError("ERROR, Fail to find directory for Resources"); return(false); } string text2 = Path.Combine(text, "Template/accessory.txt"); CSVLoader cSVLoader = new CSVLoader(); if (Application.platform == RuntimePlatform.WindowsEditor || !cSVLoader.SecuredLoad(text2)) { if (!cSVLoader.Load(text2)) { Debug.LogError("ERROR, Fail to load resource file" + text2); return(false); } if (!cSVLoader.SecuredSave(text2)) { Debug.LogError("ERROR, Load success " + text2 + " but save secured failed"); } } ParseAccessory(cSVLoader); return(true); }
/*===============================================================*/ /*===============================================================*/ /// <summary> /// @author Hironari Ushiyama /// @brief CSVを読み込み,CSVのID属性に対応したKeyの自動生成とセーブデータへの保存をするクラス /// @param string CSVファイル名 拡張子は抜かす /// @param string[] CSVキー内容格納配列 /// </summary> public void KeyGeneration(string file, string[] keyArray) { // ローダーの生成 CSVLoader loader = new CSVLoader( ); // 配列カウント用 index int index = 0; // 配列 ID 入れていき更新していく変数 string name = ""; // CSV を読み込み, CSV のデータテーブルを生成 CSVTable csvTable = loader.LoadCSV(file); foreach (CSVRecord record in csvTable.Records) { foreach (string header in csvTable.Headers) { if (header == "ID") { // ID を元に Key 名を変更 name = record.GetField(header); } // ID 属性を元にキーネームを変更していく keyArray[index] = name + "_" + header; // キーネーム, キーネームに対応した CSV データ SaveData.setString(name + "_" + header, record.GetField(header)); // 配列の入れ口をインクリメント index++; // Debug 出力 //Debug.Log( "セーブデータキー : " + name + "_" + header ); //DebugDisplayLog.displayLog.Add( name + "_" + header ); } } // セーブクラスを用いて CSV の内容をセーブする GV.save( ); }
// Use this for initialization void Start() { // example of loading csv file csv = CSVLoader.Instance; //TextAsset txt = csv.loadFile(1, 1, "Alocer_Dania"); unit = new Unit(); unit.readCharCSV(1, "Lancelot_Tartare"); //Debug.Log("step Name: " + BLance.getName()); // including fade and transition fm = FadeManager.Instance; // example of sound playing snd = SoundManager.Instance; //snd.PlayBGM(0); // example of random value util = UtilCommon.Instance; // example of using ClassBase cb = ClassBase.Instance; ps = ParameterScreen.Instance; ps.inactivateGuages(); mb = MessageBase.Instance; ms = MapScreen.Instance; //ms.showMap(); DontDestroyOnLoad(this.gameObject); }
public static void Init() { if (Enum.IsDefined(typeof(Language), (Language)Enum.Parse(typeof(Language), Application.systemLanguage.ToString()))) { language = (Language)Enum.Parse(typeof(Language), Application.systemLanguage.ToString()); } else { language = Language.English; } CSVLoader csvLoader = new CSVLoader(); csvLoader.LoadCSV(); localisedEN = csvLoader.GetDictionaryValues("en"); localisedFR = csvLoader.GetDictionaryValues("fr"); localisedES = csvLoader.GetDictionaryValues("es"); localisedRU = csvLoader.GetDictionaryValues("ru"); localisedJA = csvLoader.GetDictionaryValues("ja"); localisedKO = csvLoader.GetDictionaryValues("ko"); localisedZH = csvLoader.GetDictionaryValues("zh"); localisedIT = csvLoader.GetDictionaryValues("it"); localisedDE = csvLoader.GetDictionaryValues("de"); isInit = true; }
private void ParsePurcharseItemsTable(CSVLoader csvLoader) { purcharseItems = new PurcharseItems[csvLoader.Rows]; for (int i = 0; i < csvLoader.Rows; i++) { purcharseItems[i] = new PurcharseItems(); csvLoader.ReadValue(0, i, string.Empty, out string Value); csvLoader.ReadValue(1, i, string.Empty, out string _); csvLoader.ReadValue(2, i, string.Empty, out string Value3); csvLoader.ReadValue(3, i, string.Empty, out string Value4); csvLoader.ReadValue(4, i, string.Empty, out string Value5); csvLoader.ReadValue(5, i, string.Empty, out string Value6); csvLoader.ReadValue(6, i, string.Empty, out string Value7); Value.Trim(); Value3.Trim(); Value4.Trim(); Value5.Trim(); Value6.Trim(); Value7.Trim(); purcharseItems[i].Slot = Convert.ToInt32(Value); purcharseItems[i].Price = Convert.ToInt32(Value3); purcharseItems[i].BuyUnit = Convert.ToInt32(Value4); purcharseItems[i].incAtkSpeed = (float)Convert.ToDouble(Value5); purcharseItems[i].incMoveSpeed = (float)Convert.ToDouble(Value6); purcharseItems[i].cotinuesTime = (float)Convert.ToDouble(Value7); } }
private void ParseUpgradeChargeTable(CSVLoader csvLoader) { upgradeChargeTables = new UpgradeTable[csvLoader.Rows]; for (int i = 0; i < csvLoader.Rows; i++) { upgradeChargeTables[i] = new UpgradeTable(); csvLoader.ReadValue(0, i, string.Empty, out string Value); csvLoader.ReadValue(1, i, string.Empty, out string Value2); csvLoader.ReadValue(2, i, string.Empty, out string Value3); csvLoader.ReadValue(3, i, string.Empty, out string Value4); csvLoader.ReadValue(4, i, string.Empty, out string Value5); csvLoader.ReadValue(5, i, string.Empty, out string Value6); csvLoader.ReadValue(6, i, string.Empty, out string Value7); csvLoader.ReadValue(7, i, string.Empty, out string Value8); Value.Trim(); Value2.Trim(); Value3.Trim(); Value4.Trim(); Value5.Trim(); Value6.Trim(); Value7.Trim(); Value8.Trim(); upgradeChargeTables[i].Level = Convert.ToInt32(Value); upgradeChargeTables[i].AssultAtkVal = (float)Convert.ToDouble(Value2); upgradeChargeTables[i].SubmachineAtkVal = (float)Convert.ToDouble(Value3); upgradeChargeTables[i].SniperAtkVal = (float)Convert.ToDouble(Value4); upgradeChargeTables[i].HeavyAtkVal = (float)Convert.ToDouble(Value5); upgradeChargeTables[i].HandgunAtkVal = (float)Convert.ToDouble(Value6); upgradeChargeTables[i].SpecialAtkVal = (float)Convert.ToDouble(Value7); upgradeChargeTables[i].Price = Convert.ToInt32(Value8); } }
private void ParseMonTable(CSVLoader csvLoader) { monTables = new MonTable[csvLoader.Rows]; for (int i = 0; i < csvLoader.Rows; i++) { monTables[i] = new MonTable(); csvLoader.ReadValue(0, i, string.Empty, out string Value); csvLoader.ReadValue(1, i, string.Empty, out string Value2); csvLoader.ReadValue(2, i, string.Empty, out string Value3); csvLoader.ReadValue(3, i, string.Empty, out string Value4); csvLoader.ReadValue(4, i, string.Empty, out string Value5); csvLoader.ReadValue(5, i, string.Empty, out string Value6); Value.Trim(); Value2.Trim(); Value3.Trim(); Value4.Trim(); Value5.Trim(); Value6.Trim(); monTables[i].name = Value; monTables[i].str = Value2; monTables[i].HP = Convert.ToInt32(Value3); monTables[i].MoveSpeed = (float)Convert.ToDouble(Value4); monTables[i].toCoreDmg = Convert.ToInt32(Value5); monTables[i].Dp = Convert.ToInt32(Value6); } }
public static void Load(Stream stream) { if (stream == null) { return; } CSVData data = CSVLoader.Load(stream); for (int i = 0; i < data.RowCount; ++i) { var row = data.GetRow(i); var id = row.GetInt(_ID); var background = row.GetString(_BackgroundURL); var des = row.GetString(_Des); var Jumpto = row.GetString(_Jumpto); var Priority = row.GetInt(_Priority); var EventIntervalEnd = row.GetString(_EventIntervalEnd); var EventIntervalStart = row.GetString(_EventIntervalStart); var placementKey = row.GetString(_PlacemetKey); var element = new PopElements(id, background, Priority, des, Jumpto, placementKey, EventIntervalStart, EventIntervalEnd); m_elements.Add(element); } }
public void VerityCSVLoading() { ICSVLoader loader = new CSVLoader( Mock <IFileReader>(mock => { mock.Setup(m => m.ReadFileLines(It.IsAny <string>())) .Returns(MockCSVData); }) ); IEnumerable <CryptoData> dataList = loader.ParseFileAndReturnData(); int returnCount = 0; IEnumerator <CryptoData> listReader = dataList.GetEnumerator(); while (listReader.MoveNext()) { CryptoData dataItem = listReader.Current; Assert.True(dataItem.Unix > 0); Assert.True(dataItem.Date != default); Assert.NotEmpty(dataItem.Symbol); Assert.True(dataItem.Open > 0); Assert.True(dataItem.High > 0); Assert.True(dataItem.Low > 0); Assert.True(dataItem.Close > 0); Assert.True(dataItem.VolumeBTC > 0); Assert.True(dataItem.VolumeUSDT > 0); ++returnCount; } Assert.Equal(12, returnCount); }
T LoadTableImmediate <T>() where T : TableBase { var fName = typeof(T).Name.Replace("Table", ""); string path = string.Format("{0}{1}", ASSET_PATH, fName); var textAsset = Resources.Load <TextAsset>(path); if (textAsset == null) { Debug.LogErrorFormat("Not Found Table : {0}", path); } var csvLoader = new CSVLoader(); csvLoader.SecuredLoad(textAsset.bytes); if (!_tables.ContainsKey(typeof(T))) { _tables.Add(typeof(T), csvLoader); _tableComponentList.Add(this.gameObject.AddComponent <T>()); return(this.gameObject.GetComponent <T>()); } else { Debug.LogWarningFormat("Alreay Load Table : {0}", typeof(T).Name); return(this.gameObject.GetComponent <T>()); } }
/*===============================================================*/ /*===============================================================*/ /// <summary>初期化</summary> public void Initialize( ) { // CSV読み込み機能を使った配列へのデータ読み込み CSVLoader loader = new CSVLoader( ); CSV_EnemyStatusKeyData = loader.GetCSV_Key_Record("CSV/CSV_EnemyStatus", CSV_EnemyStatusKey); }
public void OpenConnection(ConnectParameters source, ConnectParameters target) { this.connection = source; this.target = target; fileStorageService.SetConnectionString(connection.ConnectionString); csv = new CSVLoader(fileStorageService); }
void Start() { Btn_ShowOrHideData.GetComponent <Image>().sprite = ShowIcon; Btn_ShowOrHideData.onClick.AddListener(ShowOrHideVizualization); Radius = Globe.transform.localScale.x / 2; CSVLoader.CSVLoaderThread(StormData.text, ReceiveData); }
public bool SetUnit(int unitIndex) { if (m_Filename == null) { return(false); } string filepath = m_Forder + m_Filename + m_Filter; CSVLoader loader = new CSVLoader(filepath); if (loader == null) { return(false); } for (int i = 0; i < loader.LineMaxNum; i++) { if (loader.GetInt() == unitIndex) { loader.ValueIndex = 0; SetProperty(loader); loader.SetLine(0); return(true); } loader.NextLine(); } return(false); }
private IEnumerator LoadAllFromWWW() { bool propLoaded = false; Property prop = BuildOption.Instance.Props; string url = "http://" + prop.GetResourceServer + "/BfData/Template/upgradeprops.txt.cooked"; WWW wwwProp = new WWW(url); yield return((object)wwwProp); using (MemoryStream stream = new MemoryStream(wwwProp.bytes)) { using (BinaryReader reader = new BinaryReader(stream)) { CSVLoader csvLoader = new CSVLoader(); if (csvLoader.SecuredLoadFromBinaryReader(reader)) { ParseUpgradePropTable(csvLoader); propLoaded = true; } } } if (!propLoaded) { Debug.LogError("Fail to download " + url); } Loaded = propLoaded; }
public double[] ShapeClassification() { //Get single Test Instance from CSV file CSVLoader loader = new CSVLoader(); loader.setSource(new java.io.File("GetOrientation.csv")); Instances testinstances = loader.getDataSet(); testinstances.setClassIndex(testinstances.numAttributes() - 1); Instance sekarang = testinstances.lastInstance(); //Get and build saved model LibSVM modelShape = new LibSVM(); LibSVM modelOri = new LibSVM(); modelOri = (LibSVM)SerializationHelper.read("OrientationModel.model"); modelShape = (LibSVM)SerializationHelper.read("ShapeModel.model"); //Classify actual test instance double valueShape = modelShape.classifyInstance(sekarang); double valueOri = modelOri.classifyInstance(sekarang); Console.WriteLine(valueOri); Console.WriteLine(valueShape); double[] value = new double[] { valueShape, valueOri }; return(value); }
public void TestLoadCSVData() { csvData = CSVLoader.LoadCSVFromFile(Application.dataPath + Path.DirectorySeparatorChar + "Resources", SAMPLE_CSV_FILENAME); csvResourceDictionary = CSVReader.ReadFromResources(SAMPLE_CSV_RESOURCE_FILENAME); if (csvResourceDictionary.Count == csvData.Count) { if (csvData[0].Id == (int)csvResourceDictionary[0][RESOURCE_DB_SAMPLE_KEY_ID]) { Debug.Log("Item 0 ID match in Loader and Resource Read"); } if (csvData[2].Occupation == (string)csvResourceDictionary[2][RESOURCE_DB_SAMPLE_KEY_OCCUPATION]) { Debug.Log("Item 2 Occupation match in Loader and Resource Read"); } } //csvFileDictionary = CSVReader.ReadFromFilePath(Application.dataPath + Path.DirectorySeparatorChar + "Resources", SAMPLE_CSV_FILENAME); //if (csvFileDictionary.Count == csvData.Count) //{ // if (csvData[0].Id == (int)csvFileDictionary[0]["Id"]) // { // Debug.Log("Item 0 ID match in Loader and File Read"); // } // if (csvData[2].Occupation == (string)csvFileDictionary[2]["Occupation"]) // { // Debug.Log("Item 2 Occupation match in Loader and File Read"); // } //} }
private IEnumerator LoadFromWWW() { Property prop = BuildOption.Instance.Props; string url = "http://" + prop.GetResourceServer + "/BfData/Template/command.txt.cooked"; WWW www = new WWW(url); yield return((object)www); using (MemoryStream stream = new MemoryStream(www.bytes)) { using (BinaryReader reader = new BinaryReader(stream)) { CSVLoader csvLoader = new CSVLoader(); if (csvLoader.SecuredLoadFromBinaryReader(reader)) { ParseData(csvLoader); isLoaded = true; } } } if (!isLoaded) { Debug.LogError("Fail to download " + url); } }
private void ParseUpgrade(CSVLoader csvLoader) { for (int i = 0; i < csvLoader.Rows; i++) { csvLoader.ReadValue(0, i, string.Empty, out string Value); csvLoader.ReadValue(1, i, string.Empty, out string Value2); csvLoader.ReadValue(2, i, string.Empty, out string Value3); csvLoader.ReadValue(3, i, string.Empty, out string Value4); csvLoader.ReadValue(4, i, -1, out int Value5); csvLoader.ReadValue(5, i, string.Empty, out string Value6); csvLoader.ReadValue(6, i, -1, out int Value7); csvLoader.ReadValue(7, i, -1, out int Value8); csvLoader.ReadValue(8, i, -1, out int Value9); csvLoader.ReadValue(9, i, string.Empty, out string Value10); csvLoader.ReadValue(10, i, 100, out int Value11); Value.Trim(); Value.ToLower(); Value2.Trim(); Value3.Trim(); Value4.Trim(); Value4.ToLower(); Value6.Trim(); Value6.ToLower(); Value10.Trim(); int ct = TItem.String2Type(Value4); Add(Value, new TUpgrade(Value, Value2, FindIcon(Value3), ct, Value5, Value6, Value7, Value8, Value9, Value10, Value11)); } }
private void ParseSpecial(CSVLoader csvLoader) { for (int i = 0; i < csvLoader.Rows; i++) { csvLoader.ReadValue(0, i, string.Empty, out string Value); csvLoader.ReadValue(1, i, string.Empty, out string Value2); csvLoader.ReadValue(2, i, string.Empty, out string Value3); csvLoader.ReadValue(3, i, string.Empty, out string Value4); csvLoader.ReadValue(4, i, def: false, out bool Value5); csvLoader.ReadValue(5, i, string.Empty, out string Value6); csvLoader.ReadValue(6, i, string.Empty, out string Value7); csvLoader.ReadValue(7, i, def: false, out bool Value8); csvLoader.ReadValue(8, i, string.Empty, out string Value9); csvLoader.ReadValue(9, i, def: false, out bool Value10); csvLoader.ReadValue(10, i, string.Empty, out string Value11); csvLoader.ReadValue(11, i, string.Empty, out string Value12); csvLoader.ReadValue(12, i, 100, out int Value13); Value.Trim(); Value.ToLower(); Value2.Trim(); Value3.Trim(); Value4.Trim(); Value4.ToLower(); Value6 = Value6.Trim(); Value6 = Value6.ToLower(); Value7.Trim(); Value11.Trim(); int ct = TItem.String2Type(Value4); Add(Value, new TSpecial(Value, Value2, FindIcon(Value3), ct, Value5, TItem.String2FunctionMask(Value6), Value7, Value8, Value9, Value10, Convert.ToInt32(Value11), Value12, Value13)); } }
private void ParseData(CSVLoader csvLoader) { _dicString = new Dictionary <string, string> [12]; for (int i = 0; i < _dicString.Length; i++) { _dicString[i] = new Dictionary <string, string>(); } for (int j = 0; j < csvLoader.Rows; j++) { csvLoader.ReadValue(0, j, string.Empty, out string Value); Value.Trim(); for (int k = 0; k < 12; k++) { csvLoader.ReadValue(k + 1, j, string.Empty, out string Value2); Value2 = Value2.Trim(); if (Value.Length <= 0) { Debug.LogError("ERROR, Empty key at row:" + j + " Col: " + k + " Key: " + Value + " Value: " + Value2); } if (_dicString[k].ContainsKey(Value)) { Debug.LogError("ERROR, Duplicate string key: " + Value + " at row: " + j + " Col: " + k + " Key: " + Value + " Value: " + Value2); } else { Value2 = Value2.Replace("\\0", "\n"); _dicString[k].Add(Value, Value2); if (displayReadString) { Debug.Log(" Key: " + Value + " Val: " + Value2); } } } } }
public static MarketMLDataSet GrabData(string newfileLoad) { IMarketLoader loader = new CSVLoader(); loader.GetFile(newfileLoad); var result = new MarketMLDataSet(loader, Config.INPUT_WINDOW, Config.PREDICT_WINDOW); // var desc = new MarketDataDescription(Config.TICKER, // MarketDataType.Close, true, true); var desc = new MarketDataDescription(Config.TICKER, MarketDataType.Trade, true, true); result.AddDescription(desc); var end = DateTime.Now; // end today var begin = new DateTime(end.Ticks); // begin 30 days ago begin = begin.AddDays(-150); result.Load(begin, end); result.Generate(); return(result); }
public void Run() { // Example of each tools Console.WriteLine("Today(): " + MTools.Today()); Console.WriteLine("Today(): " + MTools.Today(0, "dddd, dd MMMM yyyy HH:mm:ss")); Console.WriteLine("Today(-7): " + MTools.Today(-7)); Console.WriteLine("Today(7): " + MTools.Today(7)); Console.WriteLine("MTools.FrDateAdd(\"21/06/2004\", 15): " + MTools.FrDateAdd("21/06/2004", 15)); Console.WriteLine("MTools.IsPastFrDate(\"21/06/2004\"): " + MTools.IsPastFrDate("21/06/2004")); Console.WriteLine("MTools.DateNumToFrDate(\"20191115\"): " + MTools.DateNumToFrDate("20191115")); Console.WriteLine("MTools.CompareFrDate(\"21/06/2004\", \"21/07/2004\"): " + MTools.CompareFrDate("21/06/2004","21/07/2004")); Console.WriteLine("MTools.FrDateToYMDDate(\"21/06/2004\"): " + MTools.FrDateToYMDDate("21/06/2004")); Console.WriteLine("MTools.FrDateToDateNum(\"21/06/2004\"): " + MTools.FrDateToDateNum("21/06/2004")); Console.WriteLine("RandDate(2020): " + MTools.RandDate(2020)); Console.WriteLine("RandNum(3): " + MTools.RandNum(3)); Console.WriteLine("RandAlphaNum(10): " + MTools.RandAlphaNum(10)); Console.WriteLine("RandStr(10): " + MTools.RandStr(10)); Console.WriteLine("FirstCharToUpper(\"john\"): " + MTools.FirstCharToUpper("john")); Console.WriteLine("Siren(): " + MTools.Siren()); Console.WriteLine("RandCountry(): " + MTools.RandCountry()); Console.WriteLine("RandCountry(\"FRANCE\"): " + MTools.RandCountry("FRANCE")); Console.WriteLine(System.Environment.NewLine); // Demo on csv string string s = "{};COM;{} etc... string s = DatasetTools.ProcessData("{today};{today(5)};CHATEAUROUX;Jean-{randu1str(12)};{randstr(12)};{randnum(5)}; {randcountry}") Console.WriteLine("ProcessData: " + s); Dictionary<string, string> replacementDico = new Dictionary<string, string>(); replacementDico.Add("author", "Antoine De Saint-Exupéry") s = DatasetTools.ProcessData("{today};{today(5)};CHATEAUROUX;Jean-{randu1str(12)};{randstr(12)};{randnum(5)}; {randcountry};{#author}"); Console.WriteLine(System.Environment.NewLine); // Demo on csv file CsvInfo csvInfo = new CsvInfo(); csvInfo.fullFilename = "demo.csv"; var resList = CSVLoader.LoadAndProcessData(csvInfo); foreach(var line in resList) { Console.WriteLine(line); } }
private static Dictionary <string, AnimationClip> loadAnimClips(string name, ref string defaultAnimName) { var path = "Assets/Config/Animation/" + name + ".csv"; var loader = new CSVLoader(); var text = readAllText(path); if (!loader.Load(text)) { EditorUtility.DisplayDialog("错误", "加载动画表失败: " + path, "继续工作"); return(null); } var nameCol = loader.GetColumn("Name"); var fbxCol = loader.GetColumn("FBXPath"); var defaultCol = loader.GetColumn("IsDefault"); Dictionary <string, AnimationClip> clips = new Dictionary <string, AnimationClip>(); Dictionary <string, List <string> > infos = new Dictionary <string, List <string> >(); for (int row = 0; row < loader.RowCount(); row++) { var fbxPath = fbxCol.GetString(row); var aniClipName = nameCol.GetString(row); List <string> subAnimNames = null; if (!infos.TryGetValue(fbxPath, out subAnimNames)) { subAnimNames = new List <string>(); infos.Add(fbxPath, subAnimNames); } if (defaultAnimName == null || defaultCol.GetBoolean(row)) { defaultAnimName = aniClipName; } subAnimNames.Add(aniClipName); } foreach (var p in infos) { var animRootPath = AnimPath + "/" + p.Key; foreach (var pp in p.Value) { var animPath = animRootPath + "/" + pp + ".anim"; var clip = AssetDatabase.LoadAssetAtPath <AnimationClip>(animPath); if (clip == null) { EditorUtility.DisplayDialog("错误", "加载动画切片失败: " + animPath, "继续工作"); return(null); } clips.Add(pp, clip); } } return(clips); }
private void InitialReferences() { gridMgr = gameObject.AddComponent <GridMgr>(); blocksPool = gameObject.AddComponent <BlocksPool>(); scoreMgr = gameObject.AddComponent <ScoreMgr>(); csvLoader = gameObject.AddComponent <CSVLoader>(); playerMgr = gameObject.AddComponent <PlayerDataMgr>(); }
public static void Init() { csvLoader = new CSVLoader(); csvLoader.LoadCSV(); UpdateDictionaries(); isInit = true; }
public static void Remove(string key) { if (csvLoader == null) { csvLoader = new CSVLoader(); } csvLoader.LoadCSV(); csvLoader.Remove(key); UpdateDictionaries(); }
public void LoadInventoryFromDisk(string path = "Config\\Inventory.csv") { equipment.Clear(); csv = new CSVLoader(); csv.Load(path); if (csv._rows.Count >= maxItems) csv._rows.RemoveRange(maxItems, csv._rows.Count - maxItems); LoadInventoryFromMemory(); }
public void Trim() { var data = CSVLoader <Vector3> .LoadData(ref settings); settings.trimUp = 1; var trimmedData = CSVLoader <Vector3> .LoadData(ref settings); Assert.IsTrue(data.Skip(1).Count() == trimmedData.Count()); }
public override bool ProcessRetrievedFTPFile(SymmetryEntities dc_, string marketSnapCode_, DateTime valueDate_, string filePath_) { var loader = new CSVLoader<ExtractClass>(new Dictionary<string, string> { {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.RIC).FieldName, "RIC"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.OriginalIdentifier).FieldName, "Identifier"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.BidPrice).FieldName, "BidPrice"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.AskPrice).FieldName, "AskPrice"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.BidYield).FieldName, "BidYield"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.AskYield).FieldName, "AskYield"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.AssetStatus).FieldName, "AssetStatus"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.Isin).FieldName, "ISIN"}, }); var list = loader.Load(filePath_); if (IdentifierFilter != null) list = list.Where(x => IdentifierFilter(x.ISIN)).ToList(); return saveResponses(list, dc_, QuoteHelpers.GetOrCreateMarketSnap(marketSnapCode_, valueDate_, dc_)); }
public override bool ProcessRetrievedFTPFile(SymmetryEntities dc_, string marketSnapCode_, DateTime valueDate_, string filePath_) { var loader = new CSVLoader<ExtractClass>(new Dictionary<string, string> { {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.RIC).FieldName, "RIC"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.BidPrice).FieldName, "BidPrice"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.AskPrice).FieldName, "AskPrice"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.BidAskUpdateTime).FieldName,"BidAskDate"}, }); var list = loader.Load(filePath_); return saveResponses(list, dc_, QuoteHelpers.GetOrCreateMarketSnap(marketSnapCode_, valueDate_, dc_)); }
public override bool ProcessRetrievedFTPFile(SymmetryEntities dc_, string marketSnapCode_, DateTime valueDate_, string filePath_) { var loader = new CSVLoader<ExtractClass>(new Dictionary<string, string> { {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.RIC).FieldName, "RIC"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.UniversalClosePrice).FieldName, "Value"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.UniversalClosePriceDate).FieldName, "CloseDate"}, }); var extracted = loader.Load(filePath_); return saveValues(extracted, dc_, marketSnapCode_); }