Skip to content

Commit

Permalink
Support Load old SC FIle
Browse files Browse the repository at this point in the history
  • Loading branch information
flier268 committed Jun 2, 2018
1 parent de8bf61 commit 012f8cd
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Minecraft_updater/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號
// 指定為預設值:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.5")]
[assembly: AssemblyFileVersion("1.0.1.5")]
[assembly: AssemblyVersion("1.0.1.6")]
[assembly: AssemblyFileVersion("1.0.1.6")]
6 changes: 5 additions & 1 deletion Minecraft_updater/updatepackMaker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Menu Grid.Row="0" Visibility="Hidden"/>
<Menu Grid.Row="0" Background="#00000000" Margin="0,0,0,10">
<MenuItem Header="Files">
<MenuItem Header="Load" Click="LoadList"/>
</MenuItem>
</Menu>

<DockPanel Grid.Row="1">
<TextBox x:Name="textBox" TextWrapping="Wrap" Text="http://aaa.bb.com/" Width="380" AllowDrop="False"/>
Expand Down
46 changes: 42 additions & 4 deletions Minecraft_updater/updatepackMaker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;

Expand Down Expand Up @@ -112,10 +113,6 @@ private void TextBlock_Drop(object sender, DragEventArgs e)
TextBlock2.Text += (sb2.ToString());
TextBlock3.Text += (sb3.ToString());
}
}
private void AddToTextBlock1()
{

}
private void TextBlock_DropOver(object sender, DragEventArgs e)
{
Expand Down Expand Up @@ -170,5 +167,46 @@ private void Clear(object sender, RoutedEventArgs e)
else
TextBlock2.Text = "";
}

private void LoadList(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "sc|*.sc";
openFileDialog.FileName = "updatePackList.sc";
openFileDialog.Title = "Select a old sc File";
if (openFileDialog.ShowDialog() == true)
{
Regex r = new Regex("(.*?)\\|\\|(.*?)\\|\\|(.*)", RegexOptions.Singleline);
StringBuilder stringBuilder1 = new StringBuilder();
StringBuilder stringBuilder2 = new StringBuilder();
StringBuilder stringBuilder3 = new StringBuilder();
using (StreamReader streamReader = new StreamReader(openFileDialog.FileName))
{
while (!streamReader.EndOfStream)
{
string s = streamReader.ReadLine();
if (s.StartsWith("#"))
{
stringBuilder2.AppendLine(s);
}
else if (s.StartsWith(":"))
{
stringBuilder3.AppendLine(s);
}
else
{
Match m = r.Match(s);
if (m.Success)
{
stringBuilder1.AppendLine(s);
}
}
}
}
TextBlock1.Text = stringBuilder1.ToString();
TextBlock2.Text = stringBuilder2.ToString();
TextBlock3.Text = stringBuilder3.ToString();
}
}
}
}

0 comments on commit 012f8cd

Please sign in to comment.