コード例 #1
0
        private void DealWithLineForParameters(string dataReadline)
        {
            List <string> dataArray;

            JerkHub.Ptr2Debug.AddToDebug(("adding line from file: " + dataReadline));
            dataArray = dataReadline.Split('\t').ToList();
            JerkHub.AddOneSupplementalDataParameter(dataArray);
        }
コード例 #2
0
        public bool createSharedParameter(bool replaceExisting, Autodesk.Revit.DB.Document targetDoc)
        {
            // we should not be able to get here unless the stage is not set up correctly
            // we need to check
            // 1) does the parameter need to be created
            // 2) if it is aleady created, do they need to manually delete it and create anew?
            FamilyParameter existingParameter = this.DoesParameterExistInFile(_paramName, targetDoc);
            bool            isSuccessful      = false;
            string          failReason        = "";
            bool            okToProceed       = true;

            if (!(existingParameter == null))
            {
                JerkHub.Ptr2Debug.AddToDebug("Matching Existing - what is the user option?");
                if (replaceExisting)
                {
                    JerkHub.Ptr2Debug.AddToDebug("User Chooses to delete matching existing.");
                    this.deleteExistingParameter(existingParameter, targetDoc);
                    // -------
                    JerkHub.Ptr2Debug.AddToDebug("Testing for matching parameter again, to make sure we successfully deleted it.");
                    existingParameter = this.DoesParameterExistInFile(_paramName, targetDoc);
                    if ((existingParameter == null))
                    {
                        okToProceed = true;
                    }
                    else
                    {
                        JerkHub.Ptr2Debug.AddToDebug("Deleting existing parameter failed. This import fails.");
                        isSuccessful = false;
                        okToProceed  = false;
                    }
                }
                else
                {
                    // do nothing
                    JerkHub.Ptr2Debug.AddToDebug("User DOES NOT Choose to delete matching existing. This import fails.");
                    MessageBox.Show("parameter not added because it already exists in the file and you have not elected to overwrite it");
                    isSuccessful = false;
                    failReason   = "Parameter exist, no permission given to overwrite";
                    okToProceed  = false;
                }
            }

            if (okToProceed)
            {
                // --- we are guaranteed not to have a matching existing parameter here
                this.importOneParameter(_paramName, targetDoc);
                JerkHub.Ptr2Debug.AddToDebug("Post import, test if the parameter exists in the file...it should");
                existingParameter = this.DoesParameterExistInFile(_paramName, targetDoc);
                if ((existingParameter == null))
                {
                    isSuccessful = false;
                    failReason   = "Unable to add parameter";
                    JerkHub.Ptr2Debug.AddToDebug("Import failed");
                }
                else
                {
                    JerkHub.Ptr2Debug.AddToDebug("Import successful");
                    isSuccessful = true;
                }
            }

            ClassOneImportResult thisResult = new ClassOneImportResult();

            thisResult.ParameterName = _paramName;
            thisResult.fileNameLong  = targetDoc.PathName;
            // but what if we were not able to delete the existing parameter
            thisResult.ResultSuccessful = isSuccessful;
            thisResult.ResultLong       = failReason;
            JerkHub.AddToResults(thisResult);
            return(isSuccessful);
        }
コード例 #3
0
 private void ButtonSaveGeneric()
 {
     JerkHub.SaveSupplementalDataFile();
     flagSaveSupplemental.Visible     = false;
     JerkHub.Flags.FileNeedsToBeSaved = false;
 }