Exemplo n.º 1
0
 void Awake()
 {
     if (instance == null)
     {
         DontDestroyOnLoad(gameObject);
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var       config        = Ut.ReadTransactionPath();
            CSVreader csvReader     = new CSVreader(config.transactionPath);
            var       linesNb       = csvReader.UpdateCSV();
            var       categoryMaker = new CategoryMaker(csvReader.Transactions, config.ignoreList);
            var       categoriesNb  = categoryMaker.MakeCategory();
            var       reduction     = 100 * ((decimal)linesNb - (decimal)categoriesNb) / (decimal)linesNb;

            Console.WriteLine($"UpdateCSV: Parsed {linesNb} lines.");
            Console.WriteLine($"WriteOutPut: Written {categoriesNb} lines.");
            Console.WriteLine($"Main: Reduction of {reduction:0.00}%.");
        }
Exemplo n.º 3
0
        public void CanReadCSV()
        {
            string csvPath = Environment.CurrentDirectory;

            for (int i = 0; i < 4; i++)
            {
                csvPath = Directory.GetParent(csvPath).FullName;
            }
            csvPath = Path.Combine(csvPath, "Dataset.csv");
            CSVreader fileReader = new CSVreader(csvPath);

            Assert.Equal(14274, fileReader.Height);
        }
Exemplo n.º 4
0
 // Start is called before the first frame update
 private void Awake()
 {
     if (branchCSVDocument != null)
     {
         CSVInfo = new CSVreader(1);
         string fullPath = getFullPath(branchCSVDocument);
         CSVInfo.readFile(fullPath);
     }
     if (SelectedTree > 0)
     {
         CSVInfo = new CSVreader(1);
         string fullPath = string.Format("http://julianrutten.com/UnityExports/BirdSim/tree{0}.csv", SelectedTree);
         CSVInfo.readFile(fullPath);
     }
 }
Exemplo n.º 5
0
        public void CreateTablesIfNotExists()
        {
            if (!TableExists("CurrencyModel"))
            {
                dbConn.CreateTable <CurrencyModel>();

                CSVreader reader = new CSVreader();
                reader.readCSVToDB();
                reader.printCurrencyTableContent();
            }

            if (!TableExists("WalletModel"))
            {
                dbConn.CreateTable <WalletModel>();
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            var csvReader = new CSVreader();
            var mySearch  = new MySearch(); //Linear and Binary, Binary should only sort sorted data
            var mySort    = new MySort();   //Insert and Shell

            string path = "C:/Users/New/Documents/visual studio 2017/Projects/Algorithms1Console/unsorted_numbers.csv";

            int[] data = csvReader.ReadFile(path); // comment out unnecessary stuff

            int[] sorted = mySort.InsertionSort(data);

            Console.WriteLine("Linear Search");
            var linearstopwatch = Stopwatch.StartNew();

            mySearch.LinearSearchHighest(data);
            linearstopwatch.Stop();
            Console.WriteLine("Linear Search: " + ((linearstopwatch.Elapsed.TotalMilliseconds).ToString()));

            Console.WriteLine();

            //Console.WriteLine("Binary Search");
            //var binarystopwatch = Stopwatch.StartNew();
            //mySearch.LinearSearchHighest(data);
            //binarystopwatch.Stop();
            //Console.WriteLine("Binary Search: " + ((binarystopwatch.Elapsed.TotalMilliseconds).ToString()));

            //Console.WriteLine();

            Console.WriteLine("Linear 1500th Search");
            var linear1500thstopwatch = Stopwatch.StartNew();

            mySearch.LinearSearchEvery1500th(sorted);
            linear1500thstopwatch.Stop();
            Console.WriteLine("Linear 1500th Search: " + ((linear1500thstopwatch.Elapsed.TotalMilliseconds).ToString()));

            Console.WriteLine();

            //Console.WriteLine("Binary 1500th Search");
            //var binary1500thstopwatch = Stopwatch.StartNew();
            //mySearch.BinarySearchEvery1500th(sorted);
            //binary1500thstopwatch.Stop();
            //Console.WriteLine("Binary 1500th Search: " + ((binary1500thstopwatch.Elapsed.TotalMilliseconds).ToString()));

            Console.ReadKey();
        }
Exemplo n.º 7
0
    // Start is called before the first frame update
    void Start()
    {
        //Set all arrays.
        branchInfo      = new CSVreader[branchCSVDocuments.Length];
        trees           = new TreeInfo[branchCSVDocuments.Length];
        treeGameObjects = new GameObject[branchCSVDocuments.Length];

        // Get paths of CSV data to read at game time.
        for (int i = 0; i < branchInfo.Length; i++)
        {
            branchInfo[i] = new CSVreader(1);
            string fullPath = getFullPath(branchCSVDocuments[i]);// Path.Combine(Directory.GetParent(Application.dataPath).FullName, AssetDatabase.GetAssetPath(branchCSVDocuments[i]).Replace("/", "\\"));
            //AssetDatabase.get
            //debugText.text = string.Format("Reading CSV {0} from: \"{1}\"",i, fullPath) + debugText.text;
            branchInfo[i].readFile(fullPath);
        }

        // Force debug text to screen.
        InvokeRepeating("UpdateSelection", 0.5f, 0.5f);
    }