Exemplo n.º 1
0
        private static void CreateDll(string path)
        {
            // noop if it already exists
            Directory.CreateDirectory(path);

            CargoDll.GenerateUnbandDlls(path);

            System.Console.WriteLine("Final (modified) Band Dlls placed in: " + path);
        }
Exemplo n.º 2
0
        private static void CopyBandDlls()
        {
            var unbandDir      = new DirectoryInfo(CargoDll.GetOfficialBandDllPath());
            var destinationDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            var files = unbandDir.GetFiles("*.dll");

            foreach (var file in files)
            {
                var destination = Path.Combine(destinationDir, file.Name);
                File.Copy(file.FullName, destination, overwrite: true);
            }
        }
Exemplo n.º 3
0
        public static bool CanRun(ref string message)
        {
            string msg = null;

            if (!CargoDll.BandDllsExist(ref msg))
            {
                message = "Couldn't find the latest Microsoft Band Desktop Sync app.\n\nInstall it from: http://bit.ly/desktopband and try again.\n\nSadly we're going to have to exit now.\n\nDiagnostiscs: " + msg;

                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
        static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            if (args.Name.StartsWith("Microsoft.Band"))
            {
                // an exception will be thrown on Microsoft.Band.Desktop.resources, ignore it
                try
                {
                    var curDir = Directory.GetCurrentDirectory();
                    Directory.SetCurrentDirectory(CargoDll.GetOfficialBandDllPath());

                    var asm = Assembly.LoadFrom(CargoDll.GetUnBandBandDll(args.Name.Substring(0, args.Name.IndexOf(','))));

                    Directory.SetCurrentDirectory(curDir);

                    return(asm);
                }
                catch
                {
                    // TODO: log exception?
                }
            }

            return(null);
        }