Beispiel #1
0
        private void LoadClassificationMappingFiles()
        {
            //Get the executing Assembly
            var asmbly = Assembly.GetExecutingAssembly();

            //Get the Directory path by getting the filepath of the executing dll and removing the DLL files name from the end.
            var dirPath = asmbly.CodeBase.Substring(0, asmbly.CodeBase.IndexOf(asmbly.GetName().Name));

            //Get the LocalPath of the resource directory
            var uri = (new Uri(dirPath).AbsolutePath).Replace("%20", " ");

            var configSection = ConfigurationManager.GetSection("Xbim.Exchanger") as NameValueCollection;

            if (configSection != null)
            {
                var configValue = configSection["ClassificationMappingFolder"];
                if (!string.IsNullOrEmpty(configValue))
                {
                    uri = configValue;
                }
            }

            Log.DebugFormat("Trying to load classification mapping files from {0}", uri);
            var d = new DirectoryInfo(uri);

            if (d.Exists)
            {
                _classificationMappingFiles = Directory.GetFiles(uri, "Uniclass2015*.csv");
            }
            else
            {
                Log.ErrorFormat("Failed to load classification mapping files from {0}", uri);
            }
        }
Beispiel #2
0
        void CheckBooCompiler()
        {
            string path = Path.Combine(Path.GetDirectoryName(
                                           Assembly.GetExecutingAssembly().Location),
                                       "Boo.Lang.Compiler.dll");

            if (File.Exists(path))
            {
                foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
                {
                    if (a.FullName.StartsWith("Boo.Lang.Compiler"))
                    {
                        if (string.Compare(a.Location, path, true) != 0)
                        {
                            //can't use ResourceManager, boo.lang.dll may be out of date
                            string msg = string.Format("WARNING: booc is not using the Boo.Lang.Compiler.dll next to booc.exe.  Using '{0}' instead of '{1}'.  You may need to remove boo dlls from the GAC using gacutil or Mscorcfg.",
                                                       a.Location, path);
                            //has to be all 1 line for things like msbuild that parse booc output.
                            Console.Error.WriteLine(msg);
                        }
                        break;
                    }
                }
            }
        }
Beispiel #3
0
        void AddDefaultResponseFile(ref ArrayList arglist)
        {
            ArrayList result = new ArrayList();

            foreach (string arg in arglist)
            {
                if (arg == "-noconfig")
                {
                    _noConfig = true;
                }
                else
                {
                    result.Add(arg);
                }
            }
            if (!_noConfig)
            {
                string file = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "booc.rsp");
                if (File.Exists(file))
                {
                    result.InsertRange(0, LoadResponseFile(file));
                }
            }
            arglist = result;
        }
        public Assembly Compile(Assembly[] references, params string[] definitionFiles)
        {
            var parameters = new CompilerParameters
            {
                OutputType     = CompilerOutputType.Library,
                Pipeline       = new CompileToFile(),
                OutputAssembly = appSettings.DefinitionsAssemblyPath
            };

            parameters.References.Add(Assembly.GetExecutingAssembly());
            if (references != null)
            {
                references.ForEach(reference => parameters.References.Add(reference));
            }

            foreach (var definitionFile in definitionFiles)
            {
                parameters.Input.Add(Input(definitionFile));
            }

            parameters.Pipeline.Insert(1, new DefinitionClassCompilerStep());

            var compiler = new BooCompiler(parameters);
            var context  = compiler.Run();

            if (context.Errors.Count > 0)
            {
                throw new CompilationException(context.Errors);
            }

            return(context.GeneratedAssembly);
        }
        static CoBieLiteUkToIfcExchanger()
        {
            var tmpFile = Path.GetTempPath() + Guid.NewGuid().ToString() + ".csv";

            var asss = Assembly.GetExecutingAssembly();

            using (var input = asss.GetManifestResourceStream("XbimExchanger.IfcToCOBieLiteUK.COBieAttributes.config"))
                using (var output = File.Create(tmpFile))
                {
                    if (input != null)
                    {
                        input.CopyTo(output);
                    }
                }



            Configuration      config;
            AppSettingsSection cobiePropertyMaps;

            if (!File.Exists(tmpFile))
            {
                var directory = new DirectoryInfo(".");
                throw new Exception(
                          string.Format(
                              @"Error loading configuration file ""{0}"". App folder is ""{1}"".", tmpFile,
                              directory.FullName)
                          );
            }

            try
            {
                var configMap = new ExeConfigurationFileMap {
                    ExeConfigFilename = tmpFile
                };
                config            = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None);
                cobiePropertyMaps = (AppSettingsSection)config.GetSection("COBiePropertyMaps");
                foreach (KeyValueConfigurationElement keyVal in cobiePropertyMaps.Settings)
                {
                    var values   = keyVal.Value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    var selected = values.FirstOrDefault();
                    if (selected != null)
                    {
                        var names = selected.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
                        if (names.Length == 2)
                        {
                            CobieToIfcPropertyMap.Add(keyVal.Key, new NamedProperty(names[0], names[1]));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var directory = new DirectoryInfo(".");
                throw new Exception(
                          @"Error loading configuration file ""COBieAttributes.config"". App folder is " + directory.FullName,
                          ex);
            }
        }
Beispiel #6
0
        public void Configuration(IAppBuilder app)
        {
            var httpConfiguarion = EnableWebApi();

            IOC.Activator.Instance.ActiveWebApi(httpConfiguarion, new Asm[] { Asm.GetExecutingAssembly() });
            var apiPath = System.IO.Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.FullName;

            RegisterFilters(IOC.Activator.Container, httpConfiguarion);
            app.UseWebApi(httpConfiguarion);
            AppCore.IOC.Loader.Load(IOC.Activator.Container, System.IO.Path.Combine(apiPath, @"Libs"));
        }
Beispiel #7
0
        public void OnApplicationStart()
        {
            DisorganizationManager.sceneLoaded        += OnSceneLoaded;
            DisorganizationManager.activeSceneChanged += delegate(ExampleOfBadOrganization arg0, ExampleOfBadOrganization arg1) { new Thot().AddComponent <WhyUnityYouPieceOfCrap>(); };
            CollectionOfTrash noDontDoThisPlease = CollectionOfTrash.LoadFromStream(Spaghetti.GetExecutingAssembly().GetManifestResourceStream("FunTimesMod.HowItFeelsToDoAcid"));

            if (noDontDoThisPlease != null)
            {
                youllRegretThis = noDontDoThisPlease.LoadAsset <ShadyBoi>("PartyTimeBois");
            }
        }
        static MockInjector()
        {
            k_MarkAsPatchedKey = Assembly.GetExecutingAssembly().GetName().Name;

            var assemblyHash = Assembly.GetExecutingAssembly().Evidence.GetHostEvidence <Hash>();

            if (assemblyHash == null)
            {
                throw new Exception("Assembly not stamped with a hash");
            }

            k_MarkAsPatchedValue = assemblyHash.SHA1.ToHexString();
        }
Beispiel #9
0
        private void cssCustomToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //read the custom CSS from embedded resource
            string css;

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FileOpenAndSave.custom.css"))
            {
                using (StreamReader streamReader = new StreamReader(stream))
                {
                    css = streamReader.ReadToEnd();
                }
            }
            setCss(css, customuserdefinedToolStripMenuItem);
        }
Beispiel #10
0
        private static void PatchAssembly(string file)
        {
            var asmSelf   = AssemblyDefinition.ReadAssembly(Assembly.GetExecutingAssembly().Location);
            var patchType = asmSelf.MainModule.GetType(nameof(OvercookedControlsPatcher) + "." + nameof(PatchSource));

            var asmTarget = AssemblyDefinition.ReadAssembly(file, new ReaderParameters()
            {
                ReadWrite = true
            });

            foreach (var patchField in patchType.Fields)
            {
                var addFieldMeta = AddField.Read(patchField);

                if (addFieldMeta != null)
                {
                    var targetType = asmTarget.MainModule.GetType(addFieldMeta.targetType);
                    PatchTools.AddField(targetType, patchField);
                }
            }

            foreach (var patchMethod in patchType.Methods)
            {
                var addMethodMeta     = AddMethod.Read(patchMethod);
                var replaceMethodMeta = ReplaceMethod.Read(patchMethod);

                if (addMethodMeta != null)
                {
                    var targetType = asmTarget.MainModule.GetType(addMethodMeta.targetType);
                    if (!targetType.Methods.Any(f =>
                                                f.Name == patchMethod.Name && f.Parameters.Count == patchMethod.Parameters.Count))
                    {
                        PatchTools.CopyMethod(targetType, patchMethod);
                    }
                }
                else if (replaceMethodMeta != null)
                {
                    var targetType = asmTarget.MainModule.GetType(replaceMethodMeta.targetType);

                    // Not exactly right, but good enough for now.
                    MethodDefinition targetMethod = targetType.Methods.First(m =>
                                                                             m.Name == patchMethod.Name && patchMethod.Parameters.Count == m.Parameters.Count);

                    PatchTools.ReplaceMethod(targetMethod, patchMethod);
                }
            }

            asmTarget.Write();
        }
        public static string LoadScript(string name)
        {
            var resourceName = string.Format("Dnn.PersonaBar.Security.Components.Resources.{0}.resources", name);

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
            {
                if (stream != null)
                {
                    var script = new StreamReader(stream).ReadToEnd();
                    return(script.Replace("%SiteRoot%", Globals.ApplicationMapPath));
                }

                return(null);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Finds all <see cref="GameMaker.ModelStructure.Units.Unit"/> subclasses and uses their name to find a .js file containing the generated javascript for each
        /// of them
        /// </summary>
        /// <returns>The code for every single <see cref="GameMaker.ModelStructure.Units.Unit"/> subclass.</returns>
        private string GenerateUnitConstructors()
        {
            var typeOfUnit = typeof(Unit);
            var code       = new StringBuilder();
            var assembly   = Assembly.GetExecutingAssembly();

            foreach (Type type in assembly.GetTypes())
            {
                if (type.IsSubclassOf(typeOfUnit))
                {
                    var constructor = PathFinder.ReadEmbeddedFile(type.Name + ".js");
                    code.AppendFormat("\tvar {0} = ", type.Name);
                    code.Append("(" + constructor + ")();\n");
                }
            }
            return(code.ToString());
        }
Beispiel #13
0
        private static void CreateMscorlibName()
        {
            // NOTE: this makes certain assumptions about how AssemblyName.ToString() formats
            // it's output.  If AssemblyName.ToString() changes, this will have to as well.

            Assembly mscorlibAssembly = Assembly.GetExecutingAssembly();

            s_mscorlibName = mscorlibAssembly.nGetSimpleName();

#if _DEBUG
            String mscorlibAssemblyName = mscorlibAssembly.FullName;
            BCLDebug.Assert(mscorlibAssemblyName != null &&
                            mscorlibAssemblyName.Length >= s_mscorlibName.Length &&
                            mscorlibAssemblyName.Substring(0, s_mscorlibName.Length).Equals(s_mscorlibName),
                            "AssemblyName.ToString() changed format");
#endif
        }
        public ISparkViewEngine CreateViewEngine()
        {
            var settings = new SparkSettings()
                           .SetPageBaseType(typeof(SparkView))
                           .SetAutomaticEncoding(true)
                           .AddNamespace(typeof(string).Namespace)
                           .AddNamespace(typeof(Enumerable).Namespace)
                           .AddNamespace(typeof(Status).Namespace)
                           .AddNamespace(typeof(Run).Namespace);

            var dir       = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var templates = new FileSystemViewFolder(Path.Combine(dir, "Generation\\Spark\\Templates"));

            return(new SparkViewEngine(settings)
            {
                ViewFolder = templates
            });
        }
Beispiel #15
0
        public void TestGdiImageLayer()
        {
            var tmp       = Path.ChangeExtension(Path.GetTempFileName(), "png");
            var wmnStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("UnitTests.Resources.Women.png");
            var wmnBmp    = new System.Drawing.Bitmap(wmnStream);

            wmnBmp.Save(tmp, ImageFormat.Png);

            var           gdiS = new GdiImageLayer("Frau", tmp);
            GdiImageLayer gdiD = null;

            Assert.DoesNotThrow(() => gdiD = SandD(gdiS, GetFormatter()), "Exception");
            Assert.IsNotNull(gdiD, "GdiImageLayer is null");

            Assert.IsTrue(new LayerEqualityComparer <GdiImageLayer>().Equals(gdiS, gdiD));

            gdiS.Dispose();
            gdiD.Dispose();

            File.Delete(tmp);
        }
        private void LoadClassificationMappingFiles()
        {
            //Get the executing Assembly
            var asmbly = Assembly.GetExecutingAssembly();

            //Get the Directory path by getting the filepath of the executing dll and removing the DLL files name from the end.
            var dirPath = asmbly.CodeBase.Substring(0, asmbly.CodeBase.IndexOf(asmbly.GetName().Name));

            //The Direcory (in relation to the dirPath) where the resources are stored.
            const string resourceDirectory = "IfcToCOBieLiteUK\\Classifications\\DataFiles";

            //Get the LocalPath of the resource directory
            var uri = (new Uri(dirPath + resourceDirectory).AbsolutePath).Replace("%20", " ");

            var configSection = ConfigurationManager.GetSection("Xbim.Exchanger") as NameValueCollection;

            if (configSection != null)
            {
                var configValue = configSection["ClassificationMappingFolder"];
                if (!string.IsNullOrEmpty(configValue))
                {
                    uri = configValue;
                }
            }
            var diLocal = new DirectoryInfo(".");

            Log.DebugFormat("Trying to load classification mapping files from '{0}' running in '{1}'", uri, diLocal.FullName);
            var d = new DirectoryInfo(uri);

            if (d.Exists)
            {
                _classificationMappingFiles = Directory.GetFiles(uri);
            }
            else
            {
                Log.ErrorFormat("Failed to load classification mapping files from '{0}' running in '{1}'", uri, diLocal.FullName);
            }
        }
 static void Main()
 {
     //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
     //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-HK");
     //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-TW");
     //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     using (Mutex mutex = new Mutex(false, "Global\\" + ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), true)[0]).Value))
     {
         if (!mutex.WaitOne(0, false))
         {
             MessageBox.Show(string.Format(Resources.Messages.InstanceAlreadyRunning, Application.ProductName), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             Settings settings = Settings.LoadSettings();
             if (settings.InkRecognizer == null)
             {
                 MessageBox.Show(Resources.Messages.NoSuitableRecognizers, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 if (Properties.Settings.Default.FirstRun)
                 {
                     new FormSettings().ShowDialog();
                 }
                 do
                 {
                     restartFlag = false;
                     Application.Run(new FormMain());
                 } while (restartFlag);
             }
         }
     }
 }
        CreateCodeGroup(SecurityElement el)
        {
            if (el == null || !el.Tag.Equals("CodeGroup"))
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_WrongElementType"), "<CodeGroup>"));
            }

            String className;
            int    classNameLength;
            int    classNameStart;

            if (!ParseElementForObjectCreation(el,
                                               BuiltInCodeGroup,
                                               out className,
                                               out classNameStart,
                                               out classNameLength))
            {
                goto USEREFLECTION;
            }

            switch (classNameLength)
            {
            case 12:
                // NetCodeGroup
                if (String.Compare(className, classNameStart, "NetCodeGroup", 0, classNameLength, StringComparison.Ordinal) == 0)
                {
                    return(new NetCodeGroup());
                }
                else
                {
                    goto USEREFLECTION;
                }

            case 13:
                // FileCodeGroup
                if (String.Compare(className, classNameStart, "FileCodeGroup", 0, classNameLength, StringComparison.Ordinal) == 0)
                {
                    return(new FileCodeGroup());
                }
                else
                {
                    goto USEREFLECTION;
                }

            case 14:
                // UnionCodeGroup
                if (String.Compare(className, classNameStart, "UnionCodeGroup", 0, classNameLength, StringComparison.Ordinal) == 0)
                {
                    return(new UnionCodeGroup());
                }
                else
                {
                    goto USEREFLECTION;
                }

            case 19:
                // FirstMatchCodeGroup
                if (String.Compare(className, classNameStart, "FirstMatchCodeGroup", 0, classNameLength, StringComparison.Ordinal) == 0)
                {
                    return(new FirstMatchCodeGroup());
                }
                else
                {
                    goto USEREFLECTION;
                }

            default:
                goto USEREFLECTION;
            }

USEREFLECTION:
            Type groupClass = null;
            CodeGroup group = null;

            new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Assert();
            groupClass = GetClassFromElement(el, true);
            if (groupClass == null)
            {
                return(null);
            }
            if (!(typeof(CodeGroup).IsAssignableFrom(groupClass)))
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_NotACodeGroupType"));
            }

            group = (CodeGroup)Activator.CreateInstance(groupClass, true);

            BCLDebug.Assert(groupClass.Module.Assembly != Assembly.GetExecutingAssembly(),
                            "This path should not get called for mscorlib based classes");

            return(group);
        }
        public PrincipalForm()
        {
            InitializeComponent();

            this.Text += Assembly.GetExecutingAssembly().GetName().Version.ToString();
        }
        public void AssemblyGetCustomAttributeReturnsNullForAssemblyWithoutAttribute()
        {
            var value = Assembly.GetExecutingAssembly().GetCustomAttribute <SerializableAttribute>();

            Assert.IsNull(value);
        }
        public void AssemblyGetCustomAttributeReturnsNonNullForAssemblyWithAttribute()
        {
            var value = Assembly.GetExecutingAssembly().GetCustomAttribute <AssemblyCopyrightAttribute>();

            Assert.IsNotNull(value);
        }
        /// <summary>
        /// logs an exception related to a module provider once per cache-lifetime
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="status"></param>
        /// <param name="result"></param>
        /// <param name="messages"></param>
        /// <param name="provider"></param>
        public static void LogModuleProviderExceptionInRequest(Exception ex, string status,
                                                               ExtensionUrlProvider provider,
                                                               UrlAction result,
                                                               List <string> messages)
        {
            if (ex != null)
            {
                string moduleProviderName    = "Unknown Provider";
                string moduleProviderVersion = "Unknown Version";
                if (provider != null)
                {
                    moduleProviderName    = provider.ProviderConfig.ProviderName;
                    moduleProviderVersion = provider.GetType().Assembly.GetName(false).Version.ToString();
                }
                //this logic prevents a site logging an exception for every request made.  Instead
                //the exception will be logged once for the life of the cache / application restart or 1 hour, whichever is shorter.
                //create a cache key for this exception type
                string cacheKey = ex.GetType().ToString();
                //see if there is an existing object logged for this exception type
                object existingEx = DataCache.GetCache(cacheKey);
                if (existingEx == null)
                {
                    //if there was no existing object logged for this exception type, this is a new exception
                    DateTime expire = DateTime.Now.AddHours(1);
                    DataCache.SetCache(cacheKey, cacheKey, expire);
                    //just store the cache key - it doesn't really matter
                    //create a log event
                    string productVer = Assembly.GetExecutingAssembly().GetName(false).Version.ToString();
                    var    elc        = new EventLogController();
                    var    logEntry   = new LogInfo {
                        LogTypeKey = "GENERAL_EXCEPTION"
                    };
                    logEntry.AddProperty("Url Rewriting Extension Url Provider Exception",
                                         "Exception in Url Rewriting Process");
                    logEntry.AddProperty("Provider Name", moduleProviderName);
                    logEntry.AddProperty("Provider Version", moduleProviderVersion);
                    logEntry.AddProperty("Http Status", status);
                    logEntry.AddProperty("Product Version", productVer);
                    if (result != null)
                    {
                        logEntry.AddProperty("Original Path", result.OriginalPath ?? "null");
                        logEntry.AddProperty("Raw Url", result.RawUrl ?? "null");
                        logEntry.AddProperty("Final Url", result.FinalUrl ?? "null");

                        logEntry.AddProperty("Rewrite Result", !string.IsNullOrEmpty(result.RewritePath)
                                                                     ? result.RewritePath
                                                                     : "[no rewrite]");
                        logEntry.AddProperty("Redirect Location", string.IsNullOrEmpty(result.FinalUrl)
                                                                    ? "[no redirect]"
                                                                    : result.FinalUrl);
                        logEntry.AddProperty("Action", result.Action.ToString());
                        logEntry.AddProperty("Reason", result.Reason.ToString());
                        logEntry.AddProperty("Portal Id", result.PortalId.ToString());
                        logEntry.AddProperty("Tab Id", result.TabId.ToString());
                        logEntry.AddProperty("Http Alias", result.PortalAlias != null ? result.PortalAlias.HTTPAlias : "Null");

                        if (result.DebugMessages != null)
                        {
                            int i = 1;
                            foreach (string debugMessage in result.DebugMessages)
                            {
                                string msg = debugMessage;
                                if (debugMessage == null)
                                {
                                    msg = "[message was null]";
                                }
                                logEntry.AddProperty("Debug Message[result] " + i.ToString(), msg);
                                i++;
                            }
                        }
                    }
                    else
                    {
                        logEntry.AddProperty("Result", "Result value null");
                    }
                    if (messages != null)
                    {
                        int i = 1;
                        foreach (string msg in messages)
                        {
                            logEntry.AddProperty("Debug Message[raw] " + i.ToString(), msg);
                            i++;
                        }
                    }
                    logEntry.AddProperty("Exception Type", ex.GetType().ToString());
                    logEntry.AddProperty("Message", ex.Message);
                    logEntry.AddProperty("Stack Trace", ex.StackTrace);
                    if (ex.InnerException != null)
                    {
                        logEntry.AddProperty("Inner Exception Message", ex.InnerException.Message);
                        logEntry.AddProperty("Inner Exception Stacktrace", ex.InnerException.StackTrace);
                    }
                    logEntry.BypassBuffering = true;
                    elc.AddLog(logEntry);
                }
            }
        }
        internal static void Game_OnInput(GameInputEventArgs args)
        {
            #region Command Setup
            if (args.Input.StartsWith("#"))
            {
                args.Process = false;
            }
            else
            {
                return;
            }

            string[] arguments = args.Input.Split(' ');
            string   command   = arguments[0].Substring(1);
            #endregion

            #region Commands
            switch (command)
            {
            case "rundev":
            {
                Program.Permission = GlobalEnums.RunningMode.DEVELOPER;
            }
            break;

            case "load":
            {
                var champion = arguments[1].ToString();
                if (champion != null && Program.Permission == GlobalEnums.RunningMode.DEVELOPER)
                {
                    switch (champion.ToLowerInvariant())
                    {
                    case "vayne":
                    {
                        new Plugins.Vayne();
                        Game.PrintChat("load");
                    }
                    break;

                    case "malzahar":
                    {
                        new Plugins.Malzahar();
                        Game.PrintChat("load");
                    }
                    break;
                    }
                }
            }
            break;

            case "version":
                Game.PrintChat("Version is: " + Assembly.GetExecutingAssembly().GetName().Version, GlobalEnums.MessageType.NORMAL);
                break;

            case "buffs":
            {
                if (arguments[1].ToLowerInvariant() == ObjectManager.Player.ChampionName.ToLowerInvariant())
                {
                    foreach (var Bufferino in ObjectManager.Player.Buffs)
                    {
                        Console.Write("CASTER: {0} || COUNT: {1} || DISPLAY_NAME: {2} || NAME: {3} || TYPE: {4}", Bufferino.Caster, Bufferino.Count, Bufferino.DisplayName, Bufferino.Name, Bufferino.Type);
                    }
                }
                else if (arguments[1] != null)
                {
                    foreach (var Player in ObjectManager.Get <Obj_AI_Hero>().Where(x => !x.IsMe))
                    {
                        if (Player.ChampionName.ToLowerInvariant() == arguments[1].ToLowerInvariant())
                        {
                            foreach (var Bufferino in ObjectManager.Player.Buffs)
                            {
                                Console.Write("CASTER: {0} || COUNT: {1} || DISPLAY_NAME: {2} || NAME: {3} || TYPE: {4}", Bufferino.Caster, Bufferino.Count, Bufferino.DisplayName, Bufferino.Name, Bufferino.Type);
                            }
                        }
                    }
                }
                break;
            }

            default:
                GlobalMethods.Print("Unknown command, please retry!", GlobalEnums.MessageType.ERROR);
                break;
            }
            #endregion
        }
Beispiel #24
0
        /// <summary>
        /// Reads the necessary resources from the system and produces the author, license, build and version
        /// information about the application.
        /// </summary>
        /// <returns>relevant information about the application</returns>
        public static Pref Read()
        {
            string authors = "Michael Hoffmeister, Andreas Orzelski et al.";

            string licenseShort =
                "This software is licensed under the Apache License 2.0 (Apache-2.0)." + Environment.NewLine +
                "The Newtonsoft.JSON serialization is licensed under the MIT License (MIT)." + Environment.NewLine +
                "The QR code generation is licensed under the MIT license (MIT)." + Environment.NewLine +
                "The Zxing.Net Dot Matrix Code (DMC) generation is licensed " +
                "under the Apache License 2.0 (Apache-2.0)." + Environment.NewLine +
                "The Grapevine REST server framework is licensed " +
                "under the Apache License 2.0 (Apache-2.0)." + Environment.NewLine +
                "The AutomationML.Engine is licensed under the MIT license (MIT)." +
                "The MQTT server and client is licensed " +
                "under the MIT license (MIT)." + Environment.NewLine +
                "The IdentityModel OpenID client is licensed " +
                "under the Apache License 2.0 (Apache-2.0)." + Environment.NewLine +
                "The jose-jwt object signing and encryption is licensed " +
                "under the MIT license (MIT).";

            string buildDate = "";

            using (var stream =
                       Assembly
                       .GetExecutingAssembly()
                       .GetManifestResourceStream("AasxWpfControlLibrary.Resources.BuildDate.txt"))
            {
                if (stream != null)
                {
                    TextReader tr           = new StreamReader(stream);
                    string     fileContents = tr.ReadToEnd();
                    if (fileContents.Length > 20)
                    {
                        fileContents = fileContents.Substring(0, 20) + "..";
                    }
                    buildDate = fileContents.Trim();
                }
            }

            string licenseLong = AasxPluginHelper.LoadLicenseTxtFromAssemblyDir(
                "LICENSE.txt", Assembly.GetEntryAssembly());

            string version = "(not available)";

            {
                // %date% in European format (e.g. during development)
                var m = Regex.Match(buildDate, @"(\d+)\.(\d+)\.(\d+)");
                if (m.Success && m.Groups.Count >= 4)
                {
                    version = "v" + ((m.Groups[3].Value.Length == 2) ? "20" : "")
                              + m.Groups[3].Value + "-"
                              + m.Groups[2].Value + "-"
                              + m.Groups[1].Value;
                }
                else
                {
                    // %date% in US local (e.g. from continuous integration from Github)
                    m = Regex.Match(buildDate, @"(\d+)\/(\d+)\/(\d+)");
                    if (m.Success && m.Groups.Count >= 4)
                    {
                        version = "v" + ((m.Groups[3].Value.Length == 2) ? "20" : "")
                                  + m.Groups[3].Value + "-"
                                  + m.Groups[1].Value + "-"
                                  + m.Groups[2].Value;
                    }
                }
            }

            return(new Pref(authors, licenseShort, buildDate, licenseLong, version));
        }
Beispiel #25
0
 private static string GetExecutableName()
 {
     return(Path.GetFileName(Assembly.GetExecutingAssembly().Location));
 }
        public void AssemblyReferencesConstructorFindsReferencedConstructor()
        {
            var b = Assembly.GetExecutingAssembly().ReferencesConstructor <AttributedClass>();

            Assert.IsTrue(b);
        }
Beispiel #27
0
 public AppTestContext()
     : this(CoreRegistration.composeWithAction(Assembly.GetExecutingAssembly(), RegisterDependencies))
 {
 }