Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Merge pull request #17 from dedepete/dev
Browse files Browse the repository at this point in the history
1.4.5 Update
  • Loading branch information
dedepete committed Nov 26, 2014
2 parents 9554150 + 97c5f0a commit 5dd9a95
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 71 deletions.
12 changes: 11 additions & 1 deletion Luncher/Forms/Launcher/Launcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ private void GetVersions()

private void Launch(string profileJson)
{
var properties = new JObject();
try
{
var add = true;
Expand All @@ -660,6 +661,7 @@ private void Launch(string profileJson)
{
Variables.AccessToken = "1i1ii1i111ii1i1i1i1i1ii1ii1ii111";
Variables.ClientToken = "11i1111i11ii11iii1i1i11iiii11iii";
properties.Add(new JProperty("luncher", new JArray("228apasna")));
}
else
{
Expand All @@ -677,6 +679,11 @@ private void Launch(string profileJson)
}
Variables.AccessToken = jo["profiles"][peep.Name]["accessToken"].ToString();
Variables.ClientToken = jo["profiles"][peep.Name]["UUID"].ToString();
if (jo["profiles"][peep.Name]["properties"].HasValues)
foreach (JObject prop in jo["profiles"][peep.Name]["properties"])
properties.Add(new JProperty(prop["name"].ToString(), new JArray(prop["value"])));
else
properties.Add(new JProperty("luncher", new JArray("228apasna")));
}
break;
}
Expand All @@ -700,6 +707,9 @@ private void Launch(string profileJson)
Owner = this,
DetailsText = ex.Message,
}.ShowDialog();
Variables.AccessToken = "1i1ii1i111ii1i1i1i1i1ii1ii1ii111";
Variables.ClientToken = "11i1111i11ii11iii1i1i11iiii11iii";
properties.Add(new JProperty("luncher", new JArray("228apasna")));
}
HideProgressBar();
using (var thr = new BackgroundWorker())
Expand Down Expand Up @@ -729,7 +739,7 @@ private void Launch(string profileJson)
var finallibraries = _libs.Aggregate(string.Empty,
(current, a) => current + (a + ";"));
finallibraries = finallibraries.Substring(0, finallibraries.Length - 1);
var mp = new MinecraftProcess(this, usingAssets.Text, finallibraries, _assets, profileJson);
var mp = new MinecraftProcess(this, usingAssets.Text, finallibraries, _assets, profileJson, properties);
mp.Launch();
};
thr.RunWorkerAsync();
Expand Down
2 changes: 1 addition & 1 deletion Luncher/Forms/Launcher/Launcher.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4208,7 +4208,7 @@ Mojang AB является дочерней студией Microsoft Studios.</v
<value>Из них отсутствует:</value>
</data>
<data name="resources.reconstructing" xml:space="preserve">
<value>Выполняется перестойка ресурсов...</value>
<value>Выполняется перестройка ресурсов...</value>
</data>
<data name="resources.reconstructioncanceled" xml:space="preserve">
<value>Перестройка ресурсов была отменена пользователем</value>
Expand Down
3 changes: 2 additions & 1 deletion Luncher/Forms/LoginDialog/LoginDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ private void radButton1_Click(object sender, EventArgs e)
new JProperty("type", "official"),
new JProperty("accessToken", auth.SessionToken),
new JProperty("clientToken", auth.AccessToken),
new JProperty("UUID", auth.Uuid)
new JProperty("UUID", auth.Uuid),
new JProperty("properties", auth.UserProperties)
}));
File.WriteAllText(Variables.McFolder + "/luncher/userprofiles.json", jo.ToString());
Result = Localization_LoginForm.LoginDialog_Added_successfuly;
Expand Down
58 changes: 29 additions & 29 deletions Luncher/Forms/ProfileForm/ProfileForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private void GetParams(string pName)
}
else
Args.Text = @"-Xmx1G";
var ver = json.lastVersionId ?? _locRm.GetString("uselastversion");
string ver = json.lastVersionId ?? _locRm.GetString("uselastversion");
try
{
var jsonVer =
Expand All @@ -151,7 +151,7 @@ private void GetParams(string pName)
if (ver != null & ver != "")
{
var founded = false;
foreach (var a in Versions.Items.Where(a => a.Text.Contains(ver)))
foreach (var a in Versions.Items.Where(a => a.Text != _locRm.GetString("uselastversion")).Where(a => a.Text.Split(' ')[1] == ver))
{
Versions.SelectedItem = a;
founded = true;
Expand Down Expand Up @@ -247,17 +247,17 @@ private void radButton2_Click(object sender, EventArgs e)
json["profiles"] = Processing.Rename(json1, name => name == _profile ? ProfileName.Text : name);
json["selectedProfile"] = ProfileName.Text;
Newprofilename = ProfileName.Text;
JsonProfile.ProfileServer server = null;
if (ipTextBox.Text != string.Empty)
server = new JsonProfile.ProfileServer
var server = ipTextBox.Text != string.Empty
? new JObject
{
ip = ipTextBox.Text,
port = portTextBox.Text != string.Empty ? portTextBox.Text : null
};
var resolution = new JsonProfile.ProfileResolution
{"ip", ipTextBox.Text},
{"port", portTextBox.Text != string.Empty ? portTextBox.Text : null}
}
: null;
var resolution = new JObject
{
height = ResY.Text,
width = ResX.Text
{"height", ResY.Text},
{"width", ResX.Text}
};
var releasetypes = new List<string> {"release"};
if (EnableExp.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
Expand All @@ -274,25 +274,25 @@ private void radButton2_Click(object sender, EventArgs e)
gamedir[Gamedir.Text.Length - 1].ToString() == "/")
gamedir = Gamedir.Text.Substring(0, Gamedir.Text.Length - 1);
}
var version = new JsonProfile.Profile
{
name = ProfileName.Text,
lastVersionId =
!Versions.SelectedItem.Text.Contains(_locRm.GetString("uselastversion"))
? ((string) Versions.SelectedItem.Tag ??
(Versions.SelectedItem.Text.Replace(
Versions.SelectedItem.Text.Split(' ')[0] + " ", string.Empty)))
: null,
gameDir = UseDirectory.Checked ? gamedir : null,
javaDir = UseExec.Checked ? ExecJava.Text : null,
javaArgs = UseArgs.Checked ? Args.Text : null,
server = server,
resolution = resolution,
allowedReleaseTypes = releasetypes.ToArray<string>(),
launcherVisibilityOnGameClose = LState.SelectedItem.Tag.ToString()
};
dynamic version = new JObject();
version.name = ProfileName.Text;
if (!Versions.SelectedItem.Text.Contains(_locRm.GetString("uselastversion")))
version.lastVersionId = ((string) Versions.SelectedItem.Tag ??
(Versions.SelectedItem.Text.Replace(
Versions.SelectedItem.Text.Split(' ')[0] + " ", string.Empty)));
if (UseDirectory.Checked)
version.gameDir = gamedir;
if (UseExec.Checked)
version.javaDir = ExecJava.Text;
if (UseArgs.Checked)
version.javaArgs = Args.Text;
if (server != null)
version.server = server;
version.resolution = resolution;
version.allowedReleaseTypes = new JArray(releasetypes);
version.launcherVisibilityOnGameClose = LState.SelectedItem.Tag.ToString();
json["profiles"][ProfileName.Text] = JObject.FromObject(version,
new JsonSerializer {NullValueHandling = NullValueHandling.Ignore});
new JsonSerializer { NullValueHandling = NullValueHandling.Ignore });
File.WriteAllText(Variables.ProfileJsonFile, json.ToString());
Close();
}
Expand Down
30 changes: 0 additions & 30 deletions Luncher/JSONProfile.cs

This file was deleted.

3 changes: 1 addition & 2 deletions Luncher/Luncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="JSONProfile.cs" />
<Compile Include="Localization\Localization.LoginForm.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
Expand Down Expand Up @@ -288,7 +287,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties StartAt="" Versioning="0" IncrementAction="2" IncrementOnBuild="True" IncrementOnRebuild="True" IncrementInformational="False" />
<UserProperties IncrementInformational="False" IncrementOnRebuild="True" IncrementOnBuild="True" IncrementAction="2" Versioning="0" StartAt="" />
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
Expand Down
7 changes: 5 additions & 2 deletions Luncher/MinecraftProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Threading;
using System.Windows.Forms;
using Luncher.Forms.Launcher;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Telerik.WinControls.UI;

Expand All @@ -25,7 +26,7 @@ public class MinecraftProcess : McVariables

private readonly int _launcherVisibilityOnGameClose;

public MinecraftProcess(object mainForm, string assetsPath, string libraries, string assetsFileName, string jsonblock)
public MinecraftProcess(object mainForm, string assetsPath, string libraries, string assetsFileName, string jsonblock, JObject properties)
{
dynamic json = JObject.Parse(jsonblock);
if (json.javaArgs != null)
Expand Down Expand Up @@ -70,6 +71,7 @@ public MinecraftProcess(object mainForm, string assetsPath, string libraries, st
Assetspath = assetsPath;
Libs = libraries;
Assets = assetsFileName;
userProperties = properties;
}

private void MLogG(string text, bool iserror)
Expand Down Expand Up @@ -216,7 +218,7 @@ public void Launch()
{"auth_session", Variables.AccessToken},
{"auth_access_token", Variables.AccessToken},
{"auth_uuid", Variables.ClientToken},
{"user_properties", "{\"luncher\":[1234]}"},
{"user_properties", userProperties.ToString(Formatting.None)},
{"user_type", "mojang"}
};
Arg = re.Replace(Arg,
Expand Down Expand Up @@ -316,5 +318,6 @@ public abstract class McVariables
protected string Assets { get; set; }
protected string MainClass { get; set; }
protected string LastVersionId { get; set; }
protected JObject userProperties { get; set; }
}
}
4 changes: 2 additions & 2 deletions Luncher/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.4.1970")]
[assembly: AssemblyFileVersion("1.4.4.1970")]
[assembly: AssemblyVersion("1.4.5.2003")]
[assembly: AssemblyFileVersion("1.4.5.2003")]
[assembly: NeutralResourcesLanguageAttribute("ru-RU")]
11 changes: 8 additions & 3 deletions Luncher/YaDra4il.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ public class AuthManager
[JsonProperty("legacy")]
public bool IsLegacy;

public JArray UserProperties;

public Authenticate Login()
{
var auth = Login(Email, Password);
SessionToken = auth.accessToken;
AccessToken = auth.clientToken;
Username = auth.selectedProfile.name;
Uuid = auth.selectedProfile.id;
UserProperties = (JArray)auth.user["properties"];
return auth;
}

Expand Down Expand Up @@ -105,20 +108,22 @@ public class Authenticate : Request
public string accessToken;
public string clientToken;
public UserInfo selectedProfile;
public JObject user;
public Authenticate(string email, string password)
{
Url = AuthLinks.Authenticate;
ToPost = new JObject()
ToPost = new JObject
{
{
"agent", new JObject()
"agent", new JObject
{
{"name", "Minecraft"},
{"version", 1}
}
},
{"username", email},
{"password", password}
{"password", password},
{"requestUser", true}
}.ToString();
}
}
Expand Down

0 comments on commit 5dd9a95

Please sign in to comment.