Funny, disabling localization makes things easier...

This commit is contained in:
Michael 2017-05-28 12:40:06 -04:00
parent 4036e97f3f
commit 03ebdf42d9
7 changed files with 72 additions and 135 deletions

View file

@ -41,6 +41,7 @@ namespace ShiftOS.WinForms.Applications
[WinOpen("simplesrc")]
[Launcher("SimpleSRC Client", false, null, "Networking")]
[DefaultTitle("SimpleSRC Client")]
[AppscapeEntry("SimpleSRC", "A simple ShiftOS Relay Chat client that allows you to talk with other ShiftOS users from all over the world.", 300, 145, "file_skimmer", "Networking")]
public partial class Chat : UserControl, IShiftOSWindow
{
public Chat()

View file

@ -504,11 +504,11 @@ namespace ShiftOS.WinForms.Applications
Thread.Sleep(2000);
Console.WriteLine("As you know, ShiftOS doesn't have very many features.");
Thread.Sleep(2000);
Console.WriteLine("Using the applications you have, I need you to earn 50,000 Codepoints.");
Console.WriteLine("Using the applications you have, I need you to earn as many Codepoints as you can.");
Thread.Sleep(2000);
Console.WriteLine("You can use the Codepoints you earn to buy new applications and features in the Shiftorium, to help earn Codepoints.");
Console.WriteLine("You can use the Codepoints you earn to buy new applications and features in the Shiftorium, to help earn even more Codepoints.");
Thread.Sleep(2000);
Console.WriteLine("Start small, try to earn 500. Once you do, I'll contact you with more details.");
Console.WriteLine("Once you earn 1,000 Codepoints, I will check back with you and see how well you've done.");
Thread.Sleep(2000);
Console.WriteLine("I'll leave you to it, you've got the hang of it! One last thing, if ever you find yourself in another program, and want to exit, simply press CTRL+T to return to the Terminal.");
Thread.Sleep(2000);

View file

@ -283,7 +283,7 @@
Name: "AL Widget Manager",
Cost: 125,
Description: "Desktop Widgets are a huge advancement in ShiftOS technology, allowing access to system information, and quick control of your system, without even opening a window. However, we still need to be able to modify each widget. This upgrade adds an App Launcher entry for the Desktop Widget Manager.",
Description: "app_launcher;desktop_widgets",
Dependencies: "app_launcher;desktop_widgets",
Category: "GUI"
},
{
@ -704,7 +704,8 @@
Name: "Artpad",
Cost: 7500,
Category: "Applications",
Description: "ArtPad is a very extensible tool that allows you to draw images within ShiftOS. Buy this upgrade to gain access to it through win.open{}!"
Description: "ArtPad is a very extensible tool that allows you to draw images within ShiftOS. Buy this upgrade to gain access to it through win.open{}!",
Dependencies: "color_depth_8_bits"
},
{
Name: "AL Artpad",

View file

@ -1,3 +1,5 @@
#define SLOW_LOCALIZATION
/*
* MIT License
*
@ -144,77 +146,66 @@ namespace ShiftOS.WinForms.Tools
public static void SetupControl(Control ctrl)
{
if (!(ctrl is MenuStrip) && !(ctrl is ToolStrip) && !(ctrl is StatusStrip) && !(ctrl is ContextMenuStrip))
Desktop.InvokeOnWorkerThread(() =>
{
string tag = "";
try
if (!(ctrl is MenuStrip) && !(ctrl is ToolStrip) && !(ctrl is StatusStrip) && !(ctrl is ContextMenuStrip))
{
if(ctrl.Tag != null)
tag = ctrl.Tag.ToString();
}
catch { }
string tag = "";
if (!tag.Contains("keepbg"))
{
if (ctrl.BackColor != Control.DefaultBackColor)
try
{
Desktop.InvokeOnWorkerThread(() =>
if (ctrl.Tag != null)
tag = ctrl.Tag.ToString();
}
catch { }
if (!tag.Contains("keepbg"))
{
if (ctrl.BackColor != Control.DefaultBackColor)
{
ctrl.BackColor = SkinEngine.LoadedSkin.ControlColor;
});
}
}
}
if (!tag.Contains("keepfont"))
{
Desktop.InvokeOnWorkerThread(() =>
if (!tag.Contains("keepfont"))
{
ctrl.ForeColor = SkinEngine.LoadedSkin.ControlTextColor;
ctrl.Font = SkinEngine.LoadedSkin.MainFont;
});
if (tag.Contains("header1"))
{
Desktop.InvokeOnWorkerThread(() =>
if (tag.Contains("header1"))
{
ctrl.Font = SkinEngine.LoadedSkin.HeaderFont;
});
}
Desktop.InvokeOnWorkerThread(() =>
{
ctrl.Font = SkinEngine.LoadedSkin.HeaderFont;
});
}
if (tag.Contains("header2"))
{
Desktop.InvokeOnWorkerThread(() =>
if (tag.Contains("header2"))
{
ctrl.Font = SkinEngine.LoadedSkin.Header2Font;
});
}
}
if (tag.Contains("header3"))
{
Desktop.InvokeOnWorkerThread(() =>
if (tag.Contains("header3"))
{
ctrl.Font = SkinEngine.LoadedSkin.Header3Font;
});
}
}
}
try
{
string ctrlText = Localization.Parse(ctrl.Text);
Desktop.InvokeOnWorkerThread(() =>
try
{
#if !SLOW_LOCALIZATION
if (!string.IsNullOrWhiteSpace(ctrl.Text))
{
string ctrlText = Localization.Parse(ctrl.Text);
ctrl.Text = ctrlText;
}
#endif
}
catch
{
ctrl.Text = ctrlText;
});
}
catch
{
}
}
if(ctrl is Button)
{
Desktop.InvokeOnWorkerThread(() =>
if (ctrl is Button)
{
Button b = ctrl as Button;
if (!b.Tag.ToString().ToLower().Contains("keepbg"))
@ -229,7 +220,7 @@ namespace ShiftOS.WinForms.Tools
b.FlatAppearance.BorderColor = SkinEngine.LoadedSkin.ButtonForegroundColor;
b.ForeColor = SkinEngine.LoadedSkin.ButtonForegroundColor;
}
if(!b.Tag.ToString().ToLower().Contains("keepfont"))
if (!b.Tag.ToString().ToLower().Contains("keepfont"))
b.Font = SkinEngine.LoadedSkin.ButtonTextFont;
Color orig_bg = b.BackColor;
@ -260,15 +251,12 @@ namespace ShiftOS.WinForms.Tools
b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonpressed");
};
});
}
}
if(ctrl is TextBox)
if (ctrl is TextBox)
{
Desktop.InvokeOnWorkerThread(() =>
{
(ctrl as TextBox).BorderStyle = BorderStyle.FixedSingle;
});
(ctrl as TextBox).BorderStyle = BorderStyle.FixedSingle;
}
ctrl.KeyDown += (o, a) =>
@ -286,27 +274,19 @@ namespace ShiftOS.WinForms.Tools
};
if (ctrl is Button)
{
Desktop.InvokeOnWorkerThread(() =>
{
(ctrl as Button).FlatStyle = FlatStyle.Flat;
});
(ctrl as Button).FlatStyle = FlatStyle.Flat;
}
else if (ctrl is WindowBorder)
{
Desktop.InvokeOnWorkerThread(() =>
{
(ctrl as WindowBorder).Setup();
});
(ctrl as WindowBorder).Setup();
}
}
Desktop.InvokeOnWorkerThread(() =>
{
MakeDoubleBuffered(ctrl);
ControlSetup?.Invoke(ctrl);
});
ControlSetup?.Invoke(ctrl);
}
public static event Action<Control> ControlSetup;
public static void MakeDoubleBuffered(Control c)
@ -330,27 +310,12 @@ namespace ShiftOS.WinForms.Tools
{
Desktop.HideAppLauncher();
};
ThreadStart ts = () =>
var ctrls = frm.Controls.ToList();
for (int i = 0; i < ctrls.Count(); i++)
{
var ctrls = frm.Controls.ToList();
for (int i = 0; i < ctrls.Count(); i++)
{
SetupControls(ctrls[i]);
}
SetupControl(frm);
};
if (runInThread == true)
{
var t = new Thread(ts);
t.IsBackground = true;
t.Start();
}
else
{
ts?.Invoke();
SetupControls(ctrls[i]);
}
SetupControl(frm);
}
}

View file

@ -202,13 +202,21 @@ namespace ShiftOS.WinForms
{
if (SaveSystem.CurrentSave.Codepoints != lastcp)
lastcp = SaveSystem.CurrentSave.Codepoints;
if (lastcp >= 10000)
if (lastcp >= 2500)
{
if (!Shiftorium.UpgradeInstalled("victortran_shiftnet"))
{
Story.Start("victortran_shiftnet");
}
}
if(lastcp >= 5000)
{
if(Shiftorium.UpgradeInstalled("triwrite") && Shiftorium.UpgradeInstalled("simplesrc") && Shiftorium.UpgradeInstalled("victortran_shiftnet") && Shiftorium.UpgradeInstalled("story_hacker101_breakingthebonds"))
{
if (!Shiftorium.UpgradeInstalled("story_thefennfamily"))
Story.Start("story_thefennfamily");
}
}
}
} while (!SaveSystem.ShuttingDown);
});

View file

@ -111,50 +111,11 @@ namespace ShiftOS.Engine
localizationStrings = JsonConvert.DeserializeObject<Dictionary<string, string>>(Utils.ReadAllText(Paths.GetPath("english.local"))); //if no provider fall back to english
}
foreach (var kv in localizationStrings)
foreach (var kv in localizationStrings.Where(x=>original.Contains(x.Key)))
{
original = original.Replace(kv.Key, kv.Value); // goes through and replaces all the localization blocks
}
List<string> orphaned = new List<string>();
int start_index = 0;
int length = 0;
bool indexing = false;
foreach (var c in original)
{
// start paying attenion when you see a "{"
if (c == '{')
{
start_index = original.IndexOf(c);
indexing = true;
}
if (indexing == true)
{
// stop paying attention when you see a "}" after seeing a "{"
length++;
if (c == '}')
{
indexing = false;
string o = original.Substring(start_index, length);
if (!orphaned.Contains(o))
{
orphaned.Add(o);
}
start_index = 0;
length = 0;
}
}
}
if (orphaned.Count > 0)
{
Utils.WriteAllText("0:/dev_orphaned_lang.txt", JsonConvert.SerializeObject(orphaned, Formatting.Indented)); //format if from this txt file
}
//string original2 = Parse(original);
string usernameReplace = "";
@ -203,13 +164,13 @@ namespace ShiftOS.Engine
};
// actually do the replacement
foreach (KeyValuePair<string, string> replacement in replace)
foreach (KeyValuePair<string, string> replacement in replace.Where(x => original.Contains(x.Key)))
{
original = original.Replace(replacement.Key, Parse(replacement.Value));
}
// do the replacement but default
foreach (KeyValuePair<string, string> replacement in defaultReplace)
foreach (KeyValuePair<string, string> replacement in defaultReplace.Where(x => original.Contains(x.Key)))
{
original = original.Replace(replacement.Key, replacement.Value);
}

View file

@ -42,6 +42,7 @@ namespace ShiftOS.Engine
{
ConsoleEx.OnFlush = () =>
{
System.Diagnostics.Debug.WriteLine("[terminal] " + buffer);
Desktop.InvokeOnWorkerThread(() =>
{
UnderlyingControl?.Write(buffer);