Exemple #1
0
        private void MoveFromTempToLocal(List <AssetRecord> list)
        {
            DirectoryInfo fromPathFolder = new DirectoryInfo(StrConst.Instance.DownloadTempAddress);

            if (!fromPathFolder.Exists)
            {
                fromPathFolder.Create();
            }

            var it = list.GetEnumerator();

            while (it.MoveNext())
            {
                AssetRecord assetRecord = it.Current;
                string      fromPath    = FileHelper.GetFilePath(assetRecord, FileAddressType.DOWNLOAD_TEMP);
                if (File.Exists(fromPath))
                {
                    string        toPath      = FileHelper.GetFilePath(assetRecord, FileAddressType.LOCAL);
                    string        toFolder    = Path.GetDirectoryName(toPath);
                    DirectoryInfo toFolderDir = new DirectoryInfo(toFolder);
                    if (!toFolderDir.Exists)
                    {
                        toFolderDir.Create();
                    }
                    File.Copy(fromPath, toPath, true);
                }
            }
            DeleteDirectory(fromPathFolder);
        }
Exemple #2
0
        private void SetMainManifest(UpdateFiles updateFiles)
        {
            AssetRecordsInfo info   = AssetsManager.Instance.RecordsInfo;
            AssetRecord      record = info.GetAssetRecord(RuntimeAssetType.MANIFEST, info.mainManifestFileName);

            if (record != null)
            {
                LoadFile loadFile = record.GetLoadFile(LoadBehaviour.ContentLoadFromLoacal_LoadBundleFile, false, (obj) =>
                {
                    AssetBundle bundle = obj as AssetBundle;
                    AssetsManager.Instance.ABManifest = bundle.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
                }, (loaded) =>
                {
                    //string[] testArray = mainManifest.GetAllAssetBundles();
                    //var it = testArray.GetEnumerator();
                    //while (it.MoveNext())
                    //{
                    //    Debug.Log(it.Current);
                    //}
                    AssetsManager.Instance.IsInitialized = true;
                    Debug.Log("资源以及配置加载完毕!");
                    if (updateFiles.onUpdated != null)
                    {
                        updateFiles.onUpdated();
                    }
                });

                LoadFileController.Instance.Load(loadFile);
            }
        }
Exemple #3
0
 private void LoadFiles(List <AssetRecord> list, LoadBehaviour behaviour, bool isCacheToRecord, Action onAllLoaded)
 {
     if (list.Count == 0 && onAllLoaded != null)
     {
         onAllLoaded();
     }
     else
     {
         int count = list.Count;
         monitor.CaculateInit(count);
         var it = list.GetEnumerator();
         while (it.MoveNext())
         {
             AssetRecord assetRecord = it.Current;
             LoadFile    loadFile    = assetRecord.GetLoadFile(behaviour, isCacheToRecord, null, (loadedFile) =>
             {
                 if (!loadedFile.IsLoadSuccess)
                 {
                     isAllFilesExist = false;
                 }
                 count--;
                 monitor.Refresh(loadedFile);
                 if (count == 0 && onAllLoaded != null)
                 {
                     onAllLoaded();
                 }
             });
             LoadFileController.Instance.Load(loadFile);
         }
     }
 }
Exemple #4
0
        public static string GetFilePath(AssetRecord record, FileAddressType addressType)
        {
            if (record == null || addressType == FileAddressType.NULL)
            {
                return(null);
            }
            else
            {
                string address = "";
                switch (addressType)
                {
                case FileAddressType.LOCAL: address = StrConst.Instance.LocalFileAddress; break;

                case FileAddressType.SERVER: address = StrConst.Instance.ServerFileAddress; break;

                case FileAddressType.DOWNLOAD_TEMP: address = StrConst.Instance.DownloadTempAddress; break;
                }
                string folder = GetFileFolderPath(record.Type);

                //断电续传下载到一半终止  服务器端已经发生变化之后再更新时 用于区别旧的临时文件
                string fileName = addressType == FileAddressType.DOWNLOAD_TEMP ?
                                  record.ReleaseFileName + record.Version.ToString() :
                                  record.ReleaseFileName;

                return(new StringBuilder().AppendFormat("{0}{1}{2}", address, folder, fileName).ToString());
            }
        }
Exemple #5
0
 public override void ReadByBinaryReader(BinaryReader br)
 {
     try
     {
         ReadByBinaryReader_Summary(br);
         while (true)
         {
             string           byteStr    = FileHelper.ReadBinaryString(br);
             RuntimeAssetType recordType = (RuntimeAssetType)(Enum.Parse(typeof(RuntimeAssetType), byteStr.ToUpper()));
             countDic[recordType] = br.ReadInt32();
             for (int i = 0; i < countDic[recordType]; i++)
             {
                 AssetRecord ar = new AssetRecord(br);
                 if (!typeToRecordsDic[recordType].ContainsKey(ar.IndexName))
                 {
                     typeToRecordsDic[recordType].Add(ar.IndexName, ar);
                 }
             }
         }
     }
     catch (Exception)
     {
         // done !
     }
 }
Exemple #6
0
        public static string GetAssetBundleName(string assetName)
        {
            string      s      = assetName;
            AssetRecord record = Instance.GetRecord(s);

            return(record.assetBundleName);
        }
Exemple #7
0
        private static void ProcessAssetSTUv2(ulong guid, string typeDir)
        {
            teStructuredData structuredData = STUHelper.OpenSTUSafe(guid);

            if (structuredData == null)
            {
                return;
            }

            AssetRecord record = new AssetRecord {
                GUID = (teResourceGUID)guid,
                StructuredDataInfo = new Common.StructuredDataInfo(),
                References         = new HashSet <teResourceGUID>()
            };

            foreach (STUInstance instance in structuredData.Instances)
            {
                if (instance == null)
                {
                    continue;
                }
                STUv2ProcessInstance(record, instance);
            }

            using (Stream outputFile = File.OpenWrite(Path.Combine(typeDir, $"{teResourceGUID.AsString(guid)}.json"))) {
                outputFile.SetLength(0);
                byte[] buf = JsonSerializer.PrettyPrintByteArray(JsonSerializer.Serialize(record));
                outputFile.Write(buf, 0, buf.Length);
            }
        }
Exemple #8
0
        private void DrawIcon(CleanerRecord record)
        {
            Texture icon = null;

            AssetRecord ar = record as AssetRecord;

            if (ar != null)
            {
                if (ar.isTexture)
                {
                    icon = AssetPreview.GetMiniTypeThumbnail(ar.assetType);
                }

                if (icon == null)
                {
                    icon = AssetDatabase.GetCachedIcon(ar.assetDatabasePath);
                }
            }

            CleanerErrorRecord er = record as CleanerErrorRecord;

            if (er != null)
            {
                icon = CSEditorTextures.ErrorSmallIcon;
            }

            if (icon != null)
            {
                Rect position = EditorGUILayout.GetControlRect(false, 16, GUILayout.Width(16));
                GUI.DrawTexture(position, icon);
            }
        }
Exemple #9
0
        // --------------------------------------------------------------------------------------------------------
        public LoadFile(AssetRecord correlateRecord,
                        LoadBehaviour behaviour,
                        bool isCacheToRecord           = false,
                        Action <object> onloadingEnd   = null,
                        Action <LoadFile> onFileLoaded = null)
        {
            CorrelateRecord   = correlateRecord;
            _Behaviour        = behaviour;
            _IsCacheToRecord  = isCacheToRecord;
            this.onloadingEnd = onloadingEnd;
            this.onFileLoaded = onFileLoaded;

            switch (behaviour)
            {
            case LoadBehaviour.ContentLoadFromLoacal_LoadBundleFile:
            case LoadBehaviour.ContentLoadFromLoacal_WWW:
                _LoadPathType = FileAddressType.LOCAL;
                break;

            case LoadBehaviour.ContentLoadFromServer_WWW:
                _LoadPathType = FileAddressType.SERVER;
                break;

            case LoadBehaviour.DownloadFile_ResumeBrokenTransfer_HttpWebRequest:
            case LoadBehaviour.DownloadFile_WWW:
                _LoadPathType = FileAddressType.SERVER;
                break;
            }
        }
Exemple #10
0
 private void FieldsAreNotNull(AssetRecord Record)
 {
     Assert.True(Record.Name != null, "Name is null in " + Record.ToString());
     Assert.True(Record.Data != null, "Data is null in " + Record.ToString());
     Assert.True(Record.ScriptFilePath != null, "ScriptFilename is null in " + Record.ToString());
     Assert.True(Record.ProcessMessages != null, "ProcessMessages is null in " + Record.ToString());
 }
    public void LoadMulti(Queue <AssetRecord> queue, bool isCacheToRecord,
                          LoadMethod method, Action <object> onLoadingEnd, Action onAllLoaded)
    {
        if (queue.Count == 0 && onAllLoaded != null)
        {
            Debug.Log("LoadMulti ~ 无任何可加载的东西 ");
            onAllLoaded();
        }
        else
        {
            int             count   = queue.Count;
            ProgressMonitor monitor = new ProgressMonitor(count, ProgressState.LOAD);
            while (queue.Count > 0)
            {
                AssetRecord assetRecord = queue.Dequeue();
                LoadFile    loadFile    = assetRecord.GetLoadFile(LoadBehaviour.ContentLoadFromLoacal_LoadBundleFile,
                                                                  isCacheToRecord, onLoadingEnd, (loadedFile) =>
                {
                    count--;
                    monitor.Refresh(loadedFile);
                    if (count == 0 && onAllLoaded != null)
                    {
                        onAllLoaded();
                    }
                });

                LoadFileController.Instance.Load(loadFile);
            }
        }
    }
    // -----------------------------------------------------------------------------------------------------------------------------------
    public void Load(RuntimeAssetType type, string indexName,
                     bool isCacheToRecord = false, Action <object> OnAssetLoaded = null)
    {
        if (!IsInitialized)
        {
            Debug.Log("尚未初始化!");
            return;
        }

        AssetRecord record = RecordsInfo.GetAssetRecord(type, indexName);

        if (record != null)
        {
            //LoadMethod loadMethod = (type == RuntimeAssetType.BUNDLE_PREFAB ||
            //                         type == RuntimeAssetType.BUNDLE_SCENE) ?
            //                         LoadMethod.BUNDLE_FILE : LoadMethod.WWW;

            //LoadFile loadFile = record.GetLoadFile(FileAddressType.LOCAL, isCacheToRecord,
            //                                       loadMethod, FileAddressType.NULL, OnAssetLoaded);

            LoadBehaviour behaviour = (type == RuntimeAssetType.BUNDLE_PREFAB ||
                                       type == RuntimeAssetType.BUNDLE_SCENE) ?
                                      LoadBehaviour.ContentLoadFromLoacal_LoadBundleFile :
                                      LoadBehaviour.ContentLoadFromLoacal_WWW;

            LoadFile loadFile = record.GetLoadFile(behaviour, isCacheToRecord, OnAssetLoaded);
            LoadFileController.Instance.Load(loadFile);
        }
        else
        {
            Debug.Log(indexName + "未找到此资源!!!!!");
        }
    }
Exemple #13
0
 private void DrawRevealButton(AssetRecord record)
 {
     if (UIHelpers.RecordButton(record, "Reveal", "Reveals item in system default File Manager like Explorer on Windows or Finder on Mac.", CSIcons.Reveal))
     {
         EditorUtility.RevealInFinder(record.path);
     }
 }
Exemple #14
0
        public static string GetAssetName(string assetName)
        {
            string      s      = assetName;
            AssetRecord record = Instance.GetRecord(s);

            return(record.assetName.ToLower());
        }
Exemple #15
0
 private void ConclusionIsConsistent(AssetRecord Record)
 {
     //A assent can only have the state Success (Has Value), DoesNotApply (Has No Value) or Fatal (Error)
     Assert.True(Record.Conclusion == ConclusionEnum.DoesNotApply |
                 Record.Conclusion == ConclusionEnum.Success |
                 Record.Conclusion == ConclusionEnum.Fatal,
                 "Wrong Conclusion value for: " + Record.ToString());
 }
        private void DrawRecordButtons(RecordBase record)
        {
            using (UIHelpers.Horizontal(UIHelpers.panelWithBackground))
            {
                AddShowButtonIfPossible(record);

                AssetRecord assetRecord = record as AssetRecord;
                if (assetRecord != null)
                {
                    if (GUILayout.Button(new GUIContent("Reveal", "Reveals item in system default File Manager like Explorer on Windows or Finder on Mac."), UIHelpers.recordButton))
                    {
                        EditorUtility.RevealInFinder(assetRecord.path);
                    }

                    if (GUILayout.Button("More ...", UIHelpers.recordButton))
                    {
                        GenericMenu menu = new GenericMenu();
                        if (!string.IsNullOrEmpty(assetRecord.path))
                        {
                            menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () =>
                            {
                                if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, assetRecord.assetDatabasePath))
                                {
                                    MaintainerSettings.Save();
                                    MaintainerWindow.ShowNotification("Ignore added: " + assetRecord.assetDatabasePath);
                                    CleanerIgnoresWindow.Refresh();
                                }
                                else
                                {
                                    MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                }
                            });

                            DirectoryInfo dir = Directory.GetParent(assetRecord.assetDatabasePath);
                            if (dir.Name != "Assets")
                            {
                                menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () =>
                                {
                                    if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, dir.ToString()))
                                    {
                                        MaintainerSettings.Save();
                                        MaintainerWindow.ShowNotification("Ignore added: " + dir);
                                        CleanerIgnoresWindow.Refresh();
                                    }
                                    else
                                    {
                                        MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                    }
                                });
                            }
                        }
                        menu.ShowAsContext();
                    }
                }
            }
        }
Exemple #17
0
        public int GetAssetTimesAccessedFor(string assetId)
        {
            int         timesAccessed = 0;
            AssetRecord rec           = findRecordById(assetId);

            if (rec != null)
            {
                timesAccessed = rec.GetTimesUsed();
            }
            return(timesAccessed);
        }
        private AssetRecord CreateVideoAssetRecord(CloudVideoPart videoPart) {
            var asset = new AssetRecord {
                VideoPartRecord = videoPart.Record,
                PublishStatus = AssetPublishStatus.Published,
                UploadStatus = AssetUploadStatus.Uploading,
                Type = "Video"
            };

            _stubAssetRepository.Create(asset);
            return asset;
        }
        private AssetRecord CreateVideoAssetRecord(CloudVideoPart videoPart)
        {
            var asset = new AssetRecord {
                VideoPartRecord = videoPart.Record,
                PublishStatus   = AssetPublishStatus.Published,
                UploadStatus    = AssetUploadStatus.Uploading,
                Type            = "Video"
            };

            _stubAssetRepository.Create(asset);
            return(asset);
        }
Exemple #20
0
        public void MarkAssetCompleted(string assetIdentifier)
        {
            AssetRecord record      = findRecordById(assetIdentifier);
            long        currentTime = GetCurrentMilli();

            if (record.GetFirstAccessed() <= 0)
            {
                record.SetFirstAccessed(currentTime);
            }

            record.SetTimesUsed(record.GetTimesUsed() + 1);
            record.SetLastAccessed(currentTime);
        }
Exemple #21
0
        private static void STUv2ProcessInstance(AssetRecord record, STUInstance instance)
        {
            var fields = GetFields(instance.GetType(), true);

            foreach (FieldInfo field in fields)
            {
                object fieldValue = field.GetValue(instance);
                Type   fieldType  = field.FieldType;
                if (fieldValue == null)
                {
                    continue;
                }

                var fieldAttribute = field.GetCustomAttribute <STUFieldAttribute>();
                if (fieldAttribute != null)
                {
                    if (fieldAttribute.ReaderType == typeof(InlineInstanceFieldReader))
                    {
                        if (!fieldType.IsArray)
                        {
                            STUv2ProcessInstance(record, (STUInstance)fieldValue);
                        }
                        else
                        {
                            IEnumerable enumerable = (IEnumerable)fieldValue;
                            foreach (object val in enumerable)
                            {
                                STUv2ProcessInstance(record, (STUInstance)val);
                            }
                        }

                        return;
                    }
                }

                if (fieldType.IsArray)
                {
                    Type        elementType = fieldType.GetElementType();
                    IEnumerable enumerable  = (IEnumerable)fieldValue;
                    foreach (object val in enumerable)
                    {
                        STUv2ProcessField(record, val, elementType);
                    }
                }
                else
                {
                    STUv2ProcessField(record, fieldValue, fieldType);
                }
            }
        }
 private Asset Activate(Asset asset, AssetRecord record)
 {
     asset.Record = record;
     _assetStorageProvider.BindStorage(asset);
     asset.MimeTypeProvider = _mimeTypeProvider;
     asset._videoPartField.Loader(() => _contentManager.Get <CloudVideoPart>(record.VideoContentItemId, VersionOptions.Latest));
     asset._videoPartField.Setter(x => {
         if (x == null)
         {
             throw new ArgumentNullException("You must set a reference to a CloudVideoPart. Nulls are not alowed.");
         }
         record.VideoContentItemId = x.Id;
         return(x);
     });
     return(asset);
 }
Exemple #23
0
        private void ConclusionMatchesOtherFields(AssetRecord Record)
        {
            if (Record.Conclusion == ConclusionEnum.Success)
            {
                ConclusionMatchesOtherFields_ForSuccess(Record);
            }

            if (Record.Conclusion == ConclusionEnum.DoesNotApply)
            {
                ConclusionMatchesOtherFields_ForDoesNotApply(Record);
            }

            if (Record.Conclusion == ConclusionEnum.Fatal)
            {
                ConclusionMatchesOtherFields_ForFatal(Record);
            }
        }
Exemple #24
0
        private static void STUv2ProcessField(AssetRecord record, object value, Type fieldType)
        {
            if (value is teResourceGUID resGuid)
            {
                record.References.Add(resGuid);
                return;
            }

            if (fieldType.IsGenericType)
            {
                Type genericBase = fieldType.GetGenericTypeDefinition();

                Type[] genericParams = fieldType.GetGenericArguments();
                if (genericBase != typeof(teStructuredDataAssetRef <>))
                {
                    return;
                }

                MethodInfo method = typeof(Program).GetMethod(nameof(GetAssetRefGUID));
                if (method == null)
                {
                    return;
                }

                method = method.MakeGenericMethod(genericParams);
                record.References.Add((teResourceGUID)method.Invoke(null, new[] { value }));
                return;
            }

            if (!(value is ulong @ulong))
            {
                return;
            }
            if (@ulong == 0)
            {
                return;
            }
            ushort type = teResourceGUID.Type(@ulong);

            if (type > 1 && type < 0xFF)
            {
                record.References.Add((teResourceGUID)@ulong);
            }
        }
Exemple #25
0
            public void Update(CleanerRecord[] records)
            {
                selectedSize = totalSize = 0;

                for (int i = 0; i < records.Length; i++)
                {
                    AssetRecord assetRecord = records[i] as AssetRecord;
                    if (assetRecord == null || assetRecord.cleaned)
                    {
                        continue;
                    }

                    totalSize += assetRecord.size;
                    if (assetRecord.selected)
                    {
                        selectedSize += assetRecord.size;
                    }
                }
            }
Exemple #26
0
            public void SetUpdateByComparingRecords(Dictionary <string, AssetRecord> localRecords,
                                                    Dictionary <string, AssetRecord> serverRecords,
                                                    bool isComparingLocalFile)
            {
                //删掉多余的资源
                var it_localRecords = localRecords.GetEnumerator();

                while (it_localRecords.MoveNext())
                {
                    if (!serverRecords.ContainsKey(it_localRecords.Current.Key))
                    {
                        AssetRecord localRecord = it_localRecords.Current.Value;
                        redundancyQueue.Enqueue(FileHelper.GetFilePath(localRecord, FileAddressType.LOCAL));
                        //Debug.Log(it_localRecords.Current.Key);
                    }
                }

                //添加更新的
                var it_serverRecords = serverRecords.GetEnumerator();

                while (it_serverRecords.MoveNext())
                {
                    if (localRecords.ContainsKey(it_serverRecords.Current.Key))
                    {
                        AssetRecord localRecord  = localRecords[it_serverRecords.Current.Key];
                        AssetRecord serverRecord = it_serverRecords.Current.Value;
                        if (!localRecord.LastModifyTime.Equals(serverRecord.LastModifyTime) ||
                            !localRecord.Version.Equals(serverRecord.Version))
                        {
                            downloadList.Add(serverRecord);
                        }
                        else
                        {
                            //与本地文件进行二次校验
                            SetUpdateByAssetRecord(true, localRecord, isComparingLocalFile);
                        }
                    }
                    else
                    {
                        downloadList.Add(it_serverRecords.Current.Value);
                    }
                }
            }
Exemple #27
0
        private static void ProcessAssetBlob(ulong guid, string typeDir)
        {
            using (Stream s = IO.OpenFile(guid)) {
                if (s == null)
                {
                    return;
                }

                byte[] data = new byte[s.Length];
                s.Read(data, 0, data.Length);


                AssetRecord record = new AssetRecord {
                    GUID       = (teResourceGUID)guid,
                    References = new HashSet <teResourceGUID>()
                };

                unsafe
                {
                    fixed(byte *ptr = data)
                    {
                        var i = 0;

                        while (i + 8 <= data.Length)
                        {
                            ulong sig = *(ulong *)(ptr + i);
                            if (DataTool.Program.ValidKey(sig))
                            {
                                record.References.Add((teResourceGUID)sig);
                            }
                            i += 1;
                        }
                    }
                }

                using (Stream outputFile = File.OpenWrite(Path.Combine(typeDir, $"{teResourceGUID.AsString(guid)}.json"))) {
                    outputFile.SetLength(0);
                    byte[] buf = JsonSerializer.PrettyPrintByteArray(JsonSerializer.Serialize(record));
                    outputFile.Write(buf, 0, buf.Length);
                }
            }
        }
Exemple #28
0
        private void DrawMoreButton(AssetRecord assetRecord)
        {
            if (UIHelpers.RecordButton(assetRecord, "Shows menu with additional actions for this record.", CSIcons.More))
            {
                GenericMenu menu = new GenericMenu();
                if (!string.IsNullOrEmpty(assetRecord.path))
                {
                    menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () =>
                    {
                        if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, assetRecord.assetDatabasePath))
                        {
                            MaintainerWindow.ShowNotification("Ignore added: " + assetRecord.assetDatabasePath);
                            CleanerFiltersWindow.Refresh();
                        }
                        else
                        {
                            MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                        }
                    });

                    DirectoryInfo dir = Directory.GetParent(assetRecord.assetDatabasePath);
                    if (dir.Name != "Assets")
                    {
                        menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () =>
                        {
                            if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, dir.ToString()))
                            {
                                MaintainerWindow.ShowNotification("Ignore added: " + dir);
                                CleanerFiltersWindow.Refresh();
                            }
                            else
                            {
                                MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                            }
                        });
                    }
                }
                menu.ShowAsContext();
            }
        }
Exemple #29
0
        void Load(string recordFile)
        {
            m_dicAssetRecord = new Dictionary <string, AssetRecord>();
            //#if UNITY_EDITOR || UNITY_STANDALONE_WIN
            //        string fullPath = string.Format("{0}/{1}/{2}", "../../TankClient",AssetBundles.Utility.AssetBundlesPath(),recordFile);
            //        string content = FileUtils.GetStringFromFile(fullPath);
            //#elif UNITY_ANDROID
            //        string content = FileUtils.LoadFromStreaming(recordFile);
            //#endif

            string content = FileUtils.LoadStringFromFileSystem(string.Format("{0}", recordFile));

            //        Debug.Log("Record : " + content);
            string[] lines = content.Split('\n');
            foreach (string line in lines)
            {
                string[] row = line.Split('\t');
                if (row != null && row.Length == 2)
                {
                    AssetRecord record = new AssetRecord();

                    record.assetName       = row[0];
                    record.assetBundleName = row[1];
                    string assetNameWithoutExtension = record.assetName.Replace(Path.GetExtension(record.assetName), "");

                    //Debug.Log("Record : " + record.assetName + "  " + assetNameWithoutExtension);
                    if (!m_dicAssetRecord.ContainsKey(record.assetName))
                    {
                        m_dicAssetRecord.Add(record.assetName, record);
                    }

                    if (!m_dicAssetRecord.ContainsKey(assetNameWithoutExtension))
                    {
                        //Debug.Log("Record : " + assetNameWithoutExtension);
                        m_dicAssetRecord.Add(assetNameWithoutExtension, record);
                    }
                }
            }
        }
Exemple #30
0
        private void DrawRecordButtons(CleanerRecord record, int recordIndex)
        {
            DrawShowButtonIfPossible(record);

            AssetRecord assetRecord = record as AssetRecord;

            if (assetRecord != null)
            {
                DrawDeleteButton(assetRecord, recordIndex);

                if (record.compactMode)
                {
                    DrawMoreButton(assetRecord);
                }
                else
                {
                    DrawRevealButton(assetRecord);
                    DrawCopyButton(assetRecord);
                    DrawMoreButton(assetRecord);
                }
            }
        }
Exemple #31
0
 // ---------------------------------------------------------------------------------------------
 public void SetUpdateByAssetRecord(bool isLocal, AssetRecord assetRecord, bool isComparingLocalFile)
 {
     if (isComparingLocalFile)
     {
         string   fileLocalPath = FileHelper.GetFilePath(assetRecord, FileAddressType.LOCAL);
         FileInfo localFileInfo = new FileInfo(fileLocalPath);
         localFileInfo.Refresh();
         if (localFileInfo.Exists)
         {
             long fileLastModifyTime = FileHelper.ConvertDateTimeToLong(localFileInfo.LastWriteTimeUtc);
             if (!assetRecord.LastModifyTime.Equals(fileLastModifyTime))
             {
                 downloadList.Add(assetRecord);
             }
             else
             {
                 checkedList.Add(assetRecord);
             }
         }
         else
         {
             downloadList.Add(assetRecord);
         }
     }
     else
     {
         if (isLocal)
         {
             checkedList.Add(assetRecord);
         }
         else
         {
             downloadList.Add(assetRecord);
         }
     }
 }