当前位置: 首页>>代码示例>>C#>>正文


C# ModelType.ToString方法代码示例

本文整理汇总了C#中ModelType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ModelType.ToString方法的具体用法?C# ModelType.ToString怎么用?C# ModelType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelType的用法示例。


在下文中一共展示了ModelType.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAvailableAnalyzeOptions

        /// <summary>
        /// Retrieves available analyze options for specified research type and model type.
        /// </summary>
        /// <param name="rt">Research type.</param>
        /// <param name="mt">Model type.</param>
        /// <returns>Available analyze options.</returns>
        /// <note>Analyze option is available for research, if it is available 
        /// both for research type and model type.</note>
        public static AnalyzeOption GetAvailableAnalyzeOptions(ResearchType rt, ModelType mt)
        {
            ResearchTypeInfo[] rInfo = (ResearchTypeInfo[])rt.GetType().GetField(rt.ToString()).GetCustomAttributes(typeof(ResearchTypeInfo), false);
            Type researchType = Type.GetType(rInfo[0].Implementation, true);

            AvailableAnalyzeOption rAvailableOptions = ((AvailableAnalyzeOption[])researchType.GetCustomAttributes(typeof(AvailableAnalyzeOption), true))[0];

            ModelTypeInfo[] mInfo = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false);
            Type modelType = Type.GetType(mInfo[0].Implementation, true);

            AvailableAnalyzeOption mAvailableOptions = ((AvailableAnalyzeOption[])modelType.GetCustomAttributes(typeof(AvailableAnalyzeOption), true))[0];

            return rAvailableOptions.Options & mAvailableOptions.Options;
        }
开发者ID:kocharyan-ani,项目名称:random_networks_explorer,代码行数:22,代码来源:StatSessionManager.cs

示例2: updateCharsetcustomFwToolStripMenuItem_Click

        private void updateCharsetcustomFwToolStripMenuItem_Click (object sender, EventArgs e) {
            #region Get and validate font file
			OpenFileDialog ofd = new OpenFileDialog();
			ofd.Filter = "mcm|*.mcm";

			DialogResult dialogResp = ofd.ShowDialog();
			if((dialogResp!=System.Windows.Forms.DialogResult.OK) || (ofd.FileName.Trim()==""))
				return;

			if(!IsValidCharsetFile(ofd))
				return;
            #endregion

			//Get current fw version (plane, copter...)
			ModelType modelType = conf.GetModelType();
			modelType = ModelType.Copter;
			string modelFileName = "MinimOSD_" + modelType.ToString() + ".hex";
			if(modelType==ModelType.Unknown) {
				if(MessageBox.Show("Unknown current fw." + Environment.NewLine +
                                   "If you proceed you'll need to upload  the fw manually after charset upload." + Environment.NewLine + 
                                   "Do you want to proceed?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)==System.Windows.Forms.DialogResult.No)
					return;
			}

			//Get latest fw from ftp
			if(!GetLatestFW(modelType)) {
				if(MessageBox.Show("Unable to get latest fw from internet." + Environment.NewLine +
                                   "If you proceed you'll need to upload the fw manually after charset upload." + Environment.NewLine + 
                                   "Do you want to proceed?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)==System.Windows.Forms.DialogResult.No)
					return;
			}

			//Upload font fw
			if(!UploadFirmware("charuploader.hex")) {
				MessageBox.Show("Unable to write character uploader!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}

			//Upload font
			if(!UploadFont(ofd))
				return;

			//Upload fw
			if(modelType!=ModelType.Unknown)
				UploadFirmware(modelFileName);
			else
				MessageBox.Show("Wrong ModelType!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);

		}
开发者ID:svpcom,项目名称:minimosd-extra,代码行数:49,代码来源:OSD.cs

示例3: GetLatestFW

        private bool GetLatestFW(ModelType modelType)
        {
            try
            {
                string localFwDir = AppDomain.CurrentDomain.BaseDirectory + "\\FW";
                string fileName = "MinimOSD_Extra_" + modelType.ToString() + ".hex";

                if (!Directory.Exists(localFwDir))
                    Directory.CreateDirectory(localFwDir);
                FileStream latestPlaneFile = new FileStream(localFwDir + "\\MinimOSD_" + modelType.ToString() + ".hex", FileMode.Create);
                //FileStream latestPlaneFile = new FileStream("C:\\test\\MinimOSD_" + modelType.ToString() + "_Test.hex", FileMode.Create);

                FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://gabek.dyndns.org:23/Latest/" + fileName));
                request.Credentials = new NetworkCredential("ct", "secret01201");
                request.Method = WebRequestMethods.Ftp.DownloadFile;
                request.UseBinary = true;

                FtpWebResponse response = (FtpWebResponse)request.GetResponse();
                Stream ftpStream = response.GetResponseStream();
                long cl = response.ContentLength;
                int bufferSize = 2048;
                int readCount;
                byte[] buffer = new byte[bufferSize];
                readCount = ftpStream.Read(buffer, 0, bufferSize);
                while (readCount > 0)
                {
                    latestPlaneFile.Write(buffer, 0, readCount);
                    readCount = ftpStream.Read(buffer, 0, bufferSize);
                }
                ftpStream.Close();
                latestPlaneFile.Close();
                response.Close();
            }
            catch
            {
                return false;
            }
            return true;
        }
开发者ID:svpcom,项目名称:minimosd-extra,代码行数:39,代码来源:OSD.cs

示例4: SaveGeneralInfo

        private void SaveGeneralInfo(Guid researchID,
            string researchName,
            ResearchType rType,
            ModelType mType,
            int realizationCount,
            UInt32 size,
            Double edges,
            Dictionary<ResearchParameter, object> rp,
            Dictionary<GenerationParameter, object> gp)
        {
            Worksheet sheet = GetNextWorksheet();
            sheet.Name = "General";
            int lastRow = sheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell).Row;

            sheet.Columns[1].ColumnWidth = 30;
            sheet.Columns[2].ColumnWidth = 40;
            sheet.Columns[2].HorizontalAlignment = XlHAlign.xlHAlignLeft;
            sheet.Cells[lastRow, 1] = "Research Info";
            sheet.Cells[lastRow, 1].EntireRow.Font.Bold = true;
            ++lastRow;

            sheet.Cells[lastRow, 1] = "ResearchID";
            sheet.Cells[lastRow, 2] = researchID.ToString();
            ++lastRow;

            sheet.Cells[lastRow, 1] = "ResearchName";
            sheet.Cells[lastRow, 2] = researchName;
            ++lastRow;

            sheet.Cells[lastRow, 1] = "ResearchType";
            sheet.Cells[lastRow, 2] = rType.ToString();
            ++lastRow;

            sheet.Cells[lastRow, 1] = "ModelType";
            sheet.Cells[lastRow, 2] = mType.ToString();
            ++lastRow;

            sheet.Cells[lastRow, 1] = "RealizationCount";
            sheet.Cells[lastRow, 2] = realizationCount;
            ++lastRow;

            sheet.Cells[lastRow, 1] = "Date";
            sheet.Cells[lastRow, 2] = DateTime.Now.ToString();
            ++lastRow;

            sheet.Cells[lastRow, 1] = "Size";
            sheet.Cells[lastRow, 2] = size;
            ++lastRow;

            sheet.Cells[lastRow, 1] = "Edges";
            sheet.Cells[lastRow, 2] = edges;

            SaveResearchParameters(sheet, rp);
            SaveGenerationParameters(sheet, gp);
        }
开发者ID:kocharyan-ani,项目名称:random_networks_explorer,代码行数:55,代码来源:ExcelResultStorage.cs

示例5: GetRequiredGenerationParameters

        /// <summary>
        /// Returns list of generation parameters which are required for specified research.
        /// </summary>
        /// <param name="id">ID of research.</param>
        /// <returns>List of generation parameters.</returns>
        public static List<GenerationParameter> GetRequiredGenerationParameters(ResearchType rt,
            ModelType mt, GenerationType gt)
        {
            List<GenerationParameter> gp = new List<GenerationParameter>();

            if (rt == ResearchType.Collection ||
                rt == ResearchType.Structural)
                return gp;

            if (gt == GenerationType.Static)
            {
                gp.Add(GenerationParameter.AdjacencyMatrix);
                return gp;
            }

            ModelTypeInfo[] info = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false);
            Type t = Type.GetType(info[0].Implementation, true);

            RequiredGenerationParameter[] rRequiredGenerationParameters = (RequiredGenerationParameter[])t.GetCustomAttributes(typeof(RequiredGenerationParameter), true);
            for (int i = 0; i < rRequiredGenerationParameters.Length; ++i)
            {
                GenerationParameter g = rRequiredGenerationParameters[i].Parameter;
                if (g != GenerationParameter.AdjacencyMatrix)
                    gp.Add(g);
            }

            return gp;
        }
开发者ID:kocharyan-ani,项目名称:random_networks_explorer,代码行数:33,代码来源:SessionManager.cs

示例6: SaveResearchInfo

 private void SaveResearchInfo(Guid researchID,
     string researchName,
     ResearchType rType,
     ModelType mType,
     int realizationCount,
     DateTime date,
     UInt32 size,
     Double edges)
 {
     writer.WriteElementString("ResearchID", researchID.ToString());
     writer.WriteElementString("ResearchName", researchName);
     writer.WriteElementString("ResearchType", rType.ToString());
     writer.WriteElementString("ModelType", mType.ToString());
     writer.WriteElementString("RealizationCount", realizationCount.ToString());
     writer.WriteElementString("Date", date.ToString());
     writer.WriteElementString("Size", size.ToString());
     writer.WriteElementString("Edges", edges.ToString());
 }
开发者ID:kocharyan-ani,项目名称:random_networks_explorer,代码行数:18,代码来源:XMLResultStorage.cs

示例7: CreateNetworkByType

 public static AbstractNetwork CreateNetworkByType(ModelType mt, String rName,
     GenerationType gType,
     Dictionary<ResearchParameter, object> rParams,
     Dictionary<GenerationParameter, object> genParams,
     AnalyzeOption AnalyzeOptions)
 {
     ModelTypeInfo[] info = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false);
     Type t = Type.GetType(info[0].Implementation);
     Type[] constructTypes = new Type[] {
             typeof(String),
             typeof(GenerationType),
             typeof(Dictionary<ResearchParameter, object>),
             typeof(Dictionary<GenerationParameter, object>),
             typeof(AnalyzeOption) };
     object[] invokeParams = new object[] {
             rName,
             gType,
             rParams,
             genParams,
             AnalyzeOptions };
     return (AbstractNetwork)t.GetConstructor(constructTypes).Invoke(invokeParams);
 }
开发者ID:kocharyan-ani,项目名称:random_networks_explorer,代码行数:22,代码来源:AbstractNetwork.cs


注:本文中的ModelType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。