Ejemplo n.º 1
0
        internal static SectionInfo?ParseNormalizedSectionKey(string key)
        {
            var m = Regex.Match(key, @"^(\w)\-\w+\-(.+)$");

            if (!m.Success)
            {
                return(null);
            }
            SectionInfo info = new SectionInfo()
            {
                Id  = key,
                Key = m.Groups[2].Value
            };

            switch (m.Groups[1].Value)
            {
            case XmlStorageSection.KeyPrefix:
                info.Type = SectionType.Xml;
                break;

            case BinaryStorageSection.KeyPrefix:
                info.Type = SectionType.Raw;
                break;

            default:
                return(null);
            }
            return(info);
        }
Ejemplo n.º 2
0
        private bool UsedSectionsContains(SectionInfo SectionInfo)
        {
            var sectionInfo = SectionInfo.Section.ToLower().Replace("[", string.Empty).Replace("]", string.Empty);

            if (White.Contains(sectionInfo.ToLower()))
            {
                return(true);
            }
            else if (Regist.Contains(sectionInfo.ToLower()))
            {
                return(true);
            }
            var tmp = new List <SectionInfo>(UsedSection);

            foreach (var item in UsedSection)
            {
                if (item.Section.ToLower() == sectionInfo.ToLower())
                {
                    //tmp.Remove(item);
                    //UsedSection = tmp;
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create configuration section object.
        /// </summary>
        /// <param name="info">Info about section structure.</param>
        /// <returns>Configuration section object.</returns>
        private static ConfigSection createConfigSection(SectionInfo info)
        {
            var sectionBuilder = new ClassBuilder <ConfigSection>(info.DescribingType);

            foreach (var option in info.Options)
            {
                sectionBuilder.AddProperty(option.AssociatedProperty, option.ExpectedType);
            }

            try
            {
                var type    = sectionBuilder.Build();
                var section = (ConfigSection)Activator.CreateInstance(type);
                section.InitializeSectionInfo(info);
                return(section);
            }
            catch (Exception exception)
            {
                throw new CreateInstanceException(
                          userMsg: "Cannot create config section object, probably due to incorect structure type description",
                          developerMsg: "ConfigFactory::createConfigSection failed due to problem while creating config section instance, probably caused by incorect structure type description",
                          inner: exception
                          );
            }
        }
        /// <summary> 判断半边道路的挖填情况 </summary>
        /// <param name="center"></param>
        /// <param name="leftSide">左侧还是右侧</param>
        /// <param name="slopeFill">此侧边坡的填挖情况</param>
        /// <param name="treatmentDepth">浅挖路基的翻挖压实处理的最底部距离路面顶的深度,一般为1.5m左右</param>
        /// <param name="ground">自然地面</param>
        /// <returns>此侧路基中,需要进行翻挖压实处理的路基宽度。
        ///     当边坡为填方时(且道路中线处为挖方),此时自然地面线一般会与路面线相交,返回相交后靠近道路中线侧的挖方宽度;
        ///     如果自然地面线与路面线不相交(),则将此侧道路按全挖方考虑,且为全浅挖</returns>
        private static double HalfRoadShallowCut(SectionInfo center, bool leftSide, bool?slopeFill,
                                                 double treatmentDepth, Polyline ground)
        {
            var centerCutWidth = 0.0;

            var halfRoadWidth = leftSide
                ? center.CenterX - center.LeftRoadEdge.X
                : center.RightRoadEdge.X - center.CenterX; // 路面+路肩

            if (slopeFill == null || !slopeFill.Value)
            {
                // 说明不是填方
                centerCutWidth = halfRoadWidth;
            }
            else
            {
                // 说明中心为挖方,而边坡为填方
                var bottomPt = new Point2d(center.CenterX, center.CenterY - treatmentDepth);
                var inters   = new CurveCurveIntersector2d(ground.Get2dLinearCurve(),
                                                           new Ray2d(bottomPt, new Vector2d(leftSide ? -1 : 1, 0)));
                if (inters.NumberOfIntersectionPoints == 0)
                {
                    centerCutWidth = halfRoadWidth;
                }
                else
                {
                    centerCutWidth = Math.Abs(inters.GetIntersectionPoint(0).X - center.CenterX);
                    if (centerCutWidth > halfRoadWidth)
                    {
                        centerCutWidth = halfRoadWidth;
                    }
                }
            }
            return(centerCutWidth);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 对某一侧路基是否需要换填进行判断与计量
        /// </summary>
        /// <param name="db"></param>
        /// <param name="section">某个路基断面</param>
        /// <param name="slopeBottom">某侧填方边坡的坡脚</param>
        /// <param name="treatedLength">需要换填处理的宽度</param>
        /// <returns></returns>
        private static bool IsSideSoftSub(Database db, SectionInfo section, bool leftSide, Point3d slopeBottom, out double treatedLength)
        {
            treatedLength = 0;

            // 道路中心线与自然地面的交点
            var groundPt = new Point3d(section.CenterX, section.GetYFromElev(section.CenterElevation_Ground), 0);

            // 3. 坡底点是否位于低填区间
            var withinLf = Exporter_ThinFillShallowCut.WithinThinFillRange(groundPt, 1 / _thinFillCriterion.低填射线坡比,
                                                                           1 / _thinFillCriterion.低填射线坡比, slopeBottom);

            if (withinLf != 0)
            {
                return(false);
            }

            // 计算处理宽度
            var groundLine = leftSide ? section.LeftGroundSurfaceHandle.GetDBObject <Polyline>(db)
                : section.RightGroundSurfaceHandle.GetDBObject <Polyline>(db);
            var groundLineCurve = groundLine.Get2dLinearCurve();
            var end1Para        = groundLineCurve.GetClosestPointTo(new Point2d(slopeBottom.X, slopeBottom.Y)).Parameter;
            var end2Para        = groundLineCurve.GetClosestPointTo(new Point2d(groundPt.X, groundPt.Y)).Parameter;
            var smallerPara     = end1Para < end2Para ? end1Para : end2Para;
            var largerPara      = end1Para > end2Para ? end1Para : end2Para;

            treatedLength = groundLineCurve.GetLength(smallerPara, largerPara) + _softSubCriterion.附加宽度;
            return(true);
        }
Ejemplo n.º 6
0
        public void VerifyLithologyContainsMeasurement()
        {
            LithologicDescription description = new LithologicDescription();
            Measurement           measurement = new Measurement();

            description.StartOffset.Offset = 0;
            description.EndOffset.Offset   = 10;

            SectionInfo section = new SectionInfo();

            section.Expedition = "356";
            section.Site       = "U1500";
            section.Hole       = "A";
            section.Core       = "10";
            section.Type       = "H";
            section.Section    = "3";

            measurement.StartOffset.SectionInfo = section;
            measurement.EndOffset.SectionInfo   = section;
            description.SectionInfo             = section;

            measurement.StartOffset.Offset = 5;
            measurement.EndOffset.Offset   = 5;

            Assert.IsTrue(description.Contains(measurement.StartOffset));
        }
Ejemplo n.º 7
0
        Dictionary <string, SectionInfo> ParseSizeOutput(string output)
        {
            var sections = new Dictionary <string, SectionInfo> ();

            int skipLines = 2;

            foreach (var line in output.Split(new char [] { '\n' }))
            {
                if (skipLines > 0)
                {
                    skipLines--;
                    continue;
                }

                var cols = line.Split(new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                if (cols.Length != 3)
                {
                    continue;
                }

                sections [cols [0]] = new SectionInfo()
                {
                    Size = int.Parse(cols [1])
                };
            }

            return(sections);
        }
        public async Task <IActionResult> Edit(int id, [Bind("SectionId,SectionName,ClassId")] SectionInfo sectionInfo)
        {
            if (id != sectionInfo.SectionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sectionInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SectionInfoExists(sectionInfo.SectionId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClassId"] = new SelectList(_context.ClassInfo, "ClassId", "ClassName", sectionInfo.ClassId);
            return(View(sectionInfo));
        }
Ejemplo n.º 9
0
        private void AddFeedInfo()
        {
            if (this.MainForm == null || this.MainForm.IsDisposed)
            {
                return;
            }

            if (this.m_documents == null)
            {
                return;
            }

            if (this.m_documents.Count <= 0)
            {
                return;
            }

            SectionInfo sectionInfo = this.textEditor1.GetCurrentSection();

            if (sectionInfo != null)
            {
                this.m_documents[0].DOC_TITLE = sectionInfo.Name;
            }
            this.MainForm.AddMedicalQcMsg(this.m_documents[0]);
        }
Ejemplo n.º 10
0
        public void extractWorkExperience()
        {
            string       seg_name = "work_experience";
            WorkAnalyzer analyzer = new WorkAnalyzer(resumeContentList, sectionInfoList);

            if (segmentMap.ContainsKey(seg_name))
            {
                SectionInfo sectionInfo = segmentMap[seg_name];
                List <WorkExperienceData> workExperienceDataList = analyzer.extractWorkExperience(sectionInfo.Start,
                                                                                                  sectionInfo.End);
                resumedata.WorkExperience = workExperienceDataList;
            }
            else
            {
                // 从个人基本信息召回
                if (segmentMap.ContainsKey("basic_info"))
                {
                    SectionInfo sectionInfo = segmentMap["basic_info"];
                    List <WorkExperienceData> workExperienceDataList = analyzer.searchWorkExperience(sectionInfo.Start,
                                                                                                     sectionInfo.End);
                    // 判断单位是否与学校重复
                    if (this.resumedata.LatestSchool != null && workExperienceDataList.Count >= 1 && (this.resumedata
                                                                                                      .LatestSchool.Trim() != workExperienceDataList[0].CompanyName.Trim()))
                    {
                        resumedata.WorkExperience = workExperienceDataList;
                    }
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary> 从 AutoCAD 界面中选择横断面轴线 </summary>
        public static SubgradeSection GetSection(DocumentModifier docMdf)
        {
            SubgradeSection sec = null;
            var             op  = new PromptEntityOptions("\n选择要提取的横断面轴线");

            op.AddAllowedClass(typeof(Line), true);

            var res = docMdf.acEditor.GetEntity(op);

            if (res.Status == PromptStatus.OK)
            {
                var line = res.ObjectId.GetObject(OpenMode.ForRead) as Line;
                if (line != null && line.Layer == Options_LayerNames.LayerName_CenterAxis)
                {
                    var si = SectionInfo.FromCenterLine(line);
                    if (si != null && si.FullyCalculated)
                    {
                        sec = new SubgradeSection(docMdf, line, si);
                    }
                    else
                    {
                        MessageBox.Show($"选择的道路中心线对象所对应的横断面未进行构造," +
                                        $"\r\n请先调用“{SectionsConstructor.CommandName}”命令,以构造整个项目的横断面系统。",
                                        "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            return(sec);
        }
 public override string[] GetAllTasks(SectionInfo section)
 {
     List<string> list = new List<string>();
     foreach (ManagedFusion.Modules.Configuration.ConfigurationTask task in section.Module.Config.Tasks)
         list.Add(task.Name);
     return list.ToArray();
 }
Ejemplo n.º 13
0
        public static bool Insert(SectionInfo objSectionInfo)
        {
            ISalesPOSDBManager dbManager = new SalesPOSDBManager();
            Boolean            chk       = false;

            try
            {
                dbManager.Open();
                IDbDataParameter[] param = SalesPOSDBManagerFactory.GetParameters(dbManager.ProviderType, 6);

                param[0] = dbManager.getparam("@SectionName", objSectionInfo.SectionName.ToString());
                param[1] = dbManager.getparam("@ActivityID", objSectionInfo.ActivityID.ToString());

                param[2] = dbManager.getparam("@CreatedDate", objSectionInfo.CreatedDate);
                param[3] = dbManager.getparam("@CreatedBy", objSectionInfo.CreatedBy.ToString());
                param[4] = dbManager.getparam("@IsDeleted", false);
                param[5] = dbManager.getparam("@DiscountPercent", objSectionInfo.DiscountPercent);

                IDbCommand cmd = dbManager.getCommand(CommandType.StoredProcedure, "USP_SectionInfo_Add", param);

                chk = dbManager.ExecuteQuery(cmd);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                dbManager.Dispose();
            }
            return(chk);
        }
Ejemplo n.º 14
0
        public static bool Update(SectionInfo objSectionInfo)
        {
            ISalesPOSDBManager dbManager = new SalesPOSDBManager();
            Boolean            chk       = false;

            try
            {
                dbManager.Open();
                IDbDataParameter[] param = SalesPOSDBManagerFactory.GetParameters(dbManager.ProviderType, 6);
                param[0] = dbManager.getparam("@SectionId", objSectionInfo.SectionID.ToString());
                param[1] = dbManager.getparam("@SectionName", objSectionInfo.SectionName.ToString());
                param[2] = dbManager.getparam("@ActivityID", objSectionInfo.ActivityID.ToString());
                param[3] = dbManager.getparam("@UpdatedDate", objSectionInfo.UpdatedDate);
                param[4] = dbManager.getparam("@UpdatedBy", objSectionInfo.UpdatedBy.ToString());
                param[5] = dbManager.getparam("@Vat", Convert.ToDouble(objSectionInfo.Vat.ToString()));

                IDbCommand cmd = dbManager.getCommand(CommandType.StoredProcedure, "USP_SectionInfo_Update", param);

                chk = dbManager.ExecuteQuery(cmd);
            }
            catch (Exception ex)
            {
                throw (ex);
                return(false);
            }
            finally
            {
                dbManager.Dispose();
            }
            return(chk);
        }
Ejemplo n.º 15
0
 public Except(string avg1, SectionInfo avg2)
 {
     Exception  = avg1;
     Section    = avg2.Section;
     FileName   = avg2.FileName;
     LineNumber = avg2.LineNumber;
     FilePath   = avg2.FilePath;
 }
Ejemplo n.º 16
0
    public void RegisterSection(int id, SectionEvent section)
    {
        SectionInfo info = new SectionInfo();

        info.SectionId    = id;
        info.SectionEvent = section;
        m_Sections.Add(id, info);
    }
Ejemplo n.º 17
0
 public INTFile(object[] info, SectionInfo parent)
 {
     section    = parent;
     dataOffset = (long)info[0];
     nameOffset = (long)info[1];
     size       = (long)info[2];
     name       = (string)info[3];
 }
Ejemplo n.º 18
0
            /// <summary>
            /// Reads the dictionary info, and positions the reader after the last entry in the stream.
            /// </summary>
            /// <param name="reader">StreamReader from which to read the dictionary information</param>
            /// <returns>A SectionInfo containing data that could be found in file.</returns>
            private SectionInfo ReadInfoFromStream(StreamReader reader)
            {
                SectionInfo info = new SectionInfo();

                while (true)
                {
                    char   delim;
                    string line;
                    try {
                        line = ReadToNewLineOrNull(reader, out delim);
                    } catch (InvalidDataException) {
                        throw new ImportException("The file is not a Zbedic dictionary.");
                    }

                    string[] bits = line.Split(new char[] { '=' }, 2);
                    try {
                        if (bits.Length > 1)
                        {
                            switch (bits[0])
                            {
                            case "builddate":
                                info.Date = DateTime.Parse(bits[1]);
                                break;

                            case "copyright":
                                info.Copyright = bits[1];
                                break;

                            case "id":
                                info.Name = bits[1];
                                break;

                            case "dict-size":
                                info.Size = int.Parse(bits[1]);
                                break;

                            case "maintainer":
                                info.Maintainer = bits[1];
                                break;

                            case "items":
                                info.ItemCount = int.Parse(bits[1]);
                                break;
                            }
                        }
                    } catch (ArgumentException) {
                    } catch (FormatException) {
                    } catch (OverflowException) {
                    }

                    if (delim != '\n')
                    {
                        break;
                    }
                }

                return(info);
            }
Ejemplo n.º 19
0
 public SectionButton(SectionInfo info)
 {
     this.Content               = String.Format("[{0}] {1}", info.Block, info.Course);
     Info                       = info;
     Margin                     = new Thickness(5);
     Padding                    = new Thickness(5);
     HorizontalAlignment        = HorizontalAlignment.Stretch;
     HorizontalContentAlignment = HorizontalAlignment.Center;
 }
Ejemplo n.º 20
0
    public void ExecuteSection()
    {
        SectionInfo sectionInfo = GetSectionInfo(CurSectionId);

        if (sectionInfo != null && sectionInfo.SectionEvent != null)
        {
            sectionInfo.SectionEvent();
        }
    }
Ejemplo n.º 21
0
 public void extractBasicInfo()
 {
     if (segmentMap.ContainsKey("basic_info"))
     {
         SectionInfo       sectionInfo = segmentMap["basic_info"];
         BasicInfoAnalyzer analyzer    = new BasicInfoAnalyzer(resumeContentList, resumedata);
         analyzer.extractBasicInfo(sectionInfo.Start, sectionInfo.End);
     }
 }
Ejemplo n.º 22
0
 public ReferenceTable(EndianBinaryReader er)
 {
     NrEntries = er.ReadUInt32();
     Entries   = new SectionInfo[NrEntries];
     for (int i = 0; i < NrEntries; i++)
     {
         Entries[i] = new SectionInfo(er);
     }
 }
Ejemplo n.º 23
0
 public BoundInstruction(InstructionDefinition insn, byte[] bytes, int curOffset, SectionInfo section)
 {
     _section = section;
     _curAbsoluteOffset = curOffset + _section.SectionOffset;
     this.Instruction = insn;
     InitializeBoundData(bytes);
     _boundValues['A'] = curOffset;
     _pcRelBranchExpr = new Expression("A+o*2");
 }
Ejemplo n.º 24
0
 private void IfPresent(Dictionary <SectionFormat, SectionInfo> sectionTable, SectionFormat section, Action f)
 {
     if (sectionTable.ContainsKey(section))
     {
         SectionInfo info = sectionTable[section];
         SeekTo(info.Offset);
         f();
     }
 }
Ejemplo n.º 25
0
        public void UpdateSection(SectionInfo section)
        {
            UpdateSectionRequest request = new UpdateSectionRequest()
            {
                Section = section
            };

            CallWebService <IOrgUnitManagementServicev1_0, UpdateSectionRequest, UpdateOrgUnitResponse>(
                m_service1_0, request, (s, q) => s.UpdateSection(q));
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Selected a class.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            SectionButton button = (SectionButton)sender;

            ClassNameBox.Text = (String)button.Content;
            StudentSelectPanel.Children.Clear();
            CurrentSection = button.Info;

            foreach (var item in ClassSelectPanel.Children)
            {
                if (item is SectionButton)
                {
                    ((SectionButton)item).IsEnabled = true;
                }
            }

            foreach (StudentInfo info in button.Info.Students.OrderBy(inf => inf.LastName).ThenBy(inf => inf.FirstName).ToList())
            {
                StudentButton studentButton = new StudentButton(info);
                studentButton.Click += StudentButton_Click;
                StudentSelectPanel.Children.Add(studentButton);
            }

            try
            {
                CommentSettings.CurrentHeaderParagraph = await button.Info.CurrentCommentHeaderAsync();
            }
            // If something goes wrong alert the user.
            catch (WebException ex)
            {
                String responseBody;
                using (StreamReader sr = new StreamReader(ex.Response.GetResponseStream()))
                {
                    responseBody = sr.ReadToEnd();
                }

                Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(responseBody);
                await dialog.ShowAsync();
            }

            using (MemoryStream ms = new MemoryStream())
            {
                StreamWriter writer = new StreamWriter(ms);
                writer.Write(CommentSettings.CurrentHeaderParagraph.Html);
                writer.Flush();
                ms.Position = 0;

                EditorBox.Load(ms, FormatType.Html);
            }


            button.IsEnabled = false;
            CurrentState     = State.LoadedHeader;
            StateChanged(this, new EventArgs());
        }
Ejemplo n.º 27
0
        private SectionInfo ReadNextSection(StreamReader filein)
        {
            string line;

            while ((line = filein.ReadLine()) != null)
            {
                if (line.Length == 0)
                {
                    continue;
                }
                break;
            }

            if (line == null)
            {
                return(null);
            }

            Match match = Regex.Match(line, "<(.+)>");

            if (!match.Success)
            {
                return(null);
            }

            var result = new SectionInfo();

            result.ItemName = match.Groups[1].Value;

            AtomComposition sampleMap;
            AtomComposition referenceMap;

            if (line.IndexOf("SAM") < line.IndexOf("REF"))
            {
                ReadAtomMap(filein, out sampleMap, out referenceMap);
            }
            else
            {
                ReadAtomMap(filein, out referenceMap, out sampleMap);
            }

            result.SampleAtomMap    = sampleMap;
            result.ReferenceAtomMap = referenceMap;

            //如果是修饰,那么要求sample和reference定义一样的atom composition
            if (!Char.IsLetter(result.ItemName[0]))
            {
                if (result.SampleAtomMap.Values.Sum() != result.ReferenceAtomMap.Values.Sum())
                {
                    throw new ArgumentException(MyConvert.Format("Read SILAC information of {0} from SILAC configuration file error : the atom composition definitions for sample and refernce are different!", result.ItemName));
                }
            }

            return(result);
        }
        public Texture2D RenderSectionPreview(SectionInfo info, ModuleCarnationVariablePart current)
        {
            Texture2D result = new Texture2D(128, 128, TextureFormat.RGBA32, mipCount: 0, linear: false);

            cvsp.Section0Width  = info.width;
            cvsp.Section0Height = info.height;
            int i = -1;

            while (++i < 4)
            {
                cvsp.SetCornerRadius(i, info.radius[i]);

                string name = info.corners[i];
                if (name == null)
                {
                    continue;
                }
                SectionCorner corner = CVSPConfigs.SectionCornerDefinitions.FirstOrDefault(q => q.name.Equals(name));
                if (corner.name == null)
                {
                    continue;
                }
                cvsp.SetCornerTypes(corner, i);
                cvsp.SetCornerTypes(corner, i + 4);
            }
            //cvsp.uiEditing = true;
            if (cvsp.enabled)
            {
                cvsp.enabled = false;
                cvsp.MeshRender.sharedMaterials = new Material[2] {
                    renderMat, renderMat
                };
                Destroy(cvsp.GetComponent <Collider>());
            }

            if (!current)
            {
                renderMat.mainTexture = null;
            }
            else
            {
                renderMat.mainTexture = current.EndsDiffTexture;
            }

            cvsp.UpdateSectionTransforms();
            cvsp.ForceUpdateGeometry(updateColliders: false);
            camera.orthographicSize = Mathf.Max(info.width, info.height) / 2;
            cvsp.MeshRender.enabled = true;
            camera.Render();
            RenderTexture.active = rt;
            result.ReadPixels(new Rect(0, 0, 128, 128), 0, 0);
            cvsp.MeshRender.enabled = false;
            result.Apply(false, true);
            return(result);
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Initialize source section info.
 /// NOTE: It's not passed through construtor, because this type is dynamicallly instantied.
 /// </summary>
 /// <param name="info">Section info for this config section.</param>
 internal void InitializeSectionInfo(SectionInfo info)
 {
     _info = info;
     foreach (var option in info.Options)
     {
         var propertyName = option.AssociatedProperty;
         var optionName   = option.Name;
         _associatedProperties[optionName]      = propertyName;
         _associatedPropertiesRev[propertyName] = optionName;
     }
 }
Ejemplo n.º 30
0
        /// <summary>
        /// 分析 Arts 并将所得 全部已使用节 写入类字段
        /// </summary>
        /// <param name="paths">文件地址</param>
        public async Task InitiationArtAsync(string[] paths)
        {
            List <Task> tasks = new List <Task>();

            foreach (string path in paths)
            {
                var t = new Task(() =>
                {
                    string fullName = new FileInfo(path).FullName;
                    var fs          = new FileStream(path, FileMode.Open);
                    var sr          = new StreamReader(fs);
                    var readLock    = false;// 关闭读取
                    for (int i = 1; !sr.EndOfStream; i++)
                    {
                        var line = sr.ReadLine().Trim();// 读入行
                        if (line.StartsWith(";") || string.IsNullOrWhiteSpace(line))
                        {
                            continue;                       // 忽略注释行
                        }
                        line = line.Split(';')[0];          // 忽略注释
                        if (line.Contains("="))             // 按Key引用区分
                        {
                            var keyValue = line.Split('='); // 按等号分割
                            if (keyValue.Length < 2)
                            {
                                continue;                     // 异常处理
                            }
                            keyValue[0] = keyValue[0].Trim().ToLower();
                            keyValue[1] = keyValue[1].Trim().ToLower();
                            var section = new SectionInfo(keyValue[1].Trim().ToLower(), fullName, i.ToString(), path);
                            if (readLock)
                            {
                                if (!UsedSectionsContains(keyValue[1]))
                                {
                                    UsedSection.Add(section);
                                    UnRegistSection.Add(section);
                                }
                            }
                            else if (KeyDist(keyValue[0]))
                            {
                                UsedSection.Add(section);
                            }
                            continue;
                        }
                    }
                    sr.Close();
                    fs.Close();
                });
                t.Start();
                tasks.Add(t);
            }
            await Task.WhenAll(tasks);
        }
Ejemplo n.º 31
0
        public ActionResult CreateNewSection(int TermCourseId)
        {
            SectionDetails sectionDetails = GetExistingSectionDetails(TermCourseId);
            SectionInfo    newSectionInfo = new SectionInfo();

            newSectionInfo.ClassInfos = new List <ClassInfo>()
            {
                new ClassInfo()
            };
            sectionDetails.SectionInfos.Add(newSectionInfo);
            return(PartialView("EditSectionDetails", sectionDetails));
        }
        public async Task <IActionResult> Create([Bind("SectionId,SectionName,ClassId")] SectionInfo sectionInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sectionInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClassId"] = new SelectList(_context.ClassInfo, "ClassId", "ClassName", sectionInfo.ClassId);
            return(View(sectionInfo));
        }
Ejemplo n.º 33
0
 public abstract SectionMetaPropertyCollection GetMetaPropertiesForSection(SectionInfo section);
Ejemplo n.º 34
0
 public abstract SectionPropertyCollection GetGeneralPropertiesForSection(SectionInfo section);
Ejemplo n.º 35
0
 public abstract void UpdateRoleForSection(string role, string[] tasks, SectionInfo section);
Ejemplo n.º 36
0
 public abstract int GetSectionContainerLinkOrder(SectionInfo section, ContainerInfo container);
Ejemplo n.º 37
0
 public abstract void RemoveAllRolesForSection(SectionInfo section);
Ejemplo n.º 38
0
    /// <summary>
    /// 修改节描述
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ModifySection_Click(object sender, EventArgs e)
    {
        //章节NO由dropList的值获取,页面绑定数据
        string cNO = this.DropDownList5.Text;
        string sNO = this.DropDownList6.Text;
        //输入框的值
        string checkstring=this.TextBox4.Text;
        //将空格去掉
        string dsp = checkstring.Replace(" ", "");
        //new一个QuestionsManagement对象
        QuestionsManagement editsection = new QuestionsManagement();
        // 输入的节名为空
        if ("-1" != cNO)
        {
            if ("" != sNO)
            {
                //根据章NO和节NO获取ID
                int ID = editsection.getsectionIDbyCNOSNO(cNO, sNO, courseName);
                //根据ID获取节描述
                string check = DropDownList6.SelectedItem.Text;
                //输入的节名和数据库中的节名不相同
                if (dsp != check)
                {
                    //new一个SectionInfo对象并初始化
                    SectionInfo section = new SectionInfo();
                    section.ISectionId = ID;
                    if (dsp != "")
                        section.StrDescription = dsp;
                    else
                        section.StrDescription = check;
                    //修改节
                    editsection.EditSection(section);

                    try
                    {
                        File.Move(Server.MapPath("~/Text/") + courseName + @"/ClassTeach/TeachPlan/" + DropDownList5.SelectedItem.Text + @"/" + DropDownList6.SelectedItem.Text + ".txt", Server.MapPath("~/Text/") + courseName + @"/ClassTeach/TeachPlan/" + DropDownList5.SelectedItem.Text + @"/" + checkstring + ".txt");
                    }
                    catch { }

                    /*添加知识点*/
                    ProcessKnowledge(SECTION, ID);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                                   "<script>alert('修改节成功!')</script>");

                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                                   "<script>alert('与原节描述相同,无需修改!')</script>");
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                                  "<script>alert('请选择需修改的节!')</script>");
            }
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert",
                              "<script>alert('请选择需修改的章!')</script>");
        }

        //刷新viewtree
        TreeView1.Nodes.Clear();
        this.TreeDataBind();
        TreeView1.ShowLines = true;//显示连接父节点与子节点间的线条
        TreeView1.ExpandDepth = 1;//控件显示时所展开的层数

        for (int k = 0; k < TreeView1.Nodes[0].ChildNodes.Count; k++)
        {
            if (TreeView1.Nodes[0].ChildNodes[k].Text.Substring(TreeView1.Nodes[0].ChildNodes[k].Text.IndexOf('.') + 1) == DropDownList5.SelectedItem.Text)
            {
                TreeView1.Nodes[0].ChildNodes[k].Expand();
            }
        }

        this.DropDownList5.Text = null;
        this.DropDownList6.Text = null;
        this.TextBox4 = null;
    }
Ejemplo n.º 39
0
 public BoundInstruction Bind(byte[] bytes, int curOffset, SectionInfo section)
 {
     return new BoundInstruction(this, bytes, curOffset, section);
 }
 public override RolesTasksDictionary GetAllRoles(SectionInfo section)
 {
     return Common.DatabaseProvider.GetRolesForSection(section);
 }
Ejemplo n.º 41
0
        public IV_BASE(
            Dictionary<ushort, SectionInfo> textAndDataSections,
            ushort sectionIndex,
            EntryInfo<SYMBOL_ENTRY>[] symEntries)
        {
            _textAndDataSections = textAndDataSections;
            _sectionIndex = sectionIndex;
            _symEntries = symEntries;

            _section = _textAndDataSections[_sectionIndex];

            NeedsEndianSwap = false;
        }
 public override void RemoveRoleFromSection(string role, SectionInfo section)
 {
     Common.DatabaseProvider.RemoveRoleForSection(role, section);
 }
 public override bool TaskExists(string taskName, SectionInfo section)
 {
     ArrayList list = new ArrayList(GetAllTasks(section));
     return list.Contains(taskName);
 }
 public override void UpdateRoleForSection(string role, string[] taskNames, SectionInfo section)
 {
     Common.DatabaseProvider.UpdateRoleForSection(role, taskNames, section);
 }
Ejemplo n.º 45
0
 public abstract SectionModuleDataCollection GetModuleDataForSection(SectionInfo section);
Ejemplo n.º 46
0
 public abstract void RemoveModuleDataForSection(string name, SectionInfo section);
Ejemplo n.º 47
0
 public abstract RolesTasksDictionary GetRolesForSection(SectionInfo section);
Ejemplo n.º 48
0
 public abstract void RemoveSectionContainerLink(SectionInfo section, ContainerInfo container);
Ejemplo n.º 49
0
 public abstract int GetSectionContainerLinkPosition(SectionInfo section, ContainerInfo container);
Ejemplo n.º 50
0
 public abstract void UpdateMetaPropertyForSection(string name, string value, SectionInfo section);
Ejemplo n.º 51
0
 public abstract void RemoveMetaPropertyForSection(string name, SectionInfo section);
Ejemplo n.º 52
0
 private void LoadSections()
 {
     sections.Clear();
     sectionTotalLenght = 0;
     ConfigNode node = KAS_Shared.GetBaseConfigNode(this);
     int i = 0;
     foreach (ConfigNode sectionNode in node.GetNodes("SECTION")) {
       if (sectionNode.HasValue("transformName") && sectionNode.HasValue("lenght")) {
     SectionInfo section = new SectionInfo();
     string sectionTransformName = sectionNode.GetValue("transformName");
     section.transform = this.part.FindModelTransform(sectionTransformName);
     if (!section.transform) {
       KAS_Shared.DebugError("LoadSections(TelescopicArm) Section transform "
                         + sectionTransformName + " not found in the model !");
       continue;
     }
     if (!float.TryParse(sectionNode.GetValue("lenght"), out section.lenght)) {
       KAS_Shared.DebugError(
       "LoadSections(TelescopicArm) Unable to parse lenght of the Section : "
       + sectionTransformName);
       continue;
     }
     section.orgLocalPos = KAS_Shared.GetLocalPosFrom(section.transform, this.part.transform);
     section.orgLocalRot = KAS_Shared.GetLocalRotFrom(section.transform, this.part.transform);
     if (savedSectionsLocalPos.Count > 0) {
       section.savedLocalPos = savedSectionsLocalPos[i];
     }
     sections.Add(i, section);
     sectionTotalLenght += section.lenght;
     i++;
       }
     }
 }
Ejemplo n.º 53
0
 public abstract void RemoveRoleForSection(string role, SectionInfo section);
Ejemplo n.º 54
0
 public abstract void AddGeneralPropertyForSection(string name, string value, SectionInfo section);
Ejemplo n.º 55
0
 public abstract bool SectionContainerLinked(SectionInfo section, ContainerInfo container);
Ejemplo n.º 56
0
 public abstract void CommitSectionChanges(SectionInfo section);
Ejemplo n.º 57
0
 public abstract void UpdateModuleDataForSection(string name, string value, SectionInfo section);
Ejemplo n.º 58
0
 public abstract int[] GetContainersForSection(SectionInfo section);
Ejemplo n.º 59
0
 public abstract void UpdateSectionContainerLink(SectionInfo section, ContainerInfo container, int order, int position);
Ejemplo n.º 60
0
 public abstract int[] GetContainersInPositionForSection(SectionInfo section, int position);