Exemple #1
0
 private void saveDbSchemasToFile()
 {
     if (mNowSchemas != null && mNowSchemas.Count > 0)
     {
         if (MyHelper.FileHelper.FolderExistsCreater(Constract.dBschemasPath))
         {
             if (!MyHelper.FileHelper.Exists(Constract.getDbdBschemasPath(mConnection.id)))
             {
                 if (!MyHelper.FileHelper.createFile(Constract.getDbdBschemasPath(mConnection.id)))
                 {
                     DelegateShowMsg("创建文件失败:" + Constract.getDbdBschemasPath(mConnection.id));
                 }
             }
             string xml = MyHelper.XmlHelper.Serialize(typeof(List <MyHelper.DbSchema>), mNowSchemas);
             try
             {
                 MyHelper.FileHelper.Write(Constract.getDbdBschemasPath(mConnection.id), xml);
             }
             catch (Exception)
             {
                 DelegateShowMsg("写入文件失败");
             }
         }
         else
         {
             DelegateShowMsg("创建文件夹失败:" + Constract.dBschemasPath);
         }
     }
 }
Exemple #2
0
 private void getHostoryDbSchemas()
 {
     if (MyHelper.FileHelper.FolderExistsCreater(Constract.dBschemasPath))
     {
         if (!MyHelper.FileHelper.Exists(Constract.getDbdBschemasPath(mConnection.id)))
         {
             MyHelper.FileHelper.createFile(Constract.getDbdBschemasPath(mConnection.id));
             return;
         }
         else
         {
             string xml = MyHelper.FileHelper.Reader(Constract.getDbdBschemasPath(mConnection.id), Encoding.UTF8);
             if (string.IsNullOrEmpty(xml))
             {
                 return;
             }
             try
             {
                 mHostoryDbSchemas = (List <MyHelper.DbSchema>)MyHelper.XmlHelper.Deserialize(typeof(List <MyHelper.DbSchema>), xml);
             }
             catch (Exception)
             {
                 DelegateShowMsg("Xml  文件中有错误!");
                 return;
             }
         }
     }
     else
     {
         mHostoryDbSchemas = null;
     }
 }