Exemple #1
0
        private static UdonSharpEditorCache GetInstance()
        {
            lock (instanceLock)
            {
                if (_instance != null)
                {
                    return(_instance);
                }

                _instance = new UdonSharpEditorCache();

                if (File.Exists(CACHE_FILE_PATH))
                {
                    SourceHashLookupStorage storage = SerializationUtility.DeserializeValue <SourceHashLookupStorage>(File.ReadAllBytes(CACHE_FILE_PATH), DataFormat.Binary);
                    _instance.sourceFileHashLookup = storage.sourceFileHashLookup;
                    _instance.LastBuildType        = storage.lastScriptBuildType;
                }

                return(_instance);
            }
        }
Exemple #2
0
        void SaveAllCacheData()
        {
            if (!Directory.Exists(CACHE_DIR_PATH))
            {
                Directory.CreateDirectory(CACHE_DIR_PATH);
            }

            if (_sourceDirty)
            {
                SourceHashLookupStorage storage = new SourceHashLookupStorage()
                {
                    sourceFileHashLookup = _instance.sourceFileHashLookup,
                    lastScriptBuildType  = LastBuildType,
                };
                File.WriteAllBytes(CACHE_FILE_PATH, SerializationUtility.SerializeValue <SourceHashLookupStorage>(storage, DataFormat.Binary));
                _sourceDirty = false;
            }

            FlushDirtyDebugInfos();
            FlushUasmCache();
        }