Coder Social home page Coder Social logo

Comments (24)

LorisYounger avatar LorisYounger commented on September 24, 2024 1

In theory, it should automatically switch to English
And loading an empty language will not result in an error
I will add an automatic switch to English in the next update if the current language is empty

from vpet.

Afireal avatar Afireal commented on September 24, 2024 1

Stack trace. But I don't think it's really helpful now

System.FormatException
  HResult=0x80131537
  Message=Входная строка имела неверный формат. <-- Input string was not in a correct format.
  Source=mscorlib
  StackTrace:
   at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.String.System.IConvertible.ToDouble(IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at LinePutScript.Converter.LPSConvert.GetStringObject(String value, Type type, ConvertType convtype, LineAttribute att)
   at LinePutScript.Converter.LPSConvert.GetSubObject(ISub sub, Type type, ConvertType convtype, LineAttribute att)
   at LinePutScript.Converter.LPSConvert.DeserializeObject[T](ISub value)
   at VPet_Simulator.Windows.CoreMOD..ctor(DirectoryInfo directory, MainWindow mw) in E:\Git\VPet\VPet-Simulator.Windows\Function\CoreMOD.cs:line 137
   at VPet_Simulator.Windows.MainWindow.<GameLoad>d__107.MoveNext() in E:\Git\VPet\VPet-Simulator.Windows\MainWindow.xaml.cs:line 208```

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024 1

I think that's the real reason for the error report. I'll study how to solve it. Thank you for your feedback. It really helped a lot

from vpet.

Afireal avatar Afireal commented on September 24, 2024 1

Different one, but still the same exception. I will now send details

from vpet.

Afireal avatar Afireal commented on September 24, 2024 1

It's works!

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024 1

Thanks for you help!

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024 1

Thank you again for your help, I will update fix to steam soon
I will close when the update is complete

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024

I update a new version, can you open now?

from vpet.

Afireal avatar Afireal commented on September 24, 2024

I managed to compile latest VPet-Simulator.Windows and that's what I got.
Localization is automaticlly switching to EN without latest changes (sorry). Fortunatly, I discovered why app crashes exactly on Core mod loading. There's an exception on food initializing.

CoreMOD.cs:137

case "food":
                        Tag.Add("food");
                        foreach (FileInfo fi in di.EnumerateFiles("*.lps"))
                        {
                            var tmp = new LpsDocument(File.ReadAllText(fi.FullName));
                            foreach (ILine li in tmp)
                            {
                                string tmps = li.Find("name").info;
                                mw.Foods.RemoveAll(x => x.Name == tmps);
                                mw.Foods.Add(LPSConvert.DeserializeObject<Food>(li));
                            }
                        }
                        break;

System.FormatException: Input string was not in a correct format. on mw.Foods.Add(LPSConvert.DeserializeObject<Food>(li));
If I compile whole thing with american formats in Win settings, everything is fine. I don't really know much about dotnet, so no ideas.

from vpet.

Afireal avatar Afireal commented on September 24, 2024

That's so stupid, but it's real. This converter or smth else in the code can't accept a comma as a decimal separator. If I change it to point in Win Control Panel without completely switching to American standards, it will work. LMAO
Looks like somewhere in the converter code, there is no lookup for system formats, but hardcoded point.

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024

I'm sorry, I wrote this LinePutScript
I may find a solution and try to lock the language to en US

Convert.ChangeType(Sub.TextDeReplace(value), type, new CultureInfo("en-US"));

but I am not sure is that work, I will compile a beta version. Can you help me test it

from vpet.

Afireal avatar Afireal commented on September 24, 2024

ok, no problem

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024

LinePutScript.zip
rereplace it with LinePutScript.dll
is game working?

from vpet.

Afireal avatar Afireal commented on September 24, 2024

Nope. Neither the steam version nor the compiled one

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024

Can you use visual studio Reference this DLL and run again?
I want to see is same error or different

from vpet.

Afireal avatar Afireal commented on September 24, 2024

VPet-Simulator.Core/Graph/FoodAnimation.cs:151

                    if (strs.Length > 4)
                    {
                        Rotate = double.Parse(strs[4]);//Rotate
                        if (strs.Length > 5)
                            Opacity = double.Parse(strs[5]);//Opacity
                    }

Same System.FormatException: Input string was not in a correct format. on double.Parse(strs[5])

Stack trace

System.FormatException
  HResult=0x80131537
  Message=Входная строка имела неверный формат.
  Source=mscorlib
  StackTrace:
   at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.Double.Parse(String s)
   at VPet_Simulator.Core.FoodAnimation.Animation..ctor(FoodAnimation parent, ISub sub) in E:\Git\VPet\VPet-Simulator.Core\Graph\FoodAnimation.cs:line 149
   at VPet_Simulator.Core.FoodAnimation..ctor(GraphCore graphCore, GraphInfo graphinfo, String front_Lay, String back_Lay, ILine animations, Boolean isLoop) in E:\Git\VPet\VPet-Simulator.Core\Graph\FoodAnimation.cs:line 45
   at VPet_Simulator.Core.FoodAnimation.LoadGraph(GraphCore graph, FileSystemInfo path, ILine info) in E:\Git\VPet\VPet-Simulator.Core\Graph\FoodAnimation.cs:line 53
   at VPet_Simulator.Core.PetLoader.LoadGraph(GraphCore graph, DirectoryInfo di, String startuppath) in E:\Git\VPet\VPet-Simulator.Core\Handle\PetLoader.cs:line 94
   at VPet_Simulator.Core.PetLoader.LoadGraph(GraphCore graph, DirectoryInfo di, String startuppath) in E:\Git\VPet\VPet-Simulator.Core\Handle\PetLoader.cs:line 117
   at VPet_Simulator.Core.PetLoader.Graph(Int32 Resolution) in E:\Git\VPet\VPet-Simulator.Core\Handle\PetLoader.cs:line 25
   at VPet_Simulator.Windows.MainWindow.<>c__DisplayClass107_0.<GameLoad>b__7() in E:\Git\VPet\VPet-Simulator.Windows\MainWindow.xaml.cs:line 327
   at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024

Can you add

CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");

at https://github.com/LorisYounger/VPet/blob/main/VPet-Simulator.Windows/MainWindow.xaml.cs#L43

        public MainWindow()
        {
            LocalizeCore.StoreTranslation = true;
            CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
...

and try again?

from vpet.

Afireal avatar Afireal commented on September 24, 2024

Nothing has changed

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024

How about

            CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator = ".";

at https://github.com/LorisYounger/VPet/blob/main/VPet-Simulator.Windows/MainWindow.xaml.cs#L43

        public MainWindow()
        {
            LocalizeCore.StoreTranslation = true;
            CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator = ".";

from vpet.

Afireal avatar Afireal commented on September 24, 2024

System.InvalidOperationException on new line
It's says that it's read-only value

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024
            CultureInfo.CurrentCulture = new CultureInfo(CultureInfo.CurrentCulture.Name);
            CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator = ".";

This should be effective

from vpet.

Afireal avatar Afireal commented on September 24, 2024

No effect. Still the same error as here but on line 149

from vpet.

LorisYounger avatar LorisYounger commented on September 24, 2024
            LocalizeCore.StoreTranslation = true;
            CultureInfo.CurrentCulture = new CultureInfo(CultureInfo.CurrentCulture.Name);
            CultureInfo.CurrentCulture.NumberFormat = new CultureInfo("en-US").NumberFormat;

from vpet.

Afireal avatar Afireal commented on September 24, 2024

Should I close this issue or it's just a temporary solution?

from vpet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.