예제 #1
0
 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);
     }
 }
예제 #2
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);
        }
예제 #3
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 { }
 }
예제 #4
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);
 }
예제 #5
0
        public object save(params object[] po)
        {
            object[] obj = new object[3] {
                new List <object>(), new MiMFa_List <Variable>(), new MiMFa_List <Function>()
            };
            bool b = !_workspacelist && !_functionslist && !_handlerslist && !h && !f && !w;

            if (_handlerslist || h)
            {
                obj[0] = MiMFa_CommandLanguage.HandlersList;
            }
            if (b || _workspacelist || w)
            {
                obj[1] = MiMFa_CommandLanguage.WorkSpaceList;
            }
            if (b || _functionslist || f)
            {
                obj[2] = MiMFa_CommandLanguage.FunctionsList;
            }
            MiMFa_IOService.SaveSerializeFile(PATH.getpath(po[0] + extention), obj);
            return(Null);
        }
예제 #6
0
        //PACFileCreator
        public static void ToolStripMenuItem_PACFileCreator(ToolStripMenuItem thisMenustrip, string PACAddress)
        {
            try
            {
                Dictionary <string, object> dso = new Dictionary <string, object>();
                dso.Add("Name", thisMenustrip.Name);
                dso.Add("Text", thisMenustrip.Text);
                dso.Add("CheckOnClick", thisMenustrip.CheckOnClick);
                dso.Add("Checked", thisMenustrip.Checked);
                dso.Add("Image", thisMenustrip.Image);
                dso.Add("Enabled", thisMenustrip.Enabled);
                dso.Add("Visible", thisMenustrip.Visible);
                dso.Add("RightToLeft", thisMenustrip.RightToLeft);
                dso.Add("RightToLeftAutoMirrorImage", thisMenustrip.RightToLeftAutoMirrorImage);
                dso.Add("Padding", thisMenustrip.Padding);
                dso.Add("Margin", thisMenustrip.Margin);
                dso.Add("Dock", thisMenustrip.Dock);
                dso.Add("BackgroundImage", thisMenustrip.BackgroundImage);

                MiMFa_IOService.SaveSerializeFile(PACAddress, dso);
            }
            catch { }
        }
예제 #7
0
 public void Save()
 {
     try
     {
         SFD.Filter   = "MiMfa Report File (*" + Report.Extension + ") | *" + Report.Extension;
         SFD.FileName = MainReport.Name;
         if (SFD.InitialDirectory != null)
         {
             SFD.InitialDirectory = MainReport.GetPath();
         }
         if (SFD.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(SFD.FileName))
         {
             MainReport.Address = SFD.FileName;
             MiMFa_IOService.SaveSerializeFile(SFD.FileName, MainReport);
         }
     }
     catch (Exception ex)
     {
         if (MessageBox.Show(ex.Message, "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry)
         {
             Save();
         }
     }
 }
예제 #8
0
 public static void SaveInFile(WebPatern wr, string fileaddress)
 {
     MiMFa_IOService.SaveSerializeFile(fileaddress, wr);
 }
예제 #9
0
        public MiMFa_Table GetTable(FetchPatern patern, List <MiMFa_XMLElement> xmls)
        {
            MiMFa_Table mdt = new MiMFa_Table();

            if (patern.HTMLElementsPatern == null)
            {
                return(mdt);
            }
            List <HTMLElementPatern> continuehep = new List <HTMLElementPatern>();

            MiMFa_CollectionService.CopyTo(ref continuehep, patern.HTMLElementsPatern);
            List <MiMFa_XMLElement> me = new List <MiMFa_XMLElement>();

            foreach (var item in patern.HTMLElementsPatern)
            {
                me.Add(item.SampleHTMLElement);
            }
            MiMFa_XMLElement e = MiMFa_XMLElement.GetElementsCommonParent(me);

            while (continuehep.Count > 0)
            {
                if (e != null)
                {
                    e = MiMFa_XMLElement.Find(xmls, e);
                }
                List <MiMFa_XMLElement> scope = e == null ? xmls : new List <MiMFa_XMLElement>()
                {
                    e
                };
                bool             all  = false;
                MiMFa_XMLElement elem = null;
                int len = continuehep.Count;
                for (int i = 0; i < len; i++)
                {
                    MiMFa_XMLElement ele = null;
                    mdt = GetTable(mdt, continuehep[i], scope, out ele);
                    if (continuehep[i].All != MiMFa_Boolean.True)
                    {
                        continuehep.RemoveAt(i);
                        i--;
                        len--;
                    }
                    else if (ele != null)
                    {
                        elem = ele;
                        all  = true;
                    }
                    if (ele != null)
                    {
                        if (continuehep.Count - 1 > i + 1 && continuehep[i].SampleHTMLElement == continuehep[i + 1].SampleHTMLElement.Parent)
                        {
                            ele.StartTag = "";
                        }
                        else
                        {
                            xmls = MiMFa_XMLElement.GetLastSplitIn(xmls, ele);
                        }
                    }
                }
                if (e == null)
                {
                    break;
                }
                if (elem == null)
                {
                    xmls = MiMFa_XMLElement.GetLastSplitIn(xmls, e);
                }
                else if (all)
                {
                    xmls = MiMFa_XMLElement.GetLastSplitIn(xmls, elem);
                }
                else
                {
                    break;
                }
            }
            //
            if (fetch_url.TransposeResult)
            {
                mdt = mdt.Transpose(true);
            }
            NumberOfLastTableRows = mdt.MainTable.Rows.Count - 1;
            NumberOfAllTableRows += NumberOfLastTableRows;
            if (string.IsNullOrWhiteSpace(fetch_url.TableAddress))
            {
                fetch_url.TableAddress = TempDirectory + DateTime.Now.Ticks + MiMFa_Table.Extention;
            }
            if (NumberOfLastTableRows > 0)
            {
                try
                {
                    if (!string.IsNullOrWhiteSpace(fetch_url.Source))
                    {
                        DataColumn dcs = mdt.AddColumnSafe("auto_Source");
                        for (int i = 1; i < mdt.Rows.Count; i++)
                        {
                            mdt.Rows[i][dcs] = fetch_url.Source;
                        }
                    }
                }
                catch { }
            }
            try
            {
                MiMFa_Table nmt = null;
                MiMFa_IOService.OpenDeserializeFile(fetch_url.TableAddress, ref nmt);
                if (nmt != null)
                {
                    nmt = MiMFa_Table.ConcatTable(nmt, mdt);
                }
            }
            catch { }
            MiMFa_IOService.SaveSerializeFile(fetch_url.TableAddress, mdt);
            return(mdt);
        }
예제 #10
0
 private void tsb_Save_Click(object sender, EventArgs e)
 {
     Restart(false);
     MiMFa_IOService.SaveSerializeFile(ReportStyle.Address, ReportStyle);
 }
예제 #11
0
        public static string GetMimeObject(object obj)
        {
            if (obj == null)
            {
                return("null");
            }

            try
            {
                if (obj is byte[])
                {
                    var o = MiMFa_IOService.TryDeserialize((byte[])obj);
                    if (o is byte[])
                    {
                        throw new Exception("unknown");
                    }
                    else
                    {
                        return(GetMimeObject(o));
                    }
                }
                else
                {
                    try
                    {
                        string typ = obj.GetType().Name.ToLower();
                        switch (typ)
                        {
                        case "string":
                        case "int":
                        case "uint":
                        case "long":
                        case "float":
                        case "double":
                        case "intptr":
                        case "decimal":
                        case "single":
                            return("text/txt");

                        case "bitmap":
                            return("image/png");

                        case "image":
                            return("image/jpg");

                        case "icon":
                            return("image/ico");

                        default:
                            return(typ + "/data");
                        }
                    }
                    catch
                    {
                        string filename = Config.TempDirectory + "\\mimecheck";
                        MiMFa_IOService.SaveSerializeFile(filename, obj);
                        return(GetMimeFile(filename));
                    }
                }
            }
            catch (Exception e)
            {
                return("unknown/unknown");
            }
        }
예제 #12
0
        public override object execute(object obj, int index, int length)
        {
            FileMode f = (_create) ? FileMode.OpenOrCreate : FileMode.Open;

            if (index == 0)
            {
                source = obj;
            }
            else if (obj != null && obj is string)
            {
                if (source != null && source is string)
                {
                    string s  = PATH.getpath(source.ToString().Trim());
                    string d  = PATH.getpath(obj.ToString().Trim());
                    bool   sf = PATH.isfile(s);
                    bool   df = PATH.isfile(d);
                    if (!df && !_nocreatedestinationdirectory)
                    {
                        MiMFa_Path.CreateAllDirectories(d);
                    }
                    if (!df && !sf)
                    {
                        MiMFa_Path.DirectoryCopy(s, d, _copysubdirectory);//copy directory to directory
                    }
                    else if (!df && sf)
                    {
                        File.Copy(s, d + Path.GetFileName(s));
                    }
                    else if (df && !sf)
                    {
                        throw new ArgumentException("Can not copy a directory in file!");
                    }
                    else
                    {
                        File.Copy(s, d);
                    }
                }
                else if (source != null)
                {
                    if (_serialize)
                    {
                        MiMFa_IOService.SaveSerializeFile(obj.ToString(), source, f);
                    }
                    else if (_append)
                    {
                        MiMFa_IOService.StringNewLineAppendFile(obj.ToString(), MCL.Display.Done(source), f);
                    }
                    else
                    {
                        MiMFa_IOService.StringToFile(obj.ToString(), MCL.Display.Done(source), f);
                    }
                }
                else
                {
                    throw new ArgumentNullException("Can not be null sources!");
                }
            }
            else
            {
                obj = source;
            }
            return(Null);
        }