コード例 #1
0
 public IVFSBuilder UseProfile(string profileName)
 {
     mProfileName = profileName;
     curProfile   = VFSManagerEditor.GetProfileRecord(profileName);
     mDevelopMode = XCoreEditor.IsXProfileDevelopMode(mProfileName);
     return(this);
 }
コード例 #2
0
 private void refreshProfileInfos()
 {
     if (curProfile == null)
     {
         curProfile = VFSManagerEditor.GetProfileRecord(XCoreEditor.GetCurrentActiveXProfileName());
     }
 }
コード例 #3
0
ファイル: ContactClient.cs プロジェクト: xxyying/vmClone
        public ContactItem getContact(String contactKey)
        {
            try {
                ContactApi       contactApi = new ContactApi(session.GetApiClient());
                GetProfileResult result     = contactApi.GetProfile(contactKey);

                if (result.Hdr.Rc == 0)
                {
                    ProfileRecord record      = result.ProfileRecord;
                    ContactItem   contactItem = new ContactItem();
                    contactItem.Name          = record.DisplayName;
                    contactItem.Email         = record.Email;
                    contactItem.Phone         = record.Phone;
                    contactItem.Key           = record.UserKey;
                    contactItem.IconKey       = record.IconSmall;
                    contactItem.ProfileRecord = record;
                    return(contactItem);
                }
                else
                {
                    throw new Exception("Error getting contact");
                }
            } catch (Exception ex)
            {
                throw new Exception("Error getting contact", ex);
            }
        }
コード例 #4
0
 private void OnLostFocus()
 {
     xprofiles               = null;
     mCurProfileRecord       = null;
     select_xprofile         = 0;
     groups                  = null;
     mCur_WebVFS_profileNmae = null;
     //groups_handlemode_cache?.Clear();
 }
コード例 #5
0
 private void PopulateProfileList()
 {
     ClearProfileList();
     if (ProfileManager.instance.profileList.Count > 0)
     {
         foreach (PlayerProfile profile in ProfileManager.instance.profileList)
         {
             GameObject    uiObj  = Instantiate(profileRecordPrefab, profileScreenContent);
             ProfileRecord record = uiObj.GetComponent <ProfileRecord>();
             record.nameField.text  = profile.profileName;
             record.statsField.text = $"Balance: {Math.Truncate(profile.balance)}\nSaved On: {profile.lastSaved}";
         }
     }
 }
コード例 #6
0
ファイル: FormMain.cs プロジェクト: saad1969/AWSRetriever
 private void RunAgainToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.listViewMessages.SelectedIndices.Count > 0)
     {
         FormAction("Run Again...", delegate
         {
             int idx            = this.listViewMessages.SelectedIndices[0];
             ProgressMessage pm = this.progressMessages[idx];
             ProfileRecord pr   = this.profile.Find(pm.Service, pm.Operation);
             Operation op       = Profile.FindOpeartion(pr);
             var region         = RegionEndpoint.GetBySystemName(pm.RegionSystemName);
             scanner.Invokations.Enqueue(op.Clone(Configuration.Instance.GetWebProxy(), region, this.creds, pr.PageSize));
             Start();
         });
     }
 }
コード例 #7
0
        /// <summary>
        /// 初始值
        /// </summary>
        private static void initProfileRecord()
        {
            if (VFSProfileEditor == null)
            {
                VFSProfileEditor = new VFSProfileModel();
            }
            var profiles = XCoreEditor.GetXProfileNames();

            foreach (var profileName in profiles)
            {
                if (!VFSProfileEditor.TryGetProfille(profileName, out var pr))
                {
                    var profile = new ProfileRecord()
                                  .SetProfileName(profileName)
                                  .DefaultByGrousp(Groups);
                    VFSProfileEditor.AddProfileIfNotExists(profile);
                }
            }
        }
コード例 #8
0
ファイル: MiniProfiler.cs プロジェクト: ianlee74/Gadgeteer
        /// <summary>
        /// Initialize the MiniProfiler
        /// </summary>
        /// <param name="autoSnapshotEvery">The number of profiler records to capture before creating a snapshot. 0 for never.</param>
        /// <param name="maxProfileRecords">Maximum number of profiler records to keep in queue.</param>
        /// <param name="maxNestingDepth">Maximum nesting depth of profiler.</param>
        public static void Initialize(int autoSnapshotEvery = 0, int maxProfileRecords = 100, int maxNestingDepth = 10)
        {
            _autoSnapshotEvery = autoSnapshotEvery;
              _maxProfileRecords = maxProfileRecords;
              _maxNestingDepth = maxNestingDepth;

              _regions = new ProfileRecord[maxProfileRecords];
              for (int i = 0; i < maxProfileRecords; ++i)
              {
            _regions[i] = new ProfileRecord();
              }

              _spaces = new string[maxNestingDepth];
              _spaces[0] = string.Empty;
              for (int i = 1; i < maxNestingDepth; ++i)
              {
            _spaces[i] = new string(' ', i * 2);
              }
              _initialized = true;
        }
コード例 #9
0
        private void ListOperations_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            string operation = SelectedOpertaion;
            string service   = SelectedService;

            if (string.IsNullOrEmpty(operation) || string.IsNullOrEmpty(service))
            {
                return;
            }
            this.selectedProfileRecord = this.profile.Find(service, operation);
            if (selectedProfileRecord != null)
            {
                Operation op = Profile.FindOpeartion(selectedProfileRecord);
                this.tilePanelOpertaion.Text = op.Name;
                this.richTextBox1.Text       = op.Description;
                this.chkEnabled.Checked      = selectedProfileRecord.Enabled;
                this.maskedTextBox1.Text     = selectedProfileRecord.PageSize.ToString();
                this.regionsTextbox1.Regions = selectedProfileRecord.Regions;
                this.splitContainer1.Panel2.Show();
            }
        }
コード例 #10
0
 public static void AddProfileIfNotExists(ProfileRecord pr)
 {
     VFSProfileEditor.AddProfileIfNotExists(pr);
 }
コード例 #11
0
        private void OnGUI()
        {
            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal(style_head);
            GUILayout.Label("Profile:", GUILayout.Width(55));


            if (xprofiles == null || (select_xprofile - 1) > xprofiles.Length)
            {
                refreshXprofilesCacheData();
            }

            select_xprofile = EditorGUILayout.Popup(select_xprofile, xprofiles);
            GUILayout.EndHorizontal();

            //数据
            string cur_xprofile_name = xprofiles[select_xprofile];

            if (mCurProfileRecord == null || xprofiles[select_xprofile] != mCurProfileRecord.ProfileName)
            {
                mCurProfileRecord = VFSManagerEditor.GetProfileRecord(xprofiles[select_xprofile]);
                addConfiguredValueToCache();
            }

            // 工具栏
            GUILayout.Space(5);
            mToolbar_Index = GUILayout.Toolbar(mToolbar_Index, toolbar_str);

            if (mToolbar_Index == 0)
            {
                #region Group列表

                GUILayout.BeginVertical(style_body);
                v2_body_groups_scrollview = EditorGUILayout.BeginScrollView(v2_body_groups_scrollview);


                //表头
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label("Group", GUILayout.Width(165));
                GUILayout.Label("|", GUILayout.Width(10));
                GUILayout.Label(IsChinese ? "资源存储位置" : "Assets Storage Location", GUILayout.Width(150));
                GUILayout.Label("|", GUILayout.Width(10));
                GUILayout.Label("Disable", GUILayout.Width(50));

                EditorGUILayout.EndHorizontal();


                if (groups == null)
                {
                    groups = VFSManagerEditor.GetGroups();
                    //groupNames = VFSManagerEditor.GetGroupNames();
                }

                foreach (var group in groups)
                {
                    GUILayout.BeginHorizontal();
                    //GroupName
                    GUILayout.Label(group.GroupName, style_txt_group_item, GUILayout.Width(170));
                    GUILayout.Space(5);
                    //资源存储位置
                    GroupHandleMode handleMode = group.HandleMode;


                    if (handleMode == GroupHandleMode.LocalAndUpdatable || handleMode == GroupHandleMode.LocalOrRemote)
                    {
                        //可以主动设置资源位置
                        if (!assetLocation_cache.ContainsKey(cur_xprofile_name))
                        {
                            assetLocation_cache.Add(cur_xprofile_name, new Dictionary <string, ProfileRecord.E_GroupAssetsLocation>());
                        }

                        if (!assetLocation_cache[cur_xprofile_name].ContainsKey(group.GroupName))
                        {
                            assetLocation_cache[cur_xprofile_name].Add(group.GroupName, ProfileRecord.E_GroupAssetsLocation.Local);
                        }

                        assetLocation_cache[cur_xprofile_name][group.GroupName] = (ProfileRecord.E_GroupAssetsLocation)EditorGUILayout.EnumPopup(assetLocation_cache[cur_xprofile_name][group.GroupName], GUILayout.Width(150));

                        GUILayout.Space(2);
                    }
                    else
                    {
                        //写死资源位置
                        if (handleMode == GroupHandleMode.LocalOnly)
                        {
                            setAssetLocationCacheValue(cur_xprofile_name, group.GroupName, ProfileRecord.E_GroupAssetsLocation.Local);
                            GUILayout.Label($"[{ProfileRecord.E_GroupAssetsLocation.Local.ToString()}]", GUILayout.Width(150));
                        }
                        else if (handleMode == GroupHandleMode.RemoteOnly)
                        {
                            setAssetLocationCacheValue(cur_xprofile_name, group.GroupName, ProfileRecord.E_GroupAssetsLocation.Remote);
                            GUILayout.Label($"[{ProfileRecord.E_GroupAssetsLocation.Remote.ToString()}]", GUILayout.Width(150));
                        }
                    }

                    GUILayout.Space(10);
                    //Disable
                    if (group.ExtensionGroup)
                    {
                        //可以主动设置group disable
                        if (!disable_expansionGroup_cache.ContainsKey(cur_xprofile_name))
                        {
                            disable_expansionGroup_cache.Add(cur_xprofile_name, new Dictionary <string, bool>());
                        }

                        if (!disable_expansionGroup_cache[cur_xprofile_name].ContainsKey(group.GroupName))
                        {
                            disable_expansionGroup_cache[cur_xprofile_name].Add(group.GroupName, false);
                        }
                        GUILayout.Space(10);
                        disable_expansionGroup_cache[cur_xprofile_name][group.GroupName] = EditorGUILayout.Toggle(disable_expansionGroup_cache[cur_xprofile_name][group.GroupName], GUILayout.Width(50));
                    }
                    else
                    {
                        GUILayout.Label("[-]", style_label_center, GUILayout.Width(36));
                        setGroupDisableCacheValue(cur_xprofile_name, group.GroupName, false);
                    }

                    GUILayout.EndHorizontal();
                }



                EditorGUILayout.EndScrollView();



                GUILayout.EndVertical();
                #endregion
            }
            else if (mToolbar_Index == 1)
            {
                #region WebVFS URLs

                if (mWebVFS_Net_Config == null)
                {
                    mWebVFS_Net_Config = XConfig.CreateConfigIfNotExists <WebVFSNetworkConfig>(TinaX.VFSKit.Const.VFSConst.Config_WebVFS_URLs);
                }
                if (mWebVFS_Net_Config_serialized == null)
                {
                    mWebVFS_Net_Config_serialized = new SerializedObject(mWebVFS_Net_Config);
                }
                if (mCur_WebVFS_profileNmae == null || mCur_WebVFS_profileNmae != cur_xprofile_name)
                {
                    if (mWebVFS_Net_Config.Configs == null || !mWebVFS_Net_Config.Configs.Any(item => item.ProfileName == cur_xprofile_name))
                    {
                        ArrayUtil.Combine(ref mWebVFS_Net_Config.Configs, new WebVFSNetworkConfig.NetworkConfig[] {
                            new WebVFSNetworkConfig.NetworkConfig()
                            {
                                ProfileName = cur_xprofile_name
                            }
                        });
                        mWebVFS_Net_Config_serialized.UpdateIfRequiredOrScript();
                    }
                    for (int i = 0; i < mWebVFS_Net_Config.Configs.Length; i++)
                    {
                        if (mWebVFS_Net_Config.Configs[i].ProfileName == cur_xprofile_name)
                        {
                            mCur_ProfileIndex_InWebVFS = i;
                        }
                    }
                    SerializedProperty cur_config = mWebVFS_Net_Config_serialized.FindProperty("Configs").GetArrayElementAtIndex(mCur_ProfileIndex_InWebVFS);
                    SerializedProperty cur_urls   = cur_config.FindPropertyRelative("Urls");

                    reorderableList_urls = new ReorderableList(
                        mWebVFS_Net_Config_serialized,
                        cur_urls,
                        true,
                        true,
                        true,
                        true);
                    reorderableList_urls.drawElementCallback = (rect, index, selected, focused) =>
                    {
                        SerializedProperty itemData = reorderableList_urls.serializedProperty.GetArrayElementAtIndex(index);
                        SerializedProperty mode     = itemData.FindPropertyRelative("NetworkMode");
                        SerializedProperty url      = itemData.FindPropertyRelative("BaseUrl");
                        SerializedProperty helloUrl = itemData.FindPropertyRelative("HelloUrl");

                        rect.y     += 2;
                        rect.height = EditorGUIUtility.singleLineHeight * 1;

                        var rect_mode = rect;
                        EditorGUI.PropertyField(rect_mode, mode, new GUIContent(IsChinese ? "网络模式" : "Network Mode"));
                        //--------------------------------------------------------------------------------------------
                        var rect_url_label = rect;
                        rect_url_label.y    += EditorGUIUtility.singleLineHeight + 2;
                        rect_url_label.width = 58;
                        GUI.Label(rect_url_label, IsChinese ? "基础Url" : "Base Url");

                        var rect_url = rect;
                        rect_url.y     += EditorGUIUtility.singleLineHeight + 2;
                        rect_url.width -= 62;
                        rect_url.x     += 62;
                        EditorGUI.PropertyField(rect_url, url, GUIContent.none);
                        //---------------------------------------------------------------------------------------------------

                        var rect_hellourl_label = rect;
                        rect_hellourl_label.y    += EditorGUIUtility.singleLineHeight * 2 + 4;
                        rect_hellourl_label.width = 58;
                        GUI.Label(rect_hellourl_label, IsChinese ? "HelloUrl" : "Hello Url");

                        var rect_helloUrl = rect;
                        rect_helloUrl.y     += EditorGUIUtility.singleLineHeight * 2 + 4;
                        rect_helloUrl.width -= 62;
                        rect_helloUrl.x     += 62;
                        EditorGUI.PropertyField(rect_helloUrl, helloUrl, GUIContent.none);
                    };
                    reorderableList_urls.elementHeightCallback = (index) =>
                    {
                        return(EditorGUIUtility.singleLineHeight * 3 + 10);
                    };
                    reorderableList_urls.drawHeaderCallback = (rect) =>
                    {
                        GUI.Label(rect, IsChinese?"Web Urls":"Web Urls");
                    };

                    mCur_WebVFS_profileNmae = cur_xprofile_name;
                }

                GUILayout.BeginVertical(style_body);
                v2_body_webvfs_scrollview = EditorGUILayout.BeginScrollView(v2_body_webvfs_scrollview);

                reorderableList_urls.DoLayoutList();
                //EditorGUILayout.PropertyField(cur_urls);

                EditorGUILayout.EndScrollView();

                GUILayout.EndVertical();
                #endregion
            }

            #region 保存和重置值的两个按钮
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            //包存cache的值
            if (GUILayout.Button(IsChinese ? "保存设置" : "Save", GUILayout.Width(100)))
            {
                #region Group Profile
                foreach (var item in assetLocation_cache)
                {
                    //item.key: profile,
                    var profile = VFSManagerEditor.GetProfileRecord(item.Key); //因为获取到的是class,所以直接修改它就行了
                    //item.value 是一个字典,key = groupName, value = value
                    foreach (var item2 in item.Value)
                    {
                        //接下来要在结构体上操作了,所以不能拉过来操作了,只能找到下标之后直接去修改
                        if (!profile.GroupProfileRecords.Any(gpr => gpr.GroupName == item2.Key))
                        {
                            ArrayUtil.Combine(ref profile.GroupProfileRecords, new ProfileRecord.S_GroupProfileRecord[]
                            {
                                new ProfileRecord.S_GroupProfileRecord()
                                {
                                    GroupName = item2.Key,
                                }
                            });
                        }

                        for (var i = 0; i < profile.GroupProfileRecords.Length; i++)
                        {
                            if (profile.GroupProfileRecords[i].GroupName == item2.Key)
                            {
                                profile.GroupProfileRecords[i].Location = item2.Value;
                                break;
                            }
                        }
                    }

                    VFSManagerEditor.AddProfileIfNotExists(profile);
                }

                foreach (var item in disable_expansionGroup_cache)
                {
                    //item.key: profile,
                    var profile = VFSManagerEditor.GetProfileRecord(item.Key); //因为获取到的是class,所以直接修改它就行了
                    //item.value 是一个字典,key = groupName, value = value
                    foreach (var item2 in item.Value)
                    {
                        //接下来要在结构体上操作了,所以不能拉过来操作了,只能找到下标之后直接去修改
                        if (!profile.GroupProfileRecords.Any(gpr => gpr.GroupName == item2.Key))
                        {
                            ArrayUtil.Combine(ref profile.GroupProfileRecords, new ProfileRecord.S_GroupProfileRecord[]
                            {
                                new ProfileRecord.S_GroupProfileRecord()
                                {
                                    GroupName = item2.Key,
                                }
                            });
                        }

                        for (var i = 0; i < profile.GroupProfileRecords.Length; i++)
                        {
                            if (profile.GroupProfileRecords[i].GroupName == item2.Key)
                            {
                                profile.GroupProfileRecords[i].DisableGroup = item2.Value;
                                break;
                            }
                        }
                    }

                    VFSManagerEditor.AddProfileIfNotExists(profile);
                }

                //foreach (var item in developMode_cache)
                //{
                //    //item.key: profile,
                //    var profile = VFSManagerEditor.GetProfileRecord(item.Key); //因为获取到的是class,所以直接修改它就行了
                //    //item.value 是 是否为开发模式的value
                //    profile.DevelopMode = item.Value;
                //    VFSManagerEditor.AddProfileIfNotExists(profile);
                //}


                //通知VFSManager保存到disk
                VFSManagerEditor.SaveProfileRecord();
                #endregion

                #region WebVFS URL
                mWebVFS_Net_Config_serialized?.ApplyModifiedPropertiesWithoutUndo();
                //删掉可能多余的内容
                string[] profiles = XCoreEditor.GetXProfileNames();
                if (mWebVFS_Net_Config.Configs != null && mWebVFS_Net_Config.Configs.Length > 0)
                {
                    List <WebVFSNetworkConfig.NetworkConfig> list_temp = new List <WebVFSNetworkConfig.NetworkConfig>(mWebVFS_Net_Config.Configs);
                    for (var i = list_temp.Count - 1; i >= 0; i--)
                    {
                        if (!profiles.Contains(list_temp[i].ProfileName))
                        {
                            list_temp.RemoveAt(i);
                        }
                    }
                    if (list_temp.Count != mWebVFS_Net_Config.Configs.Length)
                    {
                        mWebVFS_Net_Config.Configs = list_temp.ToArray();
                    }
                }

                AssetDatabase.SaveAssets();
                #endregion
            }

            //重置cache的已记录值
            if (GUILayout.Button(IsChinese ? "重置设置" : "Reset modify", GUILayout.Width(100)))
            {
                assetLocation_cache?.Clear();
                disable_expansionGroup_cache?.Clear();
                addConfiguredValueToCache();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            #endregion
            GUILayout.Space(5);

            GUILayout.EndVertical();
        }