Exemplo n.º 1
0
 public DirHdr(MsGlobals msglobal)
 {
     metastockGlobals = msglobal;
     masterHeader     = new RecMasterHdr();
     emasterHeader    = new RecEmasterHdr();
     xmasterHeader    = new RecXmasterHdr();
     if (File.Exists(metastockGlobals.Fs1Pth) && metastockGlobals.Fs1 != null)
     {
         readFromFileStream(ref masterHeader);
     }
     if (File.Exists(metastockGlobals.Fs2Pth) && metastockGlobals.Fs2 != null)
     {
         readFromFileStream(ref emasterHeader);
     }
     if (!File.Exists(metastockGlobals.Fs3Pth) || metastockGlobals.Fs3 == null)
     {
         return;
     }
     readFromFileStream(ref xmasterHeader);
 }
Exemplo n.º 2
0
        public MsDir(string folder, bool isMono)
        {
            char ch = '\\';

            if (isMono)
            {
                ch = '/';
            }
            DirPath = folder;
            if ((int)DirPath[DirPath.Length - 1] != (int)ch)
            {
                DirPath += ch.ToString();
            }
            bool flag = false;

            msg = new MsGlobals(DirPath);
            hdr = new DirHdr(msg);
            resetFnAvailable();
            if (Directory.Exists(DirPath))
            {
                initFolder();
                if (File.Exists(msg.Fs1Pth))
                {
                    try
                    {
                        clearROAttribute(msg.Fs1Pth);
                        clearROAttribute(msg.Fs2Pth);
                        clearROAttribute(msg.Fs3Pth);
                    }
                    catch
                    {
                    }

                    try
                    {
                        msg.Fs1 = new FileStream(msg.Fs1Pth, FileMode.Open, FileAccess.Read, FileShare.Read);
                        msg.Fs2 = new FileStream(msg.Fs2Pth, FileMode.Open, FileAccess.Read, FileShare.Read);
                        if (File.Exists(msg.Fs3Pth))
                        {
                            msg.Fs3 = new FileStream(msg.Fs3Pth, FileMode.Open, FileAccess.Read, FileShare.None);
                        }
                        int num1 = (int)(msg.Fs1.Length / (long)RecMasterSize);
                        int num2 = (int)(msg.Fs2.Length / (long)RecEmasterSize);
                        if (num1 != num2)
                        {
                            if (num1 < num2)
                            {
                                string path = DirPath + "master.bak";
                                if (File.Exists(path))
                                {
                                    msg.Fs1.Close();
                                    msg.Fs1 = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None);
                                }
                            }
                            else if (num2 < num1)
                            {
                                string path = DirPath + "emaster.bak";
                                if (File.Exists(path))
                                {
                                    msg.Fs1.Close();
                                    msg.Fs2 = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None);
                                }
                            }
                        }

                        hdr = new DirHdr(msg);
                        int num3 = (int)(msg.Fs1.Length / (long)RecMasterSize - 1L);
                        for (int index = 0; index < num3; ++index)
                        {
                            DirEntry e = new DirEntry(msg);
                            e.Read();
                            if (e.Interval.CompareTo('d') == 0 || e.Interval.CompareTo('D') == 0)
                            {
                                e.AssetID = -1;
                                sex.Add(ref e);
                                fnAvailable[(int)e.FileNo] = false;
                            }
                        }

                        if (msg.Fs3 != null)
                        {
                            try
                            {
                                if (msg.Fs3.Length > 150L)
                                {
                                    int num4 = (int)(msg.Fs3.Length / (long)RecXmasterSize - 1L);
                                    for (int index = 0; index < num4; ++index)
                                    {
                                        DirEntry e = new DirEntry(msg, true);
                                        e.Read();
                                        sex.Add(ref e);
                                        fnAvailable[(int)e.FileNo] = false;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                flag = true;
                            }

                            msg.Fs3.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        flag = true;
                    }

                    msg.Fs1.Close();
                    msg.Fs2.Close();
                }

                if (flag)
                {
                    return;
                }
                OpenOK = true;
            }
            else
            {
                initFolder();
                hdr    = new DirHdr(msg);
                OpenOK = true;
            }
        }
Exemplo n.º 3
0
 public DirEntry(MsGlobals msglobal, bool xmrec)
 {
     msg   = msglobal;
     XmRec = xmrec;
 }
Exemplo n.º 4
0
 public DirEntry(MsGlobals msglobal)
 {
     msg = msglobal;
 }