• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ReturnCode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ReturnCode的典型用法代码示例。如果您正苦于以下问题:C# ReturnCode类的具体用法?C# ReturnCode怎么用?C# ReturnCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReturnCode类属于命名空间,在下文中一共展示了ReturnCode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Response

        internal Response(ReturnCode result,
                          int? ecadId,
                          string geoDirectoryId,
                          Request input,
                          Model.Link[] links)
        {
            if (links == null) throw new ArgumentNullException("links");

            Result = result;
            EcadId = ecadId;
            GeoDirectoryId = geoDirectoryId;
            Input = input;
            
            var newLinks = new List<Model.Link>();

            foreach (Model.Link link in links)
            {
                Model.Link newLink;

                switch (link.Rel)
                {
                    case "self":
                        newLink = new Model.MapId.Link(link.Rel, link.Href);
                        break;
                    default:
                        newLink = link;
                        break;
                }

                newLinks.Add(newLink);
            }

            Links = newLinks.ToArray();
        }
开发者ID:Autoaddress-AA2,项目名称:autoaddress2.0-sdk-net,代码行数:34,代码来源:Response.cs


示例2: Response

        /// <summary>
        /// Construct a Response object from the supplied byte array
        /// </summary>
        /// <param name="message">a byte array returned from a DNS server query</param>
        internal Response(byte[] message)
        {
            if (message == null) throw new ArgumentNullException("message");

            // the bit flags are in bytes 2 and 3
            byte flags1 = message[2];
            byte flags2 = message[3];

            // get return code from lowest 4 bits of byte 3
            int returnCode = flags2 & 15;

            // if its in the reserved section, set to other
            if (returnCode > 6) returnCode = 6;
            _returnCode = (ReturnCode) returnCode;

            // other bit flags
            _authoritativeAnswer = ((flags1 & 4) != 0);
            _recursionAvailable = ((flags2 & 128) != 0);
            _messageTruncated = ((flags1 & 2) != 0);

            // create the arrays of response objects
            _questions = new Question[GetShort(message, 4)];
            _answers = new Answer[GetShort(message, 6)];
            _nameServers = new NameServer[GetShort(message, 8)];
            _additionalRecords = new AdditionalRecord[GetShort(message, 10)];

            // need a pointer to do this, position just after the header
            var pointer = new Pointer(message, 12);

            ReadQuestions(pointer);
            ReadAnswers(pointer);
            ReadNameServers(pointer);
            ReadAdditionalRecords(pointer);
        }
开发者ID:kdblocher,项目名称:simple.mailserver,代码行数:38,代码来源:Response.cs


示例3: CreateSuccessResult

 public static JobResult CreateSuccessResult(ReturnCode returnCode = ReturnCode.OK)
 {
     return new JobResult
     {
         Job = new ConcreteJob {JobState = ConcreteJobState.Completed},
         ReturnValue = returnCode
     };
 }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:8,代码来源:JobHelper.cs


示例4: Cmd_Help

		private static int Cmd_Help(ReturnCode returncode,string error=null)
		{
			WriteLine($"RopPreBuild {Version}");
			if (error != null) Tab.Red(error).WriteLine();
			WriteLine("Usage:");
			Tab.Write("RopPreBuild <").Yellow("prefile").Write(">.pre.cs").WriteLine(" [--<flags>]");
			Tab.Write("RopPreBuild ").WriteLine(" --version");
			return (int)returncode;
		}
开发者ID:ramoneeza,项目名称:RopHelperSnippets,代码行数:9,代码来源:Program.cs


示例5: checkStatus

	/**
	 * Check the return status for errors. If there is an error,
     * then terminate.
	 **/
	public static void checkStatus(ReturnCode status, string info) {
        if (status != ReturnCode.Ok &&
             status != ReturnCode.NoData)
        {
            System.Console.WriteLine(
                "Error in " + info + ": " + getErrorName(status));
            System.Environment.Exit(-1);
        }
	}
开发者ID:shizhexu,项目名称:opensplice,代码行数:13,代码来源:ErrorHandler.cs


示例6: Response

        /// <summary>
        /// Initializes a new instance_ of the Response class by parsing the message reponse.
        /// </summary>
        /// <param name="message">A byte array that contains the response message.</param>
        internal Response(byte[] message) {
            if (message == null)
                throw new ArgumentException("message");

            // ID - 16 bits

            // QR - 1 bit
            // Opcode - 4 bits
            // AA, TC, RD - 3 bits
            byte flags1 = message[2];

            // RA, Z - 2 bits
            // RCODE - 4 bits
            byte flags2 = message[3];

            long counts = message[3];

            // adjust the return code
            int return_code = (flags2 & (byte)0x3c) >> 2;
            return_code_ = (return_code > 6) ? ReturnCode.Other : (ReturnCode)return_code;

            // other bit flags
            authoritative_answer_ = ((flags1 & 4) != 0);
            recursion_available_ = ((flags2 & 128) != 0);
            truncated_ = ((flags1 & 2) != 0);

            // create the arrays of response objects
            questions_ = new Question[GetShort(message, 4)];
            answers_ = new Answer[GetShort(message, 6)];
            name_servers_ = new NameServer[GetShort(message, 8)];
            additional_records_ = new AdditionalRecord[GetShort(message, 10)];

            // need a pointer to do this, position just after the header
            RecordPointer pointer = new RecordPointer(message, 12);

            // and now populate them, they always follow this order
            for (int i = 0; i < questions_.Length; i++) {
                try {
                    questions_[i] = new Question(pointer);
                } catch(Exception ex) {
                    throw new InvalidResponseException(ex);
                }
            }

            for (int i = 0; i < answers_.Length; i++) {
                answers_[i] = new Answer(pointer);
            }

            for (int i = 0; i < name_servers_.Length; i++) {
                name_servers_[i] = new NameServer(pointer);
            }

            for (int i = 0; i < additional_records_.Length; i++) {
                additional_records_[i] = new AdditionalRecord(pointer);
            }
        }
开发者ID:joethinh,项目名称:nohros-must,代码行数:60,代码来源:response.cs


示例7: Response

        /// <summary>
        /// Construct a Response object from the supplied byte array
        /// </summary>
        /// <param name="message">a byte array returned from a DNS server query</param>
        internal Response(byte[] message)
        {
            // the bit flags are in bytes 2 and 3
            byte flags1 = message[2];
            byte flags2 = message[3];

            // get return code from lowest 4 bits of byte 3
            int returnCode = flags2 & 15;

            // if its in the reserved section, set to other
            if (returnCode > 6) returnCode = 6;
            _returnCode = (ReturnCode)returnCode;

            // other bit flags
            _authoritativeAnswer = ((flags1 & 4) != 0);
            _recursionAvailable = ((flags2 & 128) != 0);
            _truncated = ((flags1 & 2) != 0);

            // create the arrays of response objects
            _questions = new Question[GetShort(message, 4)];
            _answers = new Answer[GetShort(message, 6)];
            _nameServers = new NameServer[GetShort(message, 8)];
            _additionalRecords = new AdditionalRecord[GetShort(message, 10)];

            // need a pointer to do this, position just after the header
            Pointer pointer = new Pointer(message, 12);

            // and now populate them, they always follow this order
            for (int index = 0; index < _questions.Length; index++)
            {
                try
                {
                    // try to build a quesion from the response
                    _questions[index] = new Question(pointer);
                }
                catch (Exception ex)
                {
                    Terminals.Logging.Error("DNS Response Question Failure", ex);
                    // something grim has happened, we can't continue
                    throw new InvalidResponseException(ex);
                }
            }
            for (int index = 0; index < _answers.Length; index++)
            {
                _answers[index] = new Answer(pointer);
            }
            for (int index = 0; index < _nameServers.Length; index++)
            {
                _nameServers[index] = new NameServer(pointer);
            }
            for (int index = 0; index < _additionalRecords.Length; index++)
            {
                _additionalRecords[index] = new AdditionalRecord(pointer);
            }
        }
开发者ID:oo00spy00oo,项目名称:SharedTerminals,代码行数:59,代码来源:Response.cs


示例8: TKeyRecord

		public TKeyRecord(string name, TSigAlgorithm algorithm, DateTime inception, DateTime expiration, TKeyMode mode, ReturnCode error, byte[] key, byte[] otherData)
			: base(name, RecordType.TKey, RecordClass.Any, 0)
		{
			Algorithm = algorithm;
			Inception = inception;
			Expiration = expiration;
			Mode = mode;
			Error = error;
			Key = key ?? new byte[] { };
			OtherData = otherData ?? new byte[] { };
		}
开发者ID:LETO-R,项目名称:ARSoft.Tools.Net,代码行数:11,代码来源:TKeyRecord.cs


示例9: DataReaderMarshaler

        public DataReaderMarshaler(object[] dataValues, SampleInfo[] sampleInfos, ref int maxSamples, ref ReturnCode result)
        {
            dataValueHandle = GCHandle.Alloc(dataValues, GCHandleType.Normal);
            dataValuesPtr = GCHandle.ToIntPtr(dataValueHandle);
            dataValuesPtrCache = dataValuesPtr;

            sampleInfoHandle = GCHandle.Alloc(sampleInfos, GCHandleType.Normal);
            sampleInfosPtr = GCHandle.ToIntPtr(sampleInfoHandle);
            sampleInfosPtrCache = sampleInfosPtr;

            result = validateParameters(dataValues, sampleInfos, ref maxSamples);
        }
开发者ID:xrl,项目名称:opensplice_dds,代码行数:12,代码来源:DataReaderMarshalers.cs


示例10: GetMessageText

        private static string GetMessageText(ReturnCode returnCode)
        {
            string enumName = Enum.GetName(returnCode.GetType(), returnCode);
            string resourceName = string.Format("ReturnCode{0}", enumName);
            string message = Resources.ResourceManager.GetString(resourceName);

            if (string.IsNullOrEmpty(message)) {
                message = enumName;
            }

            return message;
        }
开发者ID:taylorjg,项目名称:WineApi,代码行数:12,代码来源:WineApiStatusException.cs


示例11: TSigRecord

		public TSigRecord(string name, TSigAlgorithm algorithm, DateTime timeSigned, TimeSpan fudge, ushort originalID, ReturnCode error, byte[] otherData, byte[] keyData)
			: base(name, RecordType.TSig, RecordClass.Any, 0)
		{
			Algorithm = algorithm;
			TimeSigned = timeSigned;
			Fudge = fudge;
			OriginalMac = new byte[] { };
			OriginalID = originalID;
			Error = error;
			OtherData = otherData ?? new byte[] { };
			KeyData = keyData;
		}
开发者ID:LETO-R,项目名称:ARSoft.Tools.Net,代码行数:12,代码来源:TSigRecord.cs


示例12: Response

        internal Response(byte[] message)
        {
            byte flags1 = message[2];
            byte flags2 = message[3];

            int returnCode = flags2 & 15;

            if (returnCode > 6) returnCode = 6;
            _returnCode = (ReturnCode)returnCode;

            _authoritativeAnswer = ((flags1 & 4) != 0);
            _recursionAvailable = ((flags2 & 128) != 0);
            _truncated = ((flags1 & 2) != 0);

            int _questionsCount = GetShort(message, 4);
            _questions = new List<Query>();
            int _answersCount = GetShort(message, 6);
            _answers = new List<Answer>();
            int _nameServersCount = GetShort(message, 8);
            _nameServers = new List<NameServer>();
            int _additionalRecordsCount = GetShort(message, 10);
            _additionalRecords = new List<AdditionalRecord>();

            SmartPointer pointer = new SmartPointer(message, 12);

            for (int i = 0; i < _questionsCount; i++)
            {
                try
                {
                    _questions.Add(new Query(pointer));
                }
                catch
                {
                    throw new Exception("Invalid Response");
                }
            }

            for (int i = 0; i < _answersCount; i++)
            {
                _answers.Add(new Answer(pointer));
            }

            for (int i = 0; i < _nameServersCount; i++)
            {
                _nameServers.Add(new NameServer(pointer));
            }

            for (int i = 0; i < _additionalRecordsCount; i++)
            {
                _additionalRecords.Add(new AdditionalRecord(pointer));
            }
        }
开发者ID:nnikos123,项目名称:sharppjsip,代码行数:52,代码来源:Response.cs


示例13: reportResultCode

     void reportResultCode(ReturnCode code)
     {
         string msg;
 
         switch ( code ) {
             case ReturnCode.Ok:
                 msg = "result is OK";
                 break;
             case ReturnCode.Error:
                 msg = "result is ERROR";
                 break;
             case ReturnCode.Unsupported:
                 msg = "result is UNSUPPORTED";
                 break;
             case ReturnCode.BadParameter:
                 msg = "result is BAD_PARAMETER";
                 break;
             case ReturnCode.PreconditionNotMet:
                 msg = "result is PRECONDITION_NOT_MET";
                 break;
             case ReturnCode.OutOfResources:
                 msg = "result is OUT_OF_RESOURCES";
                 break;
             case ReturnCode.NotEnabled:
                 msg = "result is NOT_ENABLED";
                 break;
             case ReturnCode.ImmutablePolicy:
                 msg = "result is IMMUTABLE_POLICY";
                 break;
             case ReturnCode.InconsistentPolicy:
                 msg = "result is INCONSISTENT_POLICY";
                 break;
             case ReturnCode.AlreadyDeleted:
                 msg = "result is ALREADY_DELETED";
                 break;
             case ReturnCode.Timeout:
                 msg = "result is TIMEOUT";
                 break;
             case ReturnCode.NoData:
                 msg = "result is NO_DATA";
                 break;
             default:
                 msg = "result is UNKNOWN";
                 break;
         }
 
         tfw.TestMessage(TestMessage.Note, msg);
     }
开发者ID:shizhexu,项目名称:opensplice,代码行数:48,代码来源:InvalidData.cs


示例14: ThrowOnFailure

        /// <summary>
        /// Throws an <see cref="SpssException"/> if a prior call into SPSS failed.
        /// </summary>
        /// <param name="returnCode">The return code actually received from the SPSS function.</param>
        /// <param name="spssFunctionName">Name of the SPSS function invoked.</param>
        /// <param name="acceptableReturnCodes">The acceptable return codes that should not result in a thrown exception (SPSS_OK is always ok).</param>
        /// <returns>The value of <paramref name="returnCode"/>.</returns>
        internal static ReturnCode ThrowOnFailure(ReturnCode returnCode, string spssFunctionName, params ReturnCode[] acceptableReturnCodes)
        {
            if (returnCode == ReturnCode.SPSS_OK)
            {
                return returnCode;
            }

            if (acceptableReturnCodes != null)
            {
                if (Array.IndexOf(acceptableReturnCodes, returnCode) >= 0)
                {
                    return returnCode;
                }
            }
            throw new SpssException(returnCode, spssFunctionName);
        }
开发者ID:yuanyesong,项目名称:SimpleEntry,代码行数:23,代码来源:SpssException.cs


示例15: Data

        /// <summary>
        /// Erstellt einen neuen Datensatz mit den übergebenen Eigenschaften.
        /// Wird ein Fehler zurückgegeben (ReturnCode != noError) so ist ein null Datensatz erstellt worden,
        /// welcher gelöscht werden sollte.
        /// </summary>
        /// <param name="benutzer">Benutzername</param>
        /// <param name="passw">Passwort</param>
        /// <param name="webs">Webseite der Zugangsdaten oder Pfad zur User-Datei</param>
        /// <param name="detail">Zusätzliche Infos (optional)</param>
        /// <param name="code">Rückgabe des ReturnCode</param>
        public Data(string benutzer, Passw passw, string webs, string detail, out ReturnCode code)
        {
            code = ReturnCode.noError;
            if (Benutzer.CheckBenutzername(benutzer) == true) code = ReturnCode.BenutzernameUngültig;
            Program.stopw.Restart();
            if (Passw.CheckPasswort(passw.Passwort, passw.PasswortEigenschaften) == true) code = ReturnCode.PasswortUngültig;
            Program.stopw.Stop();
            if (webs == null) code = ReturnCode.missingParameter;

            if (code == ReturnCode.noError)
            {
                this.benutzername = benutzer;
                this.passwort = passw;
                this.pfad = webs;
                this.details = detail;
            }
        }
开发者ID:Diendi,项目名称:PasswortSave_Final,代码行数:27,代码来源:Data.cs


示例16: AniDBResponse

		public AniDBResponse(byte[] responseData, Encoding encoding = null)
		{
			OriginalString = (encoding ?? Encoding.ASCII).GetString(responseData);

			string[] responseLines = OriginalString.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

			short returnCode;

			string[] response =
				responseLines[0].Split(new[] { ' ' }, short.TryParse(responseLines[0].Split(' ')[0], out returnCode) ? 2 : 3);

			Tag = response.Length == 3 ? response[0] : "";
			Code = (ReturnCode)(response.Length == 3 ? short.Parse(response[1]) : returnCode);
			ReturnString = response.Length == 3 ? response[2] : response[1];

			List<string[]> datafields = new List<string[]>();

			for (int i = 1; i < responseLines.Length; i++)
				datafields.Add(responseLines[i].Split('|'));

			DataFields = datafields.ToArray();
		}
开发者ID:juilinsandar,项目名称:AniDB.NET,代码行数:22,代码来源:AniDBResponse.cs


示例17: DnsAnswer

        public DnsAnswer(byte[] response)
        {
            _questions = new List<Question>();
            _answers = new List<Answer>();
            _servers = new List<Server>();
            _additional = new List<Record>();
            _exceptions = new List<Exception>();
            DataBuffer buffer = new DataBuffer(response, 2);
            byte bits1 = buffer.ReadByte();
            byte bits2 = buffer.ReadByte();
            //Mask off return code
            int returnCode = bits2 & 15;
            if (returnCode > 6) returnCode = 6;
            this._returnCode = (ReturnCode)returnCode;
            //Get Additional Flags
            _authoritative = TestBit(bits1, 2);
            _recursive = TestBit(bits2, 8);
            _truncated = TestBit(bits1, 1);

            int nQuestions = buffer.ReadBEShortInt();
            int nAnswers = buffer.ReadBEShortInt();
            int nServers = buffer.ReadBEShortInt();
            int nAdditional = buffer.ReadBEShortInt();

            //read in questions
            for (int i = 0; i < nQuestions; i++)
            {
                try
                {
                    _questions.Add(new Question(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
            //read in answers
            for (int i = 0; i < nAnswers; i++)
            {
                try
                {
                    _answers.Add(new Answer(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
            //read in servers
            for (int i = 0; i < nServers; i++)
            {
                try
                {
                    _servers.Add(new Server(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
            //read in additional records
            for (int i = 0; i < nAdditional; i++)
            {
                try
                {
                    _additional.Add(new Record(buffer));
                }
                catch (Exception ex)
                {
                    _exceptions.Add(ex);
                }
            }
        }
开发者ID:yslib,项目名称:minimvc,代码行数:73,代码来源:DnsAnswer.cs


示例18: MemberVariables

 public MemberVariables(byte[] bytes, string str, ReturnCode codeInput)
 {
     byteArray = bytes;
     stringVar = str;
     code = codeInput;
 }
开发者ID:JackWangCUMT,项目名称:orleans,代码行数:6,代码来源:IGeneratorTestGrain.cs


示例19: Main

        private static int Main(string[] args)
        {
            Console.WriteLine("Community TFS Build Manager Console - {0}\n", GetFileVersion(Assembly.GetExecutingAssembly()));

            try
            {
                // ---------------------------------------------------
                // Process the arguments
                // ---------------------------------------------------
                int retval = ProcessArguments(args);
                if (retval != 0)
                {
                    return retval;
                }

                switch (action)
                {
                    case ConsoleAction.ExportBuildDefinitions:
                        // ---------------------------------------------------
                        // Export the specified builds
                        // ---------------------------------------------------
                        retval = ExportBuilds();
                        if (retval != 0)
                        {
                            return retval;
                        }

                        break;
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null)
                {
                    message += string.Format("Inner Exception: {0}", ex.InnerException.Message);
                }

                rc = ReturnCode.UnhandledException;
                LogMessage(message);
                return (int)rc;
            }

            return (int)rc;
        }
开发者ID:nagyist,项目名称:BuildManager,代码行数:45,代码来源:Program.cs


示例20: ProcessArguments

        private static int ProcessArguments(string[] args)
        {
            if (args.Contains("/?") || args.Contains("/help"))
            {
                Console.WriteLine(@"Syntax:\t\ctfsbm.exe /f:<files> | /auto [switches]\n");
                Console.WriteLine("Optional Switches:\t\t\n");
                Console.WriteLine("Samples:\t\t\n");

                return (int)ReturnCode.UsageRequested;
            }

            Console.Write("Processing Arguments");
            if (args.Length == 0)
            {
                rc = ReturnCode.ArgumentsNotSupplied;
                LogMessage();
                return (int)rc;
            }

            Regex searchTerm = new Regex(@"/p:.*", RegexOptions.IgnoreCase);
            bool propertiesargumentfound = args.Select(arg => searchTerm.Match(arg)).Any(m => m.Success);
            if (propertiesargumentfound)
            {
                // properties = args.First(item => item.Contains("/p:")).Replace("/p:", string.Empty).Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            }

            Console.Write("...Success\n");
            return 0;
        }
开发者ID:nagyist,项目名称:BuildManager,代码行数:29,代码来源:Program.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ReturnContainers类代码示例发布时间:2022-05-24
下一篇:
C# Return类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap