Exemple #1
0
        public static void Main(string[] args)
        {
            System.Console.WriteLine("Hello Interfaces");
            //xyz();//An object reference is required for the non-static field, method, or property 'Program.xyz()'
            Program obj = new Program();//obj is a reference to the object of class Program.

            obj.xyz();
            Sample SampleObj = new Sample();//SampleObj is a reference to the object of class Sample.

            SampleObj.xyz();
            abc interface_obj = new Program();

            interface_obj.xyz();
            abc Sample_interface_obj = new Sample();

            Sample_interface_obj.xyz();
            abc[] refabc = { new Program(), new Sample() };
            for (int i = 0; i <= 1; i++)
            {
                refabc[i].xyz();
            }
            def refdef = obj;

            refdef.pqr();
            refdef.xyz();
            man inheriobj = obj;

            inheriobj.xyz();
            inheriobj.pqr();
            Console.ReadLine();
        }
 /// <summary>
 /// Method used to add def to def dictionary
 /// </summary>
 /// <param name="key">Key to use</param>
 /// <param name="def">Def object to add</param>
 internal void AddDef(string key, def def, KScriptObject parent = null)
 {
     if (parent != null)
     {
         def.SetBaseScriptObject(parent);
         def.SetContainer(this);
     }
     defs.Add(key, def);
 }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            abc ob  = new abc();
            def obj = new def();

            obj.fuction();
            ob.function();
            Console.ReadKey();
        }
Exemple #4
0
    public static void Main()
    {
        System.Console.WriteLine("Hello Interfaces");
        InterfaceDemo8 refDemo = new InterfaceDemo8();
        abc            refabc  = refDemo;

        refabc.xyz();
        def refdef = refDemo;

        refdef.pqr();
//      refdef.xyz();  /* try uncommenting line */
    }
Exemple #5
0
    static void Main(string[] args)
    {
        interfaceSample i1 = new Implemntation();

        i1.SampleInterface();
        parent p = new parent();
        child  c = new child();

        Console.WriteLine("calling from parent class");
        c.display();
        c.display1();
        Console.WriteLine("From parent class");
        p.display();
        def d = new def();
        sub s = new sub();

        d.calc();
        s.calc();
        Console.ReadLine();
    }
Exemple #6
0
        /// <summary>
        /// Prepares properties for KScript objects.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="item"></param>
        /// <param name="container"></param>
        /// <returns></returns>
        public bool PrepareProperties(KScriptObject obj, XmlNode item, KScriptContainer container)
        {
            if (obj["Contents"] != null)
            {
                obj["Contents"] = item.InnerText;
            }
            foreach (XmlAttribute at in item.Attributes)
            {
                if (at.Name != "Contents")
                {
                    if (at.Name.StartsWith("__"))
                    {
                        container.GetConstantProperties().Add(at.Name.Substring(2), at.Value);
                    }
                    else
                    {
                        obj[at.Name.ToLower()] = at.Value;
                    }
                }
            }
            if (typeof(def).IsAssignableFrom(obj.GetType()))
            {
                obj.SetContainer(container);
                if (item.ChildNodes.OfType <XmlCDataSection>().Count() > 0)
                {
                    obj["Contents"] = item.ChildNodes.OfType <XmlCDataSection>().ToArray()[0].Data;
                }
                else
                {
                    obj["Contents"] = item.InnerXml;
                }
                container[((def)obj).id] = obj as def;
            }
            if (typeof(defm).IsAssignableFrom(obj.GetType()))
            {
                defm     _obj = (defm)obj;
                string[] ids  = _obj.ids.Split(',');
                foreach (string id in ids)
                {
                    container[id] = new def(_obj.Contents);
                }
            }

            obj.Init(container);

            if (typeof(KScriptIDObject).IsAssignableFrom(obj.GetType()))
            {
                ((KScriptIDObject)obj).RegisterObject();
            }

            if (obj.GetValidationType() != KScriptObject.ValidationTypes.DURING_PARSING)
            {
                try { obj.Validate(); }
                catch (KScriptValidationException ex)
                {
                    if (typeof(KScriptInvalidScriptType).IsAssignableFrom(ex.GetType()))
                    {
                        return(false);
                    }
                }
            }

            if (obj.RunImmediately)
            {
                try
                {
                    obj.Run();
                }
                catch (Exception ex)
                {
                    container.HandleException(obj, ex);
                }
            }

            return(true);
        }
 foreach (var(def, unlock) in defs)
Exemple #8
0
        static void Main(string[] args)
        {
            //* New sub-classes
            var    gCheck = new gender_check();
            user   user   = new user();
            crush  crush  = new crush();
            Person Boy    = new Person();
            Person Girl   = new Person();
            var    perc   = new personalities();
            def    d      = new def();
            string url    = "https://en.wikipedia.org/wiki/Big_Five_personality_traits#Descriptions_of_the_particular_personality_traits";

            //* Actual program starts here
            Console.Title = "Dating Predictions by AmirulDevKun";
            String asciiArt = @"
                                
██████╗░░█████╗░████████╗██╗███╗░░██╗░██████╗░
██╔══██╗██╔══██╗╚══██╔══╝██║████╗░██║██╔════╝░
██║░░██║███████║░░░██║░░░██║██╔██╗██║██║░░██╗░
██║░░██║██╔══██║░░░██║░░░██║██║╚████║██║░░╚██╗
██████╔╝██║░░██║░░░██║░░░██║██║░╚███║╚██████╔╝
╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═╝╚═╝░░╚══╝░╚═════╝░

██████╗░██████╗░███████╗██████╗░██╗░█████╗░████████╗██╗░█████╗░███╗░░██╗░██████╗
██╔══██╗██╔══██╗██╔════╝██╔══██╗██║██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║██╔════╝
██████╔╝██████╔╝█████╗░░██║░░██║██║██║░░╚═╝░░░██║░░░██║██║░░██║██╔██╗██║╚█████╗░
██╔═══╝░██╔══██╗██╔══╝░░██║░░██║██║██║░░██╗░░░██║░░░██║██║░░██║██║╚████║░╚═══██╗
██║░░░░░██║░░██║███████╗██████╔╝██║╚█████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║██████╔╝
╚═╝░░░░░╚═╝░░╚═╝╚══════╝╚═════╝░╚═╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═════╝░

by AmirulDevKun
                ";

            //ScriptAnim();

            //* Prompt for opening personality refrences / definitions.

            void personaResource(string url)
            {
                if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                {
                    Console.WriteLine("I AM LINUX");
                    Process Proc = new System.Diagnostics.Process();
                    Proc.StartInfo.FileName  = "/usr/bin/firefox";
                    Proc.StartInfo.Arguments = url;
                    Proc.Start();
                }
                else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    Console.WriteLine("FORCED TELEMETRY IS COOL!!");
                    Process.Start(new ProcessStartInfo("cmd", $"/c start {url}"));
                }
                else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    Console.WriteLine("I PAY EXCESSIVE AMOUNT OF MONEY FOR SHIT HARDWARE");
                    Process.Start("open", url);
                }
                else
                {
                    Console.WriteLine("idk man. your os is weird");
                    System.Environment.Exit(0);
                }
            }

            Console.Write("Do you want to refer the personality resources used? : ");
            string input = Console.ReadLine();

            switch (input)
            {
            case "y":
                personaResource(url);
                Console.WriteLine("When your browser closes, press anything to continue (ignore the gtk message)");
                Console.ReadKey();
                break;

            case "yes":
                personaResource(url);
                Console.WriteLine("When your browser closes, press anything to continue");
                Console.ReadKey();
                break;

            case "Yes":
                personaResource(url);
                Console.WriteLine("When your browser closes, press anything to continue");
                Console.ReadKey();
                break;

            default:
                Console.Write("Don't worry, you can always refer the resources later.\n");
                Console.WriteLine("Press any key to continue");
                Console.ReadKey();
                break;
            }
            Console.Clear();

            //* Drawing the ascii art
            Console.WriteLine(asciiArt);

            //! not useable because it can be skipped and a bug where
            //! the str_personality thing will not print the dedicated personality
            //
            // if (def.gender == "boy" || def.gender == "man")
            // {
            //     def.finalGender = "boy";
            // }
            // else if (def.gender == "girl" || def.gender == "woman")
            // {
            //     def.finalGender = "girl";
            // }
            // else {
            //     Console.WriteLine("Gender Input Wrong. Please Put it again");
            //     def.gender = Console.ReadLine();
            // }


            user.check();
            crush.check();
            //perc.lazyPrint();
            Console.WriteLine("The script has ended. Press any key to end the session.");
            Console.ReadKey();
            //EndScriptAnim();
        }