コード例 #1
0
        public bool Save()
        {
            lock (this)
            {
                try
                {
                    if (m_path == null)
                    {
                        CLog.e("Can't save settings: path is null");
                        return(false);
                    }

                    using (Stream stream = CFileUtils.OpenWrite(m_path))
                    {
                        CPlist.writeBinary(m_data, stream);
                        return(true);
                    }
                }
                catch (Exception e)
                {
                    CLog.error(e, "Can't save settings: {0}", m_path);
                    return(false);
                }
            }
        }
コード例 #2
0
        //////////////////////////////////////////////////////////////////////////////

        public bool Load()
        {
            lock (this)
            {
                try
                {
                    if (m_path == null)
                    {
                        CLog.e("Can't load settings: path is null");
                        return(false);
                    }

                    if (CFileUtils.FileExists(m_path))
                    {
                        m_data = CPlist.readPlist(m_path) as Dictionary <string, object>;
                        return(true);
                    }
                }
                catch (Exception e)
                {
                    CLog.error(e, "Can't read settings: {0}", m_path);
                }

                m_data = new Dictionary <string, object>();
                return(false);
            }
        }
コード例 #3
0
        public static bool AssetPathExists(string path)
        {
            string fullPath = Path.Combine(LunarEditor.CEditor.ProjectPath, path);

            return(CFileUtils.FileExists(fullPath));
        }
コード例 #4
0
 public static bool PathExists(string path)
 {
     return(path != null && Path.IsPathRooted(path) ? CFileUtils.FileExists(path) : AssetPathExists(path));
 }