コード例 #1
0
ファイル: Docroot.cpp プロジェクト: ChrisMoreton/Test3
void DocRoot::SetPathName(LPCTSTR pszPathName, BOOL bAddToMRU/* = TRUE*/)
  {
  Strng T;
  T.FnExt((pchar)pszPathName);
  CDocument::SetPathName(pszPathName, (_stricmp(T() ? T():"", ".spj")==0));
  CExploreScd::RefreshIt(true);
  }
コード例 #2
0
ファイル: Docroot.cpp プロジェクト: ChrisMoreton/Test3
void OleDocRoot::SetPathName(LPCTSTR pszPathName, BOOL bAddToMRU/* = TRUE*/)
  {
  Strng T;
  T.FnExt((pchar)pszPathName);
  COleLinkingDoc::SetPathName(pszPathName, (_stricmp(T(), ".spj")==0));
  }
コード例 #3
0
long CSlotConnPrf::Parse(LPCSTR File)
  {
  if (!FileExists((LPTSTR)File))
    return 1;
  
  //m_sTag.FnName((LPTSTR)File);
  m_bYReversed=false;

  long RetCode=0;
  Strng Ext;
  Ext.FnExt((LPTSTR)File);
  if (Ext.XStrICmp(".txt")==0 || Ext.XStrICmp(".csv")==0)
    {
    FILE *h=fopen(File, "rt");
    if (h)
      {
      char Buff[4096];
      CSVColArray c;
      int Quote;
      int nFlds = 0;
      Buff[0]=0;
      while (strlen(Buff)==0 && fgets(Buff, sizeof(Buff), h))
        XStrLTrim(Buff, " \t\n");

      nFlds = ParseCSVTokens(Buff, c, Quote);

      if (nFlds>0)
        {
        if (_stricmp(Buff, "ABS")==0)
          m_Mode=eABS;
        else if (_stricmp(Buff, "SCL")==0)
          m_Mode=eSCL;
        else if (_stricmp(Buff, "SCL%")==0)
          m_Mode=eSCLPERC;
        else if (_stricmp(Buff, "CONTRONIC")==0)
          m_Mode=eCONTRONIC;
        else
          {
          return 4;
          goto Leave;
          }

        if (m_Mode==eCONTRONIC)
          {
          while (fgets(Buff, sizeof(Buff), h))
            {
            int nFlds = ParseTokenList(Buff, c, "=:");
            if (nFlds>=3)
              {
              CSlotConnPrfPt Pt;
              Pt.X=(float)SafeAtoF(c[1]);
              Pt.Y=(float)SafeAtoF(c[2]);
              m_Points.Add(Pt);
              }
            else if (m_Points.GetSize()>0)
              break;
            }
          }
        else
          {
          while (fgets(Buff, sizeof(Buff), h))
            {
            int nFlds = ParseCSVTokens(Buff, c, Quote);
            if (nFlds>=2)
              {
              CSlotConnPrfPt Pt;
              Pt.X=(float)SafeAtoF(c[0]);
              Pt.Y=(float)SafeAtoF(c[1]);
              m_Points.Add(Pt);
              }
            else if (m_Points.GetSize()>0)
              break;
            }
          }
        if (m_Points.GetSize()<2)
          {
          RetCode=5;
          goto Leave;
          }
        m_bYReversed=m_Points[0].Y> m_Points[m_Points.GetUpperBound()].Y;
        fclose(h);
        }
      else
        RetCode=4;
      }
    else
      RetCode=2;
Leave:
    if (h)
      fclose(h);
    return RetCode;
    }
  else
    return 3;
  };