Skip to content

Commit b3392ce

Browse files
committed
1.1: EXCEPT mode
added functionality: 'before' date lower than 'after' date will remove everything except the specified date range.
1 parent 4dd82d3 commit b3392ce

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

Program.cs

+20-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ enum Modes {
99
BEFORE,
1010
AFTER,
1111
BETWEEN,
12-
NONE
12+
NONE,
13+
EXCEPT
1314
}
1415

1516
class Program
@@ -111,7 +112,17 @@ public static void Main(string[] args)
111112
}
112113

113114
dates[1] = ToUnixTime(new DateTime(afterT.Ticks, DateTimeKind.Local));
114-
}
115+
}
116+
117+
118+
if(before && after && dates[0] < dates[1]) {
119+
mode = Modes.EXCEPT;
120+
}
121+
122+
ConsoleColor old = Console.ForegroundColor;
123+
Console.ForegroundColor = ConsoleColor.Yellow;
124+
Console.WriteLine("Mode: {0}", mode);
125+
Console.ForegroundColor = old;
115126

116127
// if document isn't a netscape bookmarks file, quit
117128
String file_content = File.ReadAllText(path, Encoding.UTF8);
@@ -154,7 +165,14 @@ public static void Main(string[] args)
154165
Console.WriteLine("REMOVED: {0}", m.Groups["title"].Value);
155166
}
156167
break;
168+
case Modes.EXCEPT:
169+
if(date < dates[0] || date > dates[1]) {
170+
result = result.Replace(m.Value, "");
171+
Console.WriteLine("REMOVED: {0}", m.Groups["title"].Value);
172+
}
173+
break;
157174
case Modes.NONE:
175+
default:
158176
Console.WriteLine("An unknown error occured.");
159177
break;
160178
}

Properties/AssemblyInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
//
2929
// You can specify all the values or you can use the default the Revision and
3030
// Build Numbers by using the '*' as shown below:
31-
[assembly: AssemblyVersion("1.0.*")]
31+
[assembly: AssemblyVersion("1.1.*")]

0 commit comments

Comments
 (0)