Exemplo n.º 1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            await NameMap.Read();

            if (e.Parameter is Qusition)
            {
                qusition = (Qusition)e.Parameter;
                if (qusition.Qlabel1 == "")
                {
                    Label1.Visibility = Visibility.Collapsed;
                }
                if (qusition.QLabel2 == "")
                {
                    Label2.Visibility = Visibility.Collapsed;
                }
                SetBlockValue();
                Qusitionid = qusition.Qusitionid;
                Askerid    = qusition.Askerid;
                await GetAllAnswer(qusition.Qusitionid);
            }
            else if (e.Parameter is Answershow answershow)
            {
                someoneshow = answershow;
                await GetById(someoneshow.Qusitionid);
            }
            else if (e.Parameter is int ID)
            {
                await GetById(ID);
            }
            base.OnNavigatedTo(e);
        }
Exemplo n.º 2
0
        public static bool VerifyCLRVersionInfo(Version v, string procArch)
        {
            bool flag = true;

            NameMap[]     nmArray           = new NameMap[] { new NameMap("x86", 8), new Product("ia64", 2), new Product("amd64", 4) };
            uint          runtimeInfoFlags  = NameMap.MapNameToMask(procArch, nmArray) | 0x1c1;
            StringBuilder pDirectory        = new StringBuilder(260);
            StringBuilder pVersion          = new StringBuilder("v65535.65535.65535".Length);
            uint          dwDirectoryLength = 0;
            uint          dwLength          = 0;
            string        pwszVersion       = v.ToString(3);

            pwszVersion = "v" + pwszVersion;
            try
            {
                System.Deployment.Application.NativeMethods.GetRequestedRuntimeInfo(null, pwszVersion, null, 0, runtimeInfoFlags, pDirectory, (uint)pDirectory.Capacity, out dwDirectoryLength, pVersion, (uint)pVersion.Capacity, out dwLength);
            }
            catch (COMException exception)
            {
                flag = false;
                if (exception.ErrorCode != -2146232576)
                {
                    throw;
                }
            }
            return(flag);
        }
Exemplo n.º 3
0
        public Column CreateColumn(string tableName, string columnName)
        {
            FireEvent(PropertyNameFormatting, new SchemaExtractorEventArgs {
                Column = columnName
            });
            string propertyName = AvoidCollision(GetPropertyName(tableName, columnName), tableName, columnName);

            propertyName = AvoidNameOfContainingType(propertyName, tableName, columnName);
            NameMap.Set(new ColumnNameToPropertyName {
                ColumnName = columnName, PropertyName = propertyName, TableName = tableName
            });
            FireEvent(PropertyNameFormatted, new SchemaExtractorEventArgs {
                Column = columnName
            });

            Column column = new Column(columnName, GetColumnDataType(tableName, columnName))
            {
                PropertyName = propertyName,
                DataType     = GetColumnDataType(tableName, columnName),
                DbDataType   = GetColumnDbDataType(tableName, columnName),
                MaxLength    = GetColumnMaxLength(tableName, columnName),
                AllowNull    = GetColumnNullable(tableName, columnName)
            };

            return(column);
        }
Exemplo n.º 4
0
        public Form1()
        {
            InitializeComponent();


            GameFoldersForm gff = new GameFoldersForm();

            gff.ShowInTaskbar = true;
            gff.StartPosition = FormStartPosition.CenterScreen;

            bool   ccEnabled     = GetClips.Properties.Settings.Default.CustomContentEnabled;
            string customContent = GetClips.Properties.Settings.Default.CustomContentPath;
            string installDirs   = GetClips.Properties.Settings.Default.InstallDirs;
            string epsDisabled   = GetClips.Properties.Settings.Default.EPsDisabled;

            for (DialogResult dr = DialogResult.Retry; dr == DialogResult.Retry;)
            {
                gff.CCEnabled     = ccEnabled;
                gff.CustomContent = customContent;
                gff.InstallDirs   = installDirs;
                gff.EPsDisabled   = epsDisabled;
                dr = gff.ShowDialog();
            }
            GetClips.Properties.Settings.Default.CustomContentEnabled = FileTable.CustomContentEnabled = gff.CCEnabled;
            GetClips.Properties.Settings.Default.CustomContentPath    = FileTable.CustomContentPath = gff.CustomContent;
            GetClips.Properties.Settings.Default.InstallDirs          = GameFolders.InstallDirs = gff.InstallDirs;
            GetClips.Properties.Settings.Default.EPsDisabled          = epsDisabled;
            GetClips.Properties.Settings.Default.Save();

            FileTable.FileTableEnabled = true;

            NameMap.Reset();
        }
        private async Task DeleteFollow(UserFollow userFollow, AppBarButton appBarButton)
        {
            HttpClient httpClient = new HttpClient();

            httpClient.DefaultRequestHeaders.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            var content = new StringContent(JsonConvert.SerializeObject(userFollow), Encoding.UTF8, "application/json");
            HttpResponseMessage httpResponseMessage = await httpClient.PostAsync("http://localhost:60671/api/values/deletefollow", content);

            if (httpResponseMessage.IsSuccessStatusCode)
            {
                var res = await httpResponseMessage.Content.ReadAsAsync <bool>();

                if (res == true)
                {
                    var listviewitem = NameMap.FindParent <ListViewItem>(appBarButton);
                    if (listviewitem != null)
                    {
                        var contact   = (listviewitem.ContentTemplateRoot as FrameworkElement)?.FindName("Contact") as AppBarButton;
                        var addfriend = (listviewitem.ContentTemplateRoot as FrameworkElement)?.FindName("AddFriend") as AppBarButton;
                        contact.Visibility   = Visibility.Collapsed;
                        addfriend.Visibility = Visibility.Visible;
                    }
                }
            }
        }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        NameMap = this.name;
        Field   = NameMap.Replace("MapGridCell", "");
        //Field = NameMap;
        Vector2 pos = Helper.GetPositByField(Field);

        X = (int)pos.x;
        Y = (int)pos.y;

        //Debug.Log("--------------- Start Load Map Cell " + name);
        LabelCellMapGrid.text = X + "x" + Y;

        //if (X == 2 && Y == 1)
        //{
        //if ((X == 1 && Y == 1) ||
        //    (X == 2 && Y == 1) ||
        //    (X == 1 && Y == 2) ||
        //    (X == 2 && Y == 2))
        //if ((X == 1 && Y == 1) ||
        //    (X == 1 && Y == 2) ||
        //    (X == 3 && Y == 1) ||
        //    (X == 12 && Y == 1))
        //{

        //}
    }
Exemplo n.º 7
0
/*
 * new {
 *  Table = "Customer",
 *  Where = new {
 *      Name = "Monkey",
 *      And = new {
 *          LastName = "Tail"
 *      },
 *      Or = new {
 *          LastName = "Guy"
 *      }
 *  }
 * }
 * */
        private QueryFilter ParseWhere(string tableName, dynamic where)
        {
            Type        type   = where.GetType();
            QueryFilter filter = new QueryFilter();

            foreach (PropertyInfo prop in type.GetProperties())
            {
                if (TablePropertyNames.Contains(prop.Name))
                {
                    continue;
                }
                if (prop.Name.Equals("And"))
                {
                    object and = prop.GetValue(where);
                    filter = filter.IsEmpty ? ParseWhere(tableName, and) : filter && ParseWhere(tableName, and);
                }
                else if (prop.Name.Equals("Or"))
                {
                    object or = prop.GetValue(where);
                    filter = filter.IsEmpty ? ParseWhere(tableName, or) : filter || ParseWhere(tableName, or);
                }
                else if (prop.Name.Equals("Where"))
                {
                    filter = filter.IsEmpty ? ParseWhere(tableName, prop.GetValue(where)) : filter && ParseWhere(tableName, where);
                }
                else
                {
                    // TODO: enable multiple operators like QiQuery, contains, doesn't contain starts with etc
                    string      columnName  = NameMap.GetColumnName(tableName, prop.Name);
                    QueryFilter queryFilter = Bam.Net.Data.Query.Where(columnName) == prop.GetValue(where);
                    filter = filter.IsEmpty ? queryFilter : filter && queryFilter;
                }
            }
            return(filter);
        }
Exemplo n.º 8
0
        private async Task ContentDiashow(AppBarButton appBarButton)
        {
            ContentDialog contentDialog = new ContentDialog
            {
                Title               = "是否删除?",
                PrimaryButtonText   = "删除",
                SecondaryButtonText = "取消",
            };

            contentDialog.PrimaryButtonClick += (_s, _e) =>
            {
                var list = NameMap.FindParent <ListViewItem>(appBarButton);
                if (RootPivot.SelectedIndex == 0)
                {
                    drafts.RemoveAt(Draftlist.IndexFromContainer(list));
                }
                else if (RootPivot.SelectedIndex == 1)
                {
                    answerDrafts.RemoveAt(AnswerList.IndexFromContainer(list));
                }
            };
            contentDialog.SecondaryButtonClick += (_s, _e) =>
            {
            };
            await contentDialog.ShowAsync();
        }
Exemplo n.º 9
0
        public U?GetId(string name)
        {
            if (name == null)
            {
                return(null);
            }

            if (!NameMap.ContainsKey(name))
            {
                using (Models.BodyDbContext ctx = new Models.BodyDbContext())
                {
                    T map = ctx.Set <T>().FirstOrDefault(v => v.Name == name);

                    if (map == null)
                    {
                        map = new T {
                            Name = name
                        };
                        ctx.Set <T>().Add(map);
                        ctx.SaveChanges();
                    }

                    IdMap[map.Id]     = map;
                    NameMap[map.Name] = map;
                }
            }

            return(NameMap[name].Id);
        }
Exemplo n.º 10
0
 public nameconfig GetNameConfig(short uiKey)
 {
     if (NameMap.ContainsKey(uiKey))     //检查是否有该键值
     {
         return(NameMap[uiKey]);
     }
     return(null);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Returns the index of the given column name.
 /// </summary>
 /// <param name="name">The name of the column to find.</param>
 /// <returns>The numeric index of column.</returns>
 public int IndexOf(string name)
 {
     if (!NameMap.ContainsKey(name))
     {
         throw new MySqlException("Column not found '" + name + "'");
     }
     return(NameMap[name]);
 }
Exemplo n.º 12
0
        public static NameToken Create(string name)
        {
            if (!NameMap.TryGetValue(name, out var value))
            {
                return(new NameToken(name));
            }

            return(value);
        }
Exemplo n.º 13
0
 private void SetClassNamesOnColumns(SchemaManager schemaManager)
 {
     schemaManager.CurrentSchema.Tables.Each(table =>
     {
         table.Columns.Each(col =>
         {
             col.TableClassName = NameMap.GetClassName(table.Name);
         });
     });
 }
Exemplo n.º 14
0
        static NameMap DecodeNames(string names)
        {
            NameMap map;

            if (!maps.TryGetValue(names.GetHashCode(), out map))
            {
                //$Id:Value,1:Name,2:Address,3:CountryAndTown
                //$,0:Item.agg:Code:Narrative,1:Item.agg.prev:Narrative
                string[] item;
                var      idName    = string.Empty;
                var      valueName = string.Empty;
                var      items     = names.Substring(1).Split(new[] { ',' });
                if (!string.IsNullOrWhiteSpace(items[0]))
                {
                    item      = items[0].Split(new[] { ':' });
                    idName    = item[0];
                    valueName = item[1];
                }

                var keyName = new Dictionary <string, NameMap.NameMapItem>(); string[] others; string[] options;
                var fromIndex = 0; bool agg;
                for (int i = 1, l = items.Length; i < l; i++)
                {
                    item    = items[i].Split(new[] { ':' });
                    options = item[0].Split(new[] { '.' });
                    item[0] = options[0];
                    agg     = Array.IndexOf <string>(options, "agg") > -1;

                    fromIndex = agg ? 2 : string.IsNullOrWhiteSpace(idName) ? 1 : 2;

                    others = new string[item.Length - fromIndex];
                    if (others.Length != 0)
                    {
                        Array.Copy(item, fromIndex, others, 0, item.Length - fromIndex);
                    }

                    keyName.Add(item[0], new NameMap.NameMapItem
                    {
                        ValueKey  = agg || !string.IsNullOrWhiteSpace(idName) ? item[1] : null,
                        Others    = others,
                        Aggregate = agg,
                        Previous  = Array.IndexOf <string>(options, "prev") > -1
                    });
                }
                maps[names.GetHashCode()] = map = new NameMap
                {
                    Id      = idName,
                    Value   = valueName,
                    KeyName = keyName,
                    ByIndex = string.IsNullOrWhiteSpace(idName) && string.IsNullOrWhiteSpace(idName)
                };
            }
            return(map);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Creates a new <see cref="NameToken"/> with the given name, ensuring only one instance of each
        /// <see cref="NameToken"/> can exist.
        /// </summary>
        /// <param name="name">The string representation of the name for the token to create.</param>
        /// <returns>The created or existing token.</returns>
        public static NameToken Create([NotNull] string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (!NameMap.TryGetValue(name, out var value))
            {
                return(new NameToken(name));
            }

            return(value);
        }
Exemplo n.º 16
0
        private string AvoidNameOfContainingType(string propertyName, string tableName, string columnName)
        {
            string className = NameMap.GetClassName(tableName);
            string result    = propertyName;

            if (propertyName.Equals(className))
            {
                result = _namingCollisionHandlers[SchemaExtractorNamingCollisionStrategy](propertyName, tableName, columnName);
                FireEvent(PropertyNameCollisionAvoided, new SchemaExtractorEventArgs {
                    Table = tableName, Column = columnName, Property = propertyName
                });
            }
            return(result);
        }
Exemplo n.º 17
0
        private List <AssignValue> GetValueAssignments(dynamic value, string tableName)
        {
            Type type = value.GetType();
            List <AssignValue> assignValues = new List <AssignValue>();

            foreach (PropertyInfo prop in type.GetProperties())
            {
                if (KeywordProperties.Contains(prop.Name))
                {
                    continue;
                }
                assignValues.Add(new AssignValue(NameMap.GetColumnName(tableName, prop.Name), prop.GetValue(value)));
            }
            return(assignValues);
        }
        private async void DislikeButton_Click(object sender, RoutedEventArgs e)
        {
            AppBarButton appBarButton = (AppBarButton)sender;
            ListViewItem listViewItem = NameMap.FindParent <ListViewItem>(appBarButton);
            var          fore         = appBarButton.Foreground as SolidColorBrush;

            if (fore.Color == Colors.Blue)
            {
                await DelPutDisLike(people.UserId, myStruct.id, Convert.ToInt32(appBarButton.Tag));
            }
            else
            {
                await PutDisLike(people.UserId, myStruct.id, Convert.ToInt32(appBarButton.Tag));
            }
        }
Exemplo n.º 19
0
 private async void AutoSearch_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (sender.Text.Length >= 1)
     {
         string text = NameMap.ChangeMap(sender.Text);
         await GetLabel(text);
         await GetArtical(text);
         await GetQusiton(text);
         await GetPeople(text);
     }
     else
     {
         sender.PlaceholderText = "输入内容";
     }
 }
Exemplo n.º 20
0
        private void Modifyinf(int Userid, int id)
        {
            var ans = answers.Where(p => p.Userid == Userid).FirstOrDefault();
            List <AppBarButton> appBarButtons = NameMap.GetChildObjects <AppBarButton>(CurrentAnswerList);

            if (id == 0)
            {
                var apps = appBarButtons.Where(p => p.Name == "LikeButton" && Convert.ToInt32(p.Tag) == Userid).FirstOrDefault();
                if (apps != null)
                {
                    var fore = apps.Foreground as SolidColorBrush;
                    if (fore.Color == Colors.Black)
                    {
                        ans.UpAnsnum++;
                        apps.Foreground = new SolidColorBrush(Colors.Blue);
                        NameMap.UPAnswer.Add($"{qusition.Qusitionid} {apps.Tag} {Myid}");
                    }
                    else
                    {
                        ans.UpAnsnum--;
                        apps.Foreground = new SolidColorBrush(Colors.Black);
                        NameMap.UPAnswer.Remove($"{qusition.Qusitionid} {apps.Tag} {Myid}");
                    }
                    apps.Label = ans.UpAnsnum.ToString();
                }
            }
            else if (id == 1)
            {
                var apps = appBarButtons.Where(p => p.Name == "DislikeButton" && Convert.ToInt32(p.Tag) == Userid).FirstOrDefault();
                if (apps != null)
                {
                    var fore = apps.Foreground as SolidColorBrush;
                    if (fore.Color == Colors.Black)
                    {
                        ans.DownAnsnum++;
                        apps.Foreground = new SolidColorBrush(Colors.Blue);
                        NameMap.DNAnswer.Add($"{qusition.Qusitionid} {apps.Tag} {Myid}");
                    }
                    else
                    {
                        ans.DownAnsnum--;
                        apps.Foreground = new SolidColorBrush(Colors.Black);
                        NameMap.DNAnswer.Remove($"{qusition.Qusitionid} {apps.Tag} {Myid}");
                    }
                    apps.Label = ans.DownAnsnum.ToString();
                }
            }
        }
Exemplo n.º 21
0
        private void Send_Click(object sender, RoutedEventArgs e)
        {
            AppBarButton appBarButton = (AppBarButton)sender;
            var          list         = NameMap.FindParent <ListViewItem>(appBarButton);

            if (RootPivot.SelectedIndex == 0)
            {
                viewItem = list;
                Frame.Navigate(typeof(EditArtical), drafts[Draftlist.IndexFromContainer(list)]);
            }
            else if (RootPivot.SelectedIndex == 1)
            {
                vAnsItem = list;
                Frame.Navigate(typeof(MakeAnswer), answerDrafts[AnswerList.IndexFromContainer(list)]);
            }
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter is People)
            {
                people = (People)e.Parameter;
                await GetArtical(people);

                if (people.UserId == HomePage.Current.myStruct.id)
                {
                    IEnumerable <AppBarButton> appBars = (NameMap.GetChildObjects <AppBarButton>(Articallist));
                    List <AppBarButton>        apps    = appBars.Where(p => p.Name.ToLower() == "Edit").ToList();
                    apps.ForEach(p => p.Visibility = Visibility.Visible);
                }
            }
            base.OnNavigatedTo(e);
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            await NameMap.Read();

            if (e.Parameter is Artical)
            {
                artical = (Artical)e.Parameter;
                await GetComment(artical.Userid, artical.Articalid);
            }
            else if (e.Parameter is ArtComment artComment)
            {
                await GetComment(artComment.Userid, artComment.Articalid, artComment);

                FromPage = 1;
            }
            base.OnNavigatedTo(e);
        }
Exemplo n.º 24
0
        private SqlStringBuilder WriteRetrieve(string table, SqlStringBuilder sql, dynamic querySpec)
        {
            string columns = ReflectionExtensions.Property <string>(querySpec, "Columns", false) ?? "*";

            string[] columnNames = new string[] { columns };
            if (!columns.Equals("*"))
            {
                columnNames = columns.DelimitSplit(",").Select(s => NameMap.GetColumnName(table, s)).ToArray();
            }
            dynamic whereSpec = ReflectionExtensions.Property(querySpec, "Where") ?? ReflectionExtensions.Property(querySpec, "where");

            sql.Select(table);
            if (whereSpec != null)
            {
                sql.Where(ParseWhere(table, whereSpec));
            }
            return(sql);
        }
Exemplo n.º 25
0
        private string GetTableName(dynamic querySpec)
        {
            string table = ReflectionExtensions.Property <string>(querySpec, "from", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "From", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "Type", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "type", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "Table", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "TableName", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "table", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "tableName", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "Class", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "ClassName", false) ??
                           ReflectionExtensions.Property <string>(querySpec, "className", false);

            Args.ThrowIfNullOrEmpty(table, "From/Table/Class not specified");
            table = NameMap.GetTableName(table);
            return(table);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 在应用程序由最终用户正常启动时进行调用。
        /// 将在启动应用程序以打开特定文件等情况下使用。
        /// </summary>
        /// <param name="e">有关启动请求和过程的详细信息。</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += BackRequested;
            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 从之前挂起的应用程序加载状态
                }
                else if (e.PreviousExecutionState == ApplicationExecutionState.Suspended)
                {
                }

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
                await NameMap.Read();
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // 当导航堆栈尚未还原时,导航到第一页,
                    // 并通过将所需信息作为导航参数传入来配置
                    // 参数
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // 确保当前窗口处于活动状态
                Window.Current.Activate();
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = rootFrame.CanGoBack ?
                                                                                          AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
                rootFrame.Navigated += OnNavigated;
            }
        }
        /// <inheritdoc />
        public bool Remove(T setting)
        {
            ThrowIfReadOnly();
            if (!NameMap.TryGetValue(setting.MainName, out var guid))
            {
                return(false);
            }

            if (setting.IsHelp)
            {
                HasHelpCommand = false;
            }

            foreach (var name in setting.Names)
            {
                NameMap.Remove(name);
            }
            return(SettingMap.Remove(guid));
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            await NameMap.Read();

            base.OnNavigatedTo(e);
            if (e.Parameter is Artical)
            {
                artical = (Artical)e.Parameter;
                if (artical.Userid == people.UserId)
                {
                    AddFriendIcon.IsEnabled = false;
                }
                else
                {
                    await GetisFollow(artical.Userid);
                }
            }
            this.Bindings.Update();
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            await NameMap.Read();

            if (e.Parameter is Dictionary <string, string> keyValues)
            {
                Qusitionid = Convert.ToInt32(keyValues["Qusitionid"]);
                Userid     = Convert.ToInt32(keyValues["Userid"]);
                Names      = keyValues["Name"];
                await GetComment(Qusitionid, Userid);
            }
            else if (e.Parameter is Comment comment)
            {
                Comments = comment;
                await GetComments(comment.Qusitionid, comment.Userid, comment);

                FromPage = 1;
            }
            base.OnNavigatedTo(e);
        }
        /// <summary>
        /// Attempts to get the setting with the specified name.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="state"></param>
        /// <param name="setting"></param>
        /// <returns></returns>
        public bool TryGetSetting(string name, PrefixState state, out T setting)
        {
            bool InternalTryGetSetting(string deprefixedName, out T returned)
            {
                var valid = NameMap.TryGetValue(deprefixedName, out var guid);

                returned = valid ? SettingMap[guid] : default;
                return(valid);
            }

            foreach (var prefix in Prefixes)
            {
                var deprefixed = ArgumentMappingUtils.Deprefix(prefix, name, state);
                if (deprefixed != null && InternalTryGetSetting(deprefixed, out setting))
                {
                    return(true);
                }
            }
            setting = default;
            return(false);
        }
	public static string MapMaskToName(uint mask, NameMap[] nmArray) {}
	// Methods
	public static uint MapNameToMask(string name, NameMap[] nmArray) {}
 public static bool VerifyCLRVersionInfo(Version v, string procArch)
 {
     bool flag = true;
     NameMap[] nmArray = new NameMap[] { new NameMap("x86", 8), new Product("ia64", 2), new Product("amd64", 4) };
     uint runtimeInfoFlags = NameMap.MapNameToMask(procArch, nmArray) | 0x1c1;
     StringBuilder pDirectory = new StringBuilder(260);
     StringBuilder pVersion = new StringBuilder("v65535.65535.65535".Length);
     uint dwDirectoryLength = 0;
     uint dwLength = 0;
     string pwszVersion = v.ToString(3);
     pwszVersion = "v" + pwszVersion;
     try
     {
         System.Deployment.Application.NativeMethods.GetRequestedRuntimeInfo(null, pwszVersion, null, 0, runtimeInfoFlags, pDirectory, (uint) pDirectory.Capacity, out dwDirectoryLength, pVersion, (uint) pVersion.Capacity, out dwLength);
     }
     catch (COMException exception)
     {
         flag = false;
         if (exception.ErrorCode != -2146232576)
         {
             throw;
         }
     }
     return flag;
 }
Exemplo n.º 34
0
        /// <summary>
        /// 컬럼명=속성명 매핑함수를 이용하여 지정된 DataReader의 컬럼명을 속성명으로 매핑한다.
        /// </summary>
        /// <param name="reader">instance of IDataReader</param>
        /// <param name="mappingFunc">mapping function</param>
        /// <param name="propertyNamesToExclude">매핑에서 제외할 속성명</param>
        /// <returns>instance of <see cref="INameMap"/></returns>
        public static INameMap Mapping(this IDataReader reader, Func<string, string> mappingFunc, params string[] propertyNamesToExclude) {
            reader.ShouldNotBeNull("reader");
            mappingFunc.ShouldNotBeNull("mappingFunc");

            if(IsDebugEnabled)
                log.Debug("지정된 DataReader의 컬럼명을 속성명으로 매핑합니다...");

            var nameMap = new NameMap();
            var excludeNames = (propertyNamesToExclude != null) ? propertyNamesToExclude.ToList() : new List<string>();

            for(int i = 0; i < reader.FieldCount; i++) {
                var columnName = reader.GetName(i);

                if(columnName.IsNotWhiteSpace()) {
                    var propertyName = mappingFunc(columnName);

                    if(propertyName.IsNotWhiteSpace() && excludeNames.Contains(propertyName, StringComparer.Ordinal) == false)
                        nameMap.Add(columnName, propertyName);
                }
            }

            if(IsDebugEnabled)
                log.Debug("컬럼명-속성명 매핑 결과 = " + nameMap.CollectionToString());

            return nameMap;
        }
Exemplo n.º 35
0
        /// <summary>
        /// Command의 Parameter 정보와 속성 정보를 매핑한다. (ParameterName = 속성명) 형식
        /// </summary>
        /// <param name="command">instance of DbCommand to execute</param>
        /// <param name="mappingFunc">Mapping function. input = parameter name of command , result = property name of persistent object </param>
        /// <param name="propertyNamesToExclude">매핑에서 제외할 속성명</param>
        /// <returns>instance of <see cref="INameMap"/>, Key = parameter name of a specified command, Value = property name of persistent object</returns>
        public static INameMap Mapping(this DbCommand command, Func<string, string> mappingFunc, params string[] propertyNamesToExclude) {
            command.ShouldNotBeNull("command");
            mappingFunc.ShouldNotBeNull("mappingFunc");

            if(IsDebugEnabled)
                log.Debug("Command 파라미터명을 속성명으로 매핑합니다...");

            var nameMap = new NameMap();
            var excludeNames = (propertyNamesToExclude != null) ? propertyNamesToExclude.ToList() : new List<string>();

            foreach(IDataParameter parameter in command.Parameters) {
                var paramName = parameter.ParameterName.RemoveParameterPrefix();

                if(paramName.IsNotWhiteSpace()) {
                    var propertyName = mappingFunc(paramName);

                    if(propertyName.IsNotWhiteSpace() && excludeNames.Contains(propertyName, StringComparer.Ordinal) == false)
                        nameMap.Add(paramName, propertyName);
                }
            }

            if(IsDebugEnabled)
                log.Debug("Command 파라미터명-속성명 매핑 결과 = " + nameMap.CollectionToString());

            return nameMap;
        }