Esempio n. 1
0
 public static string AppData()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         string appData = Path.Combine(Android.GetStorage(), "Valkyrie");
         if (appData != null)
         {
             return(appData);
         }
     }
     return(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "Valkyrie"));
 }
Esempio n. 2
0
 public static string AppData()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         string appData = Android.GetStorage() + "/Valkyrie";
         if (appData != null)
         {
             ValkyrieDebug.Log("AppData: " + appData);
             return(appData);
         }
     }
     return(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "/Valkyrie");
 }
Esempio n. 3
0
 public override string ObbPath()
 {
     if (!System.IO.Directory.Exists(Android.GetStorage() + "/Android/obb/com.fantasyflightgames.mom"))
     {
         return("");
     }
     foreach (string file in System.IO.Directory.GetFiles(Android.GetStorage() + "/Android/obb/com.fantasyflightgames.mom"))
     {
         if (file.Contains(".com.fantasyflightgames.mom.obb"))
         {
             return(file);
         }
     }
     return("");
 }
Esempio n. 4
0
 public override string ObbPath()
 {
     if (obbPath == null) // try this only once
     {
         string location = Android.GetStorage() + "/Android/obb/com.fantasyflightgames.mom";
         if (!Directory.Exists(location))
         {
             return("");
         }
         var    files = new List <string>(Directory.GetFiles(location));
         string file  = files.Find(x => x.EndsWith(".com.fantasyflightgames.mom.obb"));
         obbPath = file ?? "";
     }
     return(obbPath);
 }
Esempio n. 5
0
        protected string GetObbPath(string prefix, string suffix)
        {
            if (prefix == null)
            {
                throw new ArgumentNullException("prefix");
            }
            if (suffix == null)
            {
                throw new ArgumentNullException("suffix");
            }

            string location = Path.Combine(Android.GetStorage(), prefix);

            if (!Directory.Exists(location))
            {
                return("");
            }
            var file = Directory.GetFiles(location).ToList().Find(x => x.EndsWith(suffix));

            return(file ?? "");
        }
Esempio n. 6
0
 public override string ObbPath()
 {
     return(Android.GetStorage() + "/Android/obb/com.fantasyflightgames.mom/main.598.com.fantasyflightgames.mom.obb");
 }
Esempio n. 7
0
        public AppFinder(Platform p)
        {
            platform = p;
            if (p == Platform.MacOS)
            {
                ValkyrieDebug.Log("Attempting to locate AppId " + AppId() + " on MacOS.");
                System.Diagnostics.ProcessStartInfo processStartInfo;
                System.Diagnostics.Process          process;

                StringBuilder outputBuilder = new StringBuilder();

                processStartInfo = new System.Diagnostics.ProcessStartInfo();
                processStartInfo.CreateNoWindow         = true;
                processStartInfo.RedirectStandardOutput = true;
                processStartInfo.RedirectStandardInput  = true;
                processStartInfo.UseShellExecute        = false;
                processStartInfo.Arguments = "SPApplicationsDataType -xml";
                processStartInfo.FileName  = "system_profiler";

                process = new System.Diagnostics.Process();
                ValkyrieDebug.Log("Starting system_profiler.");
                process.StartInfo = processStartInfo;
                // enable raising events because Process does not raise events by default
                process.EnableRaisingEvents = true;
                // attach the event handler for OutputDataReceived before starting the process
                process.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler
                                              (
                    delegate(object sender, System.Diagnostics.DataReceivedEventArgs e)
                {
                    // append the new data to the data already read-in
                    outputBuilder.Append(e.Data);
                }
                                              );
                // start the process
                // then begin asynchronously reading the output
                // then wait for the process to exit
                // then cancel asynchronously reading the output
                process.Start();
                process.BeginOutputReadLine();
                process.WaitForExit();
                process.CancelOutputRead();


                string output = outputBuilder.ToString();

                ValkyrieDebug.Log("Looking for: /" + Executable());
                // Quick hack rather than doing XML properly
                int foundAt = output.IndexOf("/" + Executable());
                if (foundAt > 0)
                {
                    ValkyrieDebug.Log("Name Index: " + foundAt);
                    int startPos = output.LastIndexOf("<string>", foundAt) + 8;
                    ValkyrieDebug.Log("Start Index: " + startPos);
                    location = output.Substring(startPos, output.IndexOf("</string>", startPos) - startPos).Trim();
                    ValkyrieDebug.Log("Using location: " + location);
                }
            }
            else if (platform == Platform.Linux)
            {
            }
            else if (platform == Platform.Android)
            {
                obbRoot = Android.GetStorage() + "/Valkyrie/Obb";
                ValkyrieDebug.Log("Obb extraction path: " + obbRoot);
                location = obbRoot + "/assets/bin/Data";
                DeleteObb();
            }
            else // Windows
            {
                // Attempt to get steam install location (current 32/64 level)
                location = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App " + AppId(), "InstallLocation", "");
                if (location.Equals(""))
                {
                    // If we are on a 64 bit system, need to read the 64bit registry from a 32 bit app (Valkyrie)
                    try
                    {
                        location = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App " + AppId(), "InstallLocation");
                    }
                    catch { }
                }
            }

            if (location == null || location.Length == 0)
            {
                string[] args = Environment.GetCommandLineArgs();
                for (int i = 0; i < (args.Length - 1); i++)
                {
                    if (args[i] == "-import")
                    {
                        location = args[i + 1];
                        if (location.Length > 0)
                        {
                            if (location[location.Length - 1] == '/' || location[location.Length - 1] == '\\')
                            {
                                location = location.Substring(0, location.Length - 1);
                            }
                        }
                        ValkyrieDebug.Log("Using import flag location: " + location);
                    }
                }
            }
            exeLocation += location + "/" + Executable();
            location    += DataDirectory();
            ValkyrieDebug.Log("Asset location: " + location);
        }