示例#1
0
        static void Main(string[] args)
        {
            //CSVClass cSVClass = new CSVClass();
            //cSVClass.GetDynamicListFromCSV(@"C:\VAlex\mycsv.csv");

            //string ss = Translit.GetTranslit("Шла Маша по шоссе");
            //string ss1 = Transliteration.Front("Шла Маша по шоссе");


            CSVClass cSVClass = new CSVClass();
            //List<TagCSV> list = cSVClass.GetListTagDynamicFromCSV(@"C:\VAlex\mycsv.csv");
            List <TagCSV> list = cSVClass.GetListTagFromCSV(@"C:\VAlex\1-3.01.2018.csv");
            //1 - 3.01.2018.csv

            List <string> files = new List <string>();

            files.Add(@"C:\VAlex\1-3.01.2018.csv");
            files.Add(@"C:\VAlex\4-6.01.2018.csv");

            List <TagCSV> tagsCSV = new List <TagCSV>();

            tagsCSV.Add(list[0]);
            tagsCSV.Add(list[1]);

            if (list != null)
            {
                //Tag tag = cSVClass.GetTagFromCSV(@"C:\VAlex\mycsv.csv", list[0]);
                //Tag tag = cSVClass.GetTagFromCSV(@"C:\VAlex\1-3.01.2018.csv", list[0]);
                //Tag tag = cSVClass.GetTagFromCSV(files, list[0]);
                List <Tag> tags = cSVClass.GetTagFromCSV(files, tagsCSV);
            }

            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            CSVClass csv = new CSVClass();

            csv.ReadCSV();
            Console.WriteLine("All Done!!!");
        }
示例#3
0
            public static CSVClass parse(string filepath)
            {
                File file = new File();

                file.Open(filepath, 1);
                string text = file.GetAsText();

                file.Close();
                //text.Replace('\n', '\r');
                string[] lines = text.Split(new string[]  { "\r", "\r\n", "\n" }, StringSplitOptions.None);
                int      rows  = lines.Length;
                int      cols  = lines[0].Split(',').Length;

                string[,] values = new string[rows, cols];
                // We skip the header row and set i to 1
                for (int i = 1; i < rows; i++)
                {
                    string[] row = lines[i].Split(',');
                    for (int j = 0; j < row.Length; j++)
                    {
                        values[i, j] = row[j];
                    }
                }
                CSVClass cls = new CSVClass(values, rows, cols);

                return(cls);
            }
示例#4
0
        private void btnChooseTags_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Файл CSV|*.CSV";

            DialogResult result = openFileDialog.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                MessageBox.Show("Файл не выбран!", "Информация", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                return;
            }

            txtFileName.Clear();
            txtFileName.Text = openFileDialog.FileName;

            chеckLstTags.Items.Clear();

            List <TagCSV> lstTagsCSV;

            CSVClass polimetalTags = new CSVClass();

            lstTagsCSV = polimetalTags.GetListTagFromCSV(openFileDialog.FileName);

            chеckLstTags.Items.AddRange(lstTagsCSV.ToArray <TagCSV>());
        }
    void Start()
    {
        time_start     = Time.realtimeSinceStartup;
        time_new_start = Time.realtimeSinceStartup;

        time_diff = 0.0f;

        rb = GetComponent <Rigidbody>();

        // System.Diagnostics.Process otherProcess = new System.Diagnostics.Process();
        DownscaleRefTextures();

        csv   = gameObject.GetComponent <CSVPlotter>();
        csvcl = gameObject.GetComponent <CSVClass>();
    }
示例#6
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (chеckLstTags.CheckedItems.Count == 0)
            {
                MessageBox.Show("Отсутствуют выбранные теги", "Сообщение об ошибке", MessageBoxButtons.OK);
                return;
            }

            if (checkedLstFiles.CheckedItems.Count == 0)
            {
                MessageBox.Show("Отсутствуют выбранные отчеты", "Сообщение об ошибке", MessageBoxButtons.OK);
                return;
            }

            List <TagCSV> lstTagsCSV = new List <TagCSV>();

            foreach (TagCSV item in chеckLstTags.CheckedItems)
            {
                lstTagsCSV.Add((TagCSV)item);
            }

            List <string> listFiles = new List <string>();

            foreach (ReportFile item in checkedLstFiles.CheckedItems)
            {
                listFiles.Add(item.ReportFullPath);
            }

            List <ReportFile> listReportFile = new List <ReportFile>();

            foreach (ReportFile item in checkedLstFiles.CheckedItems)
            {
                listReportFile.Add(item);
            }

            CSVClass csvClass = new CSVClass();

            csvClass.SaveToFileCSV(lstTagsCSV, listFiles, (int)numericUpDown1.Value, chckAvgMode.Checked);
        }
示例#7
0
 public void setStaticData(CSVClass cls)
 {
     this.staticData = cls;
 }
示例#8
0
文件: Ecs.cs 项目: IAmSegfault/zx
        private void preloadStaticMaps()
        {
            string dirPath = "res://data/staticmap";
            var    dir     = new Directory();

            dir.Open(dirPath);
            dir.ListDirBegin();
            List <string> files = new List <string>();

            while (true)
            {
                var f = dir.GetNext();
                if (f == "")
                {
                    break;
                }
                else if (f.EndsWith(".json"))
                {
                    files.Add(f);
                }
            }

            File file = new File();

            foreach (string f in files)
            {
                string filepath = dirPath + "/" + f;
                file.Open(filepath, 1);
                string text = file.GetAsText();
                file.Close();
                var jsonData = JSON.Parse(text);
                GContainers.Dictionary dataDict = jsonData.Result as GContainers.Dictionary;
                string   csvFile  = (string)dataDict["file"];
                CSVClass csvClass = CSVParser.parse(csvFile);
                var      pos      = dataDict["position"] as GContainers.Dictionary;

                var         cPos     = pos["chunk_pos"] as GContainers.Array;
                var         wPos     = pos["world_map_pos"] as GContainers.Array;
                int         cW       = Convert.ToInt32(cPos[0]);
                int         cH       = Convert.ToInt32(cPos[1]);
                int         cL       = Convert.ToInt32(cPos[2]);
                int         wW       = Convert.ToInt32(wPos[0]);
                int         wH       = Convert.ToInt32(wPos[1]);
                MapPosition position = new MapPosition(cW, cH, cL, wW, wH);
                staticMapStore.Add(position, csvClass);
            }

            foreach (LocalMap localMap in loadedMaps)
            {
                foreach (KeyValuePair <MapPosition, CSVClass> kv in staticMapStore)
                {
                    if (localMap != null && localMap.mapPosition != null)
                    {
                        if (localMap.mapPosition.Equals(kv.Key))
                        {
                            for (int i = 0; i < kv.Value.rows; i++)
                            {
                                int    x  = Convert.ToInt32(kv.Value.data[i, 0]);
                                int    y  = Convert.ToInt32(kv.Value.data[i, 1]);
                                int    t  = Convert.ToInt32(kv.Value.data[i, 2]);
                                string fg = kv.Value.data[i, 3];
                                string bg = kv.Value.data[i, 4];
                                foreach (CP437Mapping mapping in CP437Mapping.mapList)
                                {
                                    if (mapping.Value == t && mapping.colorBG == bg)
                                    {
                                        localMap.setVType(x, y, mapping.mapping);
                                        localMap.dirty = true;
                                        break;
                                    }
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }