Skip to content

Commit

Permalink
v.1.3.7.0, 2014-02-15, 05:51:45
Browse files Browse the repository at this point in the history
+ Tag reader: Support Spotify and NSFPlay
+ Tag reader: Chrome support for YouTube/SoundCloud/Spotify
+ Tag reader: Retrieve any regex group from tag pattern
+ Sharekeys: copy tag/server config between users over IRC
= Reduced stuttering/static/silence (CPU starvation)
= Old tag reader profiles couldn't be saved in 1.3.6.7 orz
  • Loading branch information
9001 committed Oct 12, 2015
1 parent f2063f8 commit fbc34fd
Show file tree
Hide file tree
Showing 13 changed files with 759 additions and 126 deletions.
2 changes: 2 additions & 0 deletions Loopstream/LSEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ string esc(string raw)
protected void makeShouter()
{
logger.a("make shouter");
proc.PriorityClass = System.Diagnostics.ProcessPriorityClass.High;

System.Net.Sockets.NetworkStream prepS;
string ver = Application.ProductVersion;
string auth = string.Format("{0}:{1}", settings.user, settings.pass);
Expand Down
263 changes: 201 additions & 62 deletions Loopstream/LSSettings.cs

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions Loopstream/LSTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public static LSTD get(LSSettings.LSMeta m, bool getRaw)
{
string ret = "";
string lpm = "";
bool hadError = false;
ProcessModule pm = null;
byte[] raw = new byte[1024];
string[] ad = m.ptn.Split(' ');
Expand Down Expand Up @@ -200,11 +201,12 @@ public static LSTD get(LSSettings.LSMeta m, bool getRaw)
ofs += Convert.ToInt32(arg, 16);
ret += a == 0 ? "" : " - ";
int len = mem.read(ofs, raw, steps);
if (len <= 0)
if (len < 0)
{
ret += "(read error)";
hadError = true;
}
else
else if (len > 0)
{
ret += m.enc.GetString(raw);
int i = ret.IndexOf('\0');
Expand All @@ -214,7 +216,7 @@ public static LSTD get(LSSettings.LSMeta m, bool getRaw)
}
}
}
return new LSTD(true, ret, "SUCCESS");
return new LSTD(!hadError, ret, hadError ? "Could not peek into the target application.\n\nThe media player is likely a 32bit process, while\nLoopstream is running in 64bit mode\n(or the other way around)." : "SUCCESS");
}
catch
{
Expand Down Expand Up @@ -247,11 +249,12 @@ public static LSTD get(LSSettings.LSMeta m, string raw)
{
return new LSTD(false, "(bad regex)", "The Pattern in this profile has a typo,\nor is otherwise broken. Call techsupport.\n\nPattern: " + m.ptn);
}
if (r.Count > m.grp)
if (r.Count > m.yi.max)
{
try
{
string ret = r[m.grp].Value.Trim(' ', '\t', '\r', '\n'); // you can never be too sure
//string ret = r[m.grp].Value.Trim(' ', '\t', '\r', '\n'); // you can never be too sure
string ret = m.yi.format(r);
if (m.urldecode)
{
string[] sanitize = {
Expand Down
9 changes: 9 additions & 0 deletions Loopstream/Loopstream.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI_input.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI_input.Designer.cs">
<DependentUpon>UI_input.cs</DependentUpon>
</Compile>
<Compile Include="UI_Msg.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -223,6 +229,9 @@
<EmbeddedResource Include="UI_Home.resx">
<DependentUpon>UI_Home.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI_input.resx">
<DependentUpon>UI_input.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI_Msg.resx">
<DependentUpon>UI_Msg.cs</DependentUpon>
</EmbeddedResource>
Expand Down
2 changes: 2 additions & 0 deletions Loopstream/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ static void Main(string[] args)
tools = tools.Substring(tools.Replace('\\', '/').LastIndexOf('/') + 1);
tools = tools.Split('.')[0];
tools += "Tools\\";

System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.High;

Logger.init();
rnd = new Random();
Expand Down
4 changes: 2 additions & 2 deletions Loopstream/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.6.7")]
[assembly: AssemblyFileVersion("1.3.6.7")]
[assembly: AssemblyVersion("1.3.7.0")]
[assembly: AssemblyFileVersion("1.3.7.0")]
134 changes: 81 additions & 53 deletions Loopstream/UI_ConfigSC.Designer.cs

Large diffs are not rendered by default.

153 changes: 149 additions & 4 deletions Loopstream/UI_ConfigSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,10 @@ private void gSource_TextChanged(object sender, EventArgs e)
string metaRaw = null;
private void gPattern_TextChanged(object sender, EventArgs e)
{
settings.meta.ptn = gPattern.Text;
if (sender == gPattern)
{
settings.meta.ptn = gPattern.Text;
}
bool mem = settings.meta.reader == LSSettings.LSMeta.Reader.ProcessMemory;
if (gTest.Checked || mem)
{
Expand Down Expand Up @@ -1041,7 +1044,8 @@ void loadMetaReader(bool redoPresets)
gURLDecode.Checked = settings.meta.urldecode;
gLatinize.Checked = settings.latin;
gTest.Checked = doRegexTests;
gGroup.Text = settings.meta.grp.ToString();
//gGroup.Text = settings.meta.grp.ToString();
gYield.Text = settings.meta.yield;

if (redoPresets)
{
Expand All @@ -1057,11 +1061,11 @@ void loadMetaReader(bool redoPresets)
}
}

private void gGroup_TextChanged(object sender, EventArgs e)
/*private void gGroup_TextChanged(object sender, EventArgs e)
{
int n = getValue(gGroup);
if (n >= 0) settings.meta.grp = n;
}
}*/

private void gTagMan_CheckedChanged(object sender, EventArgs e)
{
Expand Down Expand Up @@ -1605,5 +1609,146 @@ private void label29_Click(object sender, EventArgs e)
Clipboard.Clear();
Clipboard.SetText(ret);
}

private string serialize(LSSettings.LSMeta lsm)
{
var cfg = new System.Xml.XmlWriterSettings();
cfg.NamespaceHandling = System.Xml.NamespaceHandling.OmitDuplicates;
cfg.NewLineHandling = System.Xml.NewLineHandling.None;
cfg.NewLineOnAttributes = false;
cfg.OmitXmlDeclaration = true;
cfg.Indent = false;

var sb = new StringBuilder();
var x = new System.Xml.Serialization.XmlSerializer(lsm.GetType());
var w = System.Xml.XmlWriter.Create(sb, cfg);
x.Serialize(w, lsm);
w.Flush();
w.Close();
return sb.ToString();
}

private void gTagexport_Click(object sender, EventArgs e)
{
LSSettings.LSMeta lsm = LSSettings.LSMeta.copy(settings.meta);
bool shredText = DialogResult.No == MessageBox.Show(
"Do you want to KEEP the description text when sharing this profile?\n\n" +
"Selecting NO will make the share-key shorter,\n" +
"but the description may be useful for the recipient.",
"Share entire profile?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (shredText) lsm.desc = "";

string key = serialize(lsm);
key = key.Substring(key.IndexOf('>') + 1);
key = key.Substring(0, key.LastIndexOf('<'));
//string gz = Z.gze(key);
//string xz = Z.lze(key);
key = Z.gze(key);
key = "##gz#" + key + "##";
Clipboard.Clear();
Clipboard.SetText(key);
if (DialogResult.Yes == MessageBox.Show(
"The share-key has been made, and put on your clipboard.\n\n" +
"Length: " + key.Length + " characters.\n\n" +
//"Length: " + gz.Length + " characters.\n\n" +
//"Length: " + xz.Length + " characters.\n\n" +
"You should share this with Pastebin or bpaste.\n" +
"Open bpaste now?",
"OK !", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
System.Diagnostics.Process.Start("http://bpaste.net/");
}
}

private void gTagimport_Click(object sender, EventArgs e)
{
string key = Clipboard.GetText();
if (!key.Contains("#gz#"))
{
if (key.ToLower().Contains("bpaste.net"))
{
// http://bpaste.net/show/PNaO8zoBtZdPRv8NLoNs/
// http://bpaste.net/raw/PNaO8zoBtZdPRv8NLoNs/
var r = Regex.Match(key, "(.*[^a-zA-Z0-9]|^)bpaste.net/[^/]*/([^/]*)(/|$)", RegexOptions.IgnoreCase).Groups;
if (r.Count > 2)
{
key = new System.Net.WebClient().DownloadString("http://bpaste.net/raw/" + r[2].Value + "/");
}
}
else if (key.ToLower().Contains("pastebin.com"))
{
// http://pastebin.com/gbwsufzV
// http://pastebin.com/raw.php?i=gbwsufzV
var r = Regex.Match(key, ".*(.*[^a-zA-Z0-9]|^)pastebin.com.*[/=]([^/=]*)$", RegexOptions.IgnoreCase).Groups;
if (r.Count > 2)
{
key = new System.Net.WebClient().DownloadString("http://pastebin.com/raw.php?i=" + r[2].Value + "/");
}
}
}
try
{
int i = key.IndexOf("gz#");
int j = key.IndexOf("#", i + 4);
if (i < 0 || j < 0) throw new Exception();
i += 3;
key = key.Substring(i, j - i);
}
catch
{
MessageBox.Show(
"Padding error\n\n" +
"Sorry, but the share-key is invalid.");
return;
}
try
{
key = Z.gzd(key);
}
catch
{
MessageBox.Show(
"Decoder error\n\n" +
"Sorry, but the share-key is invalid.");
return;
}
LSSettings.LSMeta fds = new LSSettings.LSMeta();
try
{
string chrome = serialize(fds);
string chrome1 = chrome.Substring(0, chrome.IndexOf('>') + 1);
string chrome2 = chrome.Substring(chrome.LastIndexOf('<'));
key = chrome1 + key + chrome2;

var sr = new System.IO.StringReader(key);
var ds = new System.Xml.Serialization.XmlSerializer(typeof(LSSettings.LSMeta));
fds = (LSSettings.LSMeta)ds.Deserialize(sr);
}
catch
{
MessageBox.Show(
"Serializer error\n\n" +
"Sorry, but the share-key is invalid:\n\n" +
key);
return;
}
UI_input inp = new UI_input(fds, settings.metas);
inp.ShowDialog();
if (inp.wasAdded)
{
loadMetaReader(true);
gMeta.SelectedItem = settings.metas[settings.metas.Count - 1];
}
}

private void gYield_TextChanged(object sender, EventArgs e)
{
if (sender == gYield)
{
settings.meta.yield = gYield.Text;
}
//this.Text = settings.meta.yi.assert();
gPattern_TextChanged(sender, e);
}
}
}
1 change: 1 addition & 0 deletions Loopstream/UI_Home.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ private void gConnect_Click(object sender, EventArgs e)
Application.DoEvents();

System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(discthread));
//t.Priority = System.Threading.ThreadPriority.Highest;
t.Name = "LS_DISC";
t.Start();
}
Expand Down
100 changes: 100 additions & 0 deletions Loopstream/UI_input.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fbc34fd

Please sign in to comment.