Exemplo n.º 1
0
        public byte[] User_Rights_GetByUser(decimal p_group_id, string p_username)
        {
            try
            {
                byte[]         byteReturn;
                User_Rights_DA _User_Rights_DA = new User_Rights_DA();
                DataSet        ds = _User_Rights_DA.User_Rights_GetByUser(p_group_id, p_username);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 2
0
        public byte[] Estate_Object_Search(string p_Estate_Name, string p_Estate_Type, string p_Status)
        {
            try
            {
                byte[]           byteReturn;
                Estate_Object_DA _Estate_Object_DA = new Estate_Object_DA();
                DataSet          ds = _Estate_Object_DA.Estate_Object_Search(p_Estate_Name, p_Estate_Type, p_Status);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 3
0
        public byte[] Estate_Object_GetType(decimal p_Estate_Type)
        {
            try
            {
                byte[]           byteReturn;
                Estate_Object_DA _Estate_Object_DA = new Estate_Object_DA();
                DataSet          ds = _Estate_Object_DA.Estate_Object_GetType(p_Estate_Type);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 4
0
        public byte[] Get_Function_ByGroup(decimal p_group_id)
        {
            try
            {
                byte[]            byteReturn;
                Function_Group_DA _Function_Group_DA = new Function_Group_DA();
                DataSet           ds = _Function_Group_DA.Get_Function_ByGroup(p_group_id);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 5
0
        public byte[] Check_Exit_EstateInContract(decimal p_Estate_Id)
        {
            try
            {
                byte[]           byteReturn;
                Estate_Object_DA _Estate_Object_DA = new Estate_Object_DA();
                DataSet          ds = _Estate_Object_DA.Check_Exit_EstateInContract(p_Estate_Id);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 6
0
        public RemoteRepository(string uri)
        {
            var binding = new NetNamedPipeBinding {
                MaxReceivedMessageSize = 10240
            }.WithDebugSetting();

            _channelFactory = new ChannelFactory <IQueryService>(binding, uri);

            _dataProvider = expression =>
            {
                using var proxy = _channelFactory.CreateServiceProxy();

                byte[] compressedData = proxy.Service.ExecuteQuery(expression);
                IEnumerable <DynamicObject> result = new CompressionHelper().Decompress(compressedData);
                return(result);
            };
        }
Exemplo n.º 7
0
        public byte[] Function_GetAll()
        {
            try
            {
                byte[]            byteReturn;
                Function_Group_DA _Function_Group_DA = new Function_Group_DA();
                DataSet           ds = _Function_Group_DA.Function_GetAll();

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 8
0
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            var content = actionExecutedContext.Response.Content;

            byte[] contentAsByteArray;
            if (content == null)
            {
                contentAsByteArray = new byte[0];
            }
            contentAsByteArray = content.ReadAsByteArrayAsync().Result;
            contentAsByteArray = CompressionHelper.GzipCompression(contentAsByteArray);
            actionExecutedContext.Response.Content = new ByteArrayContent(contentAsByteArray);
            actionExecutedContext.Response.Content.Headers.Remove("Content-Type");
            actionExecutedContext.Response.Content.Headers.Add("Content-encoding", "gzip");
            actionExecutedContext.Response.Content.Headers.Add("Content-Type", "application/json");
            base.OnActionExecuted(actionExecutedContext);
        }
Exemplo n.º 9
0
        public byte[] Customer_Check_In_Contract(decimal Customer_Id)
        {
            try
            {
                byte[]      byteReturn;
                Customer_DA _Customer_DA = new Customer_DA();
                DataSet     ds           = _Customer_DA.Customer_Check_In_Contract(Customer_Id);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 10
0
        public byte[] Customer_GetById(decimal p_Tenant_Id)
        {
            try
            {
                byte[]      byteReturn;
                Customer_DA _Customer_DA = new Customer_DA();
                DataSet     ds           = _Customer_DA.Customer_GetById(p_Tenant_Id);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 11
0
        public byte[] Allcode_GetAll()
        {
            try
            {
                byte[]    byteReturn;
                AllCodeDA objAllCodeDA = new AllCodeDA();
                DataSet   ds           = objAllCodeDA.Allcode_GetAll();

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                Common.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 12
0
        public byte[] Fees_Report(string FromDate, string ToDate, string Created_By, string Estate_Code, string Users, string Customer_Name)
        {
            try
            {
                byte[]          byteReturn;
                Fees_Revenue_DA _Fees_Revenue_DA = new Fees_Revenue_DA();
                DataSet         ds = _Fees_Revenue_DA.Fees_Report(FromDate, ToDate, Created_By, Estate_Code, Users, Customer_Name);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 13
0
            /// <summary>
            /// Restores the dvice state from this state object
            /// </summary>
            /// <param name="device">Device instance</param>
            public void RestoreDeviceState(IDevice device)
            {
                if (!(device is Spectrum48ScreenDevice screen))
                {
                    return;
                }

                screen.BorderColor  = BorderColor;
                screen._flashPhase  = FlashPhase;
                screen._pixelByte1  = PixelByte1;
                screen._pixelByte2  = PixelByte2;
                screen._attrByte1   = AttrByte1;
                screen._attrByte2   = AttrByte2;
                screen.FrameCount   = FrameCount;
                screen.Overflow     = Overflow;
                screen._pixelBuffer = CompressionHelper.DecompressBytes(PixelBuffer, PixelBufferSize);
            }
Exemplo n.º 14
0
        public byte[] GetBuildingInEstate(decimal Building_Id)
        {
            try
            {
                byte[]      byteReturn;
                Building_DA _Building_DA = new Building_DA();
                DataSet     ds           = _Building_DA.GetBuildingInEstate(Building_Id);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 15
0
        public async Task UpdatePlayer(string partyName, string playerObj)
        {
            var player = CompressionHelper.Decompress <PlayerModel>(playerObj);

            var party = await _mongoRepository.GetParty(partyName);

            if (party != null)
            {
                await _mongoRepository.UpdatePlayerInParty(partyName, player);

                await Clients.Group(partyName).SendAsync("PlayerUpdated", CompressionHelper.Compress(player));
            }
            else
            {
                await Clients.Group(partyName).SendAsync("ForceDisconnect");
            }
        }
Exemplo n.º 16
0
        public static Azure_Media_Request ToMediaRequest(this SVR_VideoLocal v)
        {
            Azure_Media_Request r = new Azure_Media_Request();

            r.ED2K = v.ED2KHash;
            //Cleanup any File subtitles from media information.
            Media m = v.Media.DeepClone();

            if (m.Parts != null && m.Parts.Count > 0)
            {
                foreach (Part p in m.Parts)
                {
                    if (p.Streams != null)
                    {
                        List <Stream> streams = p.Streams
                                                .Where(a => a.StreamType == "3" && !String.IsNullOrEmpty(a.File))
                                                .ToList();
                        if (streams.Count > 0)
                        {
                            streams.ForEach(a => p.Streams.Remove(a));
                        }
                    }
                }
            }
            //Cleanup the VideoLocal id
            m.Id = null;
            int outsize;

            byte[] data = CompressionHelper.SerializeObject(m, out outsize);
            r.ED2K         = v.ED2KHash;
            r.MediaInfo    = new byte[data.Length + 4];
            r.MediaInfo[0] = (byte)(outsize >> 24);
            r.MediaInfo[1] = (byte)((outsize >> 16) & 0xFF);
            r.MediaInfo[2] = (byte)((outsize >> 8) & 0xFF);
            r.MediaInfo[3] = (byte)(outsize & 0xFF);
            Array.Copy(data, 0, r.MediaInfo, 4, data.Length);
            r.Version  = SVR_VideoLocal.MEDIA_VERSION;
            r.Username = ServerSettings.AniDB_Username;
            if (ServerSettings.WebCache_Anonymous)
            {
                r.Username = Constants.AnonWebCacheUsername;
            }
            r.AuthGUID = String.IsNullOrEmpty(ServerSettings.WebCacheAuthKey) ? "" : ServerSettings.WebCacheAuthKey;

            return(r);
        }
Exemplo n.º 17
0
        public byte[] Building_GetAll()
        {
            try
            {
                byte[]      byteReturn;
                Building_DA _Building_DA = new Building_DA();
                DataSet     ds           = _Building_DA.Building_GetAll();

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 18
0
        public byte[] UserInfo_GetByType(decimal p_type)
        {
            try
            {
                UserInfoDA _UserInfoDA = new UserInfoDA();
                byte[]     byteReturn;
                DataSet    _ds = _UserInfoDA.UserInfo_GetByType(p_type);

                byteReturn = CompressionHelper.CompressDataSet(_ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                NaviCommon.Common.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 19
0
 public byte[] UserInfo_Search(string name, string user_type, string status, string Custom_Id, string column,
                               string type_sort, string start, string end, ref decimal P_Total)
 {
     try
     {
         UserInfoDA _UserInfoDA = new UserInfoDA();
         byte[]     byteReturn;
         DataSet    _ds = _UserInfoDA.UserInfo_Search(name, user_type, status, Custom_Id, column, type_sort, start, end, ref P_Total);
         byteReturn = CompressionHelper.CompressDataSet(_ds);
         return(byteReturn);
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(new byte[0]);
     }
 }
Exemplo n.º 20
0
        public byte[] User_Login(string p_user_name, string p_pass)
        {
            try
            {
                byte[]  byteReturn;
                User_DA _User_DA = new User_DA();
                DataSet ds       = _User_DA.User_Login(p_user_name, p_pass);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 21
0
        public byte[] User_Get_All()
        {
            try
            {
                byte[]  byteReturn;
                User_DA _User_DA = new User_DA();
                DataSet ds       = _User_DA.User_Get_All();

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 22
0
        public byte[] Send_Users_Get_MenuItem(string p_user_name)
        {
            try
            {
                byte[]  byteReturn;
                User_DA _User_DA = new User_DA();
                DataSet ds       = _User_DA.Send_Users_Get_MenuItem(p_user_name);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 23
0
            public StoredOperation(IOperation operation)
            {
                Assert(operation != null);

                Id = operation.Id;

                var json = JsonConvert.SerializeObject(operation.Entry,
                                                       operation.EntryType,
                                                       _serializerSettings);

                Entry           = CompressionHelper.Zip(json);
                EntryType       = operation.EntryType.AssemblyQualifiedName;
                ExpectedVersion = operation.ExpectedVersion;
                OperationType   = operation.OperationType;
                State           = operation.State;
                TransactionId   = operation.TransactionId;
            }
Exemplo n.º 24
0
        public byte[] Customer_Search(string p_Tenant_Name, string p_Phone)
        {
            try
            {
                byte[]      byteReturn;
                Customer_DA _Customer_DA = new Customer_DA();
                DataSet     ds           = _Customer_DA.Customer_Search(p_Tenant_Name, p_Phone);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 25
0
        public byte[] Fees_Revenue_GetByObjectType(decimal p_Object_Type)
        {
            try
            {
                byte[]          byteReturn;
                Fees_Revenue_DA _Fees_Revenue_DA = new Fees_Revenue_DA();
                DataSet         ds = _Fees_Revenue_DA.Fees_Revenue_GetByObjectType(p_Object_Type);

                byteReturn = CompressionHelper.CompressDataSet(ds);
                return(byteReturn);
            }
            catch (Exception ex)
            {
                ErrorLog.log.Error(ex.ToString());
                return(new byte[0]);
            }
        }
Exemplo n.º 26
0
        public override async Task <IList <IEvent> > ProcessAction(int actionNumber)
        {
            var result = new List <IEvent>();

            if (actionNumber != 0)
            {
                result.Add(new CancelInputDialog());
                return(result);
            }

            var file             = GetValue <WebsiteTemplate.Menus.InputItems.FileInfo>("File");
            var connectionString = ConfigurationManager.ConnectionStrings["MainDataStore"]?.ConnectionString;

            var bytes  = file.Data;
            var base64 = QBicUtils.GetString(bytes);

            base64 = base64.Replace("data:;base64,", "").Replace("\0", "");
            bytes  = Convert.FromBase64String(base64);

            bytes = CompressionHelper.InflateByte(bytes, Ionic.Zlib.CompressionLevel.BestCompression);

            if (connectionString.Contains("##CurrentDirectory##"))
            {
                var currentDirectory = HttpRuntime.AppDomainAppPath;
                var filePath         = currentDirectory + "\\Data\\appData_test.db";
                File.WriteAllBytes(filePath, bytes);

                result.Add(new ShowMessage("Done"));
            }
            else
            {
                var json = QBicUtils.GetString(bytes);

                json = "[" + json + "]";
                json = json.Replace("}{", "},{");

                var itemsList = JsonHelper.DeserializeObject <List <BaseClass>[]>(json, true);
                var items     = itemsList.SelectMany(i => i).ToList();
                Console.WriteLine(items.Count());
            }

            result.Add(new ShowMessage("Fail"));

            return(result);
        }
Exemplo n.º 27
0
        private string dataDecoding(StegModel stegModel)
        {
            // Log unsteg data
            _log.Debug("---------------------------------------------------------------------------------");
            _log.Debug("Unstegged data:");
            _log.Debug($"Content Size: {stegModel.ContentSize}");
            _log.Debug($"Steg Content: {stegModel.Content.ToDigitString()}");
            _log.Debug($"Full Size: {stegModel.TotalSize}");
            _log.Debug($"Full Content: {stegModel.ContentFull.ToDigitString()}");
            _log.Debug("---------------------------------------------------------------------------------");

            string msg;

            if (stegModel.IsFile)
            {
                var filename        = string.IsNullOrEmpty(txtDecFileName.Text.Trim()) ? "file" : txtDecFileName.Text;
                var docPath         = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                var fileNameAndPath = $@"{docPath}\StegImageUI\Docs\steg_{DateTime.Now.ToString("yyyyMMddHHmmss")}_{filename}";
                try
                {
                    msg = CompressionHelper.Unzip(stegModel.Content, true, fileNameAndPath);
                }
                catch (Exception ex)
                {
                    _log.Debug(ex.Message);
                    MessageBox.Show(ex.Message, "StegImageUI", MessageBoxButton.OK, MessageBoxImage.Error);
                    msg = null;
                }
            }
            else
            {
                try
                {
                    msg = CompressionHelper.Unzip(stegModel.Content);
                }
                catch (Exception ex)
                {
                    _log.Debug(ex.Message);
                    MessageBox.Show(ex.Message, "StegImageUI", MessageBoxButton.OK, MessageBoxImage.Error);
                    msg = null;
                }
            }

            return(msg);
        }
Exemplo n.º 28
0
        public override void OnActionExecuted(HttpActionExecutedContext context)
        {
            var content = new byte[0];

            if (context.Response.Content != null)
            {
                var bytes = context.Response.Content.ReadAsByteArrayAsync().Result;

                if (bytes.Length < this.ByteThreshold)
                {
                    if (bytes != null)
                    {
                        content = CompressionHelper.DeflateBytes(bytes, this.CompressionLevel);
                    }

                    context.Response.Content = new ByteArrayContent(content);

                    if (this.Headers.Count > 0)
                    {
                        // Removes all header key values matching in this.Headers
                        foreach (var header in this.Headers)
                        {
                            if (context.Response.Content.Headers.Contains(header.Key))
                            {
                                // Removes header based on key
                                context.Response.Content.Headers.Remove(header.Key);

                                // Add updated header key and value
                                context.Response.Content.Headers.Add(header.Key, header.Value);
                            }
                        }
                    }
                    else
                    {
                        context.Response.Content.Headers.Remove("Content-Type");
                        context.Response.Content.Headers.Add("Content-Type", "application/json");
                    }

                    // For now we're forcing Content-encoding to deflate, since that's the compression method used
                    context.Response.Content.Headers.Add("Content-encoding", "deflate");
                }
            }

            base.OnActionExecuted(context);
        }
Exemplo n.º 29
0
        protected HttpWebRequest CreateActionCallRequest(ServiceDescriptor sd, CpAction action)
        {
            LinkData       preferredLink = sd.RootDescriptor.SSDPRootEntry.PreferredLink;
            HttpWebRequest request       = (HttpWebRequest)WebRequest.Create(new Uri(
                                                                                 new Uri(preferredLink.DescriptionLocation), sd.ControlURL));

            NetworkUtils.SetLocalEndpoint(request, preferredLink.Endpoint.EndPointIPAddress);
            request.Method      = "POST";
            request.KeepAlive   = _useHttpKeepAlive;
            request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
            request.ServicePoint.Expect100Continue = false;
            request.AllowAutoRedirect = true;
            request.UserAgent         = UPnPConfiguration.UPnPMachineInfoHeader;
            request.ContentType       = "text/xml; charset=\"utf-8\"";
            request.Headers.Add("SOAPACTION", '"' + action.Action_URN + '"');
            request.Headers.Add("Accept-Encoding", CompressionHelper.GetAcceptedEncodings());
            return(request);
        }
Exemplo n.º 30
0
        public override async Task OnDisconnectedAsync(Exception exception)
        {
            var partyName = await GetPartynameFromIndex();

            if (partyName != null)
            {
                var foundParty = await _cache.GetAsync <PartyModel>($"party:{partyName}");

                var foundPlayer = foundParty.Players.FirstOrDefault(x => x.ConnectionID == Context.ConnectionId);
                if (foundPlayer != null)
                {   //This compression and then uncompression is ugly
                    await LeaveParty(partyName, CompressionHelper.Compress(foundPlayer));

                    var success = await RemoveFromIndex();
                }
            }
            await base.OnDisconnectedAsync(exception);
        }