Beispiel #1
0
        public virtual object block(params object[] po)
        {
            object obj = po[0];

            if (obj == null)
            {
                return(Null);
            }
            string str   = "";
            int    index = Convert.ToInt32(po[1]);
            int    count = Convert.ToInt32(po[2]);

            if (l || h)
            {
                str = MiMFa_IOService.FileToString(PATH.getpath((obj.ToString())), index, count);
            }
            else
            {
                str = MiMFa_IOService.FileToTrimedString(PATH.getpath(obj.ToString()), index, count);
            }
            if (!_concatwords)
            {
                return(str + SeparateText);
            }
            return(str);
        }
Beispiel #2
0
 public void SocketReceive()
 {
     if (InterlocutorIP == null && !string.IsNullOrEmpty(InterlocutorHostName))
     {
         try
         { InterlocutorIP = MiMFa_Net.GetInternalIPv4(InterlocutorHostName); }
         catch { }
     }
     if (InterlocutorIP != null)
     {
         TcpListener listener = new TcpListener(InterlocutorIP, Port);
         listener.Start();
         ConnectedToInterlocutor(InterlocutorIPEndPoint);
         while (Run)
         {
             Socket socket = listener.AcceptSocket();
             byte[] bytarr = new byte[BufferSize];
             StartDownloadData(null, InterlocutorIPEndPoint, 0);
             int  mi = socket.Receive(bytarr);
             bool b  = mi > 0;
             if (b && EndDownloadData != null)
             {
                 EndDownloadData(MiMFa_IOService.Deserialize(bytarr), InterlocutorIPEndPoint, mi);
             }
             socket.Close();
         }
         listener.Stop();
         StopDownloadData(null, InterlocutorIPEndPoint, 0);
     }
     else
     {
         throw new ArgumentException("Not set IP or HostName");
     }
 }
 private void tsb_Import_Click(object sender, EventArgs e)
 {
     OFD.Filter = "MiMfa Report Package Style File (*" + ReportStyle.Extension + ") | *" + ReportStyle.Extension;
     if (OFD.InitialDirectory == null)
     {
         OFD.InitialDirectory = ReportStyle.GetPath();
     }
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         ReportStyle report = new ReportStyle();
         MiMFa_IOService.OpenDeserializeFile(OFD.FileName, ref report);
         if (string.IsNullOrEmpty(tstb_Subject.Text) || tstb_Subject.Text == "Default")
         {
             ReportStyle = report;
         }
         else
         {
             ReportStyle.MRLCode = report.MRLCode;
             ReportStyle.Script  = report.Script;
             ReportStyle.Css     = report.Css;
             ReportStyle.Extra   = report.Extra;
         }
         ReportStyle.Address = OFD.FileName;
     }
     Initialize(null, ReportStyle, false);
 }
 private void tsb_Export_Click(object sender, EventArgs e)
 {
     Restart(false);
     SFD.Filter   = "MiMfa Report Package Style File (*" + ReportStyle.Extension + ") | *" + ReportStyle.Extension;
     SFD.FileName = ReportStyle.Name;
     if (SFD.InitialDirectory == null)
     {
         SFD.InitialDirectory = ReportStyle.GetPath();
     }
     if (!string.IsNullOrEmpty(SFD.FileName))
     {
         SFD.FileName = ReportStyle.Address;
     }
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         ReportStyle rs = new ReportStyle()
         {
             RSID    = ReportStyle.RSID,
             Name    = ReportStyle.Name,
             Address = ReportStyle.Address,
             MRLCode = ReportStyle.MRLCode,
             Css     = ReportStyle.Css,
             Script  = ReportStyle.Script,
             Extra   = ReportStyle.Extra
         };
         MiMFa_IOService.SaveSerializeFile(SFD.FileName, rs);
     }
 }
Beispiel #5
0
        public static WebPatern OpenFromFile(string fileaddress)
        {
            WebPatern wr = new WebPatern();

            MiMFa_IOService.OpenDeserializeFile(fileaddress, ref wr);
            return(wr);
        }
Beispiel #6
0
        public virtual object line(params object[] po)
        {
            object obj = po[0];

            if (obj == null)
            {
                return(Null);
            }
            string     str = "";
            List <int> li  = new List <int>();

            for (int i = 1; i < po.Length; i++)
            {
                try { li.Add(Convert.ToInt32(PATH.getpath(po[i].ToString()))); } catch { }
            }
            if (l || h)
            {
                str = MiMFa_IOService.FileToString(PATH.getpath(obj.ToString()), li.ToArray());
            }
            else
            {
                str = MiMFa_IOService.FileToTrimedString(PATH.getpath(obj.ToString()), li.ToArray());
            }
            if (!_concatwords)
            {
                return(str + SeparateText);
            }
            return(str);
        }
Beispiel #7
0
        public override object execute(object obj, int index, int length)
        {
            if (obj == null)
            {
                return(Null);
            }
            string str = "";

            if (_serialize)
            {
                return(MiMFa_IOService.OpenDeserializeFile(PATH.getpath(obj.ToString())));
            }
            else if (_longview || _humanreadable)
            {
                return(MiMFa_IOService.FileToStringArray(PATH.getpath(obj.ToString())));
            }
            else
            {
                str = MiMFa_IOService.FileToTrimedString(PATH.getpath(obj.ToString()));
            }
            if (!_concatwords && index < length - 1)
            {
                return(str + SeparateText);
            }
            return(str);
        }
        private SQLiteParameter[] GetReportParameter(Report report = null)
        {
            Report r;

            if (report == null)
            {
                r = new Report();
            }
            else
            {
                r = report;
            }
            return(new SQLiteParameter[] {
                new SQLiteParameter("@ID", r.ID),
                new SQLiteParameter("@Name", r.Name),
                new SQLiteParameter("@Address", r.Address),
                new SQLiteParameter("@HTML", r.HTML),
                new SQLiteParameter("@RSID", r.RSID),
                new SQLiteParameter("@Style", MiMFa_IOService.Serialize(r.Style)),
                new SQLiteParameter("@Type", MiMFa_IOService.Serialize(r.Type)),
                new SQLiteParameter("@ObjectArray", MiMFa_IOService.Serialize(r.ObjectArray)),
                new SQLiteParameter("@CreatorName", r.CreatorName),
                new SQLiteParameter("@CreateDate", MiMFa_IOService.Serialize(r.CreateDate)),
                new SQLiteParameter("@CreateTime", MiMFa_IOService.Serialize(r.CreateTime)),
                new SQLiteParameter("@Accessablity", MiMFa_IOService.Serialize(r.Accessablity)),
                new SQLiteParameter("@AccessDate", MiMFa_IOService.Serialize(r.AccessDate)),
                new SQLiteParameter("@AccessTime", MiMFa_IOService.Serialize(r.AccessTime)),
                new SQLiteParameter("@Extra", MiMFa_IOService.Serialize(r.Extra))
            });
        }
Beispiel #9
0
 public void SocketSend(object obj)
 {
     if (InterlocutorIP == null && !string.IsNullOrEmpty(InterlocutorHostName))
     {
         try
         { InterlocutorIP = IPAddress.Parse(InterlocutorHostName); }
         catch
         {
             try
             { InterlocutorIP = MiMFa_Net.GetExternalIP(InterlocutorHostName); }
             catch { }
         }
     }
     if (InterlocutorIP != null)
     {
         TcpClient client = new TcpClient();
         client.Connect(InterlocutorIP, Port);
         ConnectedToInterlocutor(InterlocutorIPEndPoint);
         Stream stream = client.GetStream();
         StartUploadData(obj, InterlocutorIPEndPoint, 0);
         byte[] bytarr = (obj != null && obj is byte[]) ? (byte[])obj : MiMFa_IOService.Serialize(obj);
         stream.Write(bytarr, 0, bytarr.Length);
         client.Close();
         EndUploadData(obj, InterlocutorIPEndPoint, bytarr.Length);
     }
     else
     {
         throw new ArgumentException("Not set IP or HostName");
     }
 }
Beispiel #10
0
 public override object EXECUTE(params object[] po)
 {
     if (_print)
     {
         return(MiMFa_IOService.FileToString(MCL.Address.Constructor));
     }
     else if (_delete && _all)
     {
         MiMFa_IOService.ClearFileContent(MCL.Address.Constructor);
     }
     else if (po != null && po.Length > 0)
     {
         string cmd = MCL.CrudeText(Normalization(po[0].ToString()).Replace("  ", " ")) + ";";
         if (_delete)
         {
             MiMFa_IOService.StringRemoveFromFile(MCL.Address.Constructor, cmd + ";");
         }
         else
         {
             MiMFa_IOService.StringNewLineAppendFile(MCL.Address.Constructor, cmd);
             MCL.Parse(cmd);
         }
     }
     return(Null);
 }
Beispiel #11
0
        private void Output(Aspose.Words.SaveFormat to, string dest, bool openforce = false)
        {
            Exclusive.Extension.MiMFa_Convert pc = new Exclusive.Extension.MiMFa_Convert();
            string addr = Config.TempDirectory + System.DateTime.Now.Ticks + "mrloutput.html";

            MiMFa_IOService.StringToFile(addr, MiMFa_StringService.ReplaceWithAllWordBetween(Viewer.DocumentText, "<input ", "/>", ""));
            pc.To(addr, dest, to, openforce);
        }
Beispiel #12
0
 public void Send(object obj)
 {
     Obj = obj;
     byte[] byteData = (obj != null && obj is byte[]) ? (byte[])obj : MiMFa_IOService.Serialize(obj);
     // Sends data asynchronously to a connected Socket
     Handler.BeginSend(byteData, 0, byteData.Length, 0,
                       new AsyncCallback(SendCallback), Handler);
 }
Beispiel #13
0
 public override object EXECUTE(params object[] po)
 {
     if (_analog)
     {
         return(MiMFa_IOService.FileToString(htmladdressA));
     }
     return(MiMFa_IOService.FileToString(htmladdress));
 }
Beispiel #14
0
        private void Output(SaveFormat to, string fileName, bool openforce)
        {
            Exclusive.Extension.MiMFa_Convert pc = new Exclusive.Extension.MiMFa_Convert();
            string addr = Config.TempDirectory + System.DateTime.Now.Ticks + "htmlimportlogoutput.html";

            MiMFa_IOService.StringToFile(addr, Browser.DocumentText);
            pc.To(addr, fileName, to, openforce);
        }
Beispiel #15
0
        public void Send(object obj)
        {
            string name = FTP.InterlocutorAddress.Replace("ftp:", "").Replace("/", "").Replace("\\", "").Replace(".", "") + DateTime.Now.Ticks +
                          "." + General.MiMFa_GetDetail.GetMimeObject(obj).Split('/').Last();
            string la = LocalTempDirectory + name;

            MiMFa_IOService.SaveSerializeFile(la, obj);
            Send(la);
        }
Beispiel #16
0
 public bool Open(string path)
 {
     if (!string.IsNullOrEmpty(path))
     {
         if (MiMFa_GetDetail.IsAbsoluteURL(path))
         {
             Browse(path);
             return(true);
         }
         else
         {
             string mime = "";
             try { mime = General.MiMFa_GetDetail.GetMimeFile(path).Split('/')[0].Trim().ToLower(); } catch { }
             if (mime == "image")
             {
                 ShowBrowser(MiMFa_IOService.TryDeserialize(File.ReadAllBytes(path)), true);
             }
             else if (mime == "text")
             {
                 ShowBrowser(MiMFa_StringService.ToHTML(MiMFa_IOService.FileToString(path)));
             }
             else if (mime == "")
             {
                 Clear();
             }
             else
             {
                 bool b = General.MiMFa_GetDetail.IsBinaryFile(path);
                 if (b)
                 {
                     string ext = System.IO.Path.GetExtension(path).ToLower();
                     if (ext == ".pdf" ||
                         ext.StartsWith(".doc") ||
                         ext.StartsWith(".xls")
                         )
                     {
                         OpenBrowser(path);
                     }
                     else
                     {
                         OpenMediaPlayer(path);
                     }
                 }
                 else
                 {
                     ShowBrowser(MiMFa_IOService.FileToString(path));
                 }
                 return(true);
             }
         }
     }
     else
     {
         Clear();
     }
     return(false);
 }
Beispiel #17
0
        public void Send(object data, MiMFa_SocketPacketDataType dt)
        {
            try
            {
                try
                {
                    Send(new MiMFa_SimplePacket(MiMFa_SocketPacketSubject.Chat, data, dt));
                    SendData(data, Sender.InterlocutorIPEndPoint, 0);
                    string detail = "<div class='DETAIL'>" + Configuration.Default.Time + "</div>";
                    string shtml  = "<div style='text-align:right;'><div class='SEND'>";
                    string ehtml  = "</div></div>";
                    if (data == null)
                    {
                        SetHTML(shtml + Display.Done(data) + detail + ehtml);
                    }
                    else if (data is byte[])
                    {
                        switch (dt)
                        {
                        case MiMFa_SocketPacketDataType.None:
                            break;

                        case MiMFa_SocketPacketDataType.Image:
                            SetHTML(shtml + Display.Done(MiMFa_IOService.TryDeserialize((byte[])data)) + detail + ehtml);
                            break;

                        case MiMFa_SocketPacketDataType.Text:
                            SetHTML(shtml + Display.Done(data) + detail + ehtml);
                            break;

                        default:
                            var mim = General.MiMFa_GetDetail.GetMimeObject(data).Split('/').First();
                            if (mim == "image")
                            {
                                SetHTML(shtml + Display.Done(General.MiMFa_Convert.ToImage((byte[])data)) + detail + ehtml);
                            }
                            else
                            {
                                SetHTML(shtml + Display.Done(data) + detail + ehtml);
                            }
                            break;
                        }
                    }
                    else
                    {
                        SetHTML(shtml + Display.Done(data) + detail + ehtml);
                    }
                }
                finally { InputClear(); }
            }
            catch (Exception ex)
            {
                SendError(RTB.Text, Sender.InterlocutorIPEndPoint, 0, ex);
                NotSendAlert(ex);
            }
        }
Beispiel #18
0
        public void ChangeStyle(string fileName)
        {
            ReportStyle rs = new ReportStyle();

            MiMFa_IOService.OpenDeserializeFile(fileName, ref rs);
            Report r = new Report(MainReport);

            r.Style = rs;
            ShowReport(r, true);
        }
Beispiel #19
0
 public object GetAttach()
 {
     if (Attach != null && Attach is byte[])
     {
         return(MiMFa_IOService.TryDeserialize((byte[])Attach));
     }
     else
     {
         return(Attach);
     }
 }
Beispiel #20
0
        public MiMFa_Table GetTable(int numberOfItems = -1)
        {
            if (FetchedSuccessList.Count < 1)
            {
                return(fetch_webpatern.DefaultPatern.TransposeResult? FetchSampleTable(fetch_webpatern).Transpose(true) : FetchSampleTable(fetch_webpatern));
            }
            MiMFa_Table mdt = new MiMFa_Table();

            if (numberOfItems < 0)
            {
                foreach (var item in FetchedSuccessList)
                {
                    if (!string.IsNullOrWhiteSpace(item.TableAddress))
                    {
                        try
                        {
                            MiMFa_Table dt = null;
                            MiMFa_IOService.OpenDeserializeFile(item.TableAddress, ref dt);
                            if (dt != null)
                            {
                                mdt.ConcatTable(dt);
                            }
                        }
                        catch { }
                    }
                }
            }
            else
            {
                int ind = 0;
                foreach (var item in FetchedSuccessList)
                {
                    if (ind++ == numberOfItems)
                    {
                        break;
                    }
                    if (!string.IsNullOrWhiteSpace(item.TableAddress))
                    {
                        try
                        {
                            MiMFa_Table dt = null;
                            MiMFa_IOService.OpenDeserializeFile(item.TableAddress, ref dt);
                            if (dt != null)
                            {
                                mdt.ConcatTable(dt);
                            }
                        }
                        catch { }
                    }
                }
            }
            return(mdt);
        }
Beispiel #21
0
 protected void OnControlClick(Control clickedControl = null)
 {
     try
     {
         Dictionary <string, int> diccon = GetDicClick(ControlsParent);
         if (diccon.Count > 0 && clickedControl != null)
         {
             try { diccon[clickedControl.Name] = diccon[clickedControl.Name] + 1; }
             catch { }
         }
         MiMFa_IOService.SaveSerializeFile(SorterHistoryFileAddress, diccon);
     }
     catch { }
 }
Beispiel #22
0
        public void Reciever_EndRecieveData(byte[] data, IPEndPoint ip, long length)
        {
            try
            {
                LastRecievePacket = (MiMFa_SimplePacket)MiMFa_IOService.Deserialize(data);
                MiMFa_SocketPacketSubject msps = LastRecievePacket.GetSubject();
                if (msps == MiMFa_SocketPacketSubject.Chat)
                {
                    var typ = LastRecievePacket.GetDataType();
                    switch (typ)
                    {
                    case MiMFa_SocketPacketDataType.None:
                        SetHTML(LastRecievePacket.GetData().ToString());
                        break;

                    case MiMFa_SocketPacketDataType.Text:
                        Recieve(LastRecievePacket.GetData());
                        break;

                    case MiMFa_SocketPacketDataType.Image:
                        Recieve(LastRecievePacket.GetData());
                        break;

                    default:
                        var mim = General.MiMFa_GetDetail.GetMimeObject(LastRecievePacket.Data).Split('/').First();
                        if (mim == "image")
                        {
                            Recieve(LastRecievePacket.GetData());
                        }
                        else
                        {
                            Recieve(LastRecievePacket.Data);
                        }
                        break;
                    }
                    RecievedPacket(LastRecievePacket, ip);
                }
                else if (msps == MiMFa_SocketPacketSubject.Error)
                {
                    try
                    { NotSendAlert((Exception)LastRecievePacket.GetData()); }
                    catch { }
                }
            }
            catch (Exception ex)
            {
                RecievedError(data, ip, length, ex);
                Reciever.Send(new MiMFa_SimplePacket(MiMFa_SocketPacketSubject.Error, ex, MiMFa_SocketPacketDataType.Text));
            }
        }
Beispiel #23
0
 public object GetData()
 {
     if (GetDataType() == MiMFa_SocketPacketDataType.Image && Data != null && Data is byte[])
     {
         return(General.MiMFa_Convert.ToImage((byte[])Data));
     }
     else if (Data != null && Data is byte[])
     {
         return(MiMFa_IOService.TryDeserialize((byte[])Data));
     }
     else
     {
         return(Data);
     }
 }
Beispiel #24
0
 public override object EXECUTE(params object[] po)
 {
     if (po != null && po.Length > 0)
     {
         var sa = MiMFa_StringService.FirstFindAndSplit(po[0].ToString(), ",");
         if (_open || o)
         {
             return(MCL.Compile(MiMFa_IOService.FileToString(PATH.getpath(MCL.Compile(sa[0])))));
         }
         else if (_save || s || sa.Length == 2)
         {
             MiMFa_IOService.StringToFile(MCL.Parse(PATH.getpath(sa[0] + extention)), MCL.CrudeText(sa[1]));
         }
     }
     return(Null);
 }
Beispiel #25
0
 private void Receiver_EndReceiveData(byte[] data, IPEndPoint ip, long length)
 {
     try
     {
         string str = MiMFa_IOService.TryDeserialize(data);
         if (File.Exists(str))
         {
             AddressReceive(str); return;
         }
         else
         {
             throw new Exception("Is not address");
         }
     }
     catch { DataReceive(data, ip, length); }
 }
Beispiel #26
0
 public override object execute(object obj, int index, int length)
 {
     if (obj is Function)
     {
         Function f       = (Function)obj;
         string   path    = MCL.Address.BaseFunctionDirectory + f.Name + "(" + f.Inputs.Length + ")" + MCL.Address.FunctionExtension;
         string   content = f.Access.Status.ToString().ToLower() + " function " + f.Name + "(" + MiMFa_CollectionService.GetAllItems(f.Inputs, ",") + ")" + Environment.NewLine + f.Commands + ";";
         MiMFa_IOService.StringToFullFile(path, content);
     }
     else
     {
         string path = MiMFa_Path.CreateValidPathName(MCL.Address.BaseOtherDirectory, "out", MCL.Address.BinaryExtension, false);
         MiMFa_IOService.SaveSerializeFile(path, obj);
     }
     return(obj);
 }
Beispiel #27
0
 private void ts_Main_DragDrop(object sender, DragEventArgs e)
 {
     try
     {
         string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
         object   o    = null;
         if (data != null)
         {
             foreach (var item in data)
             {
                 MiMFa_IOService.OpenDeserializeFile(item, ref o);
                 Open(o, item);
             }
         }
     }
     catch { }
 }
Beispiel #28
0
 public void ShowMediaPlayer(object value)
 {
     Clear();
     Value = value;
     //WMP.Visible = true;
     Path = TempDirectory + System.DateTime.Now.Ticks + ".mp4";
     File.WriteAllBytes(Path, MiMFa_IOService.Serialize(Value));
     MiMFa_ControlService.SetControlThreadSafe(
         WMP,
         new Action <object[]>((arg) =>
     {
         WMP.settings.autoStart = AutoStart;
         WMP.URL     = Path;
         WMP.Visible = true;
     }), new object[] { });
     ValueChanged(this, EventArgs.Empty);
 }
Beispiel #29
0
        private object DoneByMime(object arg)
        {
            string ext = MiMFa_GetDetail.GetMimeObject(arg).Split('/').First().Trim().ToLower();

            try
            {
                switch (ext)
                {
                case "image":
                    return(Done(Image.FromStream(new System.IO.MemoryStream(MiMFa_IOService.Serialize(arg)))));

                default:
                    return(arg);
                }
            }
            catch { return(arg); }
        }
        private SQLiteParameter[] GetReportStyleParameter(ReportStyle reportStyle = null)
        {
            ReportStyle rs;

            if (reportStyle == null)
            {
                rs = new ReportStyle();
            }
            else
            {
                rs = reportStyle;
            }
            return(new SQLiteParameter[] {
                new SQLiteParameter("@RSID", rs.RSID),
                new SQLiteParameter("@Style", MiMFa_IOService.Serialize(rs))
            });
        }