Beispiel #1
0
        /// <summary>
        ///  Sisteme e-irsaliye yanıtı gönderir
        /// </summary>
        /// <returns>Gönderilen irsaliye yanıtı bilgileri</returns>
        public sendDesUBLResponse IrsaliyeYanitiGonder(TextModel m, string UUID, ArrayList sslList)
        {
            IrsaliyeYanitiUBL receiptAdvice = new IrsaliyeYanitiUBL();
            var createdUBL = receiptAdvice.CreateReceiptAdvice(m.VknTckn, m.IssueDate, UUID);                             // İrsaliye yanıtı UBL i oluşturulur
            UBLBaseSerializer serializer = new ReceiptAdviceSerializer();                                                 // UBL  XML e dönüştürülür
            var strIrsaliyeYaniti        = serializer.GetXmlAsString(createdUBL);                                         // XML byte tipinden string tipine dönüştürülür

            byte[] zipliFile = ZipUtility.CompressFile(Encoding.UTF8.GetBytes(strIrsaliyeYaniti), createdUBL.UUID.Value); // XML  ziplenir
            ServicePointManager.SecurityProtocol = TlsSetting.TlsSet(sslList);                                            // TLS/SSL ayarları

            ClientEDespatchServicesPortClient wsClient = new ClientEDespatchServicesPortClient();

            using (new OperationContextScope(wsClient.InnerChannel))
            {
                if (WebOperationContext.Current != null)
                {
                    WebOperationContext.Current.OutgoingRequest.Headers.Add(HttpRequestHeader.Authorization,
                                                                            Authorization.GetAuthorization(m.Kullanici, m.Sifre));
                }
                var req = new sendDesUBLRequest
                {
                    VKN_TCKN           = m.VknTckn,   // gönderici vkn veya tckn
                    SenderIdentifier   = m.PkEtiketi, //gönderici birim etiketi
                    ReceiverIdentifier = m.GbEtiketi, //alıcı birim etiketi
                    DocType            = "RECEIPT",   // gönderilecek doküman tipi
                    DocData            = zipliFile    //gönderilecek irsaliye yanıtının ziplenmiş byte datası
                };

                return(wsClient.sendDesUBL(req));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sisteme uygulama yanıtı gönderir
        /// </summary>
        /// <returns>Sisteme gönderilen uygulama yanıtının bilgileri</returns>
        public SendUBLResponseType[] UygulamaYanitiGonder(TextModel m, string gelenFaturaID, ArrayList sslList)
        {
            ApplicationResponseUBL applicationResponse = new ApplicationResponseUBL();
            var createdUBL = applicationResponse.CreateApplicationResponse(m.VknTckn, gelenFaturaID, m.IssueDate);        // Uygulama yanıtı UBL i oluşturulur
            UBLBaseSerializer serializer = new InvoiceSerializer();                                                       // UBL  XML e dönüştürülür
            var strUygulamaYaniti        = serializer.GetXmlAsString(createdUBL);                                         // XML  byte tipinden string tipine dönüştürülür

            byte[] zipliFile = ZipUtility.CompressFile(Encoding.UTF8.GetBytes(strUygulamaYaniti), createdUBL.UUID.Value); // XML  ziplenir

            ServicePointManager.SecurityProtocol = TlsSetting.TlsSet(sslList);                                            // TLS/SSL ayarları
            WebServisAdresDegistir();

            using (new OperationContextScope(WsClient.InnerChannel))
            {
                if (WebOperationContext.Current != null)
                {
                    WebOperationContext.Current.OutgoingRequest.Headers.Add(HttpRequestHeader.Authorization,
                                                                            Authorization.GetAuthorization(m.Kullanici, m.Sifre));
                }

                var req = new sendUBLRequest
                {
                    SenderIdentifier   = m.PkEtiketi, //uygulama yanıtı gönderici birim etiketi
                    ReceiverIdentifier = m.GbEtiketi, //uygulama yanıtı alıcı posta kutusu
                    VKN_TCKN           = m.VknTckn,   // tckn veya vkn
                    DocType            = "APP_RESP",  //gönderilen döküman tipi
                    DocData            = zipliFile    //gönderilen uygulama yanıtının ziplenmiş byte datası
                };

                return(WsClient.sendUBL(req));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Sisteme e-fatura gönderir
        /// </summary>
        /// <returns>Sisteme gönderilen faturanın bilgileri </returns>
        public SendUBLResponseType[] FaturaGonder(TextModel m, ArrayList sslList, BaseInvoiceUBL fatura)
        {
            var createdUBL = fatura.BaseUBL;                                                                      // Fatura UBL i oluşturulur
            UBLBaseSerializer serializer = new InvoiceSerializer();                                               // UBL  XML e dönüştürülür
            var strFatura = serializer.GetXmlAsString(createdUBL);                                                // XML byte tipinden string tipine dönüştürülür

            byte[] zipliFile = ZipUtility.CompressFile(Encoding.UTF8.GetBytes(strFatura), createdUBL.UUID.Value); // XML  ziplenir
            ServicePointManager.SecurityProtocol = TlsSetting.TlsSet(sslList);                                    // TLS/SSL ayarları
            WebServisAdresDegistir();
            using (new OperationContextScope(WsClient.InnerChannel))
            {
                if (WebOperationContext.Current != null)
                {
                    WebOperationContext.Current.OutgoingRequest.Headers.Add(HttpRequestHeader.Authorization,
                                                                            Authorization.GetAuthorization(m.Kullanici, m.Sifre));
                }

                var req = new sendUBLRequest
                {
                    VKN_TCKN           = m.VknTckn,   //tckn veya vkn
                    SenderIdentifier   = m.GbEtiketi, //gönderici birim etiketi
                    ReceiverIdentifier = m.PkEtiketi, //alıcı posta kutusu
                    DocType            = "INVOICE",   //gönderilen döküman tipi. zarf, fatura vs.
                    DocData            = zipliFile    //içinde xml dosyası olan zip lenen dosya.
                };

                return(WsClient.sendUBL(req));
            }
        }
Beispiel #4
0
        /// <summary>
        /// Sisteme e-Arşiv fatura gönderir
        /// </summary>
        /// <returns>Sisteme gönderilen e-Arşiv faturanın bilgileri ve binary PDF datası</returns>
        public sendInvoiceResponseType EArsivGonder(TextModel m, BaseInvoiceUBL arsiv, ArrayList sslList)
        {
            var createdUBL = arsiv.BaseUBL;                                                                       // e-Arşiv fatura UBL i oluşturulur
            UBLBaseSerializer serializer = new InvoiceSerializer();                                               // UBL  XML e dönüştürülür
            var strFatura = serializer.GetXmlAsString(createdUBL);                                                // XML byte tipinden string tipine dönüştürülür

            byte[] zipliFile = ZipUtility.CompressFile(Encoding.UTF8.GetBytes(strFatura), createdUBL.UUID.Value); // XML  ziplenir
            string hash      = GetHashInfo(zipliFile);                                                            // zipli dosyanın hash bilgisi alınır

            ServicePointManager.SecurityProtocol = TlsSetting.TlsSet(sslList);                                    // TLS/SSL ayarları
            WebServisAdresDegistir();
            using (new OperationContextScope(WsClient.InnerChannel))
            {
                if (WebOperationContext.Current != null)
                {
                    WebOperationContext.Current.OutgoingRequest.Headers.Add(HttpRequestHeader.Authorization,
                                                                            Authorization.GetAuthorization(m.Kullanici, m.Sifre));
                }

                var req = new sendInvoiceRequest
                {
                    sendInvoiceRequestType = new SendInvoiceRequestType
                    {
                        senderID            = m.VknTckn,             //gönderici VKN-TCKN
                        receiverID          = "2222222222",          //alıcı VKN-TCKN
                        fileName            = createdUBL.UUID.Value, //dosya ismi
                        binaryData          = zipliFile,             //gönderilecek fatura
                        docType             = "XML",                 //dosya tipi
                        hash                = hash,                  //dosyanın hash bilgisi
                        customizationParams = new[]
                        {
                            new CustomizationParam
                            {
                                paramName  = "BRANCH", //parametre ismi
                                paramValue = m.Sube    //şube adı opsiyoneldir. Gönderilmez ise varsayılan olarak "default" şube setlenir.
                            }
                        }
                    }
                };

                return(WsClient.sendInvoice(req.sendInvoiceRequestType));
            }
        }
        public sendDocumentResponseType[] ESmmGonder(TextModel m, ArrayList sslList)
        {
            SmmUBL            smm        = new SmmUBL(m.VknTckn);
            var               createdUBL = smm.UBL;                                                                                         // e-Mm fatura UBL i oluşturulur
            UBLBaseSerializer serializer = new SmmSerializer();                                                                             // UBL  XML e dönüştürülür
            var               strFatura  = serializer.GetXmlAsString(createdUBL);                                                           // XML byte tipinden string tipine dönüştürülür

            byte[] zipliFile = ZipUtility.CompressFile(Encoding.UTF8.GetBytes(strFatura), createdUBL.serbestMeslekMakbuz[0].ETTN + ".xml"); // XML  ziplenir
            string hash      = GetHashInfo(zipliFile);                                                                                      // zipli dosyanın hash bilgisi alınır

            ServicePointManager.SecurityProtocol = TlsSetting.TlsSet(sslList);                                                              // TLS/SSL ayarları
            WebServisAdresDegistir();
            using (new OperationContextScope(WsClient.InnerChannel))
            {
                if (WebOperationContext.Current != null)
                {
                    WebOperationContext.Current.OutgoingRequest.Headers.Add(HttpRequestHeader.Authorization,
                                                                            Authorization.GetAuthorization(m.Kullanici, m.Sifre));
                }

                var req = new sendDocumentRequest
                {
                    VKN_TCKN       = m.VknTckn,
                    Branch         = m.Sube,
                    SendDocDetails = new sendDocumentRequestType[]
                    {
                        new sendDocumentRequestType()
                        {
                            UUID    = createdUBL.serbestMeslekMakbuz[0].ETTN,
                            Type    = "SMM",
                            DocType = "XML",
                            DocData = zipliFile,
                        }
                    }
                };
                return(WsClient.sendDocument(req));
            }
        }
Beispiel #6
0
        private static void ProcessUpdate(string workingPath, string updatePath, AssetBundleBuildRule.Platform platform)
        {
            AssetBundleFileDatas.Clear();

            string[]      allFiles            = Directory.GetFiles(workingPath, "*", SearchOption.AllDirectories);
            List <string> allAssetBundleFiles = new List <string>();

            foreach (string tempFile in allFiles)
            {
                string path = tempFile.Replace("\\", "/");
                if (Path.GetExtension(path) == ".manifest")
                {
                    continue;
                }
                allAssetBundleFiles.Add(path);
            }
            EditorUtility.ClearProgressBar();
            int index = 0;
            int count = allAssetBundleFiles.Count;

            foreach (string assetBundleFile in allAssetBundleFiles)
            {
                index++;
                EditorUtility.DisplayProgressBar("压缩AssetBundle", "压缩AssetBundle文件", (float)index / (float)count);
                string target     = assetBundleFile.Replace(workingPath, updatePath);
                string targetPath = Path.GetDirectoryName(target);
                string enteyName  = Path.GetFileName(assetBundleFile);
                if (!Directory.Exists(targetPath))
                {
                    if (targetPath != null)
                    {
                        Directory.CreateDirectory(targetPath);
                    }
                }
                ZipUtility.CompressFile(target + ".zip", assetBundleFile, enteyName, AssetBundleRule.ZipPassWord);
                AssetBundleFileData assetBundleFileData = new AssetBundleFileData();

                byte[] srcBytes    = File.ReadAllBytes(assetBundleFile);
                int    srcLength   = srcBytes.Length;
                byte[] srcMd5Bytes = MD5Utility.GetMd5Bytes(srcBytes);
                int    srcMd5Code  = BitConverter.ToInt32(srcMd5Bytes, 0);

                byte[] zipBytes    = File.ReadAllBytes(target + ".zip");
                int    zipLength   = zipBytes.Length;
                byte[] zipMd5Bytes = MD5Utility.GetMd5Bytes(zipBytes);
                int    zipMd5Code  = BitConverter.ToInt32(zipMd5Bytes, 0);

                string assetBundleName = target.Replace(updatePath, "");
                assetBundleFileData.AssetBundleName = assetBundleName;
                assetBundleFileData.Length          = srcLength;
                assetBundleFileData.Md5Code         = srcMd5Code;
                assetBundleFileData.ZipLength       = zipLength;
                assetBundleFileData.ZipMd5Code      = zipMd5Code;
                AssetBundleFileDatas.Add(assetBundleFileData);
            }

            string updateVersionPath = $"{updatePath}{AppConst.AssetBundleConfig.VersionFile}";

            using (ByteBuffer buffer = new ByteBuffer())
            {
                ValueParse.WriteValue(buffer, platform.ToString(), ValueParse.StringParse);
                ValueParse.WriteValue(buffer, CurrentVersion.MasterVersion, ValueParse.IntParse);
                ValueParse.WriteValue(buffer, CurrentVersion.MinorVersion, ValueParse.IntParse);
                ValueParse.WriteValue(buffer, CurrentVersion.RevisedVersion, ValueParse.IntParse);
                ValueParse.WriteValue(buffer,
                                      string.IsNullOrEmpty(AssetBundleRule.AssetBundleVariant) ? "" : AssetBundleRule.AssetBundleVariant,
                                      ValueParse.StringParse);
                ValueParse.WriteValue(buffer, AssetBundleRule.ZipSelected, ValueParse.BoolParse);
                ValueParse.WriteValue(buffer,
                                      string.IsNullOrEmpty(AssetBundleRule.ZipPassWord) ? "" : AssetBundleRule.ZipPassWord,
                                      ValueParse.StringParse);
                File.WriteAllBytes(updateVersionPath, buffer.ToBytes());
            }

            string fileInfoPath = $"{updatePath}{AppConst.AssetBundleConfig.FileListFile}";

            using (ByteBuffer buffer = new ByteBuffer())
            {
                ValueParse.WriteValue(buffer, AssetBundleFileDatas.Count, ValueParse.IntParse);
                foreach (AssetBundleFileData assetBundleFileData in AssetBundleFileDatas)
                {
                    ValueParse.WriteValue(buffer, assetBundleFileData.AssetBundleName, ValueParse.StringParse);
                    ValueParse.WriteValue(buffer, assetBundleFileData.Length, ValueParse.IntParse);
                    ValueParse.WriteValue(buffer, assetBundleFileData.Md5Code, ValueParse.IntParse);
                    ValueParse.WriteValue(buffer, assetBundleFileData.ZipLength, ValueParse.IntParse);
                    ValueParse.WriteValue(buffer, assetBundleFileData.ZipMd5Code, ValueParse.IntParse);
                }
                File.WriteAllBytes(fileInfoPath, buffer.ToBytes());
            }
            EditorUtility.ClearProgressBar();
        }