Beispiel #1
0
    public void Build(ShortcutSettings sSettings, GameObject parentObj)
    {
        _id = ShortcutUtil.ItemAutoId;

        switch (sSettings.Type)
        {
        case (ShortcutType.Arc):
            ArcItem _aItem = parentObj.AddComponent <ArcItem>();
            _item = _aItem;

            break;

        case (ShortcutType.Stick):
            StickItem _sItem = parentObj.AddComponent <StickItem>();
            _item = _sItem;

            break;

        default:
            break;
        }

        _item.transform.SetParent(parentObj.transform, false);

        SetItemDatas();

        _item.Build(sSettings, parentObj);
    }
Beispiel #2
0
        private void RefreshList()
        {
            string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), mArcLogFolder);

            if (!Directory.Exists(logPath))
            {
                return;
            }

            string [] files = Directory.GetFiles(logPath, "*.*", SearchOption.AllDirectories);

            foreach (var filePath in files)
            {
                if (mListViewItems.ContainsKey(filePath))
                {
                    continue;
                }

                var    fileInfo    = new FileInfo(filePath);
                string bossName    = GetBossName(fileInfo.Directory);
                string bossNameLwr = bossName.ToLower();
                string notes       = (string)Registry.GetValue(mKeyNotesName, filePath, "");
                bool   included    = string.IsNullOrEmpty(this.filter) || bossNameLwr.Contains(this.filter) || notes.Contains(this.filter);

                if (!included)
                {
                    continue;
                }

                var data = new ArcItem();
                data.mTimeStamp = fileInfo.LastWriteTime;
                data.mFileSize  = (int)fileInfo.Length / 1024;
                data.mFilePath  = filePath;
                data.mBossName  = bossNameLwr;
                data.mNotes     = notes;

                string url = (string)Registry.GetValue(mKeyName, filePath, "");

                var item = new ListViewItem(bossName);
                item.SubItems.Add(data.mTimeStamp.ToString("M/d/yy h:mm tt"));
                item.SubItems.Add(data.mFileSize.ToString() + " kb");
                item.SubItems.Add(string.IsNullOrEmpty(url) ? "Not Uploaded" : url);
                item.SubItems.Add(data.mNotes);

                mListViewItems[filePath] = item;
                mItemData[item]          = data;
                listView.Items.Add(item);
            }

            foreach (ListViewItem item in listView.Items)
            {
                if (!File.Exists(mItemData[item].mFilePath))
                {
                    RemoveItem(item);
                }
                else
                {
                    bool included = string.IsNullOrEmpty(this.filter) || mItemData[item].mBossName.Contains(this.filter) || mItemData[item].mNotes.Contains(this.filter);
                    if (!included)
                    {
                        RemoveItem(item);
                    }
                }
            }

            RegistryKey regKey = Registry.CurrentUser.OpenSubKey(mRegPath, true);

            if (regKey != null)
            {
                foreach (string regItem in regKey.GetValueNames())
                {
                    if (!mListViewItems.ContainsKey(regItem))
                    {
                        regKey.DeleteValue(regItem);
                    }
                }
            }

            regKey = Registry.CurrentUser.OpenSubKey(mKeyNotesName, true);
            if (regKey != null)
            {
                foreach (string regItem in regKey.GetValueNames())
                {
                    if (!mListViewItems.ContainsKey(regItem))
                    {
                        regKey.DeleteValue(regItem);
                    }
                }
            }

            RefreshSelectionCount();
        }