/// <summary> /// </summary> public void Read(BinaryReader reader) { stdFlds = new StdFields(reader); ntFlds = new NTFields(reader); exportDir = new DataDir(reader); importDir = new DataDir(reader); resourceDir = new DataDir(reader); exceptionDir = new DataDir(reader); securityDir = new DataDir(reader); baseRelocDir = new DataDir(reader); debugDir = new DataDir(reader); copyrightDir = new DataDir(reader); GPDir = new DataDir(reader); TLSDir = new DataDir(reader); loadCfgDir = new DataDir(reader); boundImpDir = new DataDir(reader); IATDir = new DataDir(reader); delayImpDir = new DataDir(reader); CLIHdrDir = new DataDir(reader); reservedDir = new DataDir(reader); }
/// <summary> /// </summary> public void Read(BinaryReader reader) { stdFlds = new StdFields (reader); ntFlds = new NTFields (reader); exportDir = new DataDir (reader); importDir = new DataDir (reader); resourceDir = new DataDir (reader); exceptionDir = new DataDir (reader); securityDir = new DataDir (reader); baseRelocDir = new DataDir (reader); debugDir = new DataDir (reader); copyrightDir = new DataDir (reader); GPDir = new DataDir (reader); TLSDir = new DataDir (reader); loadCfgDir = new DataDir (reader); boundImpDir = new DataDir (reader); IATDir = new DataDir (reader); delayImpDir = new DataDir (reader); CLIHdrDir = new DataDir (reader); reservedDir = new DataDir (reader); }
/// <summary> /// Remove repeated values from the wording fields (PreP, PreI, PreA, LitQ, PstI, Pstp, RespOptions, NRCodes) unless they are requested. /// This applies only to series questions, which are questions whose Qnum ends in a letter. /// </summary> public void RemoveRepeatsTC() { string mainTopic = ""; string mainContent = ""; string currTopic = ""; string currContent = ""; bool firstRow = true; SurveyQuestion refQ = null;// this will hold the 'a' question's fields // only try to remove repeats if there are more than 0 rows if (Questions.Count == 0) { return; } // sort questions by their topic and then content labels var sorted = Questions.OrderBy(q => q.VarName.Topic.LabelText).ThenBy(q => q.VarName.Content.LabelText).ToList(); Questions.Clear(); AddQuestions(new BindingList <SurveyQuestion>(sorted)); sorted = null; foreach (SurveyQuestion sq in Questions) { currTopic = sq.VarName.Topic.LabelText; currContent = sq.VarName.Content.LabelText; // if this is a non-series row, the first member of a series, the first row in the report, or a new Qnum, make this row the reference row if (!currTopic.Equals(mainTopic) || (!currContent.Equals(mainContent)) || firstRow) { mainTopic = currTopic; mainContent = currContent; // copy the row's contents into an array refQ = new SurveyQuestion { PreP = sq.PreP, PreI = sq.PreI, PreA = sq.PreA, LitQ = sq.LitQ, PstI = sq.PstI, PstP = sq.PstP, RespOptions = sq.RespOptions, NRCodes = sq.NRCodes }; } else { // if we are inside a series, compare the wording fields to the reference question // if the current column is a standard wording column and has not been designated as a repeated field, compare wordings if ((StdFields.Contains("PreP") && !RepeatedFields.Contains("PreP"))) { // if the current question's wording field matches the reference question's, clear it. // otherwise, set the reference question's field to the current question's field // this will cause a new reference point for that particular field, but not the fields that were identical to the original reference question if (Utilities.RemoveTags(sq.PreP).Equals(Utilities.RemoveTags(refQ.PreP))) { sq.PreP = ""; } else { refQ.PreP = sq.PreP; } } // PreI if ((StdFields.Contains("PreI") && !RepeatedFields.Contains("PreI"))) { if (Utilities.RemoveTags(sq.PreI).Equals(Utilities.RemoveTags(refQ.PreI))) { sq.PreI = ""; } else { refQ.PreI = sq.PreI; } } // PreA if ((StdFields.Contains("PreA") && !RepeatedFields.Contains("PreA"))) { if (Utilities.RemoveTags(sq.PreA).Equals(Utilities.RemoveTags(refQ.PreA))) { sq.PreA = ""; } else { refQ.PreA = sq.PreA; } } // LitQ if ((StdFields.Contains("LitQ") && !RepeatedFields.Contains("LitQ"))) { if (Utilities.RemoveTags(sq.LitQ).Equals(Utilities.RemoveTags(refQ.LitQ))) { sq.LitQ = ""; } else { refQ.LitQ = sq.LitQ; } } // PstI if ((StdFields.Contains("PstI") && !RepeatedFields.Contains("PstI"))) { if (Utilities.RemoveTags(sq.PstI).Equals(Utilities.RemoveTags(refQ.PstI))) { sq.PstI = ""; } else { refQ.PstI = sq.PstI; } } // RespOptions if ((StdFields.Contains("RespOptions") && !RepeatedFields.Contains("RespOptions"))) { if (Utilities.RemoveTags(sq.RespOptions).Equals(Utilities.RemoveTags(refQ.RespOptions))) { sq.RespOptions = ""; } else { refQ.RespOptions = sq.RespOptions; } } // NRCodes if ((StdFields.Contains("NRCodes") && !RepeatedFields.Contains("NRCodes"))) { if (Utilities.RemoveTags(sq.NRCodes).Equals(Utilities.RemoveTags(refQ.NRCodes))) { sq.NRCodes = ""; } else { refQ.NRCodes = sq.NRCodes; } } } firstRow = false; // after once through the loop, we are no longer on the first row } }
/// <summary> /// Remove repeated values from the wording fields (PreP, PreI, PreA, LitQ, PstI, Pstp, RespOptions, NRCodes) unless they are requested. /// This applies only to series questions, which are questions whose Qnum ends in a letter. /// </summary> public void RemoveRepeats() { int mainQnum = 0; string currQnum = ""; int currQnumInt = 0; bool firstRow = true; bool removeAll = false; SurveyQuestion refQ = null; // this object is the 'a' question // only try to remove repeats if there are more than 0 rows if (Questions.Count == 0) { return; } foreach (SurveyQuestion sq in Questions) { currQnum = sq.Qnum; if (currQnum.Contains("z") && currQnum.Length >= 6) { int zPos = currQnum.IndexOf("z"); currQnum = currQnum.Substring(zPos + 1); } if (currQnum.Length != 4) { continue; } // get the integer value of the current qnum int.TryParse(currQnum.Substring(0, 3), out currQnumInt); // if this row is in table format, we need to remove all repeats, regardless of repeated designations if (sq.TableFormat) { removeAll = true; } else { removeAll = false; } // if this is a non-series row, the first member of a series, the first row in the report, or a new Qnum, make this row the reference row if (currQnum.Length == 3 || (currQnum.EndsWith("a")) || firstRow || currQnumInt != mainQnum) { mainQnum = currQnumInt; // copy the current question's contents into a new object for reference refQ = new SurveyQuestion { PreP = sq.PreP, PreI = sq.PreI, PreA = sq.PreA, LitQ = sq.LitQ, PstI = sq.PstI, PstP = sq.PstP, RespOptions = sq.RespOptions, NRCodes = sq.NRCodes, Filters = sq.Filters }; } else { // if we are inside a series, compare the wording fields to the reference question // if the current column is a standard wording column and has not been designated as a repeated field, compare wordings if ((StdFields.Contains("PreP") && !RepeatedFields.Contains("PreP")) || removeAll) { // if the current question's wording field matches the reference question's, clear it. // otherwise, set the reference question's field to the current question's field // this will cause a new reference point for that particular field, but not the fields that were identical to the original reference question if (Utilities.RemoveTags(sq.PreP).Equals(Utilities.RemoveTags(refQ.PreP))) { sq.PreP = ""; } else { refQ.PreP = sq.PreP; } } // PreI if ((StdFields.Contains("PreI") && !RepeatedFields.Contains("PreI")) || removeAll) { if (Utilities.RemoveTags(sq.PreI).Equals(Utilities.RemoveTags(refQ.PreI))) { sq.PreI = ""; } else { refQ.PreI = sq.PreI; } } // PreA if ((StdFields.Contains("PreA") && !RepeatedFields.Contains("PreA")) || removeAll) { if (Utilities.RemoveTags(sq.PreA).Equals(Utilities.RemoveTags(refQ.PreA))) { sq.PreA = ""; } else { refQ.PreA = sq.PreA; } } // LitQ if ((StdFields.Contains("LitQ") && !RepeatedFields.Contains("LitQ")) || removeAll) { if (Utilities.RemoveTags(sq.LitQ).Equals(Utilities.RemoveTags(refQ.LitQ))) { sq.LitQ = ""; } else { refQ.LitQ = sq.LitQ; } } // PstI if ((StdFields.Contains("PstI") && !RepeatedFields.Contains("PstI")) || removeAll) { if (Utilities.RemoveTags(sq.PstI).Equals(Utilities.RemoveTags(refQ.PstI))) { sq.PstI = ""; } else { refQ.PstI = sq.PstI; } } // PstP if ((StdFields.Contains("PstP") && !RepeatedFields.Contains("PstP")) || removeAll) { if (Utilities.RemoveTags(sq.PstP).Equals(Utilities.RemoveTags(refQ.PstP))) { sq.PstP = ""; } else { refQ.PstP = sq.PstP; } } // RespOptions if ((StdFields.Contains("RespOptions") && !RepeatedFields.Contains("RespOptions")) || removeAll) { if (Utilities.RemoveTags(sq.RespOptions).Equals(Utilities.RemoveTags(refQ.RespOptions))) { sq.RespOptions = ""; } else { refQ.RespOptions = sq.RespOptions; } } // NRCodes if ((StdFields.Contains("NRCodes") && !RepeatedFields.Contains("NRCodes")) || removeAll) { if (Utilities.RemoveTags(sq.NRCodes).Equals(Utilities.RemoveTags(refQ.NRCodes))) { sq.NRCodes = ""; } else { refQ.NRCodes = sq.NRCodes; } } // Filter column, remove repeated filters if the PreP field is also being removed if (!string.IsNullOrEmpty(sq.Filters) && ((StdFields.Contains("PreP") && !RepeatedFields.Contains("PreP")) || removeAll)) { if (sq.Filters.Equals(refQ.Filters)) { sq.Filters = ""; } } } firstRow = false; // after once through the loop, we are no longer on the first row } }