Пример #1
0
        internal void CreateAdditionalCsvFile(string name, GlobalOrProjectSpecific globalOrProjectSpecific)
        {
            // We're going to load the full
            // AvailableAssetTypes just to get
            // the headers.  Then we'll
            // create a new RCR, copy over the headers
            // then save off the RCR using the argument
            // fileName.  The new one will be empty except
            // for the headers.
            RuntimeCsvRepresentation rcr = CsvFileManager.CsvDeserializeToRuntime(
                mCoreTypesFileLocation);

            rcr.Records = new List <string[]>();


            string desiredFullPath = null;

            if (globalOrProjectSpecific == GlobalOrProjectSpecific.Global)
            {
                desiredFullPath = GlobalCustomContentTypesFolder + name + ".csv";
            }
            else // project-specific
            {
                desiredFullPath = ProjectSpecificContentTypesFolder + name + ".csv";
            }
            if (File.Exists(desiredFullPath))
            {
                MessageBox.Show("The CSV " + desiredFullPath + " already exists.");
            }
            else
            {
                try
                {
                    CsvFileManager.Serialize(rcr, desiredFullPath);
                }
                catch (UnauthorizedAccessException)
                {
                    MessageBox.Show("Unable to save the CSV file.  You need to run Glue as an administrator");
                }
                catch (Exception e)
                {
                    MessageBox.Show("Unknown error attempting to create the CSV:\n\n" + e.ToString());
                }
            }
        }
Пример #2
0
        public void SaveCsv(string fileName)
        {
            RuntimeCsvRepresentation rcr = RuntimeCsvRepresentation.FromList <BuildToolAssociation>(this.BuildToolList);

            CsvFileManager.Serialize(rcr, fileName);
        }