Exemplo n.º 1
0
        private string GetCsvContents(EntitySave entity, RacingEntityViewModel viewModel)
        {
            List <RacingEntityValues> values = new List <RacingEntityValues>();

            var defaultValues = new RacingEntityValues();

            defaultValues.Name = "DefaultValues";
            // leave the defaults from the class

            values.Add(defaultValues);

            RuntimeCsvRepresentation rcr = RuntimeCsvRepresentation.FromList(values);

            var nameHeader = rcr.Headers[0];

            // Setting it to IsRequired is not sufficient, need to
            // modify the "Original Text" prop
            // chop off the closing quote, and add ", required)"
            nameHeader.OriginalText = nameHeader.OriginalText.Substring(0, nameHeader.OriginalText.Length - 1) + ", required)";

            rcr.Headers[0] = nameHeader;

            // if we want more defaults here...
            rcr.Records.Add(new string[0]);

            var toReturn = rcr.GenerateCsvString();

            return(toReturn);
        }
Exemplo n.º 2
0
        private string GetCsvContents(EntitySave entity, PlatformerEntityViewModel viewModel)
        {
            List <PlatformerValues> values = new List <PlatformerValues>();

            foreach (var valuesViewModel in viewModel.PlatformerValues)
            {
                values.Add(valuesViewModel.ToValues());
            }

            RuntimeCsvRepresentation rcr = RuntimeCsvRepresentation.FromList(values);

            var nameHeader = rcr.Headers[0];

            nameHeader.IsRequired = true;
            // Setting it to IsRequired is not sufficient, need to
            // modify the "Original Text" prop
            // chop off the closing quote, and add ", required)"
            nameHeader.OriginalText = nameHeader.OriginalText.Substring(0, nameHeader.OriginalText.Length - 1) + ", required)";

            rcr.Headers[0] = nameHeader;

            var toReturn = rcr.GenerateCsvString();

            return(toReturn);
        }
Exemplo n.º 3
0
        private string GetCsvContents(EntitySave entity, TopDownEntityViewModel viewModel)
        {
            List <TopDownValues> values = new List <TopDownValues>();

            // create a default entry:
            var defaultValue = new TopDownValues();

            defaultValue.Name                        = "DefaultValues";
            defaultValue.MaxSpeed                    = 250;
            defaultValue.AccelerationTime            = 1;
            defaultValue.DecelerationTime            = .5f;
            defaultValue.UpdateDirectionFromVelocity = true;

            values.Add(defaultValue);

            RuntimeCsvRepresentation rcr = RuntimeCsvRepresentation.FromList(values);

            var nameHeader = rcr.Headers[0];

            nameHeader.IsRequired = true;
            // Setting it to IsRequired is not sufficient, need to
            // modify the "Original Text" prop
            // chop off the closing quote, and add ", required)"
            nameHeader.OriginalText = nameHeader.OriginalText.Substring(0, nameHeader.OriginalText.Length - 1) + ", required)";

            rcr.Headers[0] = nameHeader;

            var movementDefaults = new string[]
            {
            };

            rcr.Records.Add(movementDefaults);

            var toReturn = rcr.GenerateCsvString();

            return(toReturn);
        }
Exemplo n.º 4
0
        public void SaveCsv(string fileName)
        {
            RuntimeCsvRepresentation rcr = RuntimeCsvRepresentation.FromList <BuildToolAssociation>(this.BuildToolList);

            CsvFileManager.Serialize(rcr, fileName);
        }