本文整理汇总了C#中IniFile.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# IniFile.Sort方法的具体用法?C# IniFile.Sort怎么用?C# IniFile.Sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IniFile
的用法示例。
在下文中一共展示了IniFile.Sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main( string[] arguments )
{
if (0 == arguments.Length) {
showUsage();
return 0;
}
IniFile ini;
string outfile = null;
ini = new IniFile();
for (int i = 0; i < arguments.Length; i++) {
string a = arguments[i];
if (a[0] == '-' || a[0] == '/' || a[0] == '!') {
while (a[0] == '-' || a[0] == '/') {
a = a.Substring(1);
}
string al = a.ToLower();
if (al.Equals("?") || al.StartsWith("help")) {
showUsage();
return 0;
} else if (al.StartsWith("q") || al.StartsWith("!q")) {
quiet = al.StartsWith("q");
} else if (al.StartsWith("v") || al.StartsWith("!v")) {
verbose = al.StartsWith("v");
//
// Output file..
//
} else if (al.StartsWith("o")) {
outfile = a;
//
// Expand output (adds space between sections and before/after the equal sign)..
//
} else if (al.StartsWith("expand") || al.StartsWith("!expand")) {
ini.Expand = al.StartsWith("expand");
//
// Case sensitivity..
//
} else if (al.Equals("i") || al.StartsWith("case-i") || al.StartsWith("casei")) {
ini.SectionsStringComparison = StringComparison.CurrentCultureIgnoreCase;
ini.EntriesStringComparison = StringComparison.CurrentCultureIgnoreCase;
} else if (al.StartsWith("!i") || al.StartsWith("case-s") || al.StartsWith("cases")) {
ini.SectionsStringComparison = StringComparison.CurrentCulture;
ini.EntriesStringComparison = StringComparison.CurrentCulture;
} else if (al.Equals("sections-is")) {
ini.SectionsStringComparison = StringComparison.CurrentCultureIgnoreCase;
} else if (al.Equals("sections-cs")) {
ini.SectionsStringComparison = StringComparison.CurrentCulture;
} else if (al.Equals("entries-is")) {
ini.EntriesStringComparison = StringComparison.CurrentCultureIgnoreCase;
} else if (al.Equals("entries-cs")) {
ini.EntriesStringComparison = StringComparison.CurrentCulture;
//
// Sort direction..
//
} else if (al.Equals("sort-asc") || al.Equals("sortasc")) {
ini.SectionsSortOption = SortOption.Ascending;
ini.EntriesSortOption = SortOption.Ascending;
} else if (al.Equals("sort-desc") || al.Equals("sortdesc")) {
ini.SectionsSortOption = SortOption.Descending;
ini.EntriesSortOption = SortOption.Descending;
} else if (al.Equals("!sort") || al.Equals("!sort")) {
ini.SectionsSortOption = SortOption.None;
ini.EntriesSortOption = SortOption.None;
} else if (al.Equals("sections") || al.Equals("sections-asc")) {
ini.SectionsSortOption = SortOption.Ascending;
} else if (al.Equals("sections-desc")) {
ini.SectionsSortOption = SortOption.Descending;
} else if (al.Equals("!sections")) {
ini.SectionsSortOption = SortOption.None;
} else if (al.Equals("entries") || al.Equals("entries-asc")) {
ini.EntriesSortOption = SortOption.Ascending;
} else if (al.Equals("entries-desc")) {
ini.EntriesSortOption = SortOption.Descending;
} else if (al.Equals("!entries")) {
ini.EntriesSortOption = SortOption.None;
} else {
if (!quiet) {
Console.WriteLine("Unknown option: " + a);
}
}
} else {
if (ini.FileName == null || ini.FileName.Length == 0) {
ini.FileName = a;
while (ini.FileName.StartsWith("\"") && ini.FileName.EndsWith("\"")) {
ini.FileName = ini.FileName.Substring(1, ini.FileName.Length - 2);
}
} else if (outfile == null || outfile.Length == 0) {
//.........这里部分代码省略.........