Esempio n. 1
0
 public Forestilling(Movie m, Tid t, BioSal s, Billet b)
 {
     _movies   = m;
     _times    = t;
     _sale     = s;
     _billeter = b;
 }
Esempio n. 2
0
        public byte[] Build()
        {
            var packet = Tid
                         .Concat(Flags)
                         .Concat(Question)
                         .Concat(AnswerRRS)
                         .Concat(AuthorityRRS)
                         .Concat(AdditionalRRS)
                         .Concat(QuestionNameLen)
                         .Concat(QuestionName)
                         .Concat(QuestionNameNull)
                         .Concat(Type)
                         .Concat(Class)
                         .Concat(AnswerNameLen)
                         .Concat(AnswerName)
                         .Concat(AnswerNameNull)
                         .Concat(Type1)
                         .Concat(Class1)
                         .Concat(TTL)
                         .Concat(IpLen)
                         .Concat(Ip)
                         .ToArray();

            return(packet);
        }
Esempio n. 3
0
        public List <Tid> GetAllTid()
        {
            using (SqlConnection connection = new SqlConnection(DBaddress))
            {
                var        quertstring = "SELECT * FROM Tid";
                SqlCommand command     = new SqlCommand(quertstring, connection);
                connection.Open();

                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    int      id  = reader.GetInt32(0);
                    TimeSpan id2 = reader.GetTimeSpan(1);
                    TimeSpan id3 = reader.GetTimeSpan(2);


                    Tid addTid = new Tid()
                    {
                        TidId = id, TidFra = id2, TidTil = id3
                    };
                    TidList.Add(addTid);
                }
                connection.Close();
                return(TidList);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Инициализация переменных
        /// </summary>
        public override void InitializeComponents()
        {
            // m_log = Settings.Cyber.LogFile;

            try
            {
                CodePage    = "1251";
                ContentType = "application/x-www-form-urlencoded";

                SD = ProvidersSettings.Cyber.SD;
                AP = ProvidersSettings.Cyber.AP;
                OP = ProvidersSettings.Cyber.OP;

                // Пути к файлам ключей
                secret_key_path = Settings.CyberPath + ProvidersSettings.Cyber.SecretKey;
                passwd          = ProvidersSettings.Cyber.Passwd;
                public_key_path = Settings.CyberPath + ProvidersSettings.Cyber.PublicKeys;
                serial          = ProvidersSettings.Cyber.BankKeySerial;

                checkHost  = GetCheckHost();
                payHost    = GetPayHost();
                statusHost = GetStatusHost();

                session = "OLDIGW" + Tid.ToString();
            }
            catch (Exception ex)
            {
                RootLog($"{tid} {Number}{Card} {Account} {Provider}/{Service}/{Gateway}\r\n{ex.ToString()}");
            }

            // base.InitializeComponents();
        }
Esempio n. 5
0
        protected string GoPage(int Page)
        {
            string Rv;

            Rv = "/e/space/?uid=" + UID + "&tid=" + Tid.ToString() + "&page=" + Page.ToString();
            return(Rv);
        }
Esempio n. 6
0
        public Tid GetTidFromId(int tidId)
        {
            using (SqlConnection connection = new SqlConnection(DBaddress))
            {
                var        quertstring = $"SELECT * FROM Tid WHERE TidId = {tidId}";
                SqlCommand command     = new SqlCommand(quertstring, connection);
                connection.Open();
                Tid nytid = new Tid();

                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    int      id  = reader.GetInt32(0);
                    TimeSpan id2 = reader.GetTimeSpan(1);
                    TimeSpan id3 = reader.GetTimeSpan(2);


                    nytid.TidId  = id;
                    nytid.TidFra = id2;
                    nytid.TidTil = id3;
                }
                connection.Close();
                return(nytid);
            }
        }
Esempio n. 7
0
        protected string GoPage(int Page)
        {
            string Rv;

            Rv = "/e/space/?s=" + SiteId + "&username="******"&tid=" + Tid.ToString() + "&page=" + Page.ToString();
            return(Rv);
        }
Esempio n. 8
0
        public override int GetHashCode()
        {
            var hashCode = -229983936;

            hashCode = hashCode * -1521134295 + base.GetHashCode();
            hashCode = hashCode * -1521134295 + Tid.GetHashCode();
            hashCode = hashCode * -1521134295 + LanguageCode.GetHashCode();
            return(hashCode);
        }
Esempio n. 9
0
 public override int GetHashCode()
 {
     //Uid优先为HashCode, Tid次之(有的对象是单例的,也就是说Tid对应唯一对象)
     if (Uid != 0)
     {
         return(Uid.GetHashCode());
     }
     return(Tid.GetHashCode());
 }
Esempio n. 10
0
 public TimSock5Bean(Tid fromTid, Tid toTid, string addr, int port, short transport, string pubId) : this()
 {
     this.FromTid   = fromTid;
     this.ToTid     = toTid;
     this.Addr      = addr;
     this.Port      = port;
     this.Transport = transport;
     this.PubId     = pubId;
 }
Esempio n. 11
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("TimRoster");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         field.Name = "subscription";
         field.Type = TType.String;
         field.ID   = 1;
         oprot.WriteFieldBegin(field);
         oprot.WriteString(Subscription);
         oprot.WriteFieldEnd();
         field.Name = "tid";
         field.Type = TType.Struct;
         field.ID   = 2;
         oprot.WriteFieldBegin(field);
         Tid.Write(oprot);
         oprot.WriteFieldEnd();
         if (Name != null && __isset.name)
         {
             field.Name = "name";
             field.Type = TType.String;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Name);
             oprot.WriteFieldEnd();
         }
         if (ExtraMap != null && __isset.extraMap)
         {
             field.Name = "extraMap";
             field.Type = TType.Map;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteMapBegin(new TMap(TType.String, TType.String, ExtraMap.Count));
                 foreach (string _iter97 in ExtraMap.Keys)
                 {
                     oprot.WriteString(_iter97);
                     oprot.WriteString(ExtraMap[_iter97]);
                 }
                 oprot.WriteMapEnd();
             }
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
//Sjekker avgangstider for stasjoner til (retur)
        public async Task <Tid> sjekkTidRetur(int id)
        {
            //Tur ligger på indeks 1
            List <Avganger> stasjonerTur = await _db.Avganger.Where(avganger => (avganger.Stopp.StasjonId == id)).ToListAsync();

            Tid tidTur = new Tid();

            tidTur.Hours   = stasjonerTur[1].Tider[0].Tid.Hours;
            tidTur.Minutes = stasjonerTur[1].Tider[0].Tid.Minutes;
            tidTur.Seconds = stasjonerTur[1].Tider[0].Tid.Seconds;
            return(tidTur);
        }
Esempio n. 13
0
    private void FixRenderers()
    {
        var isNpc = !this.Tid.Contains("rda");


        var renderers = this.Target.GetComponentsInChildren <SkinnedMeshRenderer>(true);

        foreach (var r in renderers)
        {
            if (cm.MainScene)
            {
                r.updateWhenOffscreen = false;
                if (isNpc)
                {
                    Debug.Log("npc update aabb:" + this.Tid);
                    var so       = new SerializedObject(r);
                    var property = so.FindProperty("m_DirtyAABB");
                    property.boolValue    = true;
                    property              = so.FindProperty("m_AABB.m_Center");
                    property.vector3Value = Vector3.zero;

                    property = so.FindProperty("m_AABB.m_Extent");
                    property.vector3Value = Vector3.zero;

                    so.ApplyModifiedProperties();
                }
            }
            else
            {
                r.updateWhenOffscreen = false;
            }

            r.receiveShadows       = false;
            r.shadowCastingMode    = UnityEngine.Rendering.ShadowCastingMode.Off;
            r.motionVectors        = false;
            r.lightProbeUsage      = UnityEngine.Rendering.LightProbeUsage.Off;
            r.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
            r.skinnedMotionVectors = false;

            if (Tid.Contains("npc999"))
            {
                r.quality = SkinQuality.Bone1;
            }
            else
            {
                r.quality = SkinQuality.Auto;
            }
        }
    }
Esempio n. 14
0
        // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
        // --------------------------------------------------------                 LOGG INN METODER API-KALL          --------------------------------------------------------------------------------------------------//
        // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//

        public async Task <ActionResult> LeggTilTid(Tid tid)
        {
            if (string.IsNullOrEmpty(HttpContext.Session.GetString(_loggetInn)))
            {
                return(Unauthorized());
            }
            bool returnOk = await _db.LeggTilTid(tid);

            if (!returnOk)
            {
                _log.LogInformation("Tiden ble ikke lagret!");
                return(BadRequest("Tiden ble ikke lagret!"));
            }
            return(Ok("Tiden ble lagret!"));
        }
Esempio n. 15
0
 public byte[] Build()
 {
     return(Tid
            .Concat(Flags)
            .Concat(Question)
            .Concat(AnswerRRS)
            .Concat(AuthorityRRS)
            .Concat(AdditionalRRS)
            .Concat(NbtName)
            .Concat(Type)
            .Concat(Classy)
            .Concat(TTL)
            .Concat(Len)
            .Concat(Flags1)
            .Concat(Ip)
            .ToArray());
 }
Esempio n. 16
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Tid != null)
         {
             hashCode = hashCode * 59 + Tid.GetHashCode();
         }
         if (Message != null)
         {
             hashCode = hashCode * 59 + Message.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 17
0
        public bool UpdateTid(Tid tid, int tidId)
        {
            using (SqlConnection connection = new SqlConnection(DBaddress))
            {
                var check = GetAllTid().Contains(tid);
                if (!check)
                {
                    var        querystring = $"UPDATE Tid SET TidFra = '{tid.TidFra}', TidTil = '{tid.TidTil}' WHERE TidId = {tidId}";
                    SqlCommand command     = new SqlCommand(querystring, connection);
                    connection.Open();

                    command.ExecuteNonQuery();
                    connection.Close();
                }

                return(check);
            }
        }
        // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
        // --------------------------------------------------------                Avgangstider ADMINISTRASJON             --------------------------------------------------------------------------------------------------//
        // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//

        public async Task <bool> LeggTilTid(Tid tid)
        {
            try
            {
                var Avganger = await _db.Avganger.FindAsync(tid.Id);

                var avgangstid = new Avgangstider();
                avgangstid.Tid = new TimeSpan(tid.Hours, tid.Minutes, tid.Seconds);
                Avganger.Tider.Add(avgangstid);
                await _db.SaveChangesAsync();

                return(true);
            }
            catch (Exception e)
            {
                _log.LogInformation(e.Message);
                return(false);
            }
        }
Esempio n. 19
0
        public bool CreateTid(Tid tid)
        {
            using (SqlConnection connection = new SqlConnection(DBaddress))
            {
                var check = GetAllTid().Contains(tid);
                if (!check)
                {
                    var querystring =
                        $"INSERT INTO Tid VALUES ('{tid.TidFra}','{tid.TidTil}')";
                    SqlCommand command = new SqlCommand(querystring, connection);
                    connection.Open();

                    command.ExecuteNonQuery();
                    connection.Close();
                }

                return(check);
            }
        }
Esempio n. 20
0
    public override string ToString()
    {
        StringBuilder __sb = new StringBuilder("TimRoster(");

        __sb.Append(", Subscription: ");
        __sb.Append(Subscription);
        __sb.Append(", Tid: ");
        __sb.Append(Tid == null ? "<null>" : Tid.ToString());
        if (Name != null && __isset.name)
        {
            __sb.Append(", Name: ");
            __sb.Append(Name);
        }
        if (ExtraMap != null && __isset.extraMap)
        {
            __sb.Append(", ExtraMap: ");
            __sb.Append(ExtraMap);
        }
        __sb.Append(")");
        return(__sb.ToString());
    }
Esempio n. 21
0
    public void Setup(bool stripMesh = true, bool stripAvatar = true, bool makeControllerHolder = true, bool combineMesh = true)
    {
        var template = GetTemplate();

        if (!Tid.Contains("npc999"))
        {
            AddColliders(template);
        }

        AddBehaviours(template);
        GameObject.DestroyImmediate(template);

        if (stripMesh)
        {
            StripMesh();
        }

        if (stripAvatar)
        {
            StripAvatar();
        }

        if (makeControllerHolder)
        {
            MakeControllerHolder();
        }

        FixRenderers();

        if (!cm.MainScene)
        {
            CreateDefaultParts();
        }

        if (combineMesh)
        {
            CombineMesh();
        }
        Save();
    }
Esempio n. 22
0
        static void Main(string[] args)
        {
            Console.WriteLine("Tid Maker - By MysteryDash");
            Console.WriteLine();

            if (args.Length == 0)
            {
                Console.WriteLine("Please drag and drop one or multiple files over the executable.");
            }
            else
            {
                Parallel.ForEach(args, new ParallelOptions {
                    MaxDegreeOfParallelism = Environment.ProcessorCount
                }, arg =>
                {
                    try
                    {
                        Console.WriteLine($"Processing {arg}...");

                        var path   = Path.ChangeExtension(arg, "tid");
                        var bitmap = new Bitmap(arg);
                        var tid    = new Tid(bitmap, Path.GetFileName(path));
                        tid.WriteFile(path);
                    }
                    catch (IOException ex)
                    {
                        Console.WriteLine($"I/O error with {arg}. Details : {ex.Message}");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Gotta catch'em all ! {ex.GetType()} {ex.Message}");
                    }
                });

                Console.WriteLine("Conversion done !");
                Console.ReadKey();
            }
        }
Esempio n. 23
0
        /// <summary>
        /// Returns true if InboxesTransmissionNextResponse200 instances are equal
        /// </summary>
        /// <param name="other">Instance of InboxesTransmissionNextResponse200 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InboxesTransmissionNextResponse200 other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Tid == other.Tid ||
                     Tid != null &&
                     Tid.Equals(other.Tid)
                     ) &&
                 (
                     Message == other.Message ||
                     Message != null &&
                     Message.Equals(other.Message)
                 ));
        }
Esempio n. 24
0
    public void Save()
    {
        var go = this.Target;

        this.Animator.enabled = true;
        if (Tid.Contains("npc999"))
        {
            if (this.Animator.isOptimizable)
            {
                //AnimatorUtility.OptimizeTransformHierarchy(go, new string[] { });
            }
        }

        if (cm.MainScene && this.Animator.isOptimizable)
        {
            AnimatorUtility.OptimizeTransformHierarchy(go, exposedBones);
            go.transform.localPosition = Vector3.zero;
            go.transform.localRotation = Quaternion.identity;
        }

        var prefabPath = GetPrefabPath();

        Directory.CreateDirectory(Path.GetDirectoryName(prefabPath));
        var prefab = AssetDatabase.LoadAssetAtPath <GameObject>(prefabPath);

        if (prefab == null)
        {
            LogUtil.Debug("create prefab " + prefabPath);
            PrefabUtility.CreatePrefab(prefabPath, go, ReplacePrefabOptions.ConnectToPrefab);
        }
        else
        {
            LogUtil.Debug("replace prefab " + prefabPath);
            PrefabUtility.ReplacePrefab(go, prefab, ReplacePrefabOptions.ReplaceNameBased);
            EditorUtility.SetDirty(prefab);
        }
    }
Esempio n. 25
0
        /// <summary>
        /// Создаёт запрос check/pay/status
        /// </summary>
        /// <param name="old_state"></param>
        /// <returns></returns>
        public override int MakeRequest(int old_state)
        {
            try
            {
                if (old_state == 0)
                {
                    // jreq.reqTime = Pcdate.AsCF();
                    // checkParam
                    // freq.reqType = "queryPayeeInfo";
                    // Log($"MakeRequest for {freq.ToString()}");
                }
                // Создать запрос Pay
                else if (old_state == 1)
                {
                    if (Service.ToLower() == "rt-acc")
                    {
                        preq.svcTypeId = FindFilial();
                        preq.svcNum    = Account;
                    }
                    else
                    {
                        preq.svcNum = '7' + Phone;
                    }
                    // preq.svcSubNum = jreq.svcSubNum;
                    preq.payTime      = XConvert.AsDateTZ(DateTime.Now, Settings.Tz);
                    preq.reqTime      = XConvert.AsDateTZ(Pcdate, Settings.Tz);
                    preq.payAmount    = (int?)(Amount * 100m);
                    preq.payComment   = $"Оплата {preq.payAmount} {preq.srcPayId} {preq.svcNum}";
                    preq.srcPayId     = Tid.ToString();
                    preq.payerContact = Contact;
                    stRequest         = JsonConvert.SerializeObject(preq);
                    Log($"Создан запрос\r\n{stRequest}");

                    return(0);
                }
                // Создать запрос Status
                else if (old_state == 3)
                {
                    sreq.srcPayId = Tid.ToString();
                    stRequest     = JsonConvert.SerializeObject(sreq);
                    Log($"Создан запрос\r\n{stRequest}");
                }
                // Запрос на отмену платежа
                else if (old_state == 8)
                {
                    stRequest = JsonConvert.SerializeObject(ureq);
                    Log($"Создан запрос\r\n{stRequest}");
                }
                else
                {
                    errCode = 2;
                    errDesc = string.Format("Неизвестное состояние ({0}) платежа", old_state);
                    state   = 11;
                    Log(ErrDesc);
                    RootLog(ErrDesc);
                    return(1);
                }
            }
            catch (Exception ex)
            {
                RootLog(ex.ToString());
                return(1);
            }

            // stRequest = JsonConvert.SerializeObject(jreq);
            // Log($"Создан запрос\r\n{stRequest}");

            return(0);
        }
Esempio n. 26
0
        public override int Undo()
        {
            byte   old_state = state;
            int    OK        = 1;
            string x         = !string.IsNullOrEmpty(Phone) ? Phone :
                               !string.IsNullOrEmpty(Account) ? Account :
                               !string.IsNullOrEmpty(Number) ? Number : "";

            // Log("{0} Попытка отмены платежа", Tid);
            RootLog($"{Tid} [UNDO - начало] Num = {x} State = {State}");

            ureq.srcPayId = Tid.ToString();
            ureq.reqTime  = XConvert.AsDateTZ(Pcdate, Settings.Tz);
            stRequest     = JsonConvert.SerializeObject(ureq);

            if (MakeRequest(8) == 0 && PostJson(Host, stRequest) == 0 && ParseAnswer(stResponse) == 0)
            {
                Log($"{Tid} [UNDO - конец] reqStatus = {resp.reqStatus} payStatus = {resp.payStatus}");
                if (resp.payStatus == 3)
                {
                    errCode = 6;
                    errDesc = "Платёж отменён оператором";
                    state   = 10;
                }
                else if (resp.payStatus == 103)
                {
                    errCode = 1;
                    state   = 3;
                    errDesc = String.Format($"Платёж {Tid} отменяется: {ReqNote}");
                }
                else
                {
                    if (old_state == 6)
                    {
                        errCode = 3;
                    }
                    else if (old_state == 12)
                    {
                        errCode = 6;
                    }
                    else
                    {
                        errCode = 1;
                    }
                    errDesc = String.Format($"Ошибка отмены платежа: {ReqNote}");
                }

                // Log("{0} err={1} desc={2} st={3}", Tid, ErrCode, ErrDesc, State);

                OK = 0;
            }
            else
            {
                errCode = 2;
                state   = 11;
            }

            UpdateState(Tid, errCode: ErrCode, errDesc: ErrDesc, locked: 0, state: state);
            MakeAnswer();
            return(OK);
        }
Esempio n. 27
0
        /// <summary>
        /// Инициализация значений класса
        /// </summary>
        public override void InitializeComponents()
        {
            base.InitializeComponents();
            CodePage = "utf-8";

            commonName = Settings.Rt.CN;
            host       = Settings.Rt.Host;


            if (string.IsNullOrEmpty(Phone))
            {
                jreq.svcTypeId = FindFilial();
                jreq.svcNum    = Account;
                if (!string.IsNullOrEmpty(AccountParam))
                {
                    jreq.svcSubNum = AccountParam;
                }
            }
            else
            {
                jreq.svcNum = "7" + Phone;
                if (!string.IsNullOrEmpty(PhoneParam))
                {
                    jreq.svcSubNum = PhoneParam;
                }
            }
            if (!string.IsNullOrEmpty(Comment))
            {
                jreq.payComment = Comment;
            }

            if (pcdate == DateTime.MinValue)
            {
                pcdate = DateTime.Now;
            }

            switch (RequestType.ToLower())
            {
            case "status":
                sreq.srcPayId = Tid.ToString();
                break;

            case "payment":
                DoPay();
                break;

            case "undo":
                ureq.reqType = "abandonPayment";
                break;

            case "check":
                jreq.reqType = "checkPaymentParams";
                break;

            case "find":
                DoCheck();
                return;

            default:
                jreq.reqType = RequestType;
                break;
            }

            if (!string.IsNullOrEmpty(Number))
            {
                jreq.queryFlags = Number.ToInt();
            }

            if (Tid != long.MinValue)
            {
                jreq.srcPayId = Tid.ToString();
            }
        }
Esempio n. 28
0
    public void Read(TProtocol iprot)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            bool   isset_fromTid   = false;
            bool   isset_toTid     = false;
            bool   isset_addr      = false;
            bool   isset_port      = false;
            bool   isset_transport = false;
            bool   isset_pubId     = false;
            TField field;
            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.Struct)
                    {
                        FromTid = new Tid();
                        FromTid.Read(iprot);
                        isset_fromTid = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        ToTid = new Tid();
                        ToTid.Read(iprot);
                        isset_toTid = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.String)
                    {
                        Addr       = iprot.ReadString();
                        isset_addr = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I32)
                    {
                        Port       = iprot.ReadI32();
                        isset_port = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.I16)
                    {
                        Transport       = iprot.ReadI16();
                        isset_transport = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.String)
                    {
                        PubId       = iprot.ReadString();
                        isset_pubId = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 7:
                    if (field.Type == TType.Map)
                    {
                        {
                            ExtraMap = new Dictionary <string, string>();
                            TMap _map117 = iprot.ReadMapBegin();
                            for (int _i118 = 0; _i118 < _map117.Count; ++_i118)
                            {
                                string _key119;
                                string _val120;
                                _key119           = iprot.ReadString();
                                _val120           = iprot.ReadString();
                                ExtraMap[_key119] = _val120;
                            }
                            iprot.ReadMapEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_fromTid)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_toTid)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_addr)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_port)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_transport)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
            if (!isset_pubId)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
Esempio n. 29
0
        /// <summary>
        /// Создаёт аттач-файл для отправки по e-mail
        /// </summary>
        public void MakeRequest()
        {
            string template = "";

            using (StreamReader structure = new StreamReader(Settings.Templates + Service + "-ord-structure.tpl"))
            {
                template = structure.ReadToEnd();
            }
            if (string.IsNullOrEmpty(template))
            {
                throw new ApplicationException(string.Format("Шаблон структуры таблицы {0} пуст", Settings.Templates + Service + "-ord-structure.tpl"));
            }

            // Шаблон содержит структуру таблицы

            string tableName = Tid.ToString() + ".dbf";

            // Создадим объект Таблица
            DbfFile odbf = new DbfFile();

            // Откроем таблицу для записи в папку attachemts
            odbf.Open(Settings.Attachments + tableName, FileMode.Create);

            XElement root = XElement.Parse(stResponse);
            IEnumerable <XElement> fields =
                from el in root.Elements("fields")
                select el;

            string name;
            string type;
            string len;
            string p;

            foreach (XElement el in fields)
            {
                switch (el.Name.LocalName.ToString().ToLower())
                {
                case "field":                         // Поле
                    len  = "0";
                    p    = "0";
                    name = "";
                    type = "";
                    foreach (XAttribute attr in el.Attributes())
                    {
                        if (attr.Name.LocalName.ToLower() == "name")
                        {
                            name = attr.Value;
                        }
                        else if (attr.Name.LocalName.ToLower() == "type")
                        {
                            type = attr.Value;
                        }
                        else if (attr.Name.LocalName.ToLower() == "len")
                        {
                            len = attr.Value;
                        }
                        else if (attr.Name.LocalName.ToLower() == "p")
                        {
                            p = attr.Value;
                        }
                    }
                    if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(type))
                    {
                        throw new ApplicationException("Пропущены обязательные значения name или type в определении столбца");
                    }

                    odbf.Header.AddColumn(new DbfColumn(name, GetDbfType(type), int.Parse(len), int.Parse(p)));

                    break;

                default:
                    // Error = ErrTemplatelInvalid;
                    throw new ApplicationException("Ошибка структуры таблицы");
                }
            }

            // Создаём таблицу .DBF с заданной структурой
            odbf.WriteHeader();
            odbf.Close();

            // Формируем запрос Insert Into () Values()

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Insert Into {0} (", tableName);
            int n = 0;

            foreach (KeyValuePair <string, string> kvp in Attributes)
            {
                sb.AppendFormat("{0}{1}", n++ != 0?", ": "", kvp.Key);
            }
            sb.Append(")\r\n Values( ");
            n = 0;
            foreach (KeyValuePair <string, string> kvp in Attributes)
            {
                sb.AppendFormat("{0}{1}", n++ != 0 ? ", " : "", kvp.Value);
            }
            sb.Append(");");

            Log("Выполняется запрос:\r\n{0}", sb.ToString());

            // Записываем атрибуты в файл .dbf
            using (OleDbConnection Connection =
                       new OleDbConnection(string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Extended Properties=dbase 5.0;Data Source={0};",
                                                         Settings.Attachments)))
            {
                Connection.Open();
                using (OleDbCommand Command = new OleDbCommand(sb.ToString(), Connection))
                {
                    Command.ExecuteNonQuery();
                    Connection.Close();
                }
            }

            sb.Clear();
            sb = null;
        }
Esempio n. 30
0
    public void Read(TProtocol iprot)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            bool   isset_threadId = false;
            TField field;
            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.String)
                    {
                        ThreadId       = iprot.ReadString();
                        isset_threadId = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.String)
                    {
                        Mid = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.Struct)
                    {
                        FromTid = new Tid();
                        FromTid.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.Struct)
                    {
                        ToTid = new Tid();
                        ToTid.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.String)
                    {
                        Body = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.String)
                    {
                        Type = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 7:
                    if (field.Type == TType.I16)
                    {
                        MsgType = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 8:
                    if (field.Type == TType.Struct)
                    {
                        Offline = new TimTime();
                        Offline.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 9:
                    if (field.Type == TType.Struct)
                    {
                        LeaguerTid = new Tid();
                        LeaguerTid.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 10:
                    if (field.Type == TType.List)
                    {
                        {
                            ExtraList = new List <TimNode>();
                            TList _list75 = iprot.ReadListBegin();
                            for (int _i76 = 0; _i76 < _list75.Count; ++_i76)
                            {
                                TimNode _elem77;
                                _elem77 = new TimNode();
                                _elem77.Read(iprot);
                                ExtraList.Add(_elem77);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 11:
                    if (field.Type == TType.String)
                    {
                        Timestamp = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 12:
                    if (field.Type == TType.Struct)
                    {
                        Error = new TimError();
                        Error.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 13:
                    if (field.Type == TType.Map)
                    {
                        {
                            ExtraMap = new Dictionary <string, string>();
                            TMap _map78 = iprot.ReadMapBegin();
                            for (int _i79 = 0; _i79 < _map78.Count; ++_i79)
                            {
                                string _key80;
                                string _val81;
                                _key80           = iprot.ReadString();
                                _val81           = iprot.ReadString();
                                ExtraMap[_key80] = _val81;
                            }
                            iprot.ReadMapEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 14:
                    if (field.Type == TType.I16)
                    {
                        Readstatus = iprot.ReadI16();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
            if (!isset_threadId)
            {
                throw new TProtocolException(TProtocolException.INVALID_DATA);
            }
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }