Esempio n. 1
0
        /**************************************************************/
        /*                        Public
        /**************************************************************/
		/// <summary>
		/// Deep copies.
		/// </summary>
		/// <param name="assemblyDef">Assembly definition</param>
        public void Assign(AssemblyInfoDef assemblyDef) {
            if (!String.IsNullOrEmpty(assemblyDef.AssemblyTitle)) {
                this.AssemblyTitle = assemblyDef.AssemblyTitle;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyDescription)) {
                this.AssemblyDescription = assemblyDef.AssemblyDescription;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyConfiguration)) {
                this.AssemblyConfiguration = assemblyDef.AssemblyConfiguration;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyCompany)) {
                this.AssemblyCompany = assemblyDef.AssemblyCompany;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyProduct)) {
                this.AssemblyProduct = assemblyDef.AssemblyProduct;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyCopyright)) {
                this.AssemblyCopyright = assemblyDef.AssemblyCopyright;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyTrademark)) {
                this.AssemblyTrademark = assemblyDef.AssemblyTrademark;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyCulture)) {
                this.AssemblyCulture = assemblyDef.AssemblyCulture;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyVersion)) {
                this.AssemblyVersion = assemblyDef.AssemblyVersion;
            }

            if (assemblyDef.AssemblyDelaySign) {
                this.AssemblyDelaySign = assemblyDef.AssemblyDelaySign;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyKeyFile)) {
                this.AssemblyKeyFile = assemblyDef.AssemblyKeyFile;
            }

            if (!String.IsNullOrEmpty(assemblyDef.AssemblyKeyName)) {
                this.AssemblyKeyName = assemblyDef.AssemblyKeyName;
            }

            if (!String.IsNullOrEmpty(assemblyDef.OutputFileName)) {
                this.OutputFileName = assemblyDef.OutputFileName;
            }
        }
        private static void SaveAssemblyInfoDefInFile(string aFileName, AssemblyInfoDef aAssemblyInfoDef){
            XmlSerializer _Serializer = new XmlSerializer(typeof(AssemblyInfoDef));

            // Create an XmlSerializerNamespaces object.
            Stream _FileStream = new FileStream(aFileName, FileMode.Create);

            XmlTextWriter _Writer = new XmlTextWriter(_FileStream, new UTF8Encoding());
            try {
                _Writer.Formatting  = Formatting.Indented;

                // Serialize using the XmlTextWriter.
                _Serializer.Serialize(_Writer, aAssemblyInfoDef);
            } finally {
                _Writer.Close();
            }
        }
 private void SelectListViewItem(AssemblyInfoDef aAssemblyInfoDef) {
     foreach(ListViewItem _ListViewItem in lvFiles.Items) {
         if (_ListViewItem.Tag == aAssemblyInfoDef) {
             _ListViewItem.Selected = true;
             
             return;
         }
     }
 }
        private void btNew_Click(object sender, System.EventArgs e) {
            IOTAProject _Project = OtaUtils.GetCurrentProject();

            if (_Project != null) {
                if (saveFileDialog.ShowDialog() == DialogResult.OK) {
                    string _FileName = saveFileDialog.FileName;
                    
                    if (!_FileName.EndsWith(AID_FILE_EXTENSION, StringComparison.OrdinalIgnoreCase)) {
                        _FileName += AID_FILE_EXTENSION;
                    }

                    AssemblyInfoDef _AssemblyInfoDef = new AssemblyInfoDef();
                    fList.Add(_AssemblyInfoDef);
                    _Project.AddFile(_FileName);
                    SaveAssemblyInfoDefInFile(_FileName, _AssemblyInfoDef);
                    _AssemblyInfoDef.InputFileName = _FileName;
                    Mode = ModeEnum.New;
                    txtFileName.Text = _FileName;
                    LoadAssemblyInfoDefsInListView();
                    SelectListViewItem(_AssemblyInfoDef);
                }
            }
        }