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


C# ReturnCode类代码示例

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


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


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